From 6ceea7e635d92c72d5fed344bd88f66ed6da6142 Mon Sep 17 00:00:00 2001 From: Arturo Espinosa Date: Fri, 26 Dec 1997 08:54:12 +0000 Subject: [PATCH] Added new GDK_NO_EXPOSE and GDK_VISIBILITY_NOTIFY events. They are needed for the TV widget by Alan Cox and by the GtkXmHTML widget. Only missing with respect to their Xlib counterparts are the major_code and minor_code fields in the GdkEventNoExpose structure. Does anyone need them for their code? - Federico --- gdk/gdk.c | 25 +++++++++- gdk/gdktypes.h | 105 +++++++++++++++++++++++++--------------- gdk/gdkwindow.c | 7 +-- gdk/x11/gdkmain-x11.c | 25 +++++++++- gdk/x11/gdkwindow-x11.c | 7 +-- 5 files changed, 121 insertions(+), 48 deletions(-) diff --git a/gdk/gdk.c b/gdk/gdk.c index bc512772f5..513aa4a4d9 100644 --- a/gdk/gdk.c +++ b/gdk/gdk.c @@ -2285,7 +2285,10 @@ gdk_event_translate (GdkEvent *event, g_print ("no expose:\t\tdrawable: %ld\n", xevent->xnoexpose.drawable - base_id); - /* Not currently handled */ + event->no_expose.type = GDK_NO_EXPOSE; + event->no_expose.window = window; + + return_val = window_private && !window_private->destroyed; break; case VisibilityNotify: @@ -2308,7 +2311,25 @@ gdk_event_translate (GdkEvent *event, break; } - /* Not currently handled */ + event->visibility.type = GDK_VISIBILITY_NOTIFY; + event->visibility.window = window; + + switch (xevent->xvisibility.state) + { + case VisibilityFullyObscured: + event->visibility.state = GDK_VISIBILITY_FULLY_OBSCURED; + break; + + case VisibilityPartiallyObscured: + event->visibility.state = GDK_VISIBILITY_PARTIAL; + break; + + case VisibilityUnobscured: + event->visibility.state = GDK_VISIBILITY_UNOBSCURED; + break; + } + + return_val = window_private && !window_private->destroyed; break; case CreateNotify: diff --git a/gdk/gdktypes.h b/gdk/gdktypes.h index 680cd16bbc..a4ebe6501e 100644 --- a/gdk/gdktypes.h +++ b/gdk/gdktypes.h @@ -60,28 +60,30 @@ typedef struct _GdkCursor GdkCursor; typedef struct _GdkColorContextDither GdkColorContextDither; typedef struct _GdkColorContext GdkColorContext; -typedef struct _GdkEventAny GdkEventAny; -typedef struct _GdkEventExpose GdkEventExpose; -typedef struct _GdkEventMotion GdkEventMotion; -typedef struct _GdkEventButton GdkEventButton; -typedef struct _GdkEventKey GdkEventKey; -typedef struct _GdkEventFocus GdkEventFocus; -typedef struct _GdkEventCrossing GdkEventCrossing; -typedef struct _GdkEventConfigure GdkEventConfigure; -typedef struct _GdkEventProperty GdkEventProperty; -typedef struct _GdkEventSelection GdkEventSelection; -typedef struct _GdkEventProximity GdkEventProximity; -typedef struct _GdkEventOther GdkEventOther; -typedef struct _GdkEventDragBegin GdkEventDragBegin; +typedef struct _GdkEventAny GdkEventAny; +typedef struct _GdkEventExpose GdkEventExpose; +typedef struct _GdkEventNoExpose GdkEventNoExpose; +typedef struct _GdkEventVisibility GdkEventVisibility; +typedef struct _GdkEventMotion GdkEventMotion; +typedef struct _GdkEventButton GdkEventButton; +typedef struct _GdkEventKey GdkEventKey; +typedef struct _GdkEventFocus GdkEventFocus; +typedef struct _GdkEventCrossing GdkEventCrossing; +typedef struct _GdkEventConfigure GdkEventConfigure; +typedef struct _GdkEventProperty GdkEventProperty; +typedef struct _GdkEventSelection GdkEventSelection; +typedef struct _GdkEventProximity GdkEventProximity; +typedef struct _GdkEventOther GdkEventOther; +typedef struct _GdkEventDragBegin GdkEventDragBegin; typedef struct _GdkEventDragRequest GdkEventDragRequest; -typedef struct _GdkEventDropEnter GdkEventDropEnter; +typedef struct _GdkEventDropEnter GdkEventDropEnter; typedef struct _GdkEventDropDataAvailable GdkEventDropDataAvailable; -typedef struct _GdkEventDropLeave GdkEventDropLeave; -typedef struct _GdkEventClient GdkEventClient; -typedef union _GdkEvent GdkEvent; -typedef struct _GdkDeviceKey GdkDeviceKey; -typedef struct _GdkDeviceInfo GdkDeviceInfo; -typedef struct _GdkTimeCoord GdkTimeCoord; +typedef struct _GdkEventDropLeave GdkEventDropLeave; +typedef struct _GdkEventClient GdkEventClient; +typedef union _GdkEvent GdkEvent; +typedef struct _GdkDeviceKey GdkDeviceKey; +typedef struct _GdkDeviceInfo GdkDeviceInfo; +typedef struct _GdkTimeCoord GdkTimeCoord; typedef gint (*GdkEventFunc) (GdkEvent *event, gpointer data); @@ -286,12 +288,20 @@ typedef enum { GDK_FILTER_REMOVE /* Terminate processing, removing event */ } GdkFilterReturn; +typedef enum { + GDK_VISIBILITY_UNOBSCURED, + GDK_VISIBILITY_PARTIAL, + GDK_VISIBILITY_FULLY_OBSCURED +} GdkVisibilityState; + /* Event types. * Nothing: No event occurred. * Delete: A window delete event was sent by the window manager. * The specified window should be deleted. * Destroy: A window has been destroyed. * Expose: Part of a window has been uncovered. + * NoExpose: Same as expose, but no expose event was generated. + * VisibilityNotify: A window has become fully/partially/not obscured. * MotionNotify: The mouse has moved. * ButtonPress: A mouse button was pressed. * ButtonRelease: A mouse button was release. @@ -337,6 +347,8 @@ typedef enum GDK_DROP_LEAVE = 25, GDK_DROP_DATA_AVAIL = 26, GDK_CLIENT_EVENT = 27, + GDK_VISIBILITY_NOTIFY = 28, + GDK_NO_EXPOSE = 29, GDK_OTHER_EVENT = 9999 } GdkEventType; @@ -363,6 +375,7 @@ typedef enum GDK_PROPERTY_CHANGE_MASK = 1 << 16, GDK_PROXIMITY_IN_MASK = 1 << 17, GDK_PROXIMITY_OUT_MASK = 1 << 18, + GDK_VISIBILITY_NOTIFY_MASK = 1 << 19, GDK_ALL_EVENTS_MASK = 0x07FFFF } GdkEventMask; @@ -860,6 +873,20 @@ struct _GdkEventExpose gint count; /* If non-zero, how many more events follow. */ }; +struct _GdkEventNoExpose +{ + GdkEventType type; + GdkWindow *window; + /* XXX: does anyone need the X major_code or minor_code fields? */ +}; + +struct _GdkEventVisibility +{ + GdkEventType type; + GdkWindow *window; + GdkVisibilityState state; +}; + struct _GdkEventMotion { GdkEventType type; @@ -1069,25 +1096,27 @@ struct _GdkEventOther union _GdkEvent { - GdkEventType type; - GdkEventAny any; - GdkEventExpose expose; - GdkEventMotion motion; - GdkEventButton button; - GdkEventKey key; - GdkEventCrossing crossing; - GdkEventFocus focus_change; - GdkEventConfigure configure; - GdkEventProperty property; - GdkEventSelection selection; - GdkEventProximity proximity; - GdkEventDragBegin dragbegin; - GdkEventDragRequest dragrequest; - GdkEventDropEnter dropenter; - GdkEventDropLeave dropleave; + GdkEventType type; + GdkEventAny any; + GdkEventExpose expose; + GdkEventNoExpose no_expose; + GdkEventVisibility visibility; + GdkEventMotion motion; + GdkEventButton button; + GdkEventKey key; + GdkEventCrossing crossing; + GdkEventFocus focus_change; + GdkEventConfigure configure; + GdkEventProperty property; + GdkEventSelection selection; + GdkEventProximity proximity; + GdkEventDragBegin dragbegin; + GdkEventDragRequest dragrequest; + GdkEventDropEnter dropenter; + GdkEventDropLeave dropleave; GdkEventDropDataAvailable dropdataavailable; - GdkEventClient client; - GdkEventOther other; + GdkEventClient client; + GdkEventOther other; }; diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index 240be850ca..dbf4de1f7d 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -27,8 +27,8 @@ #include #include -int nevent_masks = 16; -int event_mask_table[18] = +int nevent_masks = 17; +int event_mask_table[19] = { ExposureMask, PointerMotionMask, @@ -47,7 +47,8 @@ int event_mask_table[18] = StructureNotifyMask, PropertyChangeMask, 0, /* PROXIMITY_IN */ - 0 /* PROXIMTY_OUT */ + 0, /* PROXIMTY_OUT */ + VisibilityChangeMask }; diff --git a/gdk/x11/gdkmain-x11.c b/gdk/x11/gdkmain-x11.c index bc512772f5..513aa4a4d9 100644 --- a/gdk/x11/gdkmain-x11.c +++ b/gdk/x11/gdkmain-x11.c @@ -2285,7 +2285,10 @@ gdk_event_translate (GdkEvent *event, g_print ("no expose:\t\tdrawable: %ld\n", xevent->xnoexpose.drawable - base_id); - /* Not currently handled */ + event->no_expose.type = GDK_NO_EXPOSE; + event->no_expose.window = window; + + return_val = window_private && !window_private->destroyed; break; case VisibilityNotify: @@ -2308,7 +2311,25 @@ gdk_event_translate (GdkEvent *event, break; } - /* Not currently handled */ + event->visibility.type = GDK_VISIBILITY_NOTIFY; + event->visibility.window = window; + + switch (xevent->xvisibility.state) + { + case VisibilityFullyObscured: + event->visibility.state = GDK_VISIBILITY_FULLY_OBSCURED; + break; + + case VisibilityPartiallyObscured: + event->visibility.state = GDK_VISIBILITY_PARTIAL; + break; + + case VisibilityUnobscured: + event->visibility.state = GDK_VISIBILITY_UNOBSCURED; + break; + } + + return_val = window_private && !window_private->destroyed; break; case CreateNotify: diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c index 240be850ca..dbf4de1f7d 100644 --- a/gdk/x11/gdkwindow-x11.c +++ b/gdk/x11/gdkwindow-x11.c @@ -27,8 +27,8 @@ #include #include -int nevent_masks = 16; -int event_mask_table[18] = +int nevent_masks = 17; +int event_mask_table[19] = { ExposureMask, PointerMotionMask, @@ -47,7 +47,8 @@ int event_mask_table[18] = StructureNotifyMask, PropertyChangeMask, 0, /* PROXIMITY_IN */ - 0 /* PROXIMTY_OUT */ + 0, /* PROXIMTY_OUT */ + VisibilityChangeMask };