From: Matt Birkholz Date: Sat, 30 Apr 2016 05:48:28 +0000 (-0700) Subject: gtk: Use gtk_widget_register_window; not gdk_window_set_user_data. X-Git-Tag: mit-scheme-pucked-9.2.12~330 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=78fc0a3580e8d5cd110b77628883beeba3b20ac5;p=mit-scheme.git gtk: Use gtk_widget_register_window; not gdk_window_set_user_data. --- diff --git a/src/gtk/Includes/gtkwidget.cdecl b/src/gtk/Includes/gtkwidget.cdecl index 604d623ef..a551118e1 100644 --- a/src/gtk/Includes/gtkwidget.cdecl +++ b/src/gtk/Includes/gtkwidget.cdecl @@ -80,6 +80,10 @@ gtk/gtkwidget.h |# (extern gboolean gtk_widget_get_realized (widget (* GtkWidget))) +#;(extern void gtk_widget_set_app_paintable + (widget (* GtkWidget)) + (app_paintable gboolean)) + (extern (* GdkWindow) gtk_widget_get_parent_window (widget (* GtkWidget))) @@ -87,6 +91,11 @@ gtk/gtkwidget.h |# (widget (* GtkWidget)) (window (* GdkWindow))) +;;GDK_AVAILABLE_IN_3_8 +(extern void gtk_widget_register_window + (widget (* GtkWidget)) + (window (* GdkWindow))) + (extern void gtk_widget_get_allocation (widget (* GtkWidget)) (allocation (* GtkAllocation))) @@ -118,6 +127,14 @@ gtk/gtkwidget.h |# (widget (* GtkWidget)) (expand gboolean)) +(extern void gtk_widget_set_events + (widget (* GtkWidget)) + (events gint)) + +#;(extern void gtk_widget_add_events + (widget (* GtkWidget)) + (events gint)) + (extern gint gtk_widget_get_events (widget (* GtkWidget))) diff --git a/src/gtk/fix-layout.scm b/src/gtk/fix-layout.scm index e3babca5b..ceb8748fc 100644 --- a/src/gtk/fix-layout.scm +++ b/src/gtk/fix-layout.scm @@ -42,7 +42,7 @@ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. (geometry define accessor initializer (lambda () (make-fix-rect))) (event-handlers define accessor initializer - (lambda () (make-vector (C-enum "GDK_DAMAGE") #f)))) + (lambda () (make-vector (C-enum "GDK_EVENT_LAST") #f)))) (define-guarantee fix-widget "a ") @@ -58,7 +58,10 @@ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. (set-fix-widget-%background-color! widget bg) ;; Init. size, for a realize signal arriving before an allocation. (set-fix-rect-size! (fix-widget-geometry widget) width height) - (C-call "gtk_widget_set_has_window" (gobject-alien widget) 1) + (let ((gtkwidget (gobject-alien widget))) + (C-call "gtk_widget_set_has_window" gtkwidget 1) + ;;(C-call "gtk_widget_set_app_paintable" gtkwidget 1) + (C-call "gtk_widget_set_events" gtkwidget event-mask)) (set-gtk-widget-realize-callback! widget fix-widget-realize-callback) (set-gtk-widget-unrealize-callback! widget fix-widget-unrealize-callback) @@ -86,7 +89,7 @@ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. (if y (C->= attr "GdkWindowAttr y" y)) (C->= attr "GdkWindowAttr width" width) (C->= attr "GdkWindowAttr height" height) - (C->= attr "GdkWindowAttr event_mask" (C-enum "GDK_ALL_EVENTS_MASK")) + (C->= attr "GdkWindowAttr event_mask" event-mask) (C-call "gtk_widget_get_parent_window" parent-GdkWindow GtkWidget) (error-if-null parent-GdkWindow "Could not get parent:" widget) @@ -97,9 +100,27 @@ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. (free attr) (error-if-null main-GdkWindow "Could not create main window:" widget) (C-call "gtk_widget_set_window" GtkWidget main-GdkWindow) - (C-call "gdk_window_set_user_data" main-GdkWindow GtkWidget) + (C-call "gtk_widget_register_window" GtkWidget main-GdkWindow) + ;; gtk_widget_unregister_window (as well as gdk_window_destroy) + ;; are called by the default unrealize method. (%trace "; window: "main-GdkWindow"\n")))) +(define event-mask + (bit-ior + ;; GDK_MAP + ;; GDK_UNMAP + (C-enum "GDK_ENTER_NOTIFY_MASK") + (C-enum "GDK_LEAVE_NOTIFY_MASK") + (C-enum "GDK_FOCUS_CHANGE_MASK") + (C-enum "GDK_VISIBILITY_NOTIFY_MASK") + (C-enum "GDK_KEY_PRESS_MASK") + (C-enum "GDK_POINTER_MOTION_MASK") + (C-enum "GDK_BUTTON_PRESS_MASK") + (C-enum "GDK_BUTTON_RELEASE_MASK") + ;; GDK_2BUTTON_PRESS + ;; GDK_3BUTTON_PRESS + )) + (define-generic fix-widget-unrealize-callback (widget)) (define-method fix-widget-unrealize-callback ((widget )) @@ -170,9 +191,8 @@ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. (let ((type (C-> GdkEvent "GdkEvent any type"))) (%trace2 " "(C-enum "GdkEventType" type)"\n") (let ((handler (vector-ref (fix-widget-event-handlers widget) type))) - (if handler - (handler widget GdkEvent) - #f)))) + (and handler + (handler widget GdkEvent))))) (define (set-fix-widget-map-handler! widget handler) (guarantee-fix-widget widget 'set-fix-widget-map-handler!)