Commit 3fb589b2 authored by Elliot Lee's avatar Elliot Lee

Add drag_end_event for future expansion, plus allow passing in NULL to the gdk...

Add drag_end_event for future expansion, plus allow passing in NULL to the gdk filter stuff to get events without a window in our app
parent b7056ea1
......@@ -1701,24 +1701,27 @@ gdk_event_translate (GdkEvent *event,
window = gdk_window_lookup (xevent->xany.window);
window_private = (GdkWindowPrivate *) window;
if (window == NULL)
g_warning ("%#lx -> NULL\n", xevent->xany.window);
else
if (window != NULL)
gdk_window_ref (window);
else if(gdk_null_window_warnings) /* Special purpose programs that
get events for other windows may
want to disable this */
g_warning ("%#lx -> NULL\n", xevent->xany.window);
/* Check for filters for this window */
if (window_private)
{
GdkFilterReturn result;
result = gdk_event_apply_filters (xevent, event, window_private->filters);
if (result != GDK_FILTER_CONTINUE)
{
return (result == GDK_FILTER_TRANSLATE) ? TRUE : FALSE;
}
}
{
GdkFilterReturn result;
result = gdk_event_apply_filters (xevent, event,
window_private
?window_private->filters
:default_filters);
if (result != GDK_FILTER_CONTINUE)
{
return (result == GDK_FILTER_TRANSLATE) ? TRUE : FALSE;
}
}
/* We do a "manual" conversion of the XEvent to a
* GdkEvent. The structures are mostly the same so
......
......@@ -47,4 +47,6 @@ GdkDndGlobals gdk_dnd = {None,None,None,
gchar *gdk_progname = NULL;
gchar *gdk_progclass = NULL;
gint gdk_error_code;
gint gdk_error_warnings = TRUE;
gboolean gdk_error_warnings = TRUE;
gboolean gdk_null_window_warnings = TRUE;
GList *default_filters = NULL;
......@@ -250,6 +250,8 @@ extern gchar *gdk_progname;
extern gchar *gdk_progclass;
extern gint gdk_error_code;
extern gint gdk_error_warnings;
extern gboolean gdk_null_window_warnings;
extern GList *default_filters;
/* Debugging support */
......
......@@ -1475,13 +1475,15 @@ gdk_window_add_filter (GdkWindow *window,
GList *tmp_list;
GdkEventFilter *filter;
g_return_if_fail (window != NULL);
private = (GdkWindowPrivate*) window;
if (private->destroyed)
if (private && private->destroyed)
return;
tmp_list = private->filters;
if(private)
tmp_list = private->filters;
else
tmp_list = default_filters;
while (tmp_list)
{
filter = (GdkEventFilter *)tmp_list->data;
......@@ -1493,8 +1495,11 @@ gdk_window_add_filter (GdkWindow *window,
filter = g_new (GdkEventFilter, 1);
filter->function = function;
filter->data = data;
private->filters = g_list_append (private->filters, filter);
if(private)
private->filters = g_list_append (private->filters, filter);
else
default_filters = g_list_append (default_filters, filter);
}
void
......@@ -1506,10 +1511,13 @@ gdk_window_remove_filter (GdkWindow *window,
GList *tmp_list;
GdkEventFilter *filter;
g_return_if_fail (window != NULL);
private = (GdkWindowPrivate*) window;
tmp_list = private->filters;
if(private)
tmp_list = private->filters;
else
tmp_list = default_filters;
while (tmp_list)
{
filter = (GdkEventFilter *)tmp_list->data;
......@@ -1517,7 +1525,10 @@ gdk_window_remove_filter (GdkWindow *window,
if ((filter->function == function) && (filter->data == data))
{
private->filters = g_list_remove_link (private->filters, tmp_list);
if(private)
private->filters = g_list_remove_link (private->filters, tmp_list);
else
default_filters = g_list_remove_link (default_filters, tmp_list);
g_list_free_1 (tmp_list);
g_free (filter);
......
......@@ -47,4 +47,6 @@ GdkDndGlobals gdk_dnd = {None,None,None,
gchar *gdk_progname = NULL;
gchar *gdk_progclass = NULL;
gint gdk_error_code;
gint gdk_error_warnings = TRUE;
gboolean gdk_error_warnings = TRUE;
gboolean gdk_null_window_warnings = TRUE;
GList *default_filters = NULL;
......@@ -1701,24 +1701,27 @@ gdk_event_translate (GdkEvent *event,
window = gdk_window_lookup (xevent->xany.window);
window_private = (GdkWindowPrivate *) window;
if (window == NULL)
g_warning ("%#lx -> NULL\n", xevent->xany.window);
else
if (window != NULL)
gdk_window_ref (window);
else if(gdk_null_window_warnings) /* Special purpose programs that
get events for other windows may
want to disable this */
g_warning ("%#lx -> NULL\n", xevent->xany.window);
/* Check for filters for this window */
if (window_private)
{
GdkFilterReturn result;
result = gdk_event_apply_filters (xevent, event, window_private->filters);
if (result != GDK_FILTER_CONTINUE)
{
return (result == GDK_FILTER_TRANSLATE) ? TRUE : FALSE;
}
}
{
GdkFilterReturn result;
result = gdk_event_apply_filters (xevent, event,
window_private
?window_private->filters
:default_filters);
if (result != GDK_FILTER_CONTINUE)
{
return (result == GDK_FILTER_TRANSLATE) ? TRUE : FALSE;
}
}
/* We do a "manual" conversion of the XEvent to a
* GdkEvent. The structures are mostly the same so
......
......@@ -1475,13 +1475,15 @@ gdk_window_add_filter (GdkWindow *window,
GList *tmp_list;
GdkEventFilter *filter;
g_return_if_fail (window != NULL);
private = (GdkWindowPrivate*) window;
if (private->destroyed)
if (private && private->destroyed)
return;
tmp_list = private->filters;
if(private)
tmp_list = private->filters;
else
tmp_list = default_filters;
while (tmp_list)
{
filter = (GdkEventFilter *)tmp_list->data;
......@@ -1493,8 +1495,11 @@ gdk_window_add_filter (GdkWindow *window,
filter = g_new (GdkEventFilter, 1);
filter->function = function;
filter->data = data;
private->filters = g_list_append (private->filters, filter);
if(private)
private->filters = g_list_append (private->filters, filter);
else
default_filters = g_list_append (default_filters, filter);
}
void
......@@ -1506,10 +1511,13 @@ gdk_window_remove_filter (GdkWindow *window,
GList *tmp_list;
GdkEventFilter *filter;
g_return_if_fail (window != NULL);
private = (GdkWindowPrivate*) window;
tmp_list = private->filters;
if(private)
tmp_list = private->filters;
else
tmp_list = default_filters;
while (tmp_list)
{
filter = (GdkEventFilter *)tmp_list->data;
......@@ -1517,7 +1525,10 @@ gdk_window_remove_filter (GdkWindow *window,
if ((filter->function == function) && (filter->data == data))
{
private->filters = g_list_remove_link (private->filters, tmp_list);
if(private)
private->filters = g_list_remove_link (private->filters, tmp_list);
else
default_filters = g_list_remove_link (default_filters, tmp_list);
g_list_free_1 (tmp_list);
g_free (filter);
......
......@@ -74,6 +74,7 @@ enum {
PROXIMITY_OUT_EVENT,
DRAG_BEGIN_EVENT,
DRAG_REQUEST_EVENT,
DRAG_END_EVENT,
DROP_ENTER_EVENT,
DROP_LEAVE_EVENT,
DROP_DATA_AVAILABLE_EVENT,
......@@ -626,6 +627,14 @@ gtk_widget_class_init (GtkWidgetClass *klass)
gtk_widget_marshal_signal_4,
GTK_TYPE_BOOL, 1,
GTK_TYPE_GDK_EVENT);
widget_signals[DRAG_END_EVENT] =
gtk_signal_new ("drag_end_event",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkWidgetClass, drag_end_event),
gtk_widget_marshal_signal_4,
GTK_TYPE_BOOL, 1,
GTK_TYPE_GDK_EVENT);
widget_signals[DROP_ENTER_EVENT] =
gtk_signal_new ("drop_enter_event",
GTK_RUN_FIRST,
......@@ -2650,6 +2659,24 @@ gtk_widget_get_parent_window (GtkWidget *widget)
return (parent_window != NULL) ? parent_window : widget->parent->window;
}
/*****************************************
* gtk_widget_set_style:
*
* arguments:
*
* results:
*****************************************/
void
gtk_widget_set_style (GtkWidget *widget,
GtkStyle *style)
{
g_return_if_fail (widget != NULL);
GTK_PRIVATE_SET_FLAG (widget, GTK_USER_STYLE);
gtk_widget_set_style_internal (widget, style);
}
/*****************************************
* gtk_widget_set_uposition:
*
......
......@@ -317,6 +317,8 @@ struct _GtkWidgetClass
GdkEventDragBegin *event);
gint (* drag_request_event) (GtkWidget *widget,
GdkEventDragRequest *event);
gint (* drag_end_event) (GtkWidget *widget,
GdkEvent *event);
gint (* drop_enter_event) (GtkWidget *widget,
GdkEventDropEnter *event);
gint (* drop_leave_event) (GtkWidget *widget,
......@@ -441,6 +443,23 @@ void gtk_widget_set_events (GtkWidget *widget,
void gtk_widget_set_extension_events (GtkWidget *widget,
GdkExtensionMode mode);
GtkWidget* gtk_widget_get_toplevel (GtkWidget *widget);
GtkWidget* gtk_widget_get_ancestor (GtkWidget *widget,
gint type);
GdkColormap* gtk_widget_get_colormap (GtkWidget *widget);
GdkVisual* gtk_widget_get_visual (GtkWidget *widget);
GtkStyle* gtk_widget_get_style (GtkWidget *widget);
gint gtk_widget_get_events (GtkWidget *widget);
GdkExtensionMode gtk_widget_get_extension_events (GtkWidget *widget);
void gtk_widget_get_pointer (GtkWidget *widget,
gint *x,
gint *y);
gint gtk_widget_is_ancestor (GtkWidget *widget,
GtkWidget *ancestor);
gint gtk_widget_is_child (GtkWidget *widget,
GtkWidget *child);
GdkExtensionMode gtk_widget_get_extension_events (GtkWidget *widget);
GtkWidget* gtk_widget_get_toplevel (GtkWidget *widget);
GtkWidget* gtk_widget_get_ancestor (GtkWidget *widget,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment