On Mon, 21 Mar 2011, Tamas TEVESZ wrote:
On Mon, 21 Mar 2011, Szabó Ambrus wrote:> Hello, > > I try to make opaque resize. with this enabled, the window size/pos indicator (showGeometry()) is gone. it is there for the very first move event, but it is apparently painted over by the window contents, and never re-painted (or is painted over again). since there is a call to showGeometry() in an if(opaqueResize) block, it's probably unintentional, but is definitely bad, as it doesn't respect ResizeDisplay. -- [-] mkdir /nonexistent
Thanks! Fixed.
From e9135c251452e16604f4efb8796246e1621239cf Mon Sep 17 00:00:00 2001 From: Szabo Ambrus <[email protected]> Date: Mon, 21 Mar 2011 16:36:56 +0100 Subject: [PATCH] Opaque Resize --- WPrefs.app/Expert.c | 7 +++++-- src/WindowMaker.h | 1 + src/defaults.c | 2 ++ src/moveres.c | 51 ++++++++++++++++++++++++++++++++++++--------------- 4 files changed, 44 insertions(+), 17 deletions(-) diff --git a/WPrefs.app/Expert.c b/WPrefs.app/Expert.c index 5ef14a9..66a85b3 100644 --- a/WPrefs.app/Expert.c +++ b/WPrefs.app/Expert.c @@ -31,7 +31,7 @@ typedef struct _Panel { WMWidget *parent; - WMButton *swi[12]; + WMButton *swi[13]; } _Panel; @@ -53,6 +53,7 @@ static void showData(_Panel * panel) WMSetButtonSelected(panel->swi[9], GetBoolForKey("ShowClipTitle")); WMSetButtonSelected(panel->swi[10], GetBoolForKey("BounceAppIconsWhenUrgent")); WMSetButtonSelected(panel->swi[11], GetBoolForKey("RaiseAppIconsWhenBouncing")); + WMSetButtonSelected(panel->swi[12], GetBoolForKey("OpaqueResize")); } static void createPanel(Panel * p) @@ -67,7 +68,7 @@ static void createPanel(Panel * p) sv = WMCreateScrollView(panel->box); WMResizeWidget(sv, 500, 215); - WMMoveWidget(sv, 12, 10); + WMMoveWidget(sv, 13, 10); WMSetScrollViewRelief(sv, WRSunken); WMSetScrollViewHasVerticalScroller(sv, True); WMSetScrollViewHasHorizontalScroller(sv, False); @@ -95,6 +96,7 @@ static void createPanel(Panel * p) WMSetButtonText(panel->swi[9], _("Show workspace title on Clip.")); WMSetButtonText(panel->swi[10], _("Bounce AppIcons when the application wants attention.")); WMSetButtonText(panel->swi[11], _("Raise AppIcons when bouncing.")); + WMSetButtonText(panel->swi[12], _("Use OpaqueResize.")); /* If the item is default true, enable the button here */ WMSetButtonEnabled(panel->swi[6], True); @@ -126,6 +128,7 @@ static void storeDefaults(_Panel * panel) SetBoolForKey(WMGetButtonSelected(panel->swi[9]), "ShowClipTitle"); SetBoolForKey(WMGetButtonSelected(panel->swi[10]), "BounceAppIconsWhenUrgent"); SetBoolForKey(WMGetButtonSelected(panel->swi[11]), "RaiseAppIconsWhenBouncing"); + SetBoolForKey(WMGetButtonSelected(panel->swi[12]), "OpaqueResize"); } Panel *InitExpert(WMScreen * scr, WMWidget * parent) diff --git a/src/WindowMaker.h b/src/WindowMaker.h index 8293985..2d57291 100644 --- a/src/WindowMaker.h +++ b/src/WindowMaker.h @@ -324,6 +324,7 @@ typedef struct WPreferences { signed char focus_mode; /* window focusing mode */ char opaque_move; /* update window position during move */ + char opaque_resize; /* update window position during resize */ char wrap_menus; /* wrap menus at edge of screen */ char scrollable_menus; /* let them be scrolled */ char align_menus; /* align menu with their parents */ diff --git a/src/defaults.c b/src/defaults.c index 9f953b1..b5b646c 100644 --- a/src/defaults.c +++ b/src/defaults.c @@ -399,6 +399,8 @@ WDefaultEntry optionList[] = { &wPreferences.use_saveunders, getBool, NULL, NULL, NULL}, {"OpaqueMove", "NO", NULL, &wPreferences.opaque_move, getBool, NULL, NULL, NULL}, + {"OpaqueResize", "NO", NULL, + &wPreferences.opaque_resize, getBool, NULL, NULL, NULL}, {"DisableAnimations", "NO", NULL, &wPreferences.no_animations, getBool, NULL, NULL, NULL}, {"DontLinkWorkspaces", "NO", NULL, diff --git a/src/moveres.c b/src/moveres.c index c0bf039..1783bce 100644 --- a/src/moveres.c +++ b/src/moveres.c @@ -1859,6 +1859,7 @@ void wMouseResizeWindow(WWindow * wwin, XEvent * ev) int head = ((wPreferences.auto_arrange_icons && wXineramaHeads(scr) > 1) ? wGetHeadForWindow(wwin) : scr->xine_info.primary_head); + int opaqueResize = wPreferences.opaque_resize; if (!IS_RESIZABLE(wwin)) return; @@ -1892,12 +1893,14 @@ void wMouseResizeWindow(WWindow * wwin, XEvent * ev) switch (event.type) { case KeyPress: showGeometry(wwin, fx, fy, fx + fw, fy + fh, res); - if ((event.xkey.keycode == shiftl || event.xkey.keycode == shiftr) - && started) { - drawTransparentFrame(wwin, fx, fy, fw, fh); - cycleGeometryDisplay(wwin, fx, fy, fw, fh, res); - drawTransparentFrame(wwin, fx, fy, fw, fh); - } + if (!opaqueResize) { + if ((event.xkey.keycode == shiftl || event.xkey.keycode == shiftr) + && started) { + drawTransparentFrame(wwin, fx, fy, fw, fh); + cycleGeometryDisplay(wwin, fx, fy, fw, fh, res); + drawTransparentFrame(wwin, fx, fy, fw, fh); + } + }; showGeometry(wwin, fx, fy, fx + fw, fy + fh, res); break; @@ -1997,21 +2000,27 @@ void wMouseResizeWindow(WWindow * wwin, XEvent * ev) /* Draw the resize frame for the first time. */ mapGeometryDisplay(wwin, fx, fy, fw, fh); - - drawTransparentFrame(wwin, fx, fy, fw, fh); - + if (!opaqueResize) { + drawTransparentFrame(wwin, fx, fy, fw, fh); + }; showGeometry(wwin, fx, fy, fx + fw, fy + fh, res); started = 1; } if (started) { if (wPreferences.size_display == WDIS_FRAME_CENTER) { - drawTransparentFrame(wwin, orig_fx, orig_fy, orig_fw, orig_fh); + if (!opaqueResize) { + drawTransparentFrame(wwin, orig_fx, orig_fy, orig_fw, orig_fh); + }; moveGeometryDisplayCentered(scr, fx + fw / 2, fy + fh / 2); - drawTransparentFrame(wwin, fx, fy, fw, fh); + if (!opaqueResize) { + drawTransparentFrame(wwin, fx, fy, fw, fh); + }; } else { - drawTransparentFrame(wwin, orig_fx, orig_fy, orig_fw, orig_fh); - drawTransparentFrame(wwin, fx, fy, fw, fh); + if (!opaqueResize) { + drawTransparentFrame(wwin, orig_fx, orig_fy, orig_fw, orig_fh); + drawTransparentFrame(wwin, fx, fy, fw, fh); + }; } if (fh != orig_fh || fw != orig_fw) { if (wPreferences.size_display == WDIS_NEW) { @@ -2020,6 +2029,17 @@ void wMouseResizeWindow(WWindow * wwin, XEvent * ev) } showGeometry(wwin, fx, fy, fx + fw, fy + fh, res); } + if (opaqueResize) { + + XUngrabServer(dpy); + + wwin->flags.user_changed_width = 1; + + moveGeometryDisplayCentered(scr, fx + fw / 2, fy + fh / 2); + + wWindowConfigure(wwin, fx, fy, fw, fh - vert_border); + showGeometry(wwin, fx, fy, fx + fw, fy + fh, res); + }; } break; @@ -2033,8 +2053,9 @@ void wMouseResizeWindow(WWindow * wwin, XEvent * ev) if (started) { showGeometry(wwin, fx, fy, fx + fw, fy + fh, res); - drawTransparentFrame(wwin, fx, fy, fw, fh); - + if (!opaqueResize) { + drawTransparentFrame(wwin, fx, fy, fw, fh); + } XUngrabKeyboard(dpy, CurrentTime); WMUnmapWidget(scr->gview); XUngrabServer(dpy); -- 1.7.4.1
