From dfe360e5c093b0dc58bdc6c01cbb37530cde0277 Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 17 Sep 1999 23:52:59 +0000 Subject: [PATCH] - Fixed the PPosition/PSize code (I hope) --Dan - removed "Ignore PPosition/PSize hints" user options, and reverted to the old "Keep Inside Screen" --- WINGs/wfilepanel.c | 7 ++++--- WINGs/wpanel.c | 1 + WINGs/wwindow.c | 6 ++++-- src/client.c | 9 +++++++++ src/session.c | 2 +- src/wconfig.h.in | 8 ++++++++ src/wdefaults.c | 8 ++++---- src/window.c | 17 +++-------------- src/window.h | 2 +- src/winspector.c | 17 ++++++++--------- 10 files changed, 43 insertions(+), 34 deletions(-) diff --git a/WINGs/wfilepanel.c b/WINGs/wfilepanel.c index 1439a798..de907649 100644 --- a/WINGs/wfilepanel.c +++ b/WINGs/wfilepanel.c @@ -304,6 +304,10 @@ makeFilePanel(WMScreen *scrPtr, char *name, char *title) WMLoadBrowserColumnZero(fPtr->browser); + WMSetWindowInitialPosition(fPtr->win, + (scrPtr->rootView->size.width - WMWidgetWidth(fPtr->win))/2, + (scrPtr->rootView->size.height - WMWidgetHeight(fPtr->win))/2); + fPtr->flags.canChooseFiles = 1; fPtr->flags.canChooseDirectories = 1; fPtr->flags.autoCompletion = 1; @@ -398,9 +402,6 @@ WMRunModalFilePanelForDirectory(WMFilePanel *panel, WMWindow *owner, break; } - WMSetWindowInitialPosition(panel->win, - (scr->rootView->size.width - WMWidgetWidth(panel->win))/2, - (scr->rootView->size.height - WMWidgetHeight(panel->win))/2); WMSetLabelText(panel->titleLabel, name); scr->modalView = W_VIEW(panel->win); diff --git a/WINGs/wpanel.c b/WINGs/wpanel.c index 9ffe1ed9..700e29b8 100644 --- a/WINGs/wpanel.c +++ b/WINGs/wpanel.c @@ -98,6 +98,7 @@ WMCreateAlertPanel(WMScreen *scrPtr, WMWindow *owner, WMSetWindowInitialPosition(panel->win, (scrPtr->rootView->size.width - WMWidgetWidth(panel->win))/2, (scrPtr->rootView->size.height - WMWidgetHeight(panel->win))/2); + WMSetWindowTitle(panel->win, ""); if (scrPtr->applicationIcon) { diff --git a/WINGs/wwindow.c b/WINGs/wwindow.c index bbacded5..151019e6 100644 --- a/WINGs/wwindow.c +++ b/WINGs/wwindow.c @@ -453,7 +453,8 @@ WMSetWindowInitialPosition(WMWindow *win, int x, int y) win->upos.x = x; win->upos.y = y; if (win->view->flags.realized) - setSizeHints(win); + setSizeHints(win); + WMMoveWidget(win, x, y); } @@ -464,7 +465,8 @@ WMSetWindowInitialSize(WMWindow *win, unsigned width, unsigned height) win->usize.width = width; win->usize.height = height; if (win->view->flags.realized) - setSizeHints(win); + setSizeHints(win); + WMResizeWidget(win, width, height); } diff --git a/src/client.c b/src/client.c index d95a4355..b3353ed8 100644 --- a/src/client.c +++ b/src/client.c @@ -715,6 +715,14 @@ wClientGetNormalHints(WWindow *wwin, XWindowAttributes *wattribs, Bool geometry, wwin->normal_hints->min_width = wwin->normal_hints->max_width; } +#ifdef IGNORE_PPOSITION + wwin->normal_hints->flags &= ~PPosition; +#endif +#if 0 + /* this seems obsoleted. Now geometry is taken from XGetWindowAttributes() + * in XGetNormalHints() we only have the hints themselves. + * check this. --Dan + */ if (/* check this !pre_icccm && */!wwin->screen_ptr->flags.startup && geometry) { if (wwin->normal_hints->flags & (USPosition|PPosition)) { *x = wwin->normal_hints->x; @@ -725,6 +733,7 @@ wClientGetNormalHints(WWindow *wwin, XWindowAttributes *wattribs, Bool geometry, *height = wwin->normal_hints->height; } } +#endif } diff --git a/src/session.c b/src/session.c index ba882065..d9903123 100644 --- a/src/session.c +++ b/src/session.c @@ -844,7 +844,7 @@ makeAttributeState(WWindow *wwin) W_FLAG(no_bind_mouse), W_FLAG(no_hide_others), W_FLAG(no_appicon), - W_FLAG(ignore_stupid_hints), + W_FLAG(dont_move_off), W_FLAG(no_focusable), W_FLAG(always_user_icon), W_FLAG(start_miniaturized), diff --git a/src/wconfig.h.in b/src/wconfig.h.in index b452c6fa..12586f00 100644 --- a/src/wconfig.h.in +++ b/src/wconfig.h.in @@ -170,6 +170,14 @@ #define HIDDENDOT +/* + * Ignores the PPosition hint from clients. This is needed for some + * programs that have buggy implementations of such hint and place + * themselves in strange locations. + */ +#undef IGNORE_PPOSITION + + #define SILLYNESS diff --git a/src/wdefaults.c b/src/wdefaults.c index cc68494c..5f193b8b 100644 --- a/src/wdefaults.c +++ b/src/wdefaults.c @@ -74,7 +74,7 @@ static proplist_t AKeepOnTop; static proplist_t AKeepOnBottom; static proplist_t AOmnipresent; static proplist_t ASkipWindowList; -static proplist_t AIgnoreGeometryHints; +static proplist_t AKeepInsideScreen; static proplist_t AUnfocusable; static proplist_t AAlwaysUserIcon; static proplist_t AStartMiniaturized; @@ -113,7 +113,7 @@ init_wdefaults(WScreen *scr) AKeepOnBottom = PLMakeString("KeepOnBottom"); AOmnipresent = PLMakeString("Omnipresent"); ASkipWindowList = PLMakeString("SkipWindowList"); - AIgnoreGeometryHints = PLMakeString("IgnoreGeometryHints"); + AKeepInsideScreen = PLMakeString("KeepInsideScreen"); AUnfocusable = PLMakeString("Unfocusable"); AAlwaysUserIcon = PLMakeString("AlwaysUserIcon"); AStartMiniaturized = PLMakeString("StartMiniaturized"); @@ -285,8 +285,8 @@ wDefaultFillAttributes(WScreen *scr, char *instance, char *class, value = get_value(dw, dc, dn, da, ASkipWindowList, No, useGlobalDefault); APPLY_VAL(value, skip_window_list, ASkipWindowList); - value = get_value(dw, dc, dn, da, AIgnoreGeometryHints, No, useGlobalDefault); - APPLY_VAL(value, ignore_stupid_hints, AIgnoreGeometryHints); + value = get_value(dw, dc, dn, da, AKeepInsideScreen, No, useGlobalDefault); + APPLY_VAL(value, dont_move_off, AKeepInsideScreen); value = get_value(dw, dc, dn, da, AUnfocusable, No, useGlobalDefault); APPLY_VAL(value, no_focusable, AUnfocusable); diff --git a/src/window.c b/src/window.c index c1a3184c..d0b08539 100644 --- a/src/window.c +++ b/src/window.c @@ -692,17 +692,6 @@ wManageWindow(WScreen *scr, Window window) wWindowSetupInitialAttributes(wwin, &window_level, &workspace); - /* if the window has bad PPosition/PSize hints, and user asked to ignore - * them, revert the size values */ - if ((wwin->normal_hints->flags & (PSize|PPosition)) - && WFLAGP(wwin, ignore_stupid_hints)) { - wwin->normal_hints->flags &= ~(PPosition|PSize); - x = wattribs.x; - y = wattribs.y; - width = wattribs.width; - height = wattribs.height; - } - #ifdef OLWM_HINTS if (wwin->client_flags.olwm_transient && wwin->transient_for==None && wwin->group_id != None && wwin->group_id != window) { @@ -884,7 +873,7 @@ wManageWindow(WScreen *scr, Window window) dontBring = True; } - if (WFLAGP(wwin, ignore_stupid_hints) && dontBring) + if (WFLAGP(wwin, dont_move_off) && dontBring) wScreenBringInside(scr, &x, &y, width, height); } @@ -1922,7 +1911,7 @@ int req_width, req_height; /* new size of the client */ synth_notify = True; } - if (WFLAGP(wwin, ignore_stupid_hints)) + if (WFLAGP(wwin, dont_move_off)) wScreenBringInside(wwin->screen_ptr, &req_x, &req_y, req_width, req_height); if (resize) { @@ -1998,7 +1987,7 @@ int req_x, req_y; /* new position of the frame */ * a completed (opaque) movement in moveres.c */ #endif - if (WFLAGP(wwin, ignore_stupid_hints)) + if (WFLAGP(wwin, dont_move_off)) wScreenBringInside(wwin->screen_ptr, &req_x, &req_y, wwin->frame->core->width, wwin->frame->core->height); diff --git a/src/window.h b/src/window.h index 1919f395..d8937071 100644 --- a/src/window.h +++ b/src/window.h @@ -118,7 +118,7 @@ typedef struct { unsigned int no_hide_others:1; /* hide window when doing hideothers */ unsigned int no_appicon:1; /* make app icon */ - unsigned int ignore_stupid_hints:1; + unsigned int dont_move_off:1; unsigned int no_focusable:1; diff --git a/src/winspector.c b/src/winspector.c index 8a966411..5109e629 100644 --- a/src/winspector.c +++ b/src/winspector.c @@ -66,7 +66,7 @@ static proplist_t AKeepOnTop; static proplist_t AKeepOnBottom; static proplist_t AOmnipresent; static proplist_t ASkipWindowList; -static proplist_t AIgnoreGeometryHints; +static proplist_t AKeepInsideScreen; static proplist_t AUnfocusable; static proplist_t AAlwaysUserIcon; static proplist_t AStartMiniaturized; @@ -116,7 +116,7 @@ make_keys() AKeepOnBottom = PLMakeString("KeepOnBottom"); AOmnipresent = PLMakeString("Omnipresent"); ASkipWindowList = PLMakeString("SkipWindowList"); - AIgnoreGeometryHints = PLMakeString("IgnoreGeometryHints"); + AKeepInsideScreen = PLMakeString("KeepInsideScreen"); AUnfocusable = PLMakeString("Unfocusable"); AAlwaysUserIcon = PLMakeString("AlwaysUserIcon"); AStartMiniaturized = PLMakeString("StartMiniaturized"); @@ -532,7 +532,7 @@ saveSettings(WMButton *button, InspectorPanel *panel) different |= insertAttribute(dict, winDic, ANoMouseBindings, value, flags); value = (WMGetButtonSelected(panel->moreChk[3])!=0) ? Yes : No; - different |= insertAttribute(dict, winDic, AIgnoreGeometryHints,value, flags); + different |= insertAttribute(dict, winDic, AKeepInsideScreen,value, flags); value = (WMGetButtonSelected(panel->moreChk[4])!=0) ? Yes : No; different |= insertAttribute(dict, winDic, AUnfocusable, value, flags); @@ -731,7 +731,7 @@ applySettings(WMButton *button, InspectorPanel *panel) WSETUFLAG(wwin, no_hide_others, WMGetButtonSelected(panel->moreChk[0])); WSETUFLAG(wwin, no_bind_keys, WMGetButtonSelected(panel->moreChk[1])); WSETUFLAG(wwin, no_bind_mouse, WMGetButtonSelected(panel->moreChk[2])); - WSETUFLAG(wwin, ignore_stupid_hints, WMGetButtonSelected(panel->moreChk[3])); + WSETUFLAG(wwin, dont_move_off, WMGetButtonSelected(panel->moreChk[3])); WSETUFLAG(wwin, no_focusable, WMGetButtonSelected(panel->moreChk[4])); WSETUFLAG(wwin, dont_save_session, WMGetButtonSelected(panel->moreChk[5])); WSETUFLAG(wwin, emulate_appicon, WMGetButtonSelected(panel->moreChk[6])); @@ -897,7 +897,7 @@ revertSettings(WMButton *button, InspectorPanel *panel) flag = WFLAGP(wwin, no_bind_mouse); break; case 3: - flag = WFLAGP(wwin, ignore_stupid_hints); + flag = WFLAGP(wwin, dont_move_off); break; case 4: flag = WFLAGP(wwin, no_focusable); @@ -1282,11 +1282,10 @@ createInspectorForWindow(WWindow *wwin) "configured)."); break; case 3: - caption = _("Ignore PPosition/PSize hints"); - flag = WFLAGP(wwin, ignore_stupid_hints); + caption = _("Keep Inside Screen"); + flag = WFLAGP(wwin, dont_move_off); descr = _("Do not allow the window to move itself completely\n" - "outside the screen, nor take imposible sizes like 1x1.\n" - "For bug compatibility.\n"); + "outside the screen. For bug compatibility.\n"); break; case 4: caption = _("Don't Let It Take Focus");