1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-28 19:05:51 +01:00

Initial mouse wheel code.

This commit is contained in:
dan
2000-04-13 21:24:28 +00:00
parent b188d55bbe
commit 5c76167098
6 changed files with 153 additions and 17 deletions

View File

@@ -10,11 +10,32 @@ _WINGsConfiguration WINGsConfiguration;
#define SYSTEM_FONT "-*-helvetica-medium-r-normal-*-%d-*-*-*-*-*-*-*,-*-*-medium-r-*-*-%d-*-*-*-*-*-*-*"
#define BOLD_SYSTEM_FONT "-*-helvetica-bold-r-normal-*-%d-*-*-*-*-*-*-*,-*-*-bold-r-*-*-%d-*-*-*-*-*-*-*"
static unsigned
getButtonWithName(const char *name, unsigned defaultButton)
{
if (strncmp(name, "Button", 6)==0 && strlen(name)==7) {
switch (name[6]) {
case '1':
return Button1;
case '2':
return Button2;
case '3':
return Button3;
case '4':
return Button4;
case '5':
return Button5;
default:
break;
}
}
return defaultButton;
}
void
@@ -27,6 +48,9 @@ W_ReadConfigurations(void)
defaults = WMGetStandardUserDefaults();
if (defaults) {
char *buttonName;
unsigned button;
WINGsConfiguration.systemFont =
WMGetUDStringForKey(defaults, "SystemFont");
@@ -38,11 +62,34 @@ W_ReadConfigurations(void)
WINGsConfiguration.doubleClickDelay =
WMGetUDIntegerForKey(defaults, "DoubleClickTime");
buttonName = WMGetUDStringForKey(defaults, "MouseWheelUp");
if (buttonName) {
button = getButtonWithName(buttonName, Button4);
free(buttonName);
} else {
button = Button4;
}
WINGsConfiguration.mouseWheelUp = button;
buttonName = WMGetUDStringForKey(defaults, "MouseWheelDown");
if (buttonName) {
button = getButtonWithName(buttonName, Button5);
free(buttonName);
} else {
button = Button5;
}
WINGsConfiguration.mouseWheelDown = button;
if (WINGsConfiguration.mouseWheelDown==WINGsConfiguration.mouseWheelUp) {
WINGsConfiguration.mouseWheelUp = Button4;
WINGsConfiguration.mouseWheelDown = Button5;
}
WINGsConfiguration.defaultFontSize =
WMGetUDIntegerForKey(defaults, "DefaultFontSize");
WMGetUDIntegerForKey(defaults, "DefaultFontSize");
}
if (!WINGsConfiguration.systemFont) {
WINGsConfiguration.systemFont = SYSTEM_FONT;
@@ -53,6 +100,12 @@ W_ReadConfigurations(void)
if (WINGsConfiguration.doubleClickDelay == 0) {
WINGsConfiguration.doubleClickDelay = 250;
}
if (WINGsConfiguration.mouseWheelUp == 0) {
WINGsConfiguration.mouseWheelUp = Button4;
}
if (WINGsConfiguration.mouseWheelDown == 0) {
WINGsConfiguration.mouseWheelDown = Button5;
}
if (WINGsConfiguration.defaultFontSize == 0) {
WINGsConfiguration.defaultFontSize = 12;
}