diff --git a/core/os/os.cpp b/core/os/os.cpp index e93038f854f..0bc06c8375c 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -523,6 +523,10 @@ String OS::get_joy_guid(int p_device) const { return "Default Joystick"; } +void OS::set_context(int p_context) { + +} + OS::OS() { last_error=NULL; frames_drawn=0; diff --git a/core/os/os.h b/core/os/os.h index cc001972b8c..0d4edb035d8 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -404,6 +404,13 @@ public: virtual bool is_joy_known(int p_device); virtual String get_joy_guid(int p_device)const; + enum EngineContext { + CONTEXT_EDITOR, + CONTEXT_PROJECTMAN, + }; + + virtual void set_context(int p_context); + OS(); virtual ~OS(); diff --git a/main/main.cpp b/main/main.cpp index f8786f5aecf..68c40a6f2b2 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1321,6 +1321,7 @@ bool Main::start() { } } } + OS::get_singleton()->set_context(OS::CONTEXT_EDITOR); //editor_node->set_edited_scene(game); } else { @@ -1465,6 +1466,7 @@ bool Main::start() { ProjectManager *pmanager = memnew( ProjectManager ); sml->get_root()->add_child(pmanager); + OS::get_singleton()->set_context(OS::CONTEXT_PROJECTMAN); } #endif diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 7c4c625dbcd..34abfc10788 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -1781,6 +1781,22 @@ String OS_X11::get_joy_guid(int p_device) const { return input->get_joy_guid_remapped(p_device); } +void OS_X11::set_context(int p_context) { + + XClassHint* classHint = NULL; + classHint = XAllocClassHint(); + if (classHint) { + + 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"; + XSetClassHint(x11_display, x11_window, classHint); + XFree(classHint); + } +} + OS_X11::OS_X11() { #ifdef RTAUDIO_ENABLED diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h index 91dbeac2840..0891e4b8ebc 100644 --- a/platform/x11/os_x11.h +++ b/platform/x11/os_x11.h @@ -226,6 +226,8 @@ public: virtual bool is_joy_known(int p_device); virtual String get_joy_guid(int p_device) const; + virtual void set_context(int p_context); + void run(); OS_X11();