MCPcopy Create free account
hub / github.com/NetHack/NetHack / qt_init_nhwindows

Method qt_init_nhwindows

win/Qt/qt_bind.cpp:175–228  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173}
174
175void NetHackQtBind::qt_init_nhwindows(int *argc, char **argv)
176{
177 // menu entries use embedded <tab> to align fields;
178 // it could be toggled off via 'O', but only when in wizard mode
179 ::iflags.menu_tab_sep = true;
180
181 // force high scores display to be shown in a window, and don't allow
182 // that to be toggled off via 'O' (note: 'nethack -s' won't reach here;
183 // its output goes to stdout so can potentially be redirected into a file)
184 ::iflags.toptenwin = true;
185 ::set_option_mod_status("toptenwin", ::set_in_config);
186
187#ifdef UNIX
188// Userid control
189//
190// Michael Hohmuth <hohmuth@inf.tu-dresden.de>...
191//
192// As the game runs setuid games, it must seteuid(getuid()) before
193// calling XOpenDisplay(), and reset the euid afterwards.
194// Otherwise, it can't read the $HOME/.Xauthority file and whines about
195// not being able to open the X display (if a magic-cookie
196// authorization mechanism is being used).
197
198 uid_t gamesuid=geteuid();
199 seteuid(getuid());
200#endif
201
202 instance=new NetHackQtBind(*argc,argv);
203
204#ifdef UNIX
205 seteuid(gamesuid);
206#endif
207
208#ifdef _WS_WIN_
209 // This nethack engine feature should be moved into windowport API
210 nt_kbhit = NetHackQtBind::qt_kbhit;
211#endif
212
213#ifndef DYNAMIC_STATUSLINES
214 // 'statuslines' option can be set in config file but not via 'O'
215 set_wc2_option_mod_status(WC2_STATUSLINES, set_gameview);
216#endif
217#if defined(SND_LIB_QTSOUND) && !defined(QT_NO_SOUND)
218 /* assign_soundlib() just flags to NetHack which soundlib
219 * should be loaded by activate_chosen_soundlib() shortly.
220 * gc.chosen_soundlib is initialized to soundlib_nosound.
221 */
222 if (gc.chosen_soundlib == (uint32_t) soundlib_nosound) {
223 uint32_t soundlibchoice = (uint32_t) soundlib_qtsound;
224
225 assign_soundlib(soundlibchoice);
226 }
227#endif
228}
229
230int NetHackQtBind::qt_kbhit()
231{

Callers

nothing calls this directly

Calls 5

set_option_mod_statusFunction · 0.85
seteuidFunction · 0.85
getuidFunction · 0.85
assign_soundlibFunction · 0.85

Tested by

no test coverage detected