1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-18 12:00:31 +01:00

wmaker: Add new advanced option to ignore decoration changes from clients.

This adds an option (IgnoreDecorationChanges in plist) for windows to
ignore any requests from the clients for changing decorations. Since the
default state for any window pre-request is to have all decorations visible
this basically means that applications cannot hide any of the titlebar,
sizing bar, titlebar buttons, etc and any hint that causes these elements
to be hidden will be followed by a restoration if this option is set.

 This is useful for broken clients (e.g. Steam) and clients that force
subpar client side decorations. It is basically a per-window setting of the
global advanced option to ignore Gtk hints, except that it also applies to
non-Gtk applications.
This commit is contained in:
Bad Sector
2018-01-14 08:59:42 +02:00
committed by Carlos R. Mafra
parent 36879de261
commit 569fbff07c
5 changed files with 37 additions and 1 deletions

View File

@@ -82,6 +82,7 @@ static WMPropList *ASharedAppIcon; /* app */
static WMPropList *ANoLanguageButton;
#endif
static WMPropList *AStartWorkspace;
static WMPropList *AIgnoreDecorationChanges;
static WMPropList *AIcon;
static WMPropList *AnyWindow;
static WMPropList *No;
@@ -121,6 +122,7 @@ static void init_wdefaults(void)
#endif
AStartWorkspace = WMCreatePLString("StartWorkspace");
AIgnoreDecorationChanges = WMCreatePLString("IgnoreDecorationChanges");
AnyWindow = WMCreatePLString("*");
No = WMCreatePLString("No");
@@ -301,6 +303,9 @@ void wDefaultFillAttributes(const char *instance, const char *class,
value = get_value(dw, dc, dn, da, AFullMaximize, No, useGlobalDefault);
APPLY_VAL(value, full_maximize, AFullMaximize);
value = get_value(dw, dc, dn, da, AIgnoreDecorationChanges, No, useGlobalDefault);
APPLY_VAL(value, ignore_decoration_changes, AIgnoreDecorationChanges);
#ifdef XKB_BUTTON_HINT
value = get_value(dw, dc, dn, da, ANoLanguageButton, No, useGlobalDefault);
APPLY_VAL(value, no_language_button, ANoLanguageButton);

View File

@@ -412,6 +412,20 @@ void wWindowSetupInitialAttributes(WWindow *wwin, int *level, int *workspace)
*/
wDefaultFillAttributes(wwin->wm_instance, wwin->wm_class, &wwin->user_flags,
&wwin->defined_user_flags, False);
/* Restore decoration if the user has enabled the
* IgnoreDecorationChanges option */
if (wwin->user_flags.ignore_decoration_changes) {
WSETUFLAG(wwin, no_titlebar, 0);
WSETUFLAG(wwin, no_resizable, 0);
WSETUFLAG(wwin, no_miniaturizable, 0);
WSETUFLAG(wwin, no_resizebar, 0);
WSETUFLAG(wwin, no_close_button, 0);
WSETUFLAG(wwin, no_miniaturize_button, 0);
WSETUFLAG(wwin, no_border, 0);
WSETUFLAG(wwin, no_movable, 0);
}
/*
* Sanity checks for attributes that depend on other attributes
*/

View File

@@ -142,6 +142,8 @@ typedef struct {
* generate their own appicons and for apps that have no_appicon=1
*/
unsigned int emulate_appicon:1;
/* Ignore any changes to the decoration elements (titlebar, etc) */
unsigned int ignore_decoration_changes:1;
} WWindowAttributes;

View File

@@ -156,7 +156,11 @@ static const struct {
{ "NoMiniaturizable", { .no_miniaturizable = 1 }, N_("Do not let it be minimized"),
N_("Do not let the window of this application be\n"
"minimized.\n") }
"minimized.\n") },
{ "IgnoreDecorationChanges", { .ignore_decoration_changes = 1 }, N_("Ignore decoration changes"),
N_("Ignore any request from the application to change\n"
"window decorations (like hiding the titlebar).\n") }
#ifdef XKB_BUTTON_HINT
,{ "NoLanguageButton", { .no_language_button = 1 }, N_("Disable language button"),

View File

@@ -1325,6 +1325,17 @@ static Bool handleWindowType(WWindow *wwin, Atom type, int *layer)
ret = False;
}
/* Restore decoration if the user has enabled the
* IgnoreDecorationChanges option */
if (WFLAGP(wwin, ignore_decoration_changes)) {
wwin->client_flags.no_titlebar = 0;
wwin->client_flags.no_resizable = 0;
wwin->client_flags.no_miniaturizable = 0;
wwin->client_flags.no_resizebar = 0;
wwin->client_flags.no_border = 0;
wwin->client_flags.no_movable = 0;
}
wwin->type = type;
*layer = getWindowLayer(wwin);