@@ -35,6 +35,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
35
35
#include " render/factory.h"
36
36
#include " inputhandler.h"
37
37
#include " gettext.h"
38
+ #include " ../gui/guiSkin.h"
38
39
39
40
#if !defined(_WIN32) && !defined(__APPLE__) && !defined(__ANDROID__) && \
40
41
!defined(SERVER) && !defined(__HAIKU__)
@@ -44,6 +45,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
44
45
#include < X11/Xlib.h>
45
46
#include < X11/Xutil.h>
46
47
#include < X11/Xatom.h>
48
+
47
49
#endif
48
50
49
51
#ifdef __ANDROID__
@@ -52,6 +54,29 @@ with this program; if not, write to the Free Software Foundation, Inc.,
52
54
53
55
RenderingEngine *RenderingEngine::s_singleton = nullptr ;
54
56
57
+
58
+ static gui::GUISkin* createSkin (gui::IGUIEnvironment *environment,
59
+ gui::EGUI_SKIN_TYPE type, video::IVideoDriver *driver)
60
+ {
61
+ gui::GUISkin* skin = new gui::GUISkin (type, driver);
62
+
63
+ gui::IGUIFont* builtinfont = environment->getBuiltInFont ();
64
+ gui::IGUIFontBitmap* bitfont = 0 ;
65
+ if (builtinfont && builtinfont->getType () == gui::EGFT_BITMAP)
66
+ bitfont = (gui::IGUIFontBitmap*)builtinfont;
67
+
68
+ gui::IGUISpriteBank* bank = 0 ;
69
+ skin->setFont (builtinfont);
70
+
71
+ if (bitfont)
72
+ bank = bitfont->getSpriteBank ();
73
+
74
+ skin->setSpriteBank (bank);
75
+
76
+ return skin;
77
+ }
78
+
79
+
55
80
RenderingEngine::RenderingEngine (IEventReceiver *receiver)
56
81
{
57
82
sanity_check (!s_singleton);
@@ -112,6 +137,11 @@ RenderingEngine::RenderingEngine(IEventReceiver *receiver)
112
137
driver = m_device->getVideoDriver ();
113
138
114
139
s_singleton = this ;
140
+
141
+ auto skin = createSkin (m_device->getGUIEnvironment (),
142
+ gui::EGST_WINDOWS_METALLIC, driver);
143
+ m_device->getGUIEnvironment ()->setSkin (skin);
144
+ skin->drop ();
115
145
}
116
146
117
147
RenderingEngine::~RenderingEngine ()
@@ -193,7 +223,7 @@ bool RenderingEngine::setupTopLevelWindow(const std::string &name)
193
223
// sort here that would call the correct toplevel setup methods for
194
224
// the environment Minetest is running in but for now not deviating
195
225
// from the original pattern.
196
-
226
+
197
227
/* Setting Xorg properties for the top level window */
198
228
setupTopLevelXorgWindow (name);
199
229
/* Done with Xorg properties */
@@ -211,7 +241,7 @@ bool RenderingEngine::setupTopLevelWindow(const std::string &name)
211
241
/* Done with general properties */
212
242
213
243
// FIXME: setWindowIcon returns a bool result but it is unused.
214
- // For now continue to return this result.
244
+ // For now continue to return this result.
215
245
return result;
216
246
}
217
247
@@ -223,7 +253,7 @@ void RenderingEngine::setupTopLevelXorgWindow(const std::string &name)
223
253
Display *x11_dpl = reinterpret_cast <Display *>(exposedData.OpenGLLinux .X11Display );
224
254
if (x11_dpl == NULL ) {
225
255
warningstream << " Client: Could not find X11 Display in ExposedVideoData"
226
- << std::endl;
256
+ << std::endl;
227
257
return ;
228
258
}
229
259
@@ -244,30 +274,30 @@ void RenderingEngine::setupTopLevelXorgWindow(const std::string &name)
244
274
245
275
// FIXME: In the future WMNormalHints should be set ... e.g see the
246
276
// gtk/gdk code (gdk/x11/gdksurface-x11.c) for the setup_top_level
247
- // method. But for now (as it would require some significant changes)
248
- // leave the code as is.
249
-
277
+ // method. But for now (as it would require some significant changes)
278
+ // leave the code as is.
279
+
250
280
// The following is borrowed from the above gdk source for setting top
251
281
// level windows. The source indicates and the Xlib docs suggest that
252
- // this will set the WM_CLIENT_MACHINE and WM_LOCAL_NAME. This will not
253
- // set the WM_CLIENT_MACHINE to a Fully Qualified Domain Name (FQDN) which is
282
+ // this will set the WM_CLIENT_MACHINE and WM_LOCAL_NAME. This will not
283
+ // set the WM_CLIENT_MACHINE to a Fully Qualified Domain Name (FQDN) which is
254
284
// required by the Extended Window Manager Hints (EWMH) spec when setting
255
285
// the _NET_WM_PID (see further down) but running Minetest in an env
256
286
// where the window manager is on another machine from Minetest (therefore
257
287
// making the PID useless) is not expected to be a problem. Further
258
288
// more, using gtk/gdk as the model it would seem that not using a FQDN is
259
289
// not an issue for modern Xorg window managers.
260
-
290
+
261
291
verbosestream << " Client: Setting Xorg window manager Properties"
262
292
<< std::endl;
263
293
264
294
XSetWMProperties (x11_dpl, x11_win, NULL , NULL , NULL , 0 , NULL , NULL , NULL );
265
295
266
- // Set the _NET_WM_PID window property according to the EWMH spec. _NET_WM_PID
267
- // (in conjunction with WM_CLIENT_MACHINE) can be used by window managers to
268
- // force a shutdown of an application if it doesn't respond to the destroy
269
- // window message.
270
-
296
+ // Set the _NET_WM_PID window property according to the EWMH spec. _NET_WM_PID
297
+ // (in conjunction with WM_CLIENT_MACHINE) can be used by window managers to
298
+ // force a shutdown of an application if it doesn't respond to the destroy
299
+ // window message.
300
+
271
301
verbosestream << " Client: Setting Xorg _NET_WM_PID extened window manager property"
272
302
<< std::endl;
273
303
@@ -277,12 +307,12 @@ void RenderingEngine::setupTopLevelXorgWindow(const std::string &name)
277
307
infostream << " Client: PID is '" << static_cast <long >(pid) << " '"
278
308
<< std::endl;
279
309
280
- XChangeProperty (x11_dpl, x11_win, NET_WM_PID,
281
- XA_CARDINAL, 32 , PropModeReplace,
310
+ XChangeProperty (x11_dpl, x11_win, NET_WM_PID,
311
+ XA_CARDINAL, 32 , PropModeReplace,
282
312
reinterpret_cast <unsigned char *>(&pid),1 );
283
313
284
314
// Set the WM_CLIENT_LEADER window property here. Minetest has only one
285
- // window and that window will always be the leader.
315
+ // window and that window will always be the leader.
286
316
287
317
verbosestream << " Client: Setting Xorg WM_CLIENT_LEADER property"
288
318
<< std::endl;
0 commit comments