diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-05-14 14:35:30 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-05-14 14:35:30 (GMT) |
commit | 3936fed2e4bd2538177704d1624300aa7d8e52ef (patch) | |
tree | 4221ed21551bb461974dee6dfa67e3bccb6e1927 /generic | |
parent | fe4022603129271b3e6e9f98136265c7982938dc (diff) | |
download | tk-3936fed2e4bd2538177704d1624300aa7d8e52ef.zip tk-3936fed2e4bd2538177704d1624300aa7d8e52ef.tar.gz tk-3936fed2e4bd2538177704d1624300aa7d8e52ef.tar.bz2 |
First concept cleanup for [d2a10a14a8] (already merged to core-8-6-branch but with a quickfix). This makes TkKeyEvent usable for all platforms, and adds a generic TkWheelEvent.
So far, only adapted for X11 and Windows, still has to be modified for MacOS.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkEvent.c | 4 | ||||
-rw-r--r-- | generic/tkInt.h | 24 |
2 files changed, 27 insertions, 1 deletions
diff --git a/generic/tkEvent.c b/generic/tkEvent.c index 0beb8b6..a2fa293 100644 --- a/generic/tkEvent.c +++ b/generic/tkEvent.c @@ -1751,13 +1751,15 @@ CleanUpTkEvent( switch (eventPtr->type) { case KeyPress: case KeyRelease: { - TkKeyEvent *kePtr = (TkKeyEvent *) eventPtr; +#if !defined(_WIN32) && !defined(MAC_OSX_TK) + TkKeyEvent *kePtr = (TkKeyEvent *) eventPtr; if (kePtr->charValuePtr != NULL) { ckfree(kePtr->charValuePtr); kePtr->charValuePtr = NULL; kePtr->charValueLen = 0; } +#endif break; } diff --git a/generic/tkInt.h b/generic/tkInt.h index 8f958ab..fd124d5 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -850,8 +850,15 @@ typedef struct TkWindow { * but have internally generated pieces added to them. */ +#define XMaxTransChars 7 + typedef struct { XKeyEvent keyEvent; /* The real event from X11. */ +#if defined(_WIN32) || defined(MAC_OSX_TK) + char trans_chars[XMaxTransChars]; + /* translated characters */ + unsigned char nbytes; /* Length of trans_chars. */ +#else char *charValuePtr; /* A pointer to a string that holds the key's * %A substitution text (before backslash * adding), or NULL if that has not been @@ -861,8 +868,25 @@ typedef struct { * is non-NULL. */ KeySym keysym; /* Key symbol computed after input methods * have been invoked */ +#endif } TkKeyEvent; +typedef struct { + int type; /* of event */ + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; /* "event" window it is reported relative to */ + Window root; /* root window that the event occured on */ + Window subwindow; /* child window */ + Time time; /* milliseconds */ + int x, y; /* pointer x, y coordinates in event window */ + int x_root, y_root; /* coordinates relative to root */ + int delta; /* delta */ + unsigned int button; /* detail */ + Bool same_screen; /* same screen flag */ +} TkWheelEvent; + /* * Flags passed to TkpMakeMenuWindow's 'transient' argument. */ |