diff options
author | fvogel <fvogel@noemail.net> | 2016-01-06 20:30:24 (GMT) |
---|---|---|
committer | fvogel <fvogel@noemail.net> | 2016-01-06 20:30:24 (GMT) |
commit | 973d7906a946ae22e84169300265b7e9743c9f2d (patch) | |
tree | 1db354a2110800a66c4b1f1904be1d5cc1e6880c /generic | |
parent | 4a0d0d2a0026b191318f3771437271b4122815bc (diff) | |
parent | f08a7a74f3df6933557e918e3cbcadf0d68fb8b8 (diff) | |
download | tk-973d7906a946ae22e84169300265b7e9743c9f2d.zip tk-973d7906a946ae22e84169300265b7e9743c9f2d.tar.gz tk-973d7906a946ae22e84169300265b7e9743c9f2d.tar.bz2 |
Fixed bug [3102228] - <<ListboxSelect>> doesn't fire when selection lost
FossilOrigin-Name: 3736983e96802c090f7957208789ee7890cc110a
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkListbox.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/generic/tkListbox.c b/generic/tkListbox.c index 437973a..1843bbb 100644 --- a/generic/tkListbox.c +++ b/generic/tkListbox.c @@ -408,6 +408,7 @@ static void ListboxEventProc(ClientData clientData, static int ListboxFetchSelection(ClientData clientData, int offset, char *buffer, int maxBytes); static void ListboxLostSelection(ClientData clientData); +static void GenerateListboxSelectEvent(Listbox *listPtr); static void EventuallyRedrawRange(Listbox *listPtr, int first, int last); static void ListboxScanTo(Listbox *listPtr, int x, int y); @@ -3170,12 +3171,46 @@ ListboxLostSelection( if ((listPtr->exportSelection) && (listPtr->nElements > 0)) { ListboxSelect(listPtr, 0, listPtr->nElements-1, 0); + GenerateListboxSelectEvent(listPtr); } } /* *---------------------------------------------------------------------- * + * GenerateListboxSelectEvent -- + * + * Send an event that the listbox selection was updated. This is + * equivalent to event generate $listboxWidget <<ListboxSelect>> + * + * Results: + * None + * + * Side effects: + * Any side effect possible, depending on bindings to this event. + * + *---------------------------------------------------------------------- + */ + +static void +GenerateListboxSelectEvent( + Listbox *listPtr) /* Information about widget. */ +{ + union {XEvent general; XVirtualEvent virtual;} event; + + memset(&event, 0, sizeof(event)); + event.general.xany.type = VirtualEvent; + event.general.xany.serial = NextRequest(Tk_Display(listPtr->tkwin)); + event.general.xany.send_event = False; + event.general.xany.window = Tk_WindowId(listPtr->tkwin); + event.general.xany.display = Tk_Display(listPtr->tkwin); + event.virtual.name = Tk_GetUid("ListboxSelect"); + Tk_HandleEvent(&event.general); +} + +/* + *---------------------------------------------------------------------- + * * EventuallyRedrawRange -- * * Ensure that a given range of elements is eventually redrawn on the |