diff --git a/panda/src/x11display/config_x11display.cxx b/panda/src/x11display/config_x11display.cxx index b89f2d68db..c609a2a5d8 100644 --- a/panda/src/x11display/config_x11display.cxx +++ b/panda/src/x11display/config_x11display.cxx @@ -1,5 +1,5 @@ // Filename: config_x11display.cxx -// Created by: pro-rsoft (07Jul09) +// Created by: rdb (07Jul09) // //////////////////////////////////////////////////////////////////// // @@ -61,6 +61,16 @@ ConfigVariableInt x_wheel_right_button "mouse button number does the system report when one scrolls " "to the right?")); +ConfigVariableString x_wm_class_name +("x-wm-class-name", "", + PRC_DESC("Specify the value to use for the res_name field of the window's " + "WM_CLASS property. Has no effect when x-wm-class is not set.")); + +ConfigVariableString x_wm_class +("x-wm-class", "", + PRC_DESC("Specify the value to use for the res_class field of the window's " + "WM_CLASS property.")); + //////////////////////////////////////////////////////////////////// // Function: init_libx11display // Description: Initializes the library. This must be called at diff --git a/panda/src/x11display/config_x11display.h b/panda/src/x11display/config_x11display.h index a4823787d4..e21085672d 100644 --- a/panda/src/x11display/config_x11display.h +++ b/panda/src/x11display/config_x11display.h @@ -1,5 +1,5 @@ // Filename: config_x11display.h -// Created by: pro-rsoft (07Jul09) +// Created by: rdb (07Jul09) // //////////////////////////////////////////////////////////////////// // @@ -33,4 +33,7 @@ extern ConfigVariableInt x_wheel_down_button; extern ConfigVariableInt x_wheel_left_button; extern ConfigVariableInt x_wheel_right_button; +extern ConfigVariableString x_wm_class_name; +extern ConfigVariableString x_wm_class; + #endif diff --git a/panda/src/x11display/x11GraphicsWindow.cxx b/panda/src/x11display/x11GraphicsWindow.cxx index a7ced81c26..e340fa27e6 100644 --- a/panda/src/x11display/x11GraphicsWindow.cxx +++ b/panda/src/x11display/x11GraphicsWindow.cxx @@ -1077,13 +1077,21 @@ set_wm_properties(const WindowProperties &properties, bool already_mapped) { // Class to "Undecorated", and let the user configure his/her window // manager not to put a border around windows of this class. XClassHint *class_hints_p = NULL; - if (properties.get_undecorated() || properties.get_fullscreen()) { + if (!x_wm_class.empty()) { + // Unless the user wanted to use his own WM_CLASS, of course. + class_hints_p = XAllocClassHint(); + class_hints_p->res_class = x_wm_class.c_str(); + if (!x_wm_class_name.empty()) { + class_hints_p->res_name = x_wm_class_name.c_str(); + } + + } else if (properties.get_undecorated() || properties.get_fullscreen()) { class_hints_p = XAllocClassHint(); class_hints_p->res_class = (char*) "Undecorated"; + } - if (!properties.get_fullscreen()) { - type_data[next_type_data++] = _net_wm_window_type_splash; - } + if (properties.get_undecorated() && !properties.get_fullscreen()) { + type_data[next_type_data++] = _net_wm_window_type_splash; } if (properties.has_z_order()) {