mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 20:38:08 +01:00
wmaker: fix misuse of 'user_flags' instead of 'client_flags' for window attributes
The structure containing the information on windows contains 2 sets of attributes, client_flags which contains those asked by the application through Hints (like MWM Hints and others) and user_flags which was defined to allow the user to override them. Unfortunately many places of the code was using the wrong structure to save the attributes to (for example by using the WSETUFLAG macro) which was merely ok as the user_flags have priority, but when we want to provide a clean consistent behaviour to users, we need to get things in the right place. Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
committed by
Carlos R. Mafra
parent
a8f6abc9ea
commit
fd1dd9c7ea
12
src/client.c
12
src/client.c
@@ -524,14 +524,14 @@ void wClientCheckProperty(WWindow * wwin, XPropertyEvent * event)
|
|||||||
wwin->transient_for = new_owner;
|
wwin->transient_for = new_owner;
|
||||||
if (new_owner == None) {
|
if (new_owner == None) {
|
||||||
if (WFLAGP(wwin, no_miniaturizable)) {
|
if (WFLAGP(wwin, no_miniaturizable)) {
|
||||||
WSETUFLAG(wwin, no_miniaturizable, 0);
|
wwin->client_flags.no_miniaturizable = 0;
|
||||||
WSETUFLAG(wwin, no_miniaturize_button, 0);
|
wwin->client_flags.no_miniaturize_button = 0;
|
||||||
if (wwin->frame)
|
if (wwin->frame)
|
||||||
wWindowConfigureBorders(wwin);
|
wWindowConfigureBorders(wwin);
|
||||||
}
|
}
|
||||||
} else if (!WFLAGP(wwin, no_miniaturizable)) {
|
} else if (!WFLAGP(wwin, no_miniaturizable)) {
|
||||||
WSETUFLAG(wwin, no_miniaturizable, 1);
|
wwin->client_flags.no_miniaturizable = 1;
|
||||||
WSETUFLAG(wwin, no_miniaturize_button, 1);
|
wwin->client_flags.no_miniaturize_button = 1;
|
||||||
if (wwin->frame)
|
if (wwin->frame)
|
||||||
wWindowConfigureBorders(wwin);
|
wWindowConfigureBorders(wwin);
|
||||||
}
|
}
|
||||||
@@ -544,7 +544,7 @@ void wClientCheckProperty(WWindow * wwin, XPropertyEvent * event)
|
|||||||
|
|
||||||
PropGetProtocols(wwin->client_win, &wwin->protocols);
|
PropGetProtocols(wwin->client_win, &wwin->protocols);
|
||||||
|
|
||||||
WSETUFLAG(wwin, kill_close, !wwin->protocols.DELETE_WINDOW);
|
wwin->client_flags.kill_close = !wwin->protocols.DELETE_WINDOW;
|
||||||
|
|
||||||
if (wwin->frame)
|
if (wwin->frame)
|
||||||
wWindowUpdateButtonImages(wwin);
|
wWindowUpdateButtonImages(wwin);
|
||||||
@@ -572,7 +572,7 @@ void wClientCheckProperty(WWindow * wwin, XPropertyEvent * event)
|
|||||||
wApplicationDestroy(wapp);
|
wApplicationDestroy(wapp);
|
||||||
while (foo) {
|
while (foo) {
|
||||||
if (foo->fake_group && foo->fake_group == fPtr) {
|
if (foo->fake_group && foo->fake_group == fPtr) {
|
||||||
WSETUFLAG(foo, shared_appicon, 0);
|
foo->client_flags.shared_appicon = 0;
|
||||||
foo->fake_group = NULL;
|
foo->fake_group = NULL;
|
||||||
|
|
||||||
if (foo->group_id != None)
|
if (foo->group_id != None)
|
||||||
|
|||||||
56
src/motif.c
56
src/motif.c
@@ -75,19 +75,21 @@ static void setupMWMHints(WWindow *wwin, MWMHints *mwm_hints)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (mwm_hints->flags & MWM_HINTS_DECORATIONS) {
|
if (mwm_hints->flags & MWM_HINTS_DECORATIONS) {
|
||||||
WSETUFLAG(wwin, no_titlebar, 1);
|
wwin->client_flags.no_titlebar = 1;
|
||||||
WSETUFLAG(wwin, no_close_button, 1);
|
wwin->client_flags.no_close_button = 1;
|
||||||
WSETUFLAG(wwin, no_miniaturize_button, 1);
|
wwin->client_flags.no_miniaturize_button = 1;
|
||||||
WSETUFLAG(wwin, no_resizebar, 1);
|
wwin->client_flags.no_resizebar = 1;
|
||||||
|
wwin->client_flags.no_border = 1;
|
||||||
|
|
||||||
if (mwm_hints->decorations & MWM_DECOR_ALL) {
|
if (mwm_hints->decorations & MWM_DECOR_ALL) {
|
||||||
WSETUFLAG(wwin, no_titlebar, 0);
|
wwin->client_flags.no_titlebar = 0;
|
||||||
WSETUFLAG(wwin, no_close_button, 0);
|
wwin->client_flags.no_close_button = 0;
|
||||||
WSETUFLAG(wwin, no_closable, 0);
|
wwin->client_flags.no_closable = 0;
|
||||||
WSETUFLAG(wwin, no_miniaturize_button, 0);
|
wwin->client_flags.no_miniaturize_button = 0;
|
||||||
WSETUFLAG(wwin, no_miniaturizable, 0);
|
wwin->client_flags.no_miniaturizable = 0;
|
||||||
WSETUFLAG(wwin, no_resizebar, 0);
|
wwin->client_flags.no_resizebar = 0;
|
||||||
WSETUFLAG(wwin, no_resizable, 0);
|
wwin->client_flags.no_resizable = 0;
|
||||||
|
wwin->client_flags.no_border = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mwm_hints->decorations & MWM_DECOR_BORDER) {
|
if (mwm_hints->decorations & MWM_DECOR_BORDER) {
|
||||||
@@ -101,12 +103,12 @@ static void setupMWMHints(WWindow *wwin, MWMHints *mwm_hints)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mwm_hints->decorations & MWM_DECOR_RESIZEH)
|
if (mwm_hints->decorations & MWM_DECOR_RESIZEH)
|
||||||
WSETUFLAG(wwin, no_resizebar, 0);
|
wwin->client_flags.no_resizebar = 0;
|
||||||
|
|
||||||
if (mwm_hints->decorations & MWM_DECOR_TITLE) {
|
if (mwm_hints->decorations & MWM_DECOR_TITLE) {
|
||||||
WSETUFLAG(wwin, no_titlebar, 0);
|
wwin->client_flags.no_titlebar = 0;
|
||||||
WSETUFLAG(wwin, no_close_button, 0);
|
wwin->client_flags.no_close_button = 0;
|
||||||
WSETUFLAG(wwin, no_closable, 0);
|
wwin->client_flags.no_closable = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mwm_hints->decorations * MWM_DECOR_MENU) {
|
if (mwm_hints->decorations * MWM_DECOR_MENU) {
|
||||||
@@ -119,8 +121,8 @@ static void setupMWMHints(WWindow *wwin, MWMHints *mwm_hints)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mwm_hints->decorations & MWM_DECOR_MINIMIZE) {
|
if (mwm_hints->decorations & MWM_DECOR_MINIMIZE) {
|
||||||
WSETUFLAG(wwin, no_miniaturize_button, 0);
|
wwin->client_flags.no_miniaturize_button = 0;
|
||||||
WSETUFLAG(wwin, no_miniaturizable, 0);
|
wwin->client_flags.no_miniaturizable = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mwm_hints->decorations & MWM_DECOR_MAXIMIZE) {
|
if (mwm_hints->decorations & MWM_DECOR_MAXIMIZE) {
|
||||||
@@ -132,17 +134,17 @@ static void setupMWMHints(WWindow *wwin, MWMHints *mwm_hints)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mwm_hints->flags & MWM_HINTS_FUNCTIONS) {
|
if (mwm_hints->flags & MWM_HINTS_FUNCTIONS) {
|
||||||
WSETUFLAG(wwin, no_closable, 1);
|
wwin->client_flags.no_closable = 1;
|
||||||
WSETUFLAG(wwin, no_miniaturizable, 1);
|
wwin->client_flags.no_miniaturizable = 1;
|
||||||
WSETUFLAG(wwin, no_resizable, 1);
|
wwin->client_flags.no_resizable = 1;
|
||||||
|
|
||||||
if (mwm_hints->functions & MWM_FUNC_ALL) {
|
if (mwm_hints->functions & MWM_FUNC_ALL) {
|
||||||
WSETUFLAG(wwin, no_closable, 0);
|
wwin->client_flags.no_closable = 0;
|
||||||
WSETUFLAG(wwin, no_miniaturizable, 0);
|
wwin->client_flags.no_miniaturizable = 0;
|
||||||
WSETUFLAG(wwin, no_resizable, 0);
|
wwin->client_flags.no_resizable = 0;
|
||||||
}
|
}
|
||||||
if (mwm_hints->functions & MWM_FUNC_RESIZE)
|
if (mwm_hints->functions & MWM_FUNC_RESIZE)
|
||||||
WSETUFLAG(wwin, no_resizable, 0);
|
wwin->client_flags.no_resizable = 0;
|
||||||
|
|
||||||
if (mwm_hints->functions & MWM_FUNC_MOVE) {
|
if (mwm_hints->functions & MWM_FUNC_MOVE) {
|
||||||
/*
|
/*
|
||||||
@@ -152,14 +154,14 @@ static void setupMWMHints(WWindow *wwin, MWMHints *mwm_hints)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mwm_hints->functions & MWM_FUNC_MINIMIZE)
|
if (mwm_hints->functions & MWM_FUNC_MINIMIZE)
|
||||||
WSETUFLAG(wwin, no_miniaturizable, 0);
|
wwin->client_flags.no_miniaturizable = 0;
|
||||||
|
|
||||||
if (mwm_hints->functions & MWM_FUNC_MAXIMIZE) {
|
if (mwm_hints->functions & MWM_FUNC_MAXIMIZE) {
|
||||||
/* a window must be resizable to be maximizable */
|
/* a window must be resizable to be maximizable */
|
||||||
WSETUFLAG(wwin, no_resizable, 0);
|
wwin->client_flags.no_resizable = 0;
|
||||||
}
|
}
|
||||||
if (mwm_hints->functions & MWM_FUNC_CLOSE)
|
if (mwm_hints->functions & MWM_FUNC_CLOSE)
|
||||||
WSETUFLAG(wwin, no_closable, 0);
|
wwin->client_flags.no_closable = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
38
src/window.c
38
src/window.c
@@ -293,7 +293,9 @@ void wWindowSetupInitialAttributes(WWindow *wwin, int *level, int *workspace)
|
|||||||
WScreen *scr = wwin->screen_ptr;
|
WScreen *scr = wwin->screen_ptr;
|
||||||
|
|
||||||
/* sets global default stuff */
|
/* sets global default stuff */
|
||||||
wDefaultFillAttributes(wwin->wm_instance, wwin->wm_class, &wwin->client_flags, NULL, True);
|
wDefaultFillAttributes(wwin->wm_instance, wwin->wm_class, &wwin->user_flags, NULL, True);
|
||||||
|
wwin->defined_user_flags = wwin->user_flags;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Decoration setting is done in this precedence (lower to higher)
|
* Decoration setting is done in this precedence (lower to higher)
|
||||||
* - use global default in the resource database
|
* - use global default in the resource database
|
||||||
@@ -302,25 +304,25 @@ void wWindowSetupInitialAttributes(WWindow *wwin, int *level, int *workspace)
|
|||||||
* - set hints specified for the app in the resource DB
|
* - set hints specified for the app in the resource DB
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WSETUFLAG(wwin, broken_close, 0);
|
wwin->client_flags.broken_close = 0;
|
||||||
|
|
||||||
if (wwin->protocols.DELETE_WINDOW)
|
if (wwin->protocols.DELETE_WINDOW)
|
||||||
WSETUFLAG(wwin, kill_close, 0);
|
wwin->client_flags.kill_close = 0;
|
||||||
else
|
else
|
||||||
WSETUFLAG(wwin, kill_close, 1);
|
wwin->client_flags.kill_close = 1;
|
||||||
|
|
||||||
/* transients can't be iconified or maximized */
|
/* transients can't be iconified or maximized */
|
||||||
if (wwin->transient_for != None && wwin->transient_for != scr->root_win) {
|
if (wwin->transient_for != None && wwin->transient_for != scr->root_win) {
|
||||||
WSETUFLAG(wwin, no_miniaturizable, 1);
|
wwin->client_flags.no_miniaturizable = 1;
|
||||||
WSETUFLAG(wwin, no_miniaturize_button, 1);
|
wwin->client_flags.no_miniaturize_button = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if the window can't be resized, remove the resizebar */
|
/* if the window can't be resized, remove the resizebar */
|
||||||
if (wwin->normal_hints->flags & (PMinSize | PMaxSize)
|
if (wwin->normal_hints->flags & (PMinSize | PMaxSize)
|
||||||
&& (wwin->normal_hints->min_width == wwin->normal_hints->max_width)
|
&& (wwin->normal_hints->min_width == wwin->normal_hints->max_width)
|
||||||
&& (wwin->normal_hints->min_height == wwin->normal_hints->max_height)) {
|
&& (wwin->normal_hints->min_height == wwin->normal_hints->max_height)) {
|
||||||
WSETUFLAG(wwin, no_resizable, 1);
|
wwin->client_flags.no_resizable = 1;
|
||||||
WSETUFLAG(wwin, no_resizebar, 1);
|
wwin->client_flags.no_resizebar = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set GNUstep window attributes */
|
/* set GNUstep window attributes */
|
||||||
@@ -401,7 +403,9 @@ void wWindowSetupInitialAttributes(WWindow *wwin, int *level, int *workspace)
|
|||||||
&& wwin->user_flags.floating && wwin->defined_user_flags.floating)
|
&& wwin->user_flags.floating && wwin->defined_user_flags.floating)
|
||||||
wwin->user_flags.sunken = 0;
|
wwin->user_flags.sunken = 0;
|
||||||
|
|
||||||
WSETUFLAG(wwin, no_shadeable, WFLAGP(wwin, no_titlebar));
|
/* A window that does not have a title cannot be Shaded and we don't let user override this */
|
||||||
|
wwin->client_flags.no_shadeable = WFLAGP(wwin, no_titlebar);
|
||||||
|
wwin->defined_user_flags.no_shadeable = 0;
|
||||||
|
|
||||||
/* windows that have takefocus=False shouldn't take focus at all */
|
/* windows that have takefocus=False shouldn't take focus at all */
|
||||||
if (wwin->focus_mode == WFM_NO_INPUT)
|
if (wwin->focus_mode == WFM_NO_INPUT)
|
||||||
@@ -724,22 +728,22 @@ WWindow *wManageWindow(WScreen *scr, Window window)
|
|||||||
wwin->orig_main_window = wwin->main_window;
|
wwin->orig_main_window = wwin->main_window;
|
||||||
|
|
||||||
if (wwin->flags.is_gnustep)
|
if (wwin->flags.is_gnustep)
|
||||||
WSETUFLAG(wwin, shared_appicon, 0);
|
wwin->client_flags.shared_appicon = 0;
|
||||||
|
|
||||||
if (wwin->main_window) {
|
if (wwin->main_window) {
|
||||||
XTextProperty text_prop;
|
XTextProperty text_prop;
|
||||||
|
|
||||||
if (XGetTextProperty(dpy, wwin->main_window, &text_prop, w_global.atom.wmaker.menu))
|
if (XGetTextProperty(dpy, wwin->main_window, &text_prop, w_global.atom.wmaker.menu))
|
||||||
WSETUFLAG(wwin, shared_appicon, 0);
|
wwin->client_flags.shared_appicon = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wwin->flags.is_dockapp)
|
if (wwin->flags.is_dockapp)
|
||||||
WSETUFLAG(wwin, shared_appicon, 0);
|
wwin->client_flags.shared_appicon = 0;
|
||||||
|
|
||||||
if (wwin->main_window) {
|
if (wwin->main_window) {
|
||||||
WApplication *app = wApplicationOf(wwin->main_window);
|
WApplication *app = wApplicationOf(wwin->main_window);
|
||||||
if (app && app->app_icon)
|
if (app && app->app_icon)
|
||||||
WSETUFLAG(wwin, shared_appicon, 0);
|
wwin->client_flags.shared_appicon = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!withdraw && wwin->main_window && WFLAGP(wwin, shared_appicon)) {
|
if (!withdraw && wwin->main_window && WFLAGP(wwin, shared_appicon)) {
|
||||||
@@ -1320,10 +1324,10 @@ WWindow *wManageInternalWindow(WScreen *scr, Window window, Window owner,
|
|||||||
|
|
||||||
wwin->flags.internal_window = 1;
|
wwin->flags.internal_window = 1;
|
||||||
|
|
||||||
WSETUFLAG(wwin, omnipresent, 1);
|
wwin->client_flags.omnipresent = 1;
|
||||||
WSETUFLAG(wwin, no_shadeable, 1);
|
wwin->client_flags.no_shadeable = 1;
|
||||||
WSETUFLAG(wwin, no_resizable, 1);
|
wwin->client_flags.no_resizable = 1;
|
||||||
WSETUFLAG(wwin, no_miniaturizable, 1);
|
wwin->client_flags.no_miniaturizable = 1;
|
||||||
|
|
||||||
wwin->focus_mode = WFM_PASSIVE;
|
wwin->focus_mode = WFM_PASSIVE;
|
||||||
wwin->client_win = window;
|
wwin->client_win = window;
|
||||||
|
|||||||
@@ -1241,8 +1241,8 @@ static InspectorPanel *createInspectorForWindow(WWindow *wwin, int xpos, int ypo
|
|||||||
/* kluge to know who should get the key events */
|
/* kluge to know who should get the key events */
|
||||||
panel->frame->client_leader = WMWidgetXID(panel->win);
|
panel->frame->client_leader = WMWidgetXID(panel->win);
|
||||||
|
|
||||||
WSETUFLAG(panel->frame, no_closable, 0);
|
panel->frame->client_flags.no_closable = 0;
|
||||||
WSETUFLAG(panel->frame, no_close_button, 0);
|
panel->frame->client_flags.no_close_button = 0;
|
||||||
wWindowUpdateButtonImages(panel->frame);
|
wWindowUpdateButtonImages(panel->frame);
|
||||||
wFrameWindowShowButton(panel->frame->frame, WFF_RIGHT_BUTTON);
|
wFrameWindowShowButton(panel->frame->frame, WFF_RIGHT_BUTTON);
|
||||||
panel->frame->frame->on_click_right = destroyInspector;
|
panel->frame->frame->on_click_right = destroyInspector;
|
||||||
|
|||||||
Reference in New Issue
Block a user