diff options
Diffstat (limited to 'platform/x11/os_x11.cpp')
-rw-r--r-- | platform/x11/os_x11.cpp | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 3d05a650da..0c02e47b5e 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -267,6 +267,10 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a // maybe contextgl wants to be in charge of creating the window #if defined(OPENGL_ENABLED) + // Set DRI_PRIME if not set. This means that Godot should default to a higher-power GPU if it exists. + // Note: Due to the final '0' parameter to setenv any existing DRI_PRIME environment variables will not + // be overwritten. + setenv("DRI_PRIME", "1", 0); ContextGL_X11::ContextType opengl_api_type = ContextGL_X11::GLES_3_0_COMPATIBLE; @@ -342,12 +346,12 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a context_gl->set_use_vsync(current_videomode.use_vsync); #endif - visual_server = memnew(VisualServerRaster); + visual_server = memnew(VisualServerRaster); if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) { - visual_server = memnew(VisualServerWrapMT(visual_server, get_render_thread_mode() == RENDER_SEPARATE_THREAD)); } + if (current_videomode.maximized) { current_videomode.maximized = false; set_window_maximized(true); @@ -365,7 +369,7 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a } // disable resizable window - if (!current_videomode.resizable) { + if (!current_videomode.resizable && !current_videomode.fullscreen) { XSizeHints *xsh; xsh = XAllocSizeHints(); xsh->flags = PMinSize | PMaxSize; @@ -1096,7 +1100,7 @@ void OS_X11::set_window_size(const Size2 p_size) { int old_h = xwa.height; // If window resizable is disabled we need to update the attributes first - if (is_window_resizable() == false) { + if (!is_window_resizable()) { XSizeHints *xsh; xsh = XAllocSizeHints(); xsh->flags = PMinSize | PMaxSize; @@ -1688,7 +1692,7 @@ void OS_X11::handle_key_event(XKeyEvent *p_event, bool p_echo) { } } else { //ignore - if (last_is_pressed == false) { + if (!last_is_pressed) { return; } } @@ -1995,15 +1999,9 @@ void OS_X11::process_xevents() { } break; case MotionNotify: { - // FUCK YOU X11 API YOU SERIOUSLY GROSS ME OUT - // YOU ARE AS GROSS AS LOOKING AT A PUTRID PILE - // OF POOP STICKING OUT OF A CLOGGED TOILET - // HOW THE FUCK I AM SUPPOSED TO KNOW WHICH ONE - // OF THE MOTION NOTIFY EVENTS IS THE ONE GENERATED - // BY WARPING THE MOUSE POINTER? - // YOU ARE FORCING ME TO FILTER ONE BY ONE TO FIND IT - // PLEASE DO ME A FAVOR AND DIE DROWNED IN A FECAL - // MOUNTAIN BECAUSE THAT'S WHERE YOU BELONG. + // The X11 API requires filtering one-by-one through the motion + // notify events, in order to figure out which event is the one + // generated by warping the mouse pointer. while (true) { if (mouse_mode == MOUSE_MODE_CAPTURED && event.xmotion.x == current_videomode.width / 2 && event.xmotion.y == current_videomode.height / 2) { @@ -2101,7 +2099,7 @@ void OS_X11::process_xevents() { last_timestamp = event.xkey.time; // key event is a little complex, so - // it will be handled in it's own function. + // it will be handled in its own function. handle_key_event((XKeyEvent *)&event); } break; case SelectionRequest: { @@ -2820,7 +2818,7 @@ void OS_X11::run() { #ifdef JOYDEV_ENABLED joypad->process_joypads(); #endif - if (Main::iteration() == true) + if (Main::iteration()) break; }; @@ -2855,11 +2853,19 @@ void OS_X11::set_context(int p_context) { XClassHint *classHint = XAllocClassHint(); if (classHint) { + char *wm_class = (char *)"Godot"; if (p_context == CONTEXT_EDITOR) classHint->res_name = (char *)"Godot_Editor"; if (p_context == CONTEXT_PROJECTMAN) classHint->res_name = (char *)"Godot_ProjectList"; - classHint->res_class = (char *)"Godot"; + + if (p_context == CONTEXT_ENGINE) { + classHint->res_name = (char *)"Godot_Engine"; + wm_class = (char *)((String)GLOBAL_GET("application/config/name")).utf8().ptrw(); + } + + classHint->res_class = wm_class; + XSetClassHint(x11_display, x11_window, classHint); XFree(classHint); } |