mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 12:58:08 +01:00
kbd shortcuts for icon dialog
This commit is contained in:
@@ -5,6 +5,7 @@ Changes since version 0.64.0:
|
||||
- added better appicon handling of apps of the same type
|
||||
- applied patch for wkdemenu (Malcolm Cowe <malk@bruhaha.co.uk>)
|
||||
- added WINDOWS_MENU submenu type for root menu (Bastien Nocera <hadess@hadess.net>)
|
||||
- added kbd shortcuts for icon chooser
|
||||
|
||||
Changes since version 0.63.1:
|
||||
.............................
|
||||
|
||||
2
TODO
2
TODO
@@ -14,7 +14,6 @@ Need to do:
|
||||
===========
|
||||
- put a "Do not save workspace state" in the exit confirmation dialog
|
||||
- allow user to select/restore default root menu from wprefs
|
||||
- fix windoze cycle window patch
|
||||
- support for X11R6.4 extension for getting extra visual info in wrlib's
|
||||
automatic best context guessing
|
||||
- docklet to control AccessX (keyboard accessibility) functions
|
||||
@@ -22,7 +21,6 @@ Need to do:
|
||||
- add function to directly make a thumbnail of an image, using the
|
||||
functionality provided by the image libraries to load a minimal
|
||||
amount of data.
|
||||
+ investigate memory leaks
|
||||
- rewrite defaults/wdefaults stuff to use WINGs UD stuff. Search list:
|
||||
~/G/D/WindowMaker /u/l/s/W/D/WindowMaker built-in-defaults
|
||||
- remake internal string processing to use wchar? unicode?
|
||||
|
||||
@@ -385,7 +385,7 @@ wAppIconIsFirstInstance(WAppIcon *icon)
|
||||
int index = 0;
|
||||
|
||||
if (!WFLAGP(icon->icon->owner, collapse_appicons))
|
||||
return False;
|
||||
return True;
|
||||
|
||||
while (list) {
|
||||
if (icon == list)
|
||||
|
||||
98
src/dialog.c
98
src/dialog.c
@@ -292,7 +292,11 @@ listCallback(void *self, void *data)
|
||||
char *path;
|
||||
|
||||
if (lPtr==panel->dirList) {
|
||||
path = WMGetListSelectedItem(lPtr)->text;
|
||||
WMListItem *item = WMGetListSelectedItem(lPtr);
|
||||
|
||||
if (item == NULL)
|
||||
return;
|
||||
path = item->text;
|
||||
|
||||
WMSetTextFieldText(panel->fileField, path);
|
||||
|
||||
@@ -304,11 +308,17 @@ listCallback(void *self, void *data)
|
||||
listPixmaps(panel->scr, panel->iconList, path);
|
||||
} else {
|
||||
char *tmp, *iconFile;
|
||||
WMListItem *item = WMGetListSelectedItem(panel->dirList);
|
||||
|
||||
path = WMGetListSelectedItem(panel->dirList)->text;
|
||||
if (item == NULL)
|
||||
return;
|
||||
path = item->text;
|
||||
tmp = wexpandpath(path);
|
||||
|
||||
iconFile = WMGetListSelectedItem(panel->iconList)->text;
|
||||
item = WMGetListSelectedItem(panel->iconList);
|
||||
if (item == NULL)
|
||||
return;
|
||||
iconFile = item->text;
|
||||
|
||||
path = wmalloc(strlen(tmp)+strlen(iconFile)+4);
|
||||
strcpy(path, tmp);
|
||||
@@ -477,6 +487,83 @@ buttonCallback(void *self, void *clientData)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
keyPressHandler(XEvent *event, void *data)
|
||||
{
|
||||
IconPanel *panel = (IconPanel*)data;
|
||||
Display *dpy = event->xany.display;
|
||||
char buffer[32];
|
||||
int count;
|
||||
KeySym ksym;
|
||||
int iidx;
|
||||
int didx;
|
||||
int item;
|
||||
WMList *list = NULL;
|
||||
|
||||
if (event->type == KeyRelease)
|
||||
return;
|
||||
|
||||
buffer[0] = 0;
|
||||
count = XLookupString(&event->xkey, buffer, sizeof(buffer), &ksym, NULL);
|
||||
|
||||
|
||||
iidx = WMGetListSelectedItemRow(panel->iconList);
|
||||
didx = WMGetListSelectedItemRow(panel->dirList);
|
||||
|
||||
switch (ksym) {
|
||||
case XK_Up:
|
||||
if (iidx > 0)
|
||||
item = iidx-1;
|
||||
else
|
||||
item = iidx;
|
||||
list = panel->iconList;
|
||||
break;
|
||||
case XK_Down:
|
||||
if (iidx < WMGetListNumberOfRows(panel->iconList) - 1)
|
||||
item = iidx+1;
|
||||
else
|
||||
item = iidx;
|
||||
list = panel->iconList;
|
||||
break;
|
||||
case XK_Home:
|
||||
item = 0;
|
||||
list = panel->iconList;
|
||||
break;
|
||||
case XK_End:
|
||||
item = WMGetListNumberOfRows(panel->iconList) - 1;
|
||||
list = panel->iconList;
|
||||
break;
|
||||
case XK_Next:
|
||||
if (didx < WMGetListNumberOfRows(panel->dirList) - 1)
|
||||
item = didx + 1;
|
||||
else
|
||||
item = didx;
|
||||
list = panel->dirList;
|
||||
break;
|
||||
case XK_Prior:
|
||||
if (didx > 0)
|
||||
item = didx - 1;
|
||||
else
|
||||
item = 0;
|
||||
list = panel->dirList;
|
||||
break;
|
||||
case XK_Return:
|
||||
WMPerformButtonClick(panel->okButton);
|
||||
break;
|
||||
case XK_Escape:
|
||||
WMPerformButtonClick(panel->cancelButton);
|
||||
break;
|
||||
}
|
||||
|
||||
if (list) {
|
||||
WMSelectListItem(list, item);
|
||||
WMSetListPosition(list, item - 5);
|
||||
listCallback(list, panel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Bool
|
||||
wIconChooserDialog(WScreen *scr, char **file, char *instance, char *class)
|
||||
{
|
||||
@@ -494,6 +581,10 @@ wIconChooserDialog(WScreen *scr, char **file, char *instance, char *class)
|
||||
panel->win = WMCreateWindow(scr->wmscreen, "iconChooser");
|
||||
WMResizeWidget(panel->win, 450, 280);
|
||||
|
||||
WMCreateEventHandler(WMWidgetView(panel->win), KeyPressMask|KeyReleaseMask,
|
||||
keyPressHandler, panel);
|
||||
|
||||
|
||||
boldFont = WMBoldSystemFontOfSize(scr->wmscreen, 12);
|
||||
panel->normalfont = WMSystemFontOfSize(WMWidgetScreen(panel->win), 12);
|
||||
|
||||
@@ -558,6 +649,7 @@ wIconChooserDialog(WScreen *scr, char **file, char *instance, char *class)
|
||||
WMSetLabelText(panel->fileLabel, _("File Name:"));
|
||||
|
||||
panel->fileField = WMCreateTextField(panel->win);
|
||||
WMSetViewNextResponder(WMWidgetView(panel->fileField), WMWidgetView(panel->win));
|
||||
WMResizeWidget(panel->fileField, 345, 20);
|
||||
WMMoveWidget(panel->fileField, 95, 210);
|
||||
WMSetTextFieldEditable(panel->fileField, False);
|
||||
|
||||
Reference in New Issue
Block a user