From: Matt Birkholz Date: Wed, 18 Jan 2017 19:48:51 +0000 (-0700) Subject: gtk: Remove map and unmap event handling. X-Git-Tag: mit-scheme-pucked-9.2.12~242 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=2b3f6f71b0f0a02f24e1d2c3201869c0f5411807;p=mit-scheme.git gtk: Remove map and unmap event handling. When gtk_widget_register_window (and gtk_widget_set_event) became necessary there was no GDK_MAP_MASK nor GDK_UNMAP_MASK. Presumably set-fix-widget-map-handler! and set-fix-widget-unmap-handler! stopped working at that time. This makes it official. --- diff --git a/src/gtk-screen/gtk-screen.pkg b/src/gtk-screen/gtk-screen.pkg index b15940e30..8fa01ef7e 100644 --- a/src/gtk-screen/gtk-screen.pkg +++ b/src/gtk-screen/gtk-screen.pkg @@ -159,8 +159,6 @@ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. fix-widget? fix-widget-new-geometry-callback fix-widget-realize-callback - set-fix-widget-map-handler! - set-fix-widget-unmap-handler! set-fix-widget-enter-notify-handler! set-fix-widget-leave-notify-handler! set-fix-widget-focus-change-handler! diff --git a/src/gtk-screen/gtk-screen.scm b/src/gtk-screen/gtk-screen.scm index f72e7c441..c0aee12c6 100644 --- a/src/gtk-screen/gtk-screen.scm +++ b/src/gtk-screen/gtk-screen.scm @@ -704,18 +704,6 @@ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. (%trace ";with-gtk-interrupts-disabled => "v"\n") v))) -(define (map-handler widget) - (%trace "; Mapped: "widget"\n") - (if (and (text-widget? widget) - (not (text-widget-modeline widget))) - (%trace "; grab-focus "widget"\n") - (gtk-widget-grab-focus widget)) - #f) - -(define (unmap-handler widget) - (%trace "; Unmapped: "widget"\n") - #f) - (define (focus-change-handler widget in?) (%trace "; Focus-"(if in? "in" "out")": "widget"\n") (let ((screen (edwin-widget-screen widget))) @@ -1145,8 +1133,6 @@ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. (fix-rect-height extent)))) (set-text-widget-override-drawing! widget drawing) (set-fix-layout-drawing! widget drawing 0 0)) - (set-fix-widget-map-handler! widget map-handler) - (set-fix-widget-unmap-handler! widget unmap-handler) (set-fix-widget-focus-change-handler! widget focus-change-handler) (set-fix-widget-visibility-notify-handler! widget visibility-notify-handler) (set-fix-widget-key-press-handler! widget key-press-handler) @@ -1183,6 +1169,10 @@ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. (%widget-x-size window screen) (%widget-y-size window screen)) (%trace "; initialized geometry: "geometry"\n")))) + ;; The typein widget is undisturbed by window changes, so grab-focus + ;; once here. + (if (not (text-widget-modeline widget)) + (gtk-widget-grab-focus widget)) (call-next-method widget)) (define-method fix-widget-new-geometry-callback ((widget )) @@ -1348,8 +1338,6 @@ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. (let ((drawing (make-fix-drawing))) ;;; (%trace "; drawing: "drawing"\n") (set-fix-layout-drawing! widget drawing 0 0)) - (set-fix-widget-map-handler! widget map-handler) - (set-fix-widget-unmap-handler! widget unmap-handler) (set-fix-widget-focus-change-handler! widget focus-change-handler) (set-fix-widget-visibility-notify-handler! widget visibility-notify-handler) (set-fix-widget-key-press-handler! widget key-press-handler) diff --git a/src/gtk/fix-layout.scm b/src/gtk/fix-layout.scm index b5bae9a4a..e21f6f74f 100644 --- a/src/gtk/fix-layout.scm +++ b/src/gtk/fix-layout.scm @@ -107,8 +107,6 @@ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. (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") @@ -116,10 +114,7 @@ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. (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 - )) + (C-enum "GDK_BUTTON_RELEASE_MASK"))) (define-generic fix-widget-unrealize-callback (widget)) @@ -194,24 +189,6 @@ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. (and handler (handler widget GdkEvent))))) -(define (set-fix-widget-map-handler! widget handler) - (guarantee-fix-widget widget 'set-fix-widget-map-handler!) - (guarantee-procedure-of-arity handler 1 'set-fix-widget-map-handler!) - (vector-set! - (fix-widget-event-handlers widget) (C-enum "GDK_MAP") - (named-lambda (fix-widget-map-handler widget GdkEvent) - (declare (ignore GdkEvent)) - (handler widget)))) - -(define (set-fix-widget-unmap-handler! widget handler) - (guarantee-fix-widget widget 'set-fix-widget-unmap-handler!) - (guarantee-procedure-of-arity handler 1 'set-fix-widget-unmap-handler!) - (vector-set! - (fix-widget-event-handlers widget) (C-enum "GDK_UNMAP") - (named-lambda (fix-widget-unmap-handler widget GdkEvent) - (declare (ignore GdkEvent)) - (handler widget)))) - (define (set-fix-widget-enter-notify-handler! widget handler) (guarantee-fix-widget widget 'set-fix-widget-enter-notify-handler!) (guarantee-procedure-of-arity handler 1 'set-fix-widget-enter-notify-handler!) diff --git a/src/gtk/gtk.pkg b/src/gtk/gtk.pkg index 1cf24f218..da1fa51c8 100644 --- a/src/gtk/gtk.pkg +++ b/src/gtk/gtk.pkg @@ -189,8 +189,6 @@ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. fix-widget-realize-callback fix-widget-unrealize-callback set-fix-widget-pointer-shape! - set-fix-widget-map-handler! - set-fix-widget-unmap-handler! set-fix-widget-enter-notify-handler! set-fix-widget-leave-notify-handler! set-fix-widget-focus-change-handler! diff --git a/src/gtk/mit-scheme-pucked-gtk.texi b/src/gtk/mit-scheme-pucked-gtk.texi index 53f173dfc..bd70db94b 100644 --- a/src/gtk/mit-scheme-pucked-gtk.texi +++ b/src/gtk/mit-scheme-pucked-gtk.texi @@ -523,14 +523,14 @@ it cannot be GCed. @end deffn @deffn Procedure gtk-widget-drawable? widget -@code{#t} if @var{widget} can be drawn, i.e. it is mapped and visible. +@code{#t} if @var{widget} can be drawn, i.e. it is realized and visible. @end deffn @deffn Procedure gtk-widget-grab-focus widget Causes @var{widget} to have the keyboard focus for the GtkWindow it's inside. @var{Widget} must be a focusable widget, such as a GtkEntry; something like a GtkFrame will not work. The widget also needs to be -realized and mapped. Grabbing the focus immediately after creating +realized. Grabbing the focus immediately after creating the widget will likely fail and cause critical warnings. @end deffn @@ -559,7 +559,7 @@ all widgets in a container, it is easier to call @bref{gtk-widget-show-all} on the container. Note that the containers containing @var{widget} must also be ``shown'' else @var{widget} cannot be displayed. When a toplevel container is shown, it is -immediately realized and mapped, as well as any descendents that are +immediately realized, as well as any descendents that are ``showing''. @end deffn @@ -855,7 +855,7 @@ will not resize @var{window}. By setting the type hint for @var{window}, you allow the window manager to decorate and handle the window in a way which is suitable to the function of the window in your application. This function -should be called before mapping @var{window}. @var{Hint} can be one +should be called before realizing @var{window}. @var{Hint} can be one of the symbols in the following table. See the Extended Window Manager Hints specification at @uref{http://www.freedesktop.org/Standards/wm-spec} for more details @@ -1430,18 +1430,6 @@ This procedure is called when @var{widget} is resized. This procedure is called when @var{widget} is being realized. @end deffn -@deffn Procedure set-fix-widget-map-handler! widget handler -Arranges to apply @var{handler} to @var{widget} when it is mapped. -@var{handler} must return @code{#t} or @code{#f}. -@xref{event-handler-note}. -@end deffn - -@deffn Procedure set-fix-widget-unmap-handler! widget handler -Arranges to apply @var{handler} to @var{widget} when it is unmapped. -@var{handler} must return @code{#t} or @code{#f}. -@xref{event-handler-note}. -@end deffn - @deffn Procedure set-fix-widget-enter-notify-handler! widget handler Arranges to apply @var{handler} to @var{widget} when the pointer enters.