summaryrefslogtreecommitdiffstats
path: root/generic/tkListbox.c
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2016-01-06 20:28:27 (GMT)
committerfvogel <fvogelnew1@free.fr>2016-01-06 20:28:27 (GMT)
commit3c29497582459e3551edc32afd714b59494f26ae (patch)
treee722c2cc7c734b1e6a496ddaf9548197537d28f8 /generic/tkListbox.c
parenta596227ea0c8011ae343a0bb4b438e6bd12ed03b (diff)
parent13cdecd256069109fe277a62a153cb31b3a1348b (diff)
downloadtk-3c29497582459e3551edc32afd714b59494f26ae.zip
tk-3c29497582459e3551edc32afd714b59494f26ae.tar.gz
tk-3c29497582459e3551edc32afd714b59494f26ae.tar.bz2
Fixed bug [3102228] - <<ListboxSelect>> doesn't fire when selection lost
Diffstat (limited to 'generic/tkListbox.c')
-rw-r--r--generic/tkListbox.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/generic/tkListbox.c b/generic/tkListbox.c
index 248dd7b..ff72596 100644
--- a/generic/tkListbox.c
+++ b/generic/tkListbox.c
@@ -401,6 +401,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);
@@ -3177,12 +3178,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