fix transparent canvases on GTK+ 3
For GTK+ 2, we used `gdk_window_ensure_native` to make sure that freeze and thaw work. For GTK+ 3, `gdk_window_ensure_native` seems not to be needed and prevents a canvas from drawing over its background.
This commit is contained in:
parent
6184a0d5c9
commit
8ee481840c
|
@ -209,11 +209,6 @@
|
||||||
(not (send wx is-panel?)))
|
(not (send wx is-panel?)))
|
||||||
#f))))
|
#f))))
|
||||||
|
|
||||||
(define-gdk gdk_window_get_background_pattern (_fun _GdkWindow -> (_or-null _cairo_pattern_t))
|
|
||||||
#:make-fail make-not-available)
|
|
||||||
(define-gdk gdk_window_get_effective_parent (_fun _GdkWindow -> _GdkWindow)
|
|
||||||
#:make-fail make-not-available)
|
|
||||||
|
|
||||||
(define-signal-handler connect-draw "draw"
|
(define-signal-handler connect-draw "draw"
|
||||||
(_fun _GtkWidget _cairo_t -> _gboolean)
|
(_fun _GtkWidget _cairo_t -> _gboolean)
|
||||||
(lambda (gtk cr)
|
(lambda (gtk cr)
|
||||||
|
@ -221,13 +216,6 @@
|
||||||
(if wx
|
(if wx
|
||||||
(let ([col (send wx get-canvas-background-for-backing)]
|
(let ([col (send wx get-canvas-background-for-backing)]
|
||||||
[win (widget-window gtk)])
|
[win (widget-window gtk)])
|
||||||
(when (and win (not col))
|
|
||||||
;; Before transparent drawing, we need to install the
|
|
||||||
;; parent window's pattern.
|
|
||||||
(cairo_set_source cr (gdk_window_get_background_pattern
|
|
||||||
(gdk_window_get_effective_parent win)))
|
|
||||||
(cairo_rectangle cr 0 0 32000 32000)
|
|
||||||
(cairo_fill cr))
|
|
||||||
(unless (send wx paint-or-queue-paint cr)
|
(unless (send wx paint-or-queue-paint cr)
|
||||||
(when col
|
(when col
|
||||||
(cairo_set_source_rgb cr
|
(cairo_set_source_rgb cr
|
||||||
|
|
|
@ -129,7 +129,7 @@
|
||||||
(lambda (gtk)
|
(lambda (gtk)
|
||||||
(GtkWidgetT-window (cast gtk _GtkWidget _GtkWidgetT-pointer)))))
|
(GtkWidgetT-window (cast gtk _GtkWidget _GtkWidgetT-pointer)))))
|
||||||
|
|
||||||
(define-gtk widget-parent (_fun _GtkWidget -> _GdkWindow)
|
(define-gtk widget-parent (_fun _GtkWidget -> _GtkWidget)
|
||||||
#:c-id gtk_widget_get_parent
|
#:c-id gtk_widget_get_parent
|
||||||
#:fail (lambda ()
|
#:fail (lambda ()
|
||||||
(lambda (gtk)
|
(lambda (gtk)
|
||||||
|
@ -864,11 +864,12 @@
|
||||||
(lambda (win-box)
|
(lambda (win-box)
|
||||||
(let ([win (mcar win-box)])
|
(let ([win (mcar win-box)])
|
||||||
(and win
|
(and win
|
||||||
;; The freeze/thaw state is actually with the window's
|
(unless gtk3?
|
||||||
;; implementation, so force a native implementation of the
|
;; The freeze/thaw state is actually with the window's
|
||||||
;; window to try to avoid it changing out from underneath
|
;; implementation, so force a native implementation of the
|
||||||
;; us between the freeze and thaw actions.
|
;; window to try to avoid it changing out from underneath
|
||||||
(gdk_window_ensure_native win)
|
;; us between the freeze and thaw actions.
|
||||||
|
(gdk_window_ensure_native win))
|
||||||
(begin
|
(begin
|
||||||
(gdk_window_freeze_updates win)
|
(gdk_window_freeze_updates win)
|
||||||
(set-mcdr! win-box (add1 (mcdr win-box)))
|
(set-mcdr! win-box (add1 (mcdr win-box)))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user