summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-02-05 13:45:27 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-02-05 13:45:27 (GMT)
commite9bfc5a20ff253e4a7c23f86ca1656f8981d081c (patch)
treef75006937dbfe4ebdc6967c22afe0fb7133018ab /win
parentbf8f5544fe873145780724a6fa9eda883487b3f8 (diff)
downloadtk-e9bfc5a20ff253e4a7c23f86ca1656f8981d081c.zip
tk-e9bfc5a20ff253e4a7c23f86ca1656f8981d081c.tar.gz
tk-e9bfc5a20ff253e4a7c23f86ca1656f8981d081c.tar.bz2
(cherry-pick): Don't panic for "Wild GenericEvent"'s: Just filter out all events Tk doesn't know about.
(cherry-pick): Protect better against possible confusion between XGenericEvent's and (Tcl-specific) XVirtualEvent's: If "name" == NULL, assume it's a XGenericEvent, so don't crash on that just ignore. Also don't use "virtual" as variable name.
Diffstat (limited to 'win')
-rw-r--r--win/tkWinMenu.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c
index ce9a482..6e856c7 100644
--- a/win/tkWinMenu.c
+++ b/win/tkWinMenu.c
@@ -3101,27 +3101,28 @@ static void
MenuSelectEvent(
TkMenu *menuPtr) /* the menu we have selected. */
{
- XVirtualEvent event;
+ union {XEvent general; XVirtualEvent virt;} event;
union {DWORD msgpos; POINTS point;} root;
- event.type = VirtualEvent;
- event.serial = menuPtr->display->request;
- event.send_event = 0;
- event.display = menuPtr->display;
+ memset(&event, 0, sizeof(event));
+ event.virt.type = VirtualEvent;
+ event.virt.serial = menuPtr->display->request;
+ event.virt.send_event = 0;
+ event.virt.display = menuPtr->display;
Tk_MakeWindowExist(menuPtr->tkwin);
- event.event = Tk_WindowId(menuPtr->tkwin);
- event.root = XRootWindow(menuPtr->display, 0);
- event.subwindow = None;
- event.time = TkpGetMS();
+ event.virt.event = Tk_WindowId(menuPtr->tkwin);
+ event.virt.root = XRootWindow(menuPtr->display, 0);
+ event.virt.subwindow = None;
+ event.virt.time = TkpGetMS();
root.msgpos = GetMessagePos();
- event.x_root = root.point.x;
- event.y_root = root.point.y;
- event.state = TkWinGetModifierState();
- event.same_screen = 1;
- event.name = Tk_GetUid("MenuSelect");
- event.user_data = NULL;
- Tk_QueueWindowEvent((XEvent *) &event, TCL_QUEUE_TAIL);
+ event.virt.x_root = root.point.x;
+ event.virt.y_root = root.point.y;
+ event.virt.state = TkWinGetModifierState();
+ event.virt.same_screen = 1;
+ event.virt.name = Tk_GetUid("MenuSelect");
+ event.virt.user_data = NULL;
+ Tk_QueueWindowEvent(&event.general, TCL_QUEUE_TAIL);
}
/*