mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 04:20:27 +01:00
fixed modifier bug in textfield again
This commit is contained in:
@@ -9,6 +9,7 @@ changes since wmaker 0.63.1:
|
||||
- Fixed a mem leak in WMList.
|
||||
- Fixed a bug that caused sigsegv for a WMList with more than 32767 items.
|
||||
- Added an example of how to create a server type program with WMConnection.
|
||||
- added WMOpenScreen()
|
||||
|
||||
|
||||
changes since wmaker 0.62.1:
|
||||
|
||||
@@ -588,6 +588,9 @@ char *WMGetApplicationName();
|
||||
/* Try to locate resource file. ext may be NULL */
|
||||
char *WMPathForResourceOfType(char *resource, char *ext);
|
||||
|
||||
|
||||
WMScreen *WMOpenScreen();
|
||||
|
||||
WMScreen *WMCreateScreenWithRContext(Display *display, int screen,
|
||||
RContext *context);
|
||||
|
||||
|
||||
@@ -189,6 +189,8 @@ typedef struct W_Screen {
|
||||
WMHashTable *fontCache;
|
||||
|
||||
Bool useMultiByte;
|
||||
|
||||
unsigned int ignoredModifierMask; /* modifiers to ignore when typing txt */
|
||||
|
||||
struct W_Balloon *balloon;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "WINGsP.h"
|
||||
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
#include <X11/keysym.h>
|
||||
#include <X11/cursorfont.h>
|
||||
|
||||
/********** data ************/
|
||||
@@ -515,6 +515,20 @@ loadPixmaps(WMScreen *scr)
|
||||
}
|
||||
|
||||
|
||||
WMScreen*
|
||||
WMOpenScreen()
|
||||
{
|
||||
Display *dpy = XOpenDisplay("");
|
||||
|
||||
if (!dpy) {
|
||||
wwarning("WINGs: could not open display %s",
|
||||
XDisplayName(""));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return WMCreateSimpleApplicationScreen(dpy);
|
||||
}
|
||||
|
||||
|
||||
WMScreen*
|
||||
WMCreateSimpleApplicationScreen(Display *display)
|
||||
@@ -602,6 +616,42 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context)
|
||||
|
||||
scrPtr->fontCache = WMCreateHashTable(WMStringPointerHashCallbacks);
|
||||
|
||||
scrPtr->ignoredModifierMask = 0;
|
||||
{
|
||||
int i;
|
||||
XModifierKeymap *modmap;
|
||||
KeyCode nlock, slock;
|
||||
static int mask_table[8] = {
|
||||
ShiftMask,LockMask,ControlMask,Mod1Mask,
|
||||
Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask
|
||||
};
|
||||
unsigned int numLockMask, scrollLockMask;
|
||||
|
||||
nlock = XKeysymToKeycode(display, XK_Num_Lock);
|
||||
slock = XKeysymToKeycode(display, XK_Scroll_Lock);
|
||||
|
||||
/*
|
||||
* Find out the masks for the NumLock and ScrollLock modifiers,
|
||||
* so that we can bind the grabs for when they are enabled too.
|
||||
*/
|
||||
modmap = XGetModifierMapping(display);
|
||||
|
||||
if (modmap!=NULL && modmap->max_keypermod>0) {
|
||||
for (i=0; i<8*modmap->max_keypermod; i++) {
|
||||
if (modmap->modifiermap[i]==nlock && nlock!=0)
|
||||
numLockMask = mask_table[i/modmap->max_keypermod];
|
||||
else if (modmap->modifiermap[i]==slock && slock!=0)
|
||||
scrollLockMask = mask_table[i/modmap->max_keypermod];
|
||||
}
|
||||
}
|
||||
|
||||
if (modmap)
|
||||
XFreeModifiermap(modmap);
|
||||
|
||||
|
||||
scrPtr->ignoredModifierMask = numLockMask|scrollLockMask|LockMask;
|
||||
}
|
||||
|
||||
/* initially allocate some colors */
|
||||
WMWhiteColor(scrPtr);
|
||||
WMBlackColor(scrPtr);
|
||||
|
||||
@@ -1000,7 +1000,10 @@ handleTextFieldKeyPress(TextField *tPtr, XEvent *event)
|
||||
int cancelSelection = 1;
|
||||
Bool shifted, controled, modified;
|
||||
Bool relay = True;
|
||||
WMScreen *scr = tPtr->view->screen;
|
||||
|
||||
event->xkey.state &= ~scr->ignoredModifierMask;
|
||||
|
||||
/*printf("(%d,%d) -> ", tPtr->selection.position, tPtr->selection.count);*/
|
||||
if (((XKeyEvent *) event)->state & WM_EMACSKEYMASK)
|
||||
control_pressed = 1;
|
||||
|
||||
Reference in New Issue
Block a user