1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 20:38:08 +01:00

Respect size hints when resizing with wheel.

Use height and width increment when wheel resizing if size hints are
set on a window and meaningful height and width increments are
specified.
Windows which don't care about their resize increments will have height
and width increments set to 1.  For these windows - and windows without
resize hints at all - use the setting configured with ResizeIncrement.
This commit is contained in:
Iain Patterson
2009-10-12 10:24:55 +01:00
committed by Carlos R. Mafra
parent a3246cfe3b
commit bf88570a5f

View File

@@ -2860,9 +2860,17 @@ static void frameMouseDown(WObjDescriptor *desc, XEvent *event)
WWindow *wwin = desc->parent;
unsigned int new_width;
unsigned int new_height;
unsigned int resize_increment;
unsigned int resize_width_increment = 0;
unsigned int resize_height_increment = 0;
resize_increment = wPreferences.resize_increment;
if (wwin->normal_hints) {
resize_width_increment = wwin->normal_hints->width_inc;
resize_height_increment = wwin->normal_hints->height_inc;
}
if (resize_width_increment <= 1 && resize_height_increment <= 1) {
resize_width_increment = wPreferences.resize_increment;
resize_height_increment = wPreferences.resize_increment;
}
event->xbutton.state &= ValidModMask;
@@ -2887,14 +2895,14 @@ static void frameMouseDown(WObjDescriptor *desc, XEvent *event)
if (event->xbutton.button == Button3) {
wMouseResizeWindow(wwin, event);
} 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);
new_width = wwin->client.width - resize_width_increment;
new_height = wwin->client.height - resize_height_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);
new_width = wwin->client.width + resize_width_increment;
new_height = wwin->client.height + resize_height_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);