1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 04:20:27 +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:
Johann Haarhoff
2009-10-11 21:36:46 +02:00
committed by Carlos R. Mafra
parent 781b663341
commit a063338175
4 changed files with 64 additions and 4 deletions

View File

@@ -53,6 +53,10 @@ typedef struct _Panel {
WMButton *miconB;
WMButton *mdockB;
WMLabel *resizeL;
WMLabel *resizeTextL;
WMSlider *resizeS;
WMFrame *opaqF;
WMButton *opaqB;
@@ -111,6 +115,22 @@ static void resistanceCallback(WMWidget * w, void *data)
}
}
static void resizeCallback(WMWidget * w, void *data)
{
_Panel *panel = (_Panel *) data;
char buffer[64];
int i;
i = WMGetSliderValue(panel->resizeS);
if (i == 0)
WMSetLabelText(panel->resizeL, "OFF");
else {
sprintf(buffer, "%i", i);
WMSetLabelText(panel->resizeL, buffer);
}
}
static int getPlacement(char *str)
{
if (!str)
@@ -163,6 +183,10 @@ static void showData(_Panel * panel)
WMSetSliderValue(panel->resS, x);
resistanceCallback(NULL, panel);
x = GetIntegerForKey("ResizeIncrement");
WMSetSliderValue(panel->resizeS, x);
resizeCallback(NULL, panel);
WMSetButtonSelected(panel->tranB, GetBoolForKey("OpenTransientOnOwnerWorkspace"));
WMSetButtonSelected(panel->opaqB, GetBoolForKey("OpaqueMove"));
@@ -192,6 +216,7 @@ static void storeData(_Panel * panel)
arr = WMCreatePLArray(WMCreatePLString(x), WMCreatePLString(y), NULL);
SetObjectForKey(arr, "WindowPlaceOrigin");
SetIntegerForKey(WMGetSliderValue(panel->resS), "EdgeResistance");
SetIntegerForKey(WMGetSliderValue(panel->resizeS), "ResizeIncrement");
SetBoolForKey(WMGetButtonSelected(panel->resrB), "Attraction");
WMReleasePropList(arr);
}
@@ -341,15 +366,31 @@ static void createPanel(Panel * p)
panel->miconB = WMCreateSwitchButton(panel->maxiF);
WMResizeWidget(panel->miconB, 190, 30);
WMMoveWidget(panel->miconB, 10, 18);
WMMoveWidget(panel->miconB, 10, 12);
WMSetButtonText(panel->miconB, _("...do not cover icons"));
panel->mdockB = WMCreateSwitchButton(panel->maxiF);
WMResizeWidget(panel->mdockB, 190, 30);
WMMoveWidget(panel->mdockB, 10, 53);
WMMoveWidget(panel->mdockB, 10, 35);
WMSetButtonText(panel->mdockB, _("...do not cover dock"));
panel->resizeS = WMCreateSlider(panel->maxiF);
WMResizeWidget(panel->resizeS, 50, 15);
WMMoveWidget(panel->resizeS, 10, 70);
WMSetSliderMinValue(panel->resizeS, 0);
WMSetSliderMaxValue(panel->resizeS, 100);
WMSetSliderAction(panel->resizeS, resizeCallback, panel);
panel->resizeL = WMCreateLabel(panel->maxiF);
WMResizeWidget(panel->resizeL, 30, 15);
WMMoveWidget(panel->resizeL, 60, 70);
panel->resizeTextL = WMCreateLabel(panel->maxiF);
WMSetLabelText(panel->resizeTextL, "Mod+Wheel\nresize increment");
WMResizeWidget(panel->resizeTextL, 110, 30);
WMMoveWidget(panel->resizeTextL, 90, 62);
WMMapSubwidgets(panel->maxiF);
/**************** Edge Resistance ****************/