;; GdkColor structs with .pixels courtesy of gdk_rgb_find_color.
;; This is oblivious to GtkStyle settings, e.g. set with
;; set-gtk-widget-bg-color!. It may (re)allocate a previously set
- ;; background color (but just once).
+ ;; background color (but just once). Upon destruction, these are
+ ;; just freed -- no GdkColor de-allocating required.
(colors define standard initial-value '())
;; Our window geometry (allocation) -- a rectangular extent in
(call-next-method widget)
(%trace "; (initialize-instance <fix-widget>) "widget" "width" "height"\n")
+
+ (let ((alien (gobject-alien widget)))
+ (let ((w (->requisition-fixnum width))
+ (h (->requisition-fixnum height)))
+ (C-call "gtk_widget_set_size_request" alien w h))
+ (C-call "gtk_widget_set_has_window" alien 1)) ; WILL have when realized
+
(set-gtk-object-destroy-callback! widget)
(set-gtk-widget-realize-callback! widget fix-widget-realize-callback)
(set-gtk-widget-size-allocate-callback! widget fix-widget-allocate-callback))
+(define-method gtk-object-destroy-callback ((widget <fix-widget>))
+ (call-next-method widget)
+ (for-each (lambda (spec.gdkcolor) (free (cdr spec.gdkcolor)))
+ (fix-widget-colors widget)))
+
(define-generic fix-widget-realize-callback (widget))
(define-method fix-widget-realize-callback ((widget <fix-widget>))
(set-fix-rect! (fix-widget-geometry widget) #f #f width height)
(%trace "; window: "main-GdkWindow"\n"))
- (let ((GtkStyle (C-> GtkWidget "GtkWidget style")))
- (C-call "gtk_style_attach" GtkStyle GtkStyle main-GdkWindow)
- (C->= GtkWidget "GtkWidget style" GtkStyle))
+ (let ((alien (C-> GtkWidget "GtkWidget style")))
+ (C-call "gtk_style_attach" alien alien main-GdkWindow)
+ (C-> GtkWidget "GtkWidget style" alien)
+ (C-> alien "GtkStyle bg" alien)
+ (C-array-loc! alien "GdkColor" (C-enum "GTK_STATE_NORMAL"))
+ (C-call "gdk_window_set_background" main-GdkWindow alien))
unspecific))