gtk: fix problems with on-focus' and
on-activate'
original commit: 29c7c28ba576051a62d9e28273fcd73052009a02
This commit is contained in:
parent
71c2b32f80
commit
1deb9d8815
|
@ -395,6 +395,21 @@
|
|||
(set! reported-activate on?)
|
||||
(on-activate on?)))))))
|
||||
|
||||
(define focus-here? #f)
|
||||
(define/override (on-focus? on?)
|
||||
(on-focus-child on?)
|
||||
(cond
|
||||
[on?
|
||||
(if (ptr-equal? (gtk_window_get_focus gtk) gtk)
|
||||
(begin
|
||||
(set! focus-here? #t)
|
||||
(super on-focus? on?))
|
||||
#f)]
|
||||
[focus-here?
|
||||
(set! focus-here? #f)
|
||||
(super on-focus? on?)]
|
||||
[else #f]))
|
||||
|
||||
(define/public (get-focus-window [even-if-not-active? #f])
|
||||
(let ([f-gtk (gtk_window_get_focus gtk)])
|
||||
(and f-gtk
|
||||
|
|
|
@ -93,6 +93,7 @@
|
|||
(gtk_widget_show client-gtk)
|
||||
|
||||
(connect-key-and-mouse gtk)
|
||||
(connect-focus gtk)
|
||||
|
||||
; With tabs to set client-width delta:
|
||||
(infer-client-delta #f #t)
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
(struct-out GdkEventConfigure)
|
||||
_GdkEventExpose _GdkEventExpose-pointer
|
||||
(struct-out GdkEventExpose)
|
||||
_GdkEventFocus _GdkEventFocus-pointer
|
||||
(struct-out GdkEventFocus)
|
||||
_GdkEventSelection _GdkEventSelection-pointer
|
||||
(struct-out GdkEventSelection)
|
||||
_GdkRectangle _GdkRectangle-pointer
|
||||
|
@ -151,6 +153,11 @@
|
|||
[region _pointer]
|
||||
[count _int]))
|
||||
|
||||
(define-cstruct _GdkEventFocus ([type _GdkEventType]
|
||||
[window _GdkWindow]
|
||||
[send_event _byte]
|
||||
[in _short]))
|
||||
|
||||
(define-cstruct _GdkColor ([pixel _uint32]
|
||||
[red _uint16]
|
||||
[green _uint16]
|
||||
|
|
|
@ -76,8 +76,6 @@
|
|||
[width _int]
|
||||
[height _int]))
|
||||
|
||||
(define _GdkEventFocus-pointer _pointer)
|
||||
|
||||
(define-gtk gtk_widget_size_request (_fun _GtkWidget _GtkRequisition-pointer -> _void))
|
||||
(define-gtk gtk_widget_size_allocate (_fun _GtkWidget _GtkAllocation-pointer -> _void))
|
||||
(define-gtk gtk_widget_set_size_request (_fun _GtkWidget _int _int -> _void))
|
||||
|
@ -145,10 +143,10 @@
|
|||
(_fun _GtkWidget _GdkEventFocus-pointer -> _gboolean)
|
||||
(lambda (gtk event)
|
||||
(let ([wx (gtk->wx gtk)])
|
||||
(when wx
|
||||
(when wx
|
||||
(send wx focus-change #t)
|
||||
(send (send wx get-top-win) on-focus-child #t)
|
||||
(queue-window-event wx (lambda () (send wx on-set-focus))))
|
||||
(when (send wx on-focus? #t)
|
||||
(queue-window-event wx (lambda () (send wx on-set-focus)))))
|
||||
#f)))
|
||||
(define-signal-handler connect-focus-out "focus-out-event"
|
||||
(_fun _GtkWidget _GdkEventFocus-pointer -> _gboolean)
|
||||
|
@ -156,8 +154,8 @@
|
|||
(let ([wx (gtk->wx gtk)])
|
||||
(when wx
|
||||
(send wx focus-change #f)
|
||||
(send (send wx get-top-win) on-focus-child #f)
|
||||
(queue-window-event wx (lambda () (send wx on-kill-focus))))
|
||||
(when (send wx on-focus? #f)
|
||||
(queue-window-event wx (lambda () (send wx on-kill-focus)))))
|
||||
#f)))
|
||||
(define (connect-focus gtk)
|
||||
(connect-focus-in gtk)
|
||||
|
@ -619,6 +617,8 @@
|
|||
(define/public (focus-change on?) (void))
|
||||
(define/public (filter-key-event e) 'none)
|
||||
|
||||
(define/public (on-focus? on?) #t)
|
||||
|
||||
(define/private (pre-event-refresh)
|
||||
;; Since we break the connection between the
|
||||
;; Gtk queue and event handling, we
|
||||
|
|
Loading…
Reference in New Issue
Block a user