mirror of
https://github.com/gryf/wmaker.git
synced 2026-01-10 15:54:17 +01:00
cleaning the house today
This commit is contained in:
@@ -21,6 +21,9 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "config.h" /* for HAVE_XCONVERTCASE */
|
||||
|
||||
|
||||
#include "WPrefs.h"
|
||||
#include <ctype.h>
|
||||
|
||||
@@ -120,6 +123,121 @@ static char *keyOptions[] = {
|
||||
|
||||
|
||||
|
||||
#ifndef HAVE_XCONVERTCASE
|
||||
/* from Xlib */
|
||||
|
||||
static void
|
||||
XConvertCase(sym, lower, upper)
|
||||
register KeySym sym;
|
||||
KeySym *lower;
|
||||
KeySym *upper;
|
||||
{
|
||||
*lower = sym;
|
||||
*upper = sym;
|
||||
switch(sym >> 8) {
|
||||
case 0: /* Latin 1 */
|
||||
if ((sym >= XK_A) && (sym <= XK_Z))
|
||||
*lower += (XK_a - XK_A);
|
||||
else if ((sym >= XK_a) && (sym <= XK_z))
|
||||
*upper -= (XK_a - XK_A);
|
||||
else if ((sym >= XK_Agrave) && (sym <= XK_Odiaeresis))
|
||||
*lower += (XK_agrave - XK_Agrave);
|
||||
else if ((sym >= XK_agrave) && (sym <= XK_odiaeresis))
|
||||
*upper -= (XK_agrave - XK_Agrave);
|
||||
else if ((sym >= XK_Ooblique) && (sym <= XK_Thorn))
|
||||
*lower += (XK_oslash - XK_Ooblique);
|
||||
else if ((sym >= XK_oslash) && (sym <= XK_thorn))
|
||||
*upper -= (XK_oslash - XK_Ooblique);
|
||||
break;
|
||||
case 1: /* Latin 2 */
|
||||
/* Assume the KeySym is a legal value (ignore discontinuities) */
|
||||
if (sym == XK_Aogonek)
|
||||
*lower = XK_aogonek;
|
||||
else if (sym >= XK_Lstroke && sym <= XK_Sacute)
|
||||
*lower += (XK_lstroke - XK_Lstroke);
|
||||
else if (sym >= XK_Scaron && sym <= XK_Zacute)
|
||||
*lower += (XK_scaron - XK_Scaron);
|
||||
else if (sym >= XK_Zcaron && sym <= XK_Zabovedot)
|
||||
*lower += (XK_zcaron - XK_Zcaron);
|
||||
else if (sym == XK_aogonek)
|
||||
*upper = XK_Aogonek;
|
||||
else if (sym >= XK_lstroke && sym <= XK_sacute)
|
||||
*upper -= (XK_lstroke - XK_Lstroke);
|
||||
else if (sym >= XK_scaron && sym <= XK_zacute)
|
||||
*upper -= (XK_scaron - XK_Scaron);
|
||||
else if (sym >= XK_zcaron && sym <= XK_zabovedot)
|
||||
*upper -= (XK_zcaron - XK_Zcaron);
|
||||
else if (sym >= XK_Racute && sym <= XK_Tcedilla)
|
||||
*lower += (XK_racute - XK_Racute);
|
||||
else if (sym >= XK_racute && sym <= XK_tcedilla)
|
||||
*upper -= (XK_racute - XK_Racute);
|
||||
break;
|
||||
case 2: /* Latin 3 */
|
||||
/* Assume the KeySym is a legal value (ignore discontinuities) */
|
||||
if (sym >= XK_Hstroke && sym <= XK_Hcircumflex)
|
||||
*lower += (XK_hstroke - XK_Hstroke);
|
||||
else if (sym >= XK_Gbreve && sym <= XK_Jcircumflex)
|
||||
*lower += (XK_gbreve - XK_Gbreve);
|
||||
else if (sym >= XK_hstroke && sym <= XK_hcircumflex)
|
||||
*upper -= (XK_hstroke - XK_Hstroke);
|
||||
else if (sym >= XK_gbreve && sym <= XK_jcircumflex)
|
||||
*upper -= (XK_gbreve - XK_Gbreve);
|
||||
else if (sym >= XK_Cabovedot && sym <= XK_Scircumflex)
|
||||
*lower += (XK_cabovedot - XK_Cabovedot);
|
||||
else if (sym >= XK_cabovedot && sym <= XK_scircumflex)
|
||||
*upper -= (XK_cabovedot - XK_Cabovedot);
|
||||
break;
|
||||
case 3: /* Latin 4 */
|
||||
/* Assume the KeySym is a legal value (ignore discontinuities) */
|
||||
if (sym >= XK_Rcedilla && sym <= XK_Tslash)
|
||||
*lower += (XK_rcedilla - XK_Rcedilla);
|
||||
else if (sym >= XK_rcedilla && sym <= XK_tslash)
|
||||
*upper -= (XK_rcedilla - XK_Rcedilla);
|
||||
else if (sym == XK_ENG)
|
||||
*lower = XK_eng;
|
||||
else if (sym == XK_eng)
|
||||
*upper = XK_ENG;
|
||||
else if (sym >= XK_Amacron && sym <= XK_Umacron)
|
||||
*lower += (XK_amacron - XK_Amacron);
|
||||
else if (sym >= XK_amacron && sym <= XK_umacron)
|
||||
*upper -= (XK_amacron - XK_Amacron);
|
||||
break;
|
||||
case 6: /* Cyrillic */
|
||||
/* Assume the KeySym is a legal value (ignore discontinuities) */
|
||||
if (sym >= XK_Serbian_DJE && sym <= XK_Serbian_DZE)
|
||||
*lower -= (XK_Serbian_DJE - XK_Serbian_dje);
|
||||
else if (sym >= XK_Serbian_dje && sym <= XK_Serbian_dze)
|
||||
*upper += (XK_Serbian_DJE - XK_Serbian_dje);
|
||||
else if (sym >= XK_Cyrillic_YU && sym <= XK_Cyrillic_HARDSIGN)
|
||||
*lower -= (XK_Cyrillic_YU - XK_Cyrillic_yu);
|
||||
else if (sym >= XK_Cyrillic_yu && sym <= XK_Cyrillic_hardsign)
|
||||
*upper += (XK_Cyrillic_YU - XK_Cyrillic_yu);
|
||||
break;
|
||||
case 7: /* Greek */
|
||||
/* Assume the KeySym is a legal value (ignore discontinuities) */
|
||||
if (sym >= XK_Greek_ALPHAaccent && sym <= XK_Greek_OMEGAaccent)
|
||||
*lower += (XK_Greek_alphaaccent - XK_Greek_ALPHAaccent);
|
||||
else if (sym >= XK_Greek_alphaaccent && sym <= XK_Greek_omegaaccent &&
|
||||
sym != XK_Greek_iotaaccentdieresis &&
|
||||
sym != XK_Greek_upsilonaccentdieresis)
|
||||
*upper -= (XK_Greek_alphaaccent - XK_Greek_ALPHAaccent);
|
||||
else if (sym >= XK_Greek_ALPHA && sym <= XK_Greek_OMEGA)
|
||||
*lower += (XK_Greek_alpha - XK_Greek_ALPHA);
|
||||
else if (sym >= XK_Greek_alpha && sym <= XK_Greek_omega &&
|
||||
sym != XK_Greek_finalsmallsigma)
|
||||
*upper -= (XK_Greek_alpha - XK_Greek_ALPHA);
|
||||
break;
|
||||
case 0x14: /* Armenian */
|
||||
if (sym >= XK_Armenian_AYB && sym <= XK_Armenian_fe) {
|
||||
*lower = sym | 1;
|
||||
*upper = sym & ~1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static char*
|
||||
captureShortcut(Display *dpy, _Panel *panel)
|
||||
{
|
||||
@@ -135,7 +253,8 @@ captureShortcut(Display *dpy, _Panel *panel)
|
||||
ksym = XKeycodeToKeysym(dpy, ev.xkey.keycode, 0);
|
||||
if (!IsModifierKey(ksym)) {
|
||||
XConvertCase(ksym, &lksym, &uksym);
|
||||
key=XKeysymToString(uksym);
|
||||
key=XKeysymToString(uksym);
|
||||
|
||||
panel->capturing = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -83,6 +83,7 @@ typedef struct _Panel {
|
||||
|
||||
WMFrame *pipeF;
|
||||
WMTextField *pipeT;
|
||||
WMButton *pipeCacheB;
|
||||
|
||||
WMFrame *dpathF;
|
||||
WMTextField *dpathT;
|
||||
@@ -134,6 +135,7 @@ typedef struct {
|
||||
} external;
|
||||
struct {
|
||||
char *command;
|
||||
unsigned cached:1;
|
||||
} pipe;
|
||||
struct {
|
||||
char *directory;
|
||||
@@ -691,8 +693,8 @@ createPanel(_Panel *p)
|
||||
/* pipe */
|
||||
|
||||
panel->pipeF = WMCreateFrame(panel->optionsF);
|
||||
WMResizeWidget(panel->pipeF, width, 100);
|
||||
WMMoveWidget(panel->pipeF, 10, 50);
|
||||
WMResizeWidget(panel->pipeF, width, 150);
|
||||
WMMoveWidget(panel->pipeF, 10, 30);
|
||||
WMSetFrameTitle(panel->pipeF, _("Command"));
|
||||
|
||||
panel->pipeT = WMCreateTextField(panel->pipeF);
|
||||
@@ -710,6 +712,14 @@ createPanel(_Panel *p)
|
||||
WMSetLabelText(label, _("Enter a command that outputs a menu\n"
|
||||
"definition to stdout when invoked."));
|
||||
|
||||
|
||||
panel->pipeCacheB = WMCreateSwitchButton(panel->pipeF);
|
||||
WMResizeWidget(panel->pipeCacheB, width - 20, 40);
|
||||
WMMoveWidget(panel->pipeCacheB, 10, 110);
|
||||
WMSetButtonText(panel->pipeCacheB,
|
||||
_("Cache menu contents after opening for\n"
|
||||
"the first time"));
|
||||
|
||||
WMMapSubwidgets(panel->pipeF);
|
||||
|
||||
|
||||
@@ -983,11 +993,17 @@ parseCommand(WMPropList *item)
|
||||
/*
|
||||
* dir menu, menu file
|
||||
* dir WITH
|
||||
* |pipe (TODO: ||pipe)
|
||||
* |pipe
|
||||
*/
|
||||
p = parameter;
|
||||
while (isspace(*p) && *p) p++;
|
||||
if (*p == '|') {
|
||||
if (*(p+1) == '|') {
|
||||
p++;
|
||||
data->param.pipe.cached = 0;
|
||||
} else {
|
||||
data->param.pipe.cached = 1;
|
||||
}
|
||||
data->type = PipeInfo;
|
||||
data->param.pipe.command = wtrimspace(p+1);
|
||||
} else {
|
||||
@@ -1226,6 +1242,10 @@ updateMenuItem(_Panel *panel, WEditMenuItem *item, WMWidget *changedWidget)
|
||||
REPLACE(data->param.pipe.command,
|
||||
WMGetTextFieldText(panel->pipeT));
|
||||
}
|
||||
if (changedWidget == panel->pipeCacheB) {
|
||||
data->param.pipe.cached =
|
||||
WMGetButtonSelected(panel->pipeCacheB);
|
||||
}
|
||||
break;
|
||||
|
||||
case ExternalInfo:
|
||||
@@ -1290,6 +1310,7 @@ menuItemCloned(WEditMenuDelegate *delegate, WEditMenu *menu,
|
||||
|
||||
case PipeInfo:
|
||||
newData->param.pipe.command = DUP(data->param.pipe.command);
|
||||
newData->param.pipe.cached = data->param.pipe.cached;
|
||||
break;
|
||||
|
||||
case ExternalInfo:
|
||||
@@ -1415,6 +1436,7 @@ menuItemSelected(WEditMenuDelegate *delegate, WEditMenu *menu,
|
||||
|
||||
case PipeInfo:
|
||||
WMSetTextFieldText(panel->pipeT, data->param.pipe.command);
|
||||
WMSetButtonSelected(panel->pipeCacheB, data->param.pipe.cached);
|
||||
break;
|
||||
|
||||
case ExternalInfo:
|
||||
@@ -1682,11 +1704,14 @@ processData(char *title, ItemData *data)
|
||||
if (!data->param.pipe.command)
|
||||
return NULL;
|
||||
WMAddToPLArray(item, pomenu);
|
||||
s1 = wstrconcat("| ", data->param.pipe.command);
|
||||
if (data->param.pipe.cached)
|
||||
s1 = wstrconcat("| ", data->param.pipe.command);
|
||||
else
|
||||
s1 = wstrconcat("|| ", data->param.pipe.command);
|
||||
WMAddToPLArray(item, WMCreatePLString(s1));
|
||||
wfree(s1);
|
||||
break;
|
||||
|
||||
|
||||
case ExternalInfo:
|
||||
if (!data->param.external.path)
|
||||
return NULL;
|
||||
|
||||
@@ -18,7 +18,8 @@ es.po Spanish Alvaro Herrera <alvherre@webhost.cl>
|
||||
fi.po Finnish Tomi Kajala <tomi@iki.fi>
|
||||
it.po Italian Michele Campeotto <micampe@f2s.com>
|
||||
ru.po Russian Igor P. Roboul <igor@srcso.sochi.su>
|
||||
de.po German Bernd Eggert <Bernd.Eggert@t-online.de>
|
||||
de.po German Torsten Marek <torsten.marek@vbdnet.de>
|
||||
Bernd Eggert <Bernd.Eggert@t-online.de>
|
||||
Guido Scholz <guido.scholz@bayernline.de>
|
||||
hu.po Hungarian Horvath Szabolcs <horvathsz@penguinpowered.com>
|
||||
bg.po Bulgarian Slavei Karadjov <slaff@exco.net>
|
||||
|
||||
Reference in New Issue
Block a user