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
This commit is contained in:
Arturo Espinosa
1997-12-26 08:54:12 +00:00
parent ed11431bdb
commit 6ceea7e635
5 changed files with 121 additions and 48 deletions

View File

@ -2285,7 +2285,10 @@ gdk_event_translate (GdkEvent *event,
g_print ("no expose:\t\tdrawable: %ld\n", g_print ("no expose:\t\tdrawable: %ld\n",
xevent->xnoexpose.drawable - base_id); 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; break;
case VisibilityNotify: case VisibilityNotify:
@ -2308,7 +2311,25 @@ gdk_event_translate (GdkEvent *event,
break; 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; break;
case CreateNotify: case CreateNotify:

View File

@ -60,28 +60,30 @@ typedef struct _GdkCursor GdkCursor;
typedef struct _GdkColorContextDither GdkColorContextDither; typedef struct _GdkColorContextDither GdkColorContextDither;
typedef struct _GdkColorContext GdkColorContext; typedef struct _GdkColorContext GdkColorContext;
typedef struct _GdkEventAny GdkEventAny; typedef struct _GdkEventAny GdkEventAny;
typedef struct _GdkEventExpose GdkEventExpose; typedef struct _GdkEventExpose GdkEventExpose;
typedef struct _GdkEventMotion GdkEventMotion; typedef struct _GdkEventNoExpose GdkEventNoExpose;
typedef struct _GdkEventButton GdkEventButton; typedef struct _GdkEventVisibility GdkEventVisibility;
typedef struct _GdkEventKey GdkEventKey; typedef struct _GdkEventMotion GdkEventMotion;
typedef struct _GdkEventFocus GdkEventFocus; typedef struct _GdkEventButton GdkEventButton;
typedef struct _GdkEventCrossing GdkEventCrossing; typedef struct _GdkEventKey GdkEventKey;
typedef struct _GdkEventConfigure GdkEventConfigure; typedef struct _GdkEventFocus GdkEventFocus;
typedef struct _GdkEventProperty GdkEventProperty; typedef struct _GdkEventCrossing GdkEventCrossing;
typedef struct _GdkEventSelection GdkEventSelection; typedef struct _GdkEventConfigure GdkEventConfigure;
typedef struct _GdkEventProximity GdkEventProximity; typedef struct _GdkEventProperty GdkEventProperty;
typedef struct _GdkEventOther GdkEventOther; typedef struct _GdkEventSelection GdkEventSelection;
typedef struct _GdkEventDragBegin GdkEventDragBegin; typedef struct _GdkEventProximity GdkEventProximity;
typedef struct _GdkEventOther GdkEventOther;
typedef struct _GdkEventDragBegin GdkEventDragBegin;
typedef struct _GdkEventDragRequest GdkEventDragRequest; typedef struct _GdkEventDragRequest GdkEventDragRequest;
typedef struct _GdkEventDropEnter GdkEventDropEnter; typedef struct _GdkEventDropEnter GdkEventDropEnter;
typedef struct _GdkEventDropDataAvailable GdkEventDropDataAvailable; typedef struct _GdkEventDropDataAvailable GdkEventDropDataAvailable;
typedef struct _GdkEventDropLeave GdkEventDropLeave; typedef struct _GdkEventDropLeave GdkEventDropLeave;
typedef struct _GdkEventClient GdkEventClient; typedef struct _GdkEventClient GdkEventClient;
typedef union _GdkEvent GdkEvent; typedef union _GdkEvent GdkEvent;
typedef struct _GdkDeviceKey GdkDeviceKey; typedef struct _GdkDeviceKey GdkDeviceKey;
typedef struct _GdkDeviceInfo GdkDeviceInfo; typedef struct _GdkDeviceInfo GdkDeviceInfo;
typedef struct _GdkTimeCoord GdkTimeCoord; typedef struct _GdkTimeCoord GdkTimeCoord;
typedef gint (*GdkEventFunc) (GdkEvent *event, typedef gint (*GdkEventFunc) (GdkEvent *event,
gpointer data); gpointer data);
@ -286,12 +288,20 @@ typedef enum {
GDK_FILTER_REMOVE /* Terminate processing, removing event */ GDK_FILTER_REMOVE /* Terminate processing, removing event */
} GdkFilterReturn; } GdkFilterReturn;
typedef enum {
GDK_VISIBILITY_UNOBSCURED,
GDK_VISIBILITY_PARTIAL,
GDK_VISIBILITY_FULLY_OBSCURED
} GdkVisibilityState;
/* Event types. /* Event types.
* Nothing: No event occurred. * Nothing: No event occurred.
* Delete: A window delete event was sent by the window manager. * Delete: A window delete event was sent by the window manager.
* The specified window should be deleted. * The specified window should be deleted.
* Destroy: A window has been destroyed. * Destroy: A window has been destroyed.
* Expose: Part of a window has been uncovered. * 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. * MotionNotify: The mouse has moved.
* ButtonPress: A mouse button was pressed. * ButtonPress: A mouse button was pressed.
* ButtonRelease: A mouse button was release. * ButtonRelease: A mouse button was release.
@ -337,6 +347,8 @@ typedef enum
GDK_DROP_LEAVE = 25, GDK_DROP_LEAVE = 25,
GDK_DROP_DATA_AVAIL = 26, GDK_DROP_DATA_AVAIL = 26,
GDK_CLIENT_EVENT = 27, GDK_CLIENT_EVENT = 27,
GDK_VISIBILITY_NOTIFY = 28,
GDK_NO_EXPOSE = 29,
GDK_OTHER_EVENT = 9999 GDK_OTHER_EVENT = 9999
} GdkEventType; } GdkEventType;
@ -363,6 +375,7 @@ typedef enum
GDK_PROPERTY_CHANGE_MASK = 1 << 16, GDK_PROPERTY_CHANGE_MASK = 1 << 16,
GDK_PROXIMITY_IN_MASK = 1 << 17, GDK_PROXIMITY_IN_MASK = 1 << 17,
GDK_PROXIMITY_OUT_MASK = 1 << 18, GDK_PROXIMITY_OUT_MASK = 1 << 18,
GDK_VISIBILITY_NOTIFY_MASK = 1 << 19,
GDK_ALL_EVENTS_MASK = 0x07FFFF GDK_ALL_EVENTS_MASK = 0x07FFFF
} GdkEventMask; } GdkEventMask;
@ -860,6 +873,20 @@ struct _GdkEventExpose
gint count; /* If non-zero, how many more events follow. */ 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 struct _GdkEventMotion
{ {
GdkEventType type; GdkEventType type;
@ -1069,25 +1096,27 @@ struct _GdkEventOther
union _GdkEvent union _GdkEvent
{ {
GdkEventType type; GdkEventType type;
GdkEventAny any; GdkEventAny any;
GdkEventExpose expose; GdkEventExpose expose;
GdkEventMotion motion; GdkEventNoExpose no_expose;
GdkEventButton button; GdkEventVisibility visibility;
GdkEventKey key; GdkEventMotion motion;
GdkEventCrossing crossing; GdkEventButton button;
GdkEventFocus focus_change; GdkEventKey key;
GdkEventConfigure configure; GdkEventCrossing crossing;
GdkEventProperty property; GdkEventFocus focus_change;
GdkEventSelection selection; GdkEventConfigure configure;
GdkEventProximity proximity; GdkEventProperty property;
GdkEventDragBegin dragbegin; GdkEventSelection selection;
GdkEventDragRequest dragrequest; GdkEventProximity proximity;
GdkEventDropEnter dropenter; GdkEventDragBegin dragbegin;
GdkEventDropLeave dropleave; GdkEventDragRequest dragrequest;
GdkEventDropEnter dropenter;
GdkEventDropLeave dropleave;
GdkEventDropDataAvailable dropdataavailable; GdkEventDropDataAvailable dropdataavailable;
GdkEventClient client; GdkEventClient client;
GdkEventOther other; GdkEventOther other;
}; };

View File

@ -27,8 +27,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
int nevent_masks = 16; int nevent_masks = 17;
int event_mask_table[18] = int event_mask_table[19] =
{ {
ExposureMask, ExposureMask,
PointerMotionMask, PointerMotionMask,
@ -47,7 +47,8 @@ int event_mask_table[18] =
StructureNotifyMask, StructureNotifyMask,
PropertyChangeMask, PropertyChangeMask,
0, /* PROXIMITY_IN */ 0, /* PROXIMITY_IN */
0 /* PROXIMTY_OUT */ 0, /* PROXIMTY_OUT */
VisibilityChangeMask
}; };

View File

@ -2285,7 +2285,10 @@ gdk_event_translate (GdkEvent *event,
g_print ("no expose:\t\tdrawable: %ld\n", g_print ("no expose:\t\tdrawable: %ld\n",
xevent->xnoexpose.drawable - base_id); 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; break;
case VisibilityNotify: case VisibilityNotify:
@ -2308,7 +2311,25 @@ gdk_event_translate (GdkEvent *event,
break; 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; break;
case CreateNotify: case CreateNotify:

View File

@ -27,8 +27,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
int nevent_masks = 16; int nevent_masks = 17;
int event_mask_table[18] = int event_mask_table[19] =
{ {
ExposureMask, ExposureMask,
PointerMotionMask, PointerMotionMask,
@ -47,7 +47,8 @@ int event_mask_table[18] =
StructureNotifyMask, StructureNotifyMask,
PropertyChangeMask, PropertyChangeMask,
0, /* PROXIMITY_IN */ 0, /* PROXIMITY_IN */
0 /* PROXIMTY_OUT */ 0, /* PROXIMTY_OUT */
VisibilityChangeMask
}; };