mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-24 15:12:32 +01:00
Add a configuration option to ignore Decoration Hints from GTK-based application
As reported by Nerijus Baliunas and Paul Jakma, the GNOME application, which use the GTK toolkit, are asking to have no window decoration. This can be solved by editing the window's attributes in Window Maker, but this can be tedious when there are many GNOME application used. This patch adds a configuration option: Window Maker tries to detect for GTK-based windows and in this case ignore the decoration hints that were provided by the application. Suggested-by: Paul Jakma <paul@jakma.org> Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
committed by
Carlos R. Mafra
parent
5ecb96cbf4
commit
ea42641033
@@ -394,6 +394,7 @@ extern struct WPreferences {
|
||||
char dont_confirm_kill; /* do not confirm Kill application */
|
||||
char disable_miniwindows;
|
||||
char disable_workspace_pager;
|
||||
char ignore_gtk_decoration_hints;
|
||||
|
||||
char dont_blink; /* do not blink icon selection */
|
||||
|
||||
@@ -558,6 +559,11 @@ extern struct wmaker_global_variables {
|
||||
Atom titlebar_state;
|
||||
} gnustep;
|
||||
|
||||
/* Destkop-environment related */
|
||||
struct {
|
||||
Atom gtk_object_path;
|
||||
} desktop;
|
||||
|
||||
/* WindowMaker specific */
|
||||
struct {
|
||||
Atom menu;
|
||||
|
||||
@@ -518,6 +518,8 @@ WDefaultEntry optionList[] = {
|
||||
&wPreferences.panel_only_open, getBool, NULL, NULL, NULL},
|
||||
{"MiniPreviewSize", "128", NULL,
|
||||
&wPreferences.minipreview_size, getInt, NULL, NULL, NULL},
|
||||
{"IgnoreGtkHints", "NO", NULL,
|
||||
&wPreferences.ignore_gtk_decoration_hints, getBool, NULL, NULL, NULL},
|
||||
|
||||
/*
|
||||
* Backward Compatibility:
|
||||
|
||||
@@ -394,6 +394,8 @@ static char *atomNames[] = {
|
||||
GNUSTEP_WM_MINIATURIZE_WINDOW,
|
||||
GNUSTEP_TITLEBAR_STATE,
|
||||
|
||||
"_GTK_APPLICATION_OBJECT_PATH",
|
||||
|
||||
"WM_IGNORE_FOCUS_EVENTS"
|
||||
};
|
||||
|
||||
@@ -467,7 +469,9 @@ void StartUp(Bool defaultScreenOnly)
|
||||
w_global.atom.gnustep.wm_miniaturize_window = atom[18];
|
||||
w_global.atom.gnustep.titlebar_state = atom[19];
|
||||
|
||||
w_global.atom.wm.ignore_focus_events = atom[20];
|
||||
w_global.atom.desktop.gtk_object_path = atom[20];
|
||||
|
||||
w_global.atom.wm.ignore_focus_events = atom[21];
|
||||
|
||||
#ifdef USE_DOCK_XDND
|
||||
wXDNDInitializeAtoms();
|
||||
|
||||
28
src/window.c
28
src/window.c
@@ -288,6 +288,31 @@ static void setupGNUstepHints(WWindow *wwin, GNUstepWMAttributes *gs_hints)
|
||||
wwin->client_flags.no_appicon = 1;
|
||||
}
|
||||
|
||||
static void discard_hints_from_gtk(WWindow *wwin)
|
||||
{
|
||||
Atom type;
|
||||
int format;
|
||||
unsigned long nb_item, nb_remain;
|
||||
unsigned char *result;
|
||||
int status;
|
||||
|
||||
status = XGetWindowProperty(dpy, wwin->client_win, w_global.atom.desktop.gtk_object_path, 0, 16, False,
|
||||
AnyPropertyType, &type, &format, &nb_item, &nb_remain, &result);
|
||||
if (status != Success)
|
||||
return;
|
||||
|
||||
/* If we're here, that means the Property exists. We don't care what is inside, it means it is a GTK-based application */
|
||||
|
||||
if (result != NULL)
|
||||
XFree(result);
|
||||
|
||||
/* GTK is asking to remove these decorations: */
|
||||
wwin->client_flags.no_titlebar = 0;
|
||||
wwin->client_flags.no_close_button = 0;
|
||||
wwin->client_flags.no_miniaturize_button = 0;
|
||||
wwin->client_flags.no_resizebar = 0;
|
||||
}
|
||||
|
||||
void wWindowSetupInitialAttributes(WWindow *wwin, int *level, int *workspace)
|
||||
{
|
||||
WScreen *scr = wwin->screen_ptr;
|
||||
@@ -351,6 +376,9 @@ void wWindowSetupInitialAttributes(WWindow *wwin, int *level, int *workspace)
|
||||
|
||||
wNETWMCheckClientHints(wwin, &tmp_level, &tmp_workspace);
|
||||
|
||||
if (wPreferences.ignore_gtk_decoration_hints)
|
||||
discard_hints_from_gtk(wwin);
|
||||
|
||||
/* window levels are between INT_MIN+1 and INT_MAX, so if we still
|
||||
* have INT_MIN that means that no window level was requested. -Dan
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user