mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-26 00:12:31 +01:00
Mod+Wheel Window Resize
This patch adds the ability to resize windows with the mouse wheel while holding the Mod key. This currently ignores wWindowConstrainSize until I can figure out a way to repeatably resize windows with fixed size increments (like xterm) using this method. This also adds a slider to WPrefs to choose the increment with which the wheel will resize a window.
This commit is contained in:
committed by
Carlos R. Mafra
parent
781b663341
commit
a063338175
@@ -466,6 +466,7 @@ typedef struct WPreferences {
|
||||
signed char shade_speed;
|
||||
|
||||
int edge_resistance;
|
||||
int resize_increment;
|
||||
char attract;
|
||||
|
||||
unsigned int workspace_border_size; /* Size in pixels of the workspace border */
|
||||
|
||||
@@ -468,6 +468,8 @@ WDefaultEntry optionList[] = {
|
||||
&wPreferences.help_balloon, getBool, NULL},
|
||||
{"EdgeResistance", "30", NULL,
|
||||
&wPreferences.edge_resistance, getInt, NULL},
|
||||
{"ResizeIncrement", "32", NULL,
|
||||
&wPreferences.resize_increment, getInt, NULL},
|
||||
{"Attraction", "NO", NULL,
|
||||
&wPreferences.attract, getBool, NULL},
|
||||
{"DisableBlinking", "NO", NULL,
|
||||
|
||||
20
src/window.c
20
src/window.c
@@ -2966,6 +2966,11 @@ static void titlebarDblClick(WCoreWindow * sender, void *data, XEvent * event)
|
||||
static void frameMouseDown(WObjDescriptor * desc, XEvent * event)
|
||||
{
|
||||
WWindow *wwin = desc->parent;
|
||||
unsigned int new_width;
|
||||
unsigned int new_height;
|
||||
unsigned int resize_increment;
|
||||
|
||||
resize_increment = wPreferences.resize_increment;
|
||||
|
||||
event->xbutton.state &= ValidModMask;
|
||||
|
||||
@@ -2990,10 +2995,21 @@ static void frameMouseDown(WObjDescriptor * desc, XEvent * event)
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
if (event->xbutton.button == Button3)
|
||||
if (event->xbutton.button == Button3) {
|
||||
wMouseResizeWindow(wwin, event);
|
||||
else if (event->xbutton.button == Button1 || event->xbutton.button == Button2)
|
||||
} else if (event->xbutton.button == Button4) {
|
||||
new_width = wwin->client.width - resize_increment;
|
||||
new_height = wwin->client.height - resize_increment;
|
||||
//wWindowConstrainSize(wwin, &new_width,&new_height);
|
||||
wWindowConfigure(wwin, wwin->frame_x, wwin->frame_y, new_width, new_height);
|
||||
} else if (event->xbutton.button == Button5) {
|
||||
new_width = wwin->client.width + resize_increment;
|
||||
new_height = wwin->client.height + resize_increment;
|
||||
//wWindowConstrainSize(wwin, &new_width,&new_height);
|
||||
wWindowConfigure(wwin, wwin->frame_x, wwin->frame_y, new_width, new_height);
|
||||
} else if (event->xbutton.button == Button1 || event->xbutton.button == Button2) {
|
||||
wMouseMoveWindow(wwin, event);
|
||||
}
|
||||
XUngrabPointer(dpy, CurrentTime);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user