Mercurial > dwindows
comparison gtk4/dw.c @ 2308:a9018bd91d04
GTK4: Fix DW_SIGNAL_ITEM_ENTER callbacks via the keyboard. Remove mouse
warning... however the mouse isn't working so might need a second callback.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 10 Feb 2021 09:04:55 +0000 |
parents | 558959a64772 |
children | e238178186ff |
comparison
equal
deleted
inserted
replaced
2307:46e60dca8285 | 2308:a9018bd91d04 |
---|---|
43 # define __func__ "<unknown>" | 43 # define __func__ "<unknown>" |
44 # endif | 44 # endif |
45 #endif | 45 #endif |
46 | 46 |
47 /* Macros to encapsulate running functions on the main thread | 47 /* Macros to encapsulate running functions on the main thread |
48 * #define _DW_SINGLE_THREADED to disable thread safety encapulation. | 48 * #define _DW_SINGLE_THREADED to disable thread safety encapsulation. |
49 * Parameters converted to a pointer array: | 49 * Parameters converted to a pointer array: |
50 * [0] Pointer to the thread's event semaphore | 50 * [0] Pointer to the thread's event semaphore |
51 * [1] Pointer to the funtion's return value | 51 * [1] Pointer to the funtion's return value |
52 * [2] Pointer to function parameter 1 | 52 * [2] Pointer to function parameter 1 |
53 * ... | 53 * ... |
1074 SignalHandler work = _dw_get_signal_handler(data); | 1074 SignalHandler work = _dw_get_signal_handler(data); |
1075 int retval = FALSE; | 1075 int retval = FALSE; |
1076 | 1076 |
1077 if(work.window && GTK_IS_WIDGET(work.window)) | 1077 if(work.window && GTK_IS_WIDGET(work.window)) |
1078 { | 1078 { |
1079 GtkWidget *widget = work.window; | 1079 GtkWidget *widget = GTK_WIDGET(g_object_get_data(G_OBJECT(work.window), "_dw_user")); |
1080 GdkEvent *event = gtk_event_controller_get_current_event(GTK_EVENT_CONTROLLER(controller)); | 1080 GdkEvent *event = gtk_event_controller_get_current_event(GTK_EVENT_CONTROLLER(controller)); |
1081 GdkEventType type = gdk_event_get_event_type(event); | 1081 GdkEventType type = gdk_event_get_event_type(event); |
1082 gint button = gdk_button_event_get_button(event); | 1082 gint button = (type == GDK_BUTTON_PRESS) ? gdk_button_event_get_button(event) : -1; |
1083 | |
1083 | 1084 |
1084 /* TODO: Make sure this works. | 1085 /* TODO: Make sure this works. |
1085 Handle both key and button events together */ | 1086 Handle both key and button events together */ |
1086 if((type == GDK_BUTTON_PRESS && button == 1) || keyval == VK_RETURN) | 1087 if((type == GDK_BUTTON_PRESS && button == 1) || keyval == VK_RETURN) |
1087 { | 1088 { |