(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)))
(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)))
(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)))
(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 <fix-widget>")
(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)
(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)
(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 <fix-widget>))
(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!)