gtk: Mass delete all GtkWidget event mask API

We now rely on toplevels receiving and forwarding all the events
the windowing should be able to handle. Event masks are no longer a
way to determine whether an event is deliverable ot a widget.

Events will always be delivered in the three captured/target/bubbled
phases, widgets can now just attach GtkEventControllers and let those
handle the events.
This commit is contained in:
Carlos Garnacho 2017-03-31 18:58:16 +02:00
parent ef4f0e5336
commit a72404dd5a
61 changed files with 52 additions and 737 deletions

View File

@ -92,10 +92,6 @@ do_css_multiplebgs (GtkWidget *do_widget)
G_CALLBACK (gtk_widget_destroyed), &window);
container = gtk_overlay_new ();
gtk_widget_add_events (container,
GDK_ENTER_NOTIFY_MASK |
GDK_LEAVE_NOTIFY_MASK |
GDK_POINTER_MOTION_MASK);
gtk_container_add (GTK_CONTAINER (window), container);
child = gtk_drawing_area_new ();
@ -106,10 +102,6 @@ do_css_multiplebgs (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (container), child);
child = gtk_button_new ();
gtk_widget_add_events (child,
GDK_ENTER_NOTIFY_MASK |
GDK_LEAVE_NOTIFY_MASK |
GDK_POINTER_MOTION_MASK);
gtk_overlay_add_overlay (GTK_OVERLAY (container), child);
gtk_widget_set_name (child, "bricks-button");
gtk_widget_set_halign (child, GTK_ALIGN_CENTER);

View File

@ -263,17 +263,6 @@ do_drawingarea (GtkWidget *do_widget)
G_CALLBACK (scribble_motion_notify_event), NULL);
g_signal_connect (da, "button-press-event",
G_CALLBACK (scribble_button_press_event), NULL);
/* Ask to receive events the drawing area doesn't normally
* subscribe to
*/
gtk_widget_set_events (da, gtk_widget_get_events (da)
| GDK_LEAVE_NOTIFY_MASK
| GDK_BUTTON_PRESS_MASK
| GDK_POINTER_MOTION_MASK
| GDK_POINTER_MOTION_HINT_MASK);
}
if (!gtk_widget_get_visible (window))

View File

@ -628,14 +628,6 @@ do_event_axes (GtkWidget *toplevel)
box = gtk_event_box_new ();
gtk_container_add (GTK_CONTAINER (window), box);
gtk_widget_set_support_multidevice (box, TRUE);
gtk_widget_add_events (box,
GDK_POINTER_MOTION_MASK |
GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
GDK_SMOOTH_SCROLL_MASK |
GDK_ENTER_NOTIFY_MASK |
GDK_LEAVE_NOTIFY_MASK |
GDK_TOUCH_MASK);
event_data = event_data_new ();
g_object_set_data_full (G_OBJECT (box), "gtk-demo-event-data",

View File

@ -151,9 +151,6 @@ do_gestures (GtkWidget *do_widget)
drawing_area = gtk_drawing_area_new ();
gtk_container_add (GTK_CONTAINER (window), drawing_area);
gtk_widget_add_events (drawing_area,
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
GDK_POINTER_MOTION_MASK | GDK_TOUCH_MASK);
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (drawing_area),
drawing_area_draw,

View File

@ -4521,12 +4521,6 @@ gtk_widget_set_sensitive
gtk_widget_set_parent
gtk_widget_set_parent_window
gtk_widget_get_parent_window
gtk_widget_set_events
gtk_widget_get_events
gtk_widget_add_events
gtk_widget_set_device_events
gtk_widget_get_device_events
gtk_widget_add_device_events
gtk_widget_set_device_enabled
gtk_widget_get_device_enabled
gtk_widget_get_toplevel

View File

@ -162,14 +162,6 @@ activate (GtkApplication *app,
g_signal_connect (drawing_area, "button-press-event",
G_CALLBACK (button_press_event_cb), NULL);
/* Ask to receive events the drawing area doesn't normally
* subscribe to. In particular, we need to ask for the
* button press and motion notify events that want to handle.
*/
gtk_widget_set_events (drawing_area, gtk_widget_get_events (drawing_area)
| GDK_BUTTON_PRESS_MASK
| GDK_POINTER_MOTION_MASK);
gtk_widget_show (window);
}

View File

@ -787,12 +787,7 @@ gtk_button_realize (GtkWidget *widget)
gtk_widget_get_allocation (widget, &allocation);
priv->event_window = gdk_window_new_input (gtk_widget_get_window (widget),
gtk_widget_get_events (widget)
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
| GDK_TOUCH_MASK
| GDK_ENTER_NOTIFY_MASK
| GDK_LEAVE_NOTIFY_MASK,
GDK_ALL_EVENTS_MASK,
&allocation);
gtk_widget_register_window (widget, priv->event_window);
}

View File

@ -1545,9 +1545,7 @@ calendar_realize_arrows (GtkCalendar *calendar)
rect.y += allocation.y;
priv->arrow_win[i] = gdk_window_new_input (gtk_widget_get_window (widget),
gtk_widget_get_events (widget)
| GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
| GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK,
GDK_ALL_EVENTS_MASK,
&rect);
gtk_widget_register_window (widget, priv->arrow_win[i]);
}
@ -1639,12 +1637,7 @@ gtk_calendar_realize (GtkWidget *widget)
rect.height = priv->main_h;
priv->main_win = gdk_window_new_input (gtk_widget_get_window (widget),
gtk_widget_get_events (widget)
| GDK_SCROLL_MASK
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
| GDK_POINTER_MOTION_MASK
| GDK_LEAVE_NOTIFY_MASK,
GDK_ALL_EVENTS_MASK,
&rect);
gtk_widget_register_window (widget, priv->main_win);

View File

@ -439,9 +439,6 @@ make_clipboard_widget (GdkDisplay *display,
if (provider)
{
/* We need this for gdk_x11_get_server_time() */
gtk_widget_add_events (widget, GDK_PROPERTY_CHANGE_MASK);
g_signal_connect (widget, "selection-get",
G_CALLBACK (selection_get_cb), NULL);
g_signal_connect (widget, "selection-clear-event",

View File

@ -346,14 +346,6 @@ gtk_color_editor_init (GtkColorEditor *editor)
g_type_ensure (GTK_TYPE_COLOR_SWATCH);
gtk_widget_init_template (GTK_WIDGET (editor));
/* Some post processing is needed in code to set this up */
gtk_widget_set_events (editor->priv->swatch,
gtk_widget_get_events (editor->priv->swatch)
& ~(GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
| GDK_KEY_PRESS_MASK
| GDK_KEY_RELEASE_MASK));
if (gtk_widget_get_direction (editor->priv->h_slider) == GTK_TEXT_DIR_RTL)
gtk_style_context_add_class (gtk_widget_get_style_context (editor->priv->h_slider),
"marks-before");

View File

@ -207,12 +207,7 @@ plane_realize (GtkWidget *widget)
gtk_widget_get_allocation (widget, &allocation);
priv->input_window = gdk_window_new_input (gtk_widget_get_window (widget),
gtk_widget_get_events (widget)
| GDK_KEY_PRESS_MASK
| GDK_TOUCH_MASK
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
| GDK_POINTER_MOTION_MASK,
GDK_ALL_EVENTS_MASK,
&allocation);
gtk_widget_register_window (widget, priv->input_window);

View File

@ -154,8 +154,6 @@ gtk_color_scale_init (GtkColorScale *scale)
scale->priv = gtk_color_scale_get_instance_private (scale);
gtk_widget_add_events (GTK_WIDGET (scale), GDK_TOUCH_MASK);
scale->priv->long_press_gesture = gtk_gesture_long_press_new (GTK_WIDGET (scale));
g_signal_connect (scale->priv->long_press_gesture, "pressed",
G_CALLBACK (hold_action), scale);

View File

@ -471,12 +471,7 @@ swatch_realize (GtkWidget *widget)
gtk_widget_get_allocation (widget, &allocation);
swatch->priv->event_window = gdk_window_new_input (gtk_widget_get_window (widget),
gtk_widget_get_events (widget)
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
| GDK_ENTER_NOTIFY_MASK
| GDK_LEAVE_NOTIFY_MASK
| GDK_TOUCH_MASK,
GDK_ALL_EVENTS_MASK,
&allocation);
gtk_widget_register_window (widget, swatch->priv->event_window);
}

View File

@ -1046,8 +1046,6 @@ gtk_combo_box_init (GtkComboBox *combo_box)
g_type_ensure (GTK_TYPE_TREE_MENU);
gtk_widget_init_template (GTK_WIDGET (combo_box));
gtk_widget_add_events (priv->button, GDK_SCROLL_MASK);
context = gtk_widget_get_style_context (priv->button);
gtk_style_context_remove_class (context, "toggle");
gtk_style_context_add_class (context, "combo");

View File

@ -1613,7 +1613,6 @@ gtk_drag_set_icon_widget_internal (GdkDragContext *context,
gtk_window_set_type_hint (GTK_WINDOW (info->icon_window), GDK_WINDOW_TYPE_HINT_DND);
gtk_window_set_screen (GTK_WINDOW (info->icon_window), screen);
gtk_widget_set_size_request (info->icon_window, 24, 24);
gtk_widget_set_events (info->icon_window, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
gtk_style_context_remove_class (gtk_widget_get_style_context (info->icon_window), "background");
gtk_window_set_hardcoded_window (GTK_WINDOW (info->icon_window),

View File

@ -146,11 +146,6 @@ gtk_drag_source_set (GtkWidget *widget,
site = g_object_get_data (G_OBJECT (widget), "gtk-site-data");
gtk_widget_add_events (widget,
gtk_widget_get_events (widget) |
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
GDK_BUTTON_MOTION_MASK);
if (site)
{
if (site->target_list)

View File

@ -2884,14 +2884,7 @@ realize_icon_info (GtkWidget *widget,
g_return_if_fail (icon_info != NULL);
icon_info->window = gdk_window_new_input (gtk_widget_get_window (widget),
gtk_widget_get_events (widget)
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
| GDK_BUTTON1_MOTION_MASK
| GDK_BUTTON3_MOTION_MASK
| GDK_POINTER_MOTION_MASK
| GDK_ENTER_NOTIFY_MASK
| GDK_LEAVE_NOTIFY_MASK,
GDK_ALL_EVENTS_MASK,
&(GdkRectangle) { 0, 0, 1, 1});
gtk_widget_register_window (widget, icon_info->window);

View File

@ -387,13 +387,7 @@ gtk_event_box_realize (GtkWidget *widget)
if (visible_window)
{
window = gdk_window_new_child (gtk_widget_get_parent_window (widget),
gtk_widget_get_events (widget)
| GDK_BUTTON_MOTION_MASK
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
| GDK_EXPOSURE_MASK
| GDK_ENTER_NOTIFY_MASK
| GDK_LEAVE_NOTIFY_MASK,
GDK_ALL_EVENTS_MASK,
&allocation);
gtk_widget_set_window (widget, window);
@ -414,13 +408,7 @@ gtk_event_box_realize (GtkWidget *widget)
allocation.y = 0;
}
priv->event_window = gdk_window_new_input (window,
gtk_widget_get_events (widget)
| GDK_BUTTON_MOTION_MASK
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
| GDK_EXPOSURE_MASK
| GDK_ENTER_NOTIFY_MASK
| GDK_LEAVE_NOTIFY_MASK,
GDK_ALL_EVENTS_MASK,
&allocation);
gtk_widget_register_window (widget, priv->event_window);
}

View File

@ -537,11 +537,7 @@ gtk_expander_realize (GtkWidget *widget)
gtk_widget_get_allocation (widget, &allocation);
priv->event_window = gdk_window_new_input (gtk_widget_get_window (widget),
gtk_widget_get_events (widget)
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
| GDK_ENTER_NOTIFY_MASK
| GDK_LEAVE_NOTIFY_MASK,
GDK_ALL_EVENTS_MASK,
&allocation);
gtk_widget_register_window (widget, priv->event_window);
}

View File

@ -361,9 +361,7 @@ gtk_fixed_realize (GtkWidget *widget)
gtk_widget_get_allocation (widget, &allocation);
window = gdk_window_new_child (gtk_widget_get_parent_window (widget),
gtk_widget_get_events (widget)
| GDK_EXPOSURE_MASK
| GDK_BUTTON_PRESS_MASK,
GDK_ALL_EVENTS_MASK,
&allocation);
gtk_widget_set_window (widget, window);
gtk_widget_register_window (widget, window);

View File

@ -3046,14 +3046,8 @@ gtk_flow_box_realize (GtkWidget *widget)
gtk_widget_get_allocation (GTK_WIDGET (box), &allocation);
priv->view_window = gdk_window_new_child (gtk_widget_get_parent_window (GTK_WIDGET (box)),
gtk_widget_get_events (GTK_WIDGET (box))
| GDK_ENTER_NOTIFY_MASK
| GDK_LEAVE_NOTIFY_MASK
| GDK_POINTER_MOTION_MASK
| GDK_KEY_PRESS_MASK
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK,
&allocation);
GDK_ALL_EVENTS_MASK,
&allocation);
gtk_widget_register_window (GTK_WIDGET (box), priv->view_window);
for (iter = g_sequence_get_begin_iter (priv->children);

View File

@ -695,8 +695,6 @@ gtk_font_chooser_widget_init (GtkFontChooserWidget *fontchooser)
gtk_font_chooser_widget_update_preview_attributes (fontchooser);
gtk_widget_add_events (priv->preview, GDK_SCROLL_MASK);
/* Set the upper values of the spin/scale with G_MAXINT / PANGO_SCALE */
gtk_spin_button_set_range (GTK_SPIN_BUTTON (priv->size_spin),
1.0, (gdouble)(G_MAXINT / PANGO_SCALE));

View File

@ -287,7 +287,7 @@ gtk_gl_area_realize (GtkWidget *widget)
gtk_widget_get_allocation (widget, &allocation);
priv->event_window = gdk_window_new_input (gtk_widget_get_parent_window (widget),
gtk_widget_get_events (widget),
GDK_ALL_EVENTS_MASK,
&allocation);
gtk_widget_register_window (widget, priv->event_window);

View File

@ -1272,15 +1272,7 @@ gtk_icon_view_realize (GtkWidget *widget)
/* Make the window for the icon view */
icon_view->priv->bin_window = gdk_window_new_child (icon_view->priv->view_window,
gtk_widget_get_events (widget)
| GDK_SCROLL_MASK
| GDK_SMOOTH_SCROLL_MASK
| GDK_POINTER_MOTION_MASK
| GDK_LEAVE_NOTIFY_MASK
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
| GDK_KEY_PRESS_MASK
| GDK_KEY_RELEASE_MASK,
GDK_ALL_EVENTS_MASK,
&(GdkRectangle) { 0, 0,
MAX (icon_view->priv->width, allocation.width),
MAX (icon_view->priv->height, allocation.height)});

View File

@ -5088,12 +5088,7 @@ gtk_label_create_window (GtkLabel *label)
gtk_widget_get_allocation (widget, &allocation);
priv->select_info->window = gdk_window_new_input (gtk_widget_get_window (widget),
gtk_widget_get_events (widget)
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
| GDK_LEAVE_NOTIFY_MASK
| GDK_BUTTON_MOTION_MASK
| GDK_POINTER_MOTION_MASK,
GDK_ALL_EVENTS_MASK,
&allocation);
if (gtk_widget_is_sensitive (widget) && priv->select_info->selectable)

View File

@ -787,10 +787,7 @@ gtk_layout_realize (GtkWidget *widget)
gtk_widget_register_window (widget, window);
priv->bin_window = gdk_window_new_child (window,
gtk_widget_get_events (widget)
| GDK_EXPOSURE_MASK
| GDK_SCROLL_MASK
| GDK_SMOOTH_SCROLL_MASK,
GDK_ALL_EVENTS_MASK,
&(GdkRectangle) {
- gtk_adjustment_get_value (priv->hadjustment),
- gtk_adjustment_get_value (priv->vadjustment),

View File

@ -2156,12 +2156,7 @@ gtk_list_box_realize (GtkWidget *widget)
gtk_widget_get_allocation (widget, &allocation);
priv->view_window = gdk_window_new_child (gtk_widget_get_parent_window (widget),
gtk_widget_get_events (widget)
| GDK_ENTER_NOTIFY_MASK
| GDK_LEAVE_NOTIFY_MASK
| GDK_POINTER_MOTION_MASK
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK,
GDK_ALL_EVENTS_MASK,
&allocation);
gdk_window_set_user_data (priv->view_window, (GObject*) widget);

View File

@ -305,9 +305,6 @@ _gtk_magnifier_init (GtkMagnifier *magnifier)
priv = _gtk_magnifier_get_instance_private (magnifier);
gtk_widget_set_events (widget,
gtk_widget_get_events (widget));
gtk_widget_set_has_window (widget, FALSE);
priv->magnification = 1;
priv->resize = FALSE;

View File

@ -2619,10 +2619,7 @@ gtk_menu_realize (GtkWidget *widget)
get_arrows_border (menu, &arrow_border);
priv->view_window = gdk_window_new_child (gtk_widget_get_window (widget),
gtk_widget_get_events (widget)
| GDK_KEY_PRESS_MASK
| GDK_ENTER_NOTIFY_MASK
| GDK_LEAVE_NOTIFY_MASK,
GDK_ALL_EVENTS_MASK,
&(GdkRectangle) {
allocation.x + padding.left,
allocation.y + padding.top + arrow_border.top,
@ -2632,10 +2629,7 @@ gtk_menu_realize (GtkWidget *widget)
gtk_widget_register_window (widget, priv->view_window);
priv->bin_window = gdk_window_new_child (priv->view_window,
gtk_widget_get_events (widget)
| GDK_KEY_PRESS_MASK
| GDK_ENTER_NOTIFY_MASK
| GDK_LEAVE_NOTIFY_MASK,
GDK_ALL_EVENTS_MASK,
&(GdkRectangle) {
0,
- priv->scroll_offset,

View File

@ -1234,12 +1234,7 @@ gtk_menu_item_realize (GtkWidget *widget)
gtk_widget_get_allocation (widget, &allocation);
priv->event_window = gdk_window_new_input (gtk_widget_get_window (widget),
gtk_widget_get_events (widget)
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
| GDK_ENTER_NOTIFY_MASK
| GDK_LEAVE_NOTIFY_MASK
| GDK_POINTER_MOTION_MASK,
GDK_ALL_EVENTS_MASK,
&allocation);
gtk_widget_register_window (widget, priv->event_window);
}

View File

@ -1839,13 +1839,7 @@ gtk_notebook_realize (GtkWidget *widget)
gtk_css_gadget_get_border_allocation (priv->header_gadget, &event_window_pos, NULL);
priv->event_window = gdk_window_new_input (gtk_widget_get_window (widget),
gtk_widget_get_events (widget)
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
| GDK_KEY_PRESS_MASK
| GDK_POINTER_MOTION_MASK
| GDK_ENTER_NOTIFY_MASK
| GDK_LEAVE_NOTIFY_MASK,
GDK_ALL_EVENTS_MASK,
&event_window_pos);
gtk_widget_register_window (widget, priv->event_window);
}

View File

@ -143,7 +143,7 @@ gtk_overlay_create_child_window (GtkOverlay *overlay,
gtk_overlay_compute_child_allocation (overlay, child, &allocation, NULL);
window = gdk_window_new_child (gtk_widget_get_window (widget),
gtk_widget_get_events (widget),
GDK_ALL_EVENTS_MASK,
&allocation);
gtk_widget_register_window (widget, window);

View File

@ -1528,7 +1528,7 @@ gtk_paned_create_child_window (GtkPaned *paned,
}
window = gdk_window_new_child (gtk_widget_get_window (widget),
gtk_widget_get_events (widget),
GDK_ALL_EVENTS_MASK,
&allocation);
gtk_widget_register_window (widget, window);
@ -1547,12 +1547,7 @@ gtk_paned_realize (GtkWidget *widget)
GTK_WIDGET_CLASS (gtk_paned_parent_class)->realize (widget);
priv->handle = gdk_window_new_input (gtk_widget_get_window (widget),
gtk_widget_get_events (widget)
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
| GDK_ENTER_NOTIFY_MASK
| GDK_LEAVE_NOTIFY_MASK
| GDK_POINTER_MOTION_MASK,
GDK_ALL_EVENTS_MASK,
&priv->handle_pos);
if (gtk_widget_is_sensitive (widget))

View File

@ -474,8 +474,7 @@ gtk_path_bar_realize (GtkWidget *widget)
gtk_widget_get_allocation (widget, &allocation);
path_bar->priv->event_window = gdk_window_new_input (gtk_widget_get_window (widget),
gtk_widget_get_events (widget)
| GDK_SCROLL_MASK,
GDK_ALL_EVENTS_MASK,
&allocation);
gtk_widget_register_window (widget, path_bar->priv->event_window);
}
@ -1469,7 +1468,6 @@ make_directory_button (GtkPathBar *path_bar,
button_data->button = gtk_toggle_button_new ();
atk_obj = gtk_widget_get_accessible (button_data->button);
gtk_widget_set_focus_on_click (button_data->button, FALSE);
gtk_widget_add_events (button_data->button, GDK_SCROLL_MASK);
switch (button_data->type)
{

View File

@ -381,13 +381,7 @@ gtk_popover_realize (GtkWidget *widget)
gtk_widget_get_allocation (widget, &allocation);
window = gdk_window_new_child (gtk_widget_get_parent_window (widget),
gtk_widget_get_events (widget)
| GDK_POINTER_MOTION_MASK
| GDK_BUTTON_MOTION_MASK
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
| GDK_ENTER_NOTIFY_MASK
| GDK_LEAVE_NOTIFY_MASK,
GDK_ALL_EVENTS_MASK,
&(GdkRectangle) { 0, 0, allocation.width, allocation.height });
gtk_widget_set_window (widget, window);
gtk_widget_register_window (widget, window);

View File

@ -1980,14 +1980,7 @@ gtk_range_realize (GtkWidget *widget)
gtk_widget_get_allocation (widget, &allocation);
priv->event_window = gdk_window_new_input (gtk_widget_get_parent_window (widget),
gtk_widget_get_events (widget)
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
| GDK_SCROLL_MASK
| GDK_SMOOTH_SCROLL_MASK
| GDK_ENTER_NOTIFY_MASK
| GDK_LEAVE_NOTIFY_MASK
| GDK_POINTER_MOTION_MASK,
GDK_ALL_EVENTS_MASK,
&allocation);
gtk_widget_register_window (widget, priv->event_window);
}

View File

@ -352,7 +352,7 @@ gtk_revealer_real_realize (GtkWidget *widget)
priv->view_window =
gdk_window_new_child (gtk_widget_get_parent_window (widget),
gtk_widget_get_events (widget),
GDK_ALL_EVENTS_MASK,
&allocation);
gtk_widget_register_window (widget, priv->view_window);
@ -380,7 +380,7 @@ gtk_revealer_real_realize (GtkWidget *widget)
priv->bin_window =
gdk_window_new_child (priv->view_window,
gtk_widget_get_events (widget),
GDK_ALL_EVENTS_MASK,
&child_allocation);
gtk_widget_register_window (widget, priv->bin_window);

View File

@ -365,8 +365,6 @@ gtk_scale_button_init (GtkScaleButton *button)
g_object_ref_sink (priv->adjustment);
gtk_range_set_adjustment (GTK_RANGE (priv->scale), priv->adjustment);
gtk_widget_add_events (GTK_WIDGET (button), GDK_SMOOTH_SCROLL_MASK);
context = gtk_widget_get_style_context (GTK_WIDGET (button));
gtk_style_context_add_class (context, "scale");
}

View File

@ -3891,7 +3891,7 @@ create_indicator_window (GtkScrolledWindow *scrolled_window,
gtk_scrolled_window_allocate_scrollbar (scrolled_window, child, &allocation);
window = gdk_window_new_child (priv->view_window,
gtk_widget_get_events (widget),
GDK_ALL_EVENTS_MASK,
&allocation);
gtk_widget_register_window (widget, window);
@ -4153,10 +4153,7 @@ gtk_scrolled_window_realize (GtkWidget *widget)
gtk_widget_get_allocation (widget, &allocation);
priv->view_window = gdk_window_new_child (gtk_widget_get_parent_window (widget),
gtk_widget_get_events (widget)
| GDK_ENTER_NOTIFY_MASK
| GDK_LEAVE_NOTIFY_MASK
| GDK_POINTER_MOTION_MASK,
GDK_ALL_EVENTS_MASK,
&allocation);
gtk_widget_register_window (widget, priv->view_window);

View File

@ -276,10 +276,7 @@ gtk_separator_tool_item_realize (GtkWidget *widget)
g_object_ref (window);
priv->event_window = gdk_window_new_input (gtk_widget_get_parent_window (widget),
gtk_widget_get_events (widget)
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
| GDK_POINTER_MOTION_MASK,
GDK_ALL_EVENTS_MASK,
&allocation);
gtk_widget_register_window (widget, priv->event_window);
}

View File

@ -886,8 +886,6 @@ gtk_spin_button_init (GtkSpinButton *spin_button)
update_node_ordering (spin_button);
gtk_widget_add_events (GTK_WIDGET (spin_button), GDK_SCROLL_MASK);
priv->swipe_gesture = gtk_gesture_swipe_new (GTK_WIDGET (spin_button));
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (priv->swipe_gesture), TRUE);
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (priv->swipe_gesture),
@ -931,8 +929,6 @@ gtk_spin_button_realize (GtkWidget *widget)
GtkSpinButton *spin_button = GTK_SPIN_BUTTON (widget);
gboolean return_val;
gtk_widget_set_events (widget, gtk_widget_get_events (widget) |
GDK_KEY_RELEASE_MASK);
GTK_WIDGET_CLASS (gtk_spin_button_parent_class)->realize (widget);
return_val = FALSE;

View File

@ -318,7 +318,6 @@ gtk_stack_realize (GtkWidget *widget)
GtkAllocation allocation;
GtkStackChildInfo *info;
GList *l;
gint event_mask;
GTK_WIDGET_CLASS (gtk_stack_parent_class)->realize (widget);
@ -326,20 +325,13 @@ gtk_stack_realize (GtkWidget *widget)
priv->view_window =
gdk_window_new_child (gtk_widget_get_window (GTK_WIDGET (stack)),
gtk_widget_get_events (widget),
GDK_ALL_EVENTS_MASK,
&allocation);
gtk_widget_register_window (widget, priv->view_window);
event_mask = gtk_widget_get_events (widget);
for (l = priv->children; l != NULL; l = l->next)
{
info = l->data;
event_mask |= gtk_widget_get_events (info->widget);
}
priv->bin_window =
gdk_window_new_child (priv->view_window,
event_mask,
GDK_ALL_EVENTS_MASK,
&(GdkRectangle) {
get_bin_window_x (stack, &allocation),
get_bin_window_y (stack, &allocation),
@ -1239,8 +1231,7 @@ gtk_stack_add (GtkContainer *container,
if (priv->bin_window)
gdk_window_set_events (priv->bin_window,
gdk_window_get_events (priv->bin_window) |
gtk_widget_get_events (child));
GDK_ALL_EVENTS_MASK);
g_signal_connect (child, "notify::visible",
G_CALLBACK (stack_child_visibility_notify_cb), stack);

View File

@ -457,13 +457,7 @@ gtk_switch_realize (GtkWidget *widget)
gtk_widget_get_allocation (widget, &allocation);
priv->event_window = gdk_window_new_input (parent_window,
gtk_widget_get_events (widget)
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
| GDK_BUTTON1_MOTION_MASK
| GDK_POINTER_MOTION_MASK
| GDK_ENTER_NOTIFY_MASK
| GDK_LEAVE_NOTIFY_MASK,
GDK_ALL_EVENTS_MASK,
&allocation);
gtk_widget_register_window (widget, priv->event_window);
}

View File

@ -284,12 +284,6 @@ _gtk_text_handle_ensure_widget (GtkTextHandle *handle,
widget = gtk_event_box_new ();
gtk_event_box_set_visible_window (GTK_EVENT_BOX (widget), TRUE);
gtk_widget_set_events (widget,
GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
GDK_ENTER_NOTIFY_MASK |
GDK_LEAVE_NOTIFY_MASK |
GDK_POINTER_MOTION_MASK);
gtk_widget_set_direction (widget, priv->windows[pos].dir);

View File

@ -9777,13 +9777,7 @@ text_window_realize (GtkTextWindow *win,
gdk_window_lower (win->window);
win->bin_window = gdk_window_new_child (win->window,
gtk_widget_get_events (win->widget)
| GDK_SCROLL_MASK
| GDK_SMOOTH_SCROLL_MASK
| GDK_KEY_PRESS_MASK
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
| GDK_POINTER_MOTION_MASK,
GDK_ALL_EVENTS_MASK,
&(GdkRectangle) {
0, 0,
win->allocation.width, win->allocation.height});

View File

@ -786,12 +786,7 @@ gtk_toolbar_realize (GtkWidget *widget)
gtk_widget_get_allocation (widget, &allocation);
priv->event_window = gdk_window_new_input (gtk_widget_get_window (widget),
gtk_widget_get_events (widget)
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
| GDK_POINTER_MOTION_MASK
| GDK_ENTER_NOTIFY_MASK
| GDK_LEAVE_NOTIFY_MASK,
GDK_ALL_EVENTS_MASK,
&allocation);
gtk_widget_register_window (widget, priv->event_window);
}

View File

@ -328,7 +328,7 @@ create_drag_window (GtkToolItem *toolitem)
gtk_widget_get_allocation (widget, &allocation);
toolitem->priv->drag_window = gdk_window_new_input (gtk_widget_get_parent_window (widget),
gtk_widget_get_events (widget),
GDK_ALL_EVENTS_MASK,
&allocation);
gtk_widget_register_window (widget, toolitem->priv->drag_window);
}

View File

@ -1209,10 +1209,7 @@ gtk_tool_item_group_realize (GtkWidget *widget)
gtk_widget_get_allocation (widget, &allocation);
window = gdk_window_new_child (gtk_widget_get_parent_window (widget),
gtk_widget_get_events (widget)
| GDK_VISIBILITY_NOTIFY_MASK
| GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
| GDK_BUTTON_MOTION_MASK,
GDK_ALL_EVENTS_MASK,
&allocation);
gtk_widget_set_window (widget, window);

View File

@ -707,12 +707,7 @@ gtk_tool_palette_realize (GtkWidget *widget)
gtk_widget_get_allocation (widget, &allocation);
window = gdk_window_new_child (gtk_widget_get_parent_window (widget),
gtk_widget_get_events (widget)
| GDK_VISIBILITY_NOTIFY_MASK
| GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
| GDK_BUTTON_MOTION_MASK
| GDK_SCROLL_MASK | GDK_SMOOTH_SCROLL_MASK
| GDK_TOUCH_MASK,
GDK_ALL_EVENTS_MASK,
&allocation);
gtk_widget_set_window (widget, window);
gtk_widget_register_window (widget, window);

View File

@ -2246,14 +2246,7 @@ gtk_tree_view_realize (GtkWidget *widget)
/* Make the window for the tree */
tree_view->priv->bin_window = gdk_window_new_child (window,
gtk_widget_get_events (widget)
| GDK_SCROLL_MASK
| GDK_SMOOTH_SCROLL_MASK
| GDK_POINTER_MOTION_MASK
| GDK_ENTER_NOTIFY_MASK
| GDK_LEAVE_NOTIFY_MASK
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK,
GDK_ALL_EVENTS_MASK,
&(GdkRectangle) {
0,
gtk_tree_view_get_effective_header_height (tree_view),
@ -2263,14 +2256,7 @@ gtk_tree_view_realize (GtkWidget *widget)
/* Make the column header window */
tree_view->priv->header_window = gdk_window_new_child (window,
gtk_widget_get_events (widget)
| GDK_SCROLL_MASK
| GDK_ENTER_NOTIFY_MASK
| GDK_LEAVE_NOTIFY_MASK
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
| GDK_KEY_PRESS_MASK
| GDK_KEY_RELEASE_MASK,
GDK_ALL_EVENTS_MASK,
&(GdkRectangle) {
0,
0,

View File

@ -820,8 +820,6 @@ gtk_tree_view_column_create_button (GtkTreeViewColumn *tree_column)
priv->button = gtk_button_new ();
g_object_ref_sink (priv->button);
gtk_widget_add_events (priv->button, GDK_POINTER_MOTION_MASK);
g_signal_connect (priv->button, "event",
G_CALLBACK (gtk_tree_view_column_button_event),
tree_column);
@ -1319,11 +1317,7 @@ _gtk_tree_view_column_realize_button (GtkTreeViewColumn *column)
gtk_widget_get_allocation (priv->button, &allocation);
priv->window = gdk_window_new_input (_gtk_tree_view_get_header_window (tree_view),
gtk_widget_get_events (GTK_WIDGET (tree_view)) |
GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
GDK_POINTER_MOTION_MASK |
GDK_KEY_PRESS_MASK,
GDK_ALL_EVENTS_MASK,
&(GdkRectangle) {(allocation.x + (rtl ? 0 : allocation.width)) - TREE_VIEW_DRAG_WIDTH / 2, 0,
TREE_VIEW_DRAG_WIDTH, _gtk_tree_view_get_header_height (tree_view)});
cursor = gdk_cursor_new_from_name (display, "col-resize");

View File

@ -625,21 +625,19 @@ gtk_viewport_realize (GtkWidget *widget)
GtkAdjustment *vadjustment = priv->vadjustment;
GtkAllocation view_allocation;
GtkWidget *child;
gint event_mask;
GTK_WIDGET_CLASS (gtk_viewport_parent_class)->realize (widget);
event_mask = gtk_widget_get_events (widget);
gtk_css_gadget_get_content_allocation (priv->gadget,
&view_allocation, NULL);
priv->view_window = gdk_window_new_child (gtk_widget_get_window (widget),
event_mask | GDK_SCROLL_MASK | GDK_TOUCH_MASK | GDK_SMOOTH_SCROLL_MASK,
GDK_ALL_EVENTS_MASK,
&view_allocation);
gtk_widget_register_window (widget, priv->view_window);
priv->bin_window = gdk_window_new_child (priv->view_window,
event_mask,
GDK_ALL_EVENTS_MASK,
&(GdkRectangle) {
- gtk_adjustment_get_value (hadjustment),
- gtk_adjustment_get_value (vadjustment),

View File

@ -573,7 +573,6 @@ enum {
PROP_CAN_DEFAULT,
PROP_HAS_DEFAULT,
PROP_RECEIVES_DEFAULT,
PROP_EVENTS,
PROP_HAS_TOOLTIP,
PROP_TOOLTIP_MARKUP,
PROP_TOOLTIP_TEXT,
@ -757,9 +756,6 @@ static void gtk_widget_set_usize_internal (GtkWidget *widget,
gint width,
gint height);
static void gtk_widget_add_events_internal (GtkWidget *widget,
GdkDevice *device,
gint events);
static void gtk_widget_set_device_enabled_internal (GtkWidget *widget,
GdkDevice *device,
gboolean recurse,
@ -785,8 +781,6 @@ static GParamSpecPool *style_property_spec_pool = NULL;
static GQuark quark_property_parser = 0;
static GQuark quark_accel_path = 0;
static GQuark quark_accel_closures = 0;
static GQuark quark_event_mask = 0;
static GQuark quark_device_event_mask = 0;
static GQuark quark_parent_window = 0;
static GQuark quark_shape_info = 0;
static GQuark quark_input_shape_info = 0;
@ -1032,8 +1026,6 @@ gtk_widget_class_init (GtkWidgetClass *klass)
quark_property_parser = g_quark_from_static_string ("gtk-rc-property-parser");
quark_accel_path = g_quark_from_static_string ("gtk-accel-path");
quark_accel_closures = g_quark_from_static_string ("gtk-accel-closures");
quark_event_mask = g_quark_from_static_string ("gtk-event-mask");
quark_device_event_mask = g_quark_from_static_string ("gtk-device-event-mask");
quark_parent_window = g_quark_from_static_string ("gtk-parent-window");
quark_shape_info = g_quark_from_static_string ("gtk-shape-info");
quark_input_shape_info = g_quark_from_static_string ("gtk-input-shape-info");
@ -1240,14 +1232,6 @@ gtk_widget_class_init (GtkWidgetClass *klass)
FALSE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
widget_props[PROP_EVENTS] =
g_param_spec_flags ("events",
P_("Events"),
P_("The event mask that decides what kind of GdkEvents this widget gets"),
GDK_TYPE_EVENT_MASK,
GDK_STRUCTURE_MASK,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkWidget:has-tooltip:
*
@ -3296,10 +3280,6 @@ gtk_widget_set_property (GObject *object,
case PROP_RECEIVES_DEFAULT:
gtk_widget_set_receives_default (widget, g_value_get_boolean (value));
break;
case PROP_EVENTS:
if (!_gtk_widget_get_realized (widget) && _gtk_widget_get_has_window (widget))
gtk_widget_set_events (widget, g_value_get_flags (value));
break;
case PROP_HAS_TOOLTIP:
gtk_widget_real_set_has_tooltip (widget,
g_value_get_boolean (value), FALSE);
@ -3416,8 +3396,6 @@ gtk_widget_get_property (GObject *object,
switch (prop_id)
{
gpointer *eventp;
case PROP_NAME:
if (priv->name)
g_value_set_string (value, priv->name);
@ -3468,10 +3446,6 @@ gtk_widget_get_property (GObject *object,
case PROP_RECEIVES_DEFAULT:
g_value_set_boolean (value, gtk_widget_get_receives_default (widget));
break;
case PROP_EVENTS:
eventp = g_object_get_qdata (G_OBJECT (widget), quark_event_mask);
g_value_set_flags (value, GPOINTER_TO_INT (eventp));
break;
case PROP_HAS_TOOLTIP:
g_value_set_boolean (value, gtk_widget_get_has_tooltip (widget));
break;
@ -4523,31 +4497,6 @@ gtk_widget_unmap (GtkWidget *widget)
}
}
static void
_gtk_widget_enable_device_events (GtkWidget *widget)
{
GHashTable *device_events;
GHashTableIter iter;
gpointer key, value;
device_events = g_object_get_qdata (G_OBJECT (widget), quark_device_event_mask);
if (!device_events)
return;
g_hash_table_iter_init (&iter, device_events);
while (g_hash_table_iter_next (&iter, &key, &value))
{
GdkDevice *device;
GdkEventMask event_mask;
device = key;
event_mask = GPOINTER_TO_UINT (value);
gtk_widget_add_events_internal (widget, device, event_mask);
}
}
typedef struct {
GtkWidget *widget;
GdkDevice *device;
@ -4964,7 +4913,6 @@ gtk_widget_realize (GtkWidget *widget)
if (priv->multidevice)
gdk_window_set_support_multidevice (priv->window, TRUE);
_gtk_widget_enable_device_events (widget);
gtk_widget_update_devices_mask (widget, TRUE);
gtk_widget_update_alpha (widget);
@ -6731,26 +6679,6 @@ _gtk_widget_set_captured_event_handler (GtkWidget *widget,
g_object_set_data (G_OBJECT (widget), "captured-event-handler", callback);
}
static GdkEventMask
_gtk_widget_get_controllers_evmask (GtkWidget *widget)
{
EventControllerData *data;
GdkEventMask evmask = 0;
GtkWidgetPrivate *priv;
GList *l;
priv = widget->priv;
for (l = priv->event_controllers; l; l = l->next)
{
data = l->data;
if (data->controller)
evmask |= gtk_event_controller_get_event_mask (GTK_EVENT_CONTROLLER (data->controller));
}
return evmask;
}
static gboolean
_gtk_widget_run_controllers (GtkWidget *widget,
const GdkEvent *event,
@ -9902,84 +9830,6 @@ gtk_widget_has_size_request (GtkWidget *widget)
return !(widget->priv->width == -1 && widget->priv->height == -1);
}
/**
* gtk_widget_set_events:
* @widget: a #GtkWidget
* @events: event mask
*
* Sets the event mask (see #GdkEventMask) for a widget. The event
* mask determines which events a widget will receive. Keep in mind
* that different widgets have different default event masks, and by
* changing the event mask you may disrupt a widgets functionality,
* so be careful. This function must be called while a widget is
* unrealized. Consider gtk_widget_add_events() for widgets that are
* already realized, or if you want to preserve the existing event
* mask. This function cant be used with widgets that have no window.
* (See gtk_widget_get_has_window()). To get events on those widgets,
* place them inside a #GtkEventBox and receive events on the event
* box.
**/
void
gtk_widget_set_events (GtkWidget *widget,
gint events)
{
gint e;
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (!_gtk_widget_get_realized (widget));
e = GPOINTER_TO_INT (g_object_get_qdata (G_OBJECT (widget), quark_event_mask));
if (e != events)
{
g_object_set_qdata (G_OBJECT (widget), quark_event_mask,
GINT_TO_POINTER (events));
g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_EVENTS]);
}
}
/**
* gtk_widget_set_device_events:
* @widget: a #GtkWidget
* @device: a #GdkDevice
* @events: event mask
*
* Sets the device event mask (see #GdkEventMask) for a widget. The event
* mask determines which events a widget will receive from @device. Keep
* in mind that different widgets have different default event masks, and by
* changing the event mask you may disrupt a widgets functionality,
* so be careful. This function must be called while a widget is
* unrealized. Consider gtk_widget_add_device_events() for widgets that are
* already realized, or if you want to preserve the existing event
* mask. This function cant be used with windowless widgets (which return
* %FALSE from gtk_widget_get_has_window());
* to get events on those widgets, place them inside a #GtkEventBox
* and receive events on the event box.
*
* Since: 3.0
**/
void
gtk_widget_set_device_events (GtkWidget *widget,
GdkDevice *device,
GdkEventMask events)
{
GHashTable *device_events;
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (GDK_IS_DEVICE (device));
g_return_if_fail (!_gtk_widget_get_realized (widget));
device_events = g_object_get_qdata (G_OBJECT (widget), quark_device_event_mask);
if (G_UNLIKELY (!device_events))
{
device_events = g_hash_table_new (NULL, NULL);
g_object_set_qdata_full (G_OBJECT (widget), quark_device_event_mask, device_events,
(GDestroyNotify) g_hash_table_unref);
}
g_hash_table_insert (device_events, device, GUINT_TO_POINTER (events));
}
/**
* gtk_widget_set_device_enabled:
* @widget: a #GtkWidget
@ -10041,137 +9891,6 @@ gtk_widget_get_device_enabled (GtkWidget *widget,
return g_list_find (enabled_devices, device) != NULL;
}
static void
gtk_widget_add_events_internal_list (GtkWidget *widget,
GdkDevice *device,
GdkEventMask events,
GList *window_list)
{
GdkEventMask controllers_mask;
GList *l;
controllers_mask = _gtk_widget_get_controllers_evmask (widget);
for (l = window_list; l != NULL; l = l->next)
{
GdkWindow *window = l->data;
GtkWidget *window_widget;
gdk_window_get_user_data (window, (gpointer *)&window_widget);
if (window_widget == widget)
{
GList *children;
if (device)
gdk_window_set_device_events (window, device,
gdk_window_get_events (window)
| events
| controllers_mask);
else
gdk_window_set_events (window,
gdk_window_get_events (window)
| events
| controllers_mask);
children = gdk_window_peek_children (window);
gtk_widget_add_events_internal_list (widget, device, events, children);
}
}
}
static void
gtk_widget_add_events_internal (GtkWidget *widget,
GdkDevice *device,
gint events)
{
GtkWidgetPrivate *priv = widget->priv;
GList *window_list;
GList win;
if (!_gtk_widget_get_has_window (widget))
window_list = gdk_window_peek_children (priv->window);
else
{
win.data = priv->window;
win.prev = win.next = NULL;
window_list = &win;
}
gtk_widget_add_events_internal_list (widget, device, events, window_list);
}
/**
* gtk_widget_add_events:
* @widget: a #GtkWidget
* @events: an event mask, see #GdkEventMask
*
* Adds the events in the bitfield @events to the event mask for
* @widget. See gtk_widget_set_events() and the
* [input handling overview][event-masks] for details.
**/
void
gtk_widget_add_events (GtkWidget *widget,
gint events)
{
gint old_events;
g_return_if_fail (GTK_IS_WIDGET (widget));
old_events = GPOINTER_TO_INT (g_object_get_qdata (G_OBJECT (widget), quark_event_mask));
g_object_set_qdata (G_OBJECT (widget), quark_event_mask,
GINT_TO_POINTER (old_events | events));
if (_gtk_widget_get_realized (widget))
{
gtk_widget_add_events_internal (widget, NULL, events);
gtk_widget_update_devices_mask (widget, FALSE);
}
g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_EVENTS]);
}
/**
* gtk_widget_add_device_events:
* @widget: a #GtkWidget
* @device: a #GdkDevice
* @events: an event mask, see #GdkEventMask
*
* Adds the device events in the bitfield @events to the event mask for
* @widget. See gtk_widget_set_device_events() for details.
*
* Since: 3.0
**/
void
gtk_widget_add_device_events (GtkWidget *widget,
GdkDevice *device,
GdkEventMask events)
{
GdkEventMask old_events;
GHashTable *device_events;
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (GDK_IS_DEVICE (device));
old_events = gtk_widget_get_device_events (widget, device);
device_events = g_object_get_qdata (G_OBJECT (widget), quark_device_event_mask);
if (G_UNLIKELY (!device_events))
{
device_events = g_hash_table_new (NULL, NULL);
g_object_set_qdata_full (G_OBJECT (widget), quark_device_event_mask, device_events,
(GDestroyNotify) g_hash_table_unref);
}
g_hash_table_insert (device_events, device,
GUINT_TO_POINTER (old_events | events));
if (_gtk_widget_get_realized (widget))
gtk_widget_add_events_internal (widget, device, events);
g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_EVENTS]);
}
/**
* gtk_widget_get_toplevel:
* @widget: a #GtkWidget
@ -10265,58 +9984,6 @@ gtk_widget_get_settings (GtkWidget *widget)
return gtk_settings_get_for_screen (gtk_widget_get_screen (widget));
}
/**
* gtk_widget_get_events:
* @widget: a #GtkWidget
*
* Returns the event mask (see #GdkEventMask) for the widget. These are the
* events that the widget will receive.
*
* Note: Internally, the widget event mask will be the logical OR of the event
* mask set through gtk_widget_set_events() or gtk_widget_add_events(), and the
* event mask necessary to cater for every #GtkEventController created for the
* widget.
*
* Returns: event mask for @widget
**/
gint
gtk_widget_get_events (GtkWidget *widget)
{
g_return_val_if_fail (GTK_IS_WIDGET (widget), 0);
return GPOINTER_TO_INT (g_object_get_qdata (G_OBJECT (widget), quark_event_mask)) |
_gtk_widget_get_controllers_evmask (widget);
}
/**
* gtk_widget_get_device_events:
* @widget: a #GtkWidget
* @device: a #GdkDevice
*
* Returns the events mask for the widget corresponding to an specific device. These
* are the events that the widget will receive when @device operates on it.
*
* Returns: device event mask for @widget
*
* Since: 3.0
**/
GdkEventMask
gtk_widget_get_device_events (GtkWidget *widget,
GdkDevice *device)
{
GHashTable *device_events;
g_return_val_if_fail (GTK_IS_WIDGET (widget), 0);
g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
device_events = g_object_get_qdata (G_OBJECT (widget), quark_device_event_mask);
if (!device_events)
return 0;
return GPOINTER_TO_UINT (g_hash_table_lookup (device_events, device));
}
/**
* gtk_widget_is_ancestor:
* @widget: a #GtkWidget
@ -13395,11 +13062,6 @@ gtk_widget_real_set_has_tooltip (GtkWidget *widget,
gdk_window_get_events (priv->window) |
GDK_LEAVE_NOTIFY_MASK |
GDK_POINTER_MOTION_MASK);
if (_gtk_widget_get_has_window (widget))
gtk_widget_add_events (widget,
GDK_LEAVE_NOTIFY_MASK |
GDK_POINTER_MOTION_MASK);
}
g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_HAS_TOOLTIP]);
@ -15405,17 +15067,6 @@ event_controller_grab_notify (GtkWidget *widget,
gtk_event_controller_reset (data->controller);
}
static void
_gtk_widget_update_evmask (GtkWidget *widget)
{
if (_gtk_widget_get_realized (widget))
{
gint events = GPOINTER_TO_INT (g_object_get_qdata (G_OBJECT (widget),
quark_event_mask));
gtk_widget_add_events_internal (widget, NULL, events);
}
}
static void
event_controller_sequence_state_changed (GtkGesture *gesture,
GdkEventSequence *sequence,
@ -15496,7 +15147,6 @@ _gtk_widget_add_controller (GtkWidget *widget,
}
priv->event_controllers = g_list_prepend (priv->event_controllers, data);
_gtk_widget_update_evmask (widget);
}
void

View File

@ -786,20 +786,6 @@ GDK_AVAILABLE_IN_ALL
void gtk_widget_get_size_request (GtkWidget *widget,
gint *width,
gint *height);
GDK_AVAILABLE_IN_ALL
void gtk_widget_set_events (GtkWidget *widget,
gint events);
GDK_AVAILABLE_IN_ALL
void gtk_widget_add_events (GtkWidget *widget,
gint events);
GDK_AVAILABLE_IN_ALL
void gtk_widget_set_device_events (GtkWidget *widget,
GdkDevice *device,
GdkEventMask events);
GDK_AVAILABLE_IN_ALL
void gtk_widget_add_device_events (GtkWidget *widget,
GdkDevice *device,
GdkEventMask events);
GDK_AVAILABLE_IN_3_8
void gtk_widget_set_opacity (GtkWidget *widget,
double opacity);
@ -913,12 +899,6 @@ GDK_AVAILABLE_IN_ALL
void gtk_widget_set_margin_bottom (GtkWidget *widget,
gint margin);
GDK_AVAILABLE_IN_ALL
gint gtk_widget_get_events (GtkWidget *widget);
GDK_AVAILABLE_IN_ALL
GdkEventMask gtk_widget_get_device_events (GtkWidget *widget,
GdkDevice *device);
GDK_AVAILABLE_IN_ALL
gboolean gtk_widget_is_ancestor (GtkWidget *widget,
GtkWidget *ancestor);

View File

@ -6318,8 +6318,7 @@ popover_realize (GtkWidget *widget,
if (GDK_IS_WAYLAND_DISPLAY (gtk_widget_get_display (widget)))
{
popover->window = gdk_wayland_window_new_subsurface (gtk_widget_get_display (GTK_WIDGET (window)),
gtk_widget_get_events (popover->widget)
| GDK_EXPOSURE_MASK,
GDK_ALL_EVENTS_MASK,
&rect);
gdk_window_set_transient_for (popover->window,
_gtk_widget_get_window (GTK_WIDGET (window)));
@ -6328,7 +6327,7 @@ popover_realize (GtkWidget *widget,
#endif
{
popover->window = gdk_window_new_child (_gtk_widget_get_window (GTK_WIDGET (window)),
gtk_widget_get_events (popover->widget) | GDK_EXPOSURE_MASK,
GDK_ALL_EVENTS_MASK,
&rect);
}
@ -6805,7 +6804,6 @@ gtk_window_realize (GtkWidget *widget)
GdkWindow *gdk_window;
GtkBorder window_border;
GtkWindowPrivate *priv;
gint event_mask;
gint i;
GList *link;
@ -6820,7 +6818,7 @@ gtk_window_realize (GtkWidget *widget)
if (gtk_widget_get_parent_window (widget))
{
gdk_window = gdk_window_new_child (gtk_widget_get_parent_window (widget),
gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK | GDK_STRUCTURE_MASK,
GDK_ALL_EVENTS_MASK,
&allocation);
gtk_widget_set_window (widget, gdk_window);
gtk_widget_register_window (widget, gdk_window);
@ -6871,25 +6869,12 @@ gtk_window_realize (GtkWidget *widget)
else
{
_gtk_widget_get_allocation (widget, &allocation);
event_mask = gtk_widget_get_events (widget);
event_mask |= (GDK_EXPOSURE_MASK |
GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
GDK_BUTTON_MOTION_MASK |
GDK_KEY_PRESS_MASK |
GDK_KEY_RELEASE_MASK |
GDK_ENTER_NOTIFY_MASK |
GDK_LEAVE_NOTIFY_MASK |
GDK_FOCUS_CHANGE_MASK |
GDK_STRUCTURE_MASK);
if (priv->decorated && priv->client_decorated)
event_mask |= GDK_POINTER_MOTION_MASK;
switch (priv->type)
{
case GTK_WINDOW_TOPLEVEL:
gdk_window = gdk_window_new_toplevel (gtk_widget_get_display (widget),
event_mask,
GDK_ALL_EVENTS_MASK,
allocation.width,
allocation.height);
break;
@ -6899,14 +6884,14 @@ gtk_window_realize (GtkWidget *widget)
GDK_IS_WAYLAND_DISPLAY (gtk_widget_get_display (widget)))
{
gdk_window = gdk_wayland_window_new_subsurface (gtk_widget_get_display (widget),
event_mask,
GDK_ALL_EVENTS_MASK,
&allocation);
}
else
#endif
{
gdk_window = gdk_window_new_popup (gtk_widget_get_display (widget),
event_mask,
GDK_ALL_EVENTS_MASK,
&allocation);
}
break;

View File

@ -363,12 +363,6 @@ gtk_inspector_on_inspect (GtkWidget *button,
if (!iw->invisible)
{
iw->invisible = gtk_invisible_new_for_screen (gdk_screen_get_default ());
gtk_widget_add_events (iw->invisible,
GDK_POINTER_MOTION_MASK |
GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
GDK_KEY_PRESS_MASK |
GDK_KEY_RELEASE_MASK);
gtk_widget_realize (iw->invisible);
gtk_widget_show (iw->invisible);
}

View File

@ -47,7 +47,6 @@ main (int argc, char **argv)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size (GTK_WINDOW (window), 300, 300);
gtk_widget_add_events (window, GDK_POINTER_MOTION_MASK);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);

View File

@ -4280,7 +4280,6 @@ create_cursors (GtkWidget *widget)
"draw",
G_CALLBACK (cursor_draw),
NULL);
gtk_widget_set_events (darea, GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK);
g_signal_connect (darea, "button_press_event",
G_CALLBACK (cursor_event), entry);
gtk_widget_show (darea);
@ -6057,11 +6056,6 @@ shape_create_icon (GdkScreen *screen,
gtk_container_add (GTK_CONTAINER (window), fixed);
gtk_widget_show (fixed);
gtk_widget_set_events (window,
gtk_widget_get_events (window) |
GDK_BUTTON_MOTION_MASK |
GDK_BUTTON_PRESS_MASK);
gtk_widget_realize (window);
pixbuf = gdk_pixbuf_new_from_file (xpm_file, NULL);
@ -7836,8 +7830,6 @@ create_scroll_test (GtkWidget *widget)
gtk_box_pack_start (GTK_BOX (hbox), drawing_area);
gtk_widget_show (drawing_area);
gtk_widget_set_events (drawing_area, GDK_EXPOSURE_MASK | GDK_SCROLL_MASK);
adjustment = gtk_adjustment_new (0.0, 0.0, 1000.0, 1.0, 180.0, 200.0);
scroll_test_pos = 0.0;
@ -8123,7 +8115,6 @@ void create_layout (GtkWidget *widget)
gtk_scrollable_set_hadjustment (GTK_SCROLLABLE (layout), hadjustment);
gtk_scrollable_set_vadjustment (GTK_SCROLLABLE (layout), vadjustment);
gtk_widget_set_events (layout_widget, GDK_EXPOSURE_MASK);
g_signal_connect (layout, "draw",
G_CALLBACK (layout_draw_handler), NULL);

View File

@ -229,19 +229,14 @@ quit (void)
int
main (int argc, char *argv[])
{
GList *devices, *d;
GdkEventMask event_mask;
GtkWidget *window;
GtkWidget *drawing_area;
GtkWidget *vbox;
GtkWidget *button;
GdkWindow *gdk_win;
GdkSeat *seat;
gtk_init ();
seat = gdk_display_get_default_seat (gdk_display_get_default ());
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_name (window, "Test Input");
@ -282,28 +277,6 @@ main (int argc, char *argv[])
g_signal_connect (drawing_area, "proximity_out_event",
G_CALLBACK (proximity_out_event), NULL);
event_mask = GDK_EXPOSURE_MASK |
GDK_LEAVE_NOTIFY_MASK |
GDK_BUTTON_PRESS_MASK |
GDK_KEY_PRESS_MASK |
GDK_POINTER_MOTION_MASK |
GDK_PROXIMITY_OUT_MASK;
gtk_widget_set_events (drawing_area, event_mask);
devices = gdk_seat_get_slaves (seat, GDK_SEAT_CAPABILITY_ALL_POINTING);
for (d = devices; d; d = d->next)
{
GdkDevice *device;
device = d->data;
gtk_widget_set_device_events (drawing_area, device, event_mask);
gdk_device_set_mode (device, GDK_MODE_SCREEN);
}
g_list_free (devices);
gtk_widget_set_can_focus (drawing_area, TRUE);
gtk_widget_grab_focus (drawing_area);

View File

@ -344,7 +344,6 @@ test_chase (void)
gtk_window_set_title (GTK_WINDOW (win), "Chase");
overlay = gtk_overlay_new ();
gtk_widget_set_events (overlay, GDK_ENTER_NOTIFY_MASK|GDK_LEAVE_NOTIFY_MASK);
gtk_container_add (GTK_CONTAINER (win), overlay);
sw = gtk_scrolled_window_new (NULL, NULL);

View File

@ -57,7 +57,6 @@ main (int argc, char *argv[])
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_events (window, GDK_POINTER_MOTION_MASK);
g_signal_connect (window, "destroy", gtk_main_quit, NULL);
g_signal_connect (window, "map-event", G_CALLBACK (on_map_event), NULL);