[gtk+/wip/carlosg/event-delivery: 46/105] gtk: Mass delete all GtkWidget event mask API



commit e7c15211ce8fb4ba8812341422c78119000bff93
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Mar 31 18:58:16 2017 +0200

    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.

 demos/gtk-demo/css_multiplebgs.c     |    8 -
 demos/gtk-demo/drawingarea.c         |   11 -
 demos/gtk-demo/event_axes.c          |    8 -
 demos/gtk-demo/gestures.c            |    3 -
 docs/reference/gtk/gtk4-sections.txt |    6 -
 examples/drawing.c                   |    8 -
 gtk/gtkbutton.c                      |    7 +-
 gtk/gtkcalendar.c                    |   11 +-
 gtk/gtkclipboard.c                   |    3 -
 gtk/gtkcoloreditor.c                 |    8 -
 gtk/gtkcolorplane.c                  |    7 +-
 gtk/gtkcolorscale.c                  |    2 -
 gtk/gtkcolorswatch.c                 |    7 +-
 gtk/gtkcombobox.c                    |    2 -
 gtk/gtkdnd.c                         |    1 -
 gtk/gtkdragsource.c                  |    5 -
 gtk/gtkentry.c                       |    9 +-
 gtk/gtkeventbox.c                    |   16 +--
 gtk/gtkexpander.c                    |    6 +-
 gtk/gtkfixed.c                       |    4 +-
 gtk/gtkflowbox.c                     |   10 +-
 gtk/gtkfontchooserwidget.c           |    2 -
 gtk/gtkglarea.c                      |    2 +-
 gtk/gtkiconview.c                    |   10 +-
 gtk/gtklabel.c                       |    7 +-
 gtk/gtklayout.c                      |    5 +-
 gtk/gtklistbox.c                     |    7 +-
 gtk/gtkmagnifier.c                   |    3 -
 gtk/gtkmenu.c                        |   10 +-
 gtk/gtkmenuitem.c                    |    7 +-
 gtk/gtknotebook.c                    |    8 +-
 gtk/gtkoverlay.c                     |    2 +-
 gtk/gtkpaned.c                       |    9 +-
 gtk/gtkpathbar.c                     |    4 +-
 gtk/gtkpopover.c                     |    8 +-
 gtk/gtkrange.c                       |    9 +-
 gtk/gtkrevealer.c                    |    4 +-
 gtk/gtkscalebutton.c                 |    2 -
 gtk/gtkscrolledwindow.c              |    7 +-
 gtk/gtkseparatortoolitem.c           |    5 +-
 gtk/gtkspinbutton.c                  |    4 -
 gtk/gtkstack.c                       |   15 +--
 gtk/gtkswitch.c                      |    8 +-
 gtk/gtktexthandle.c                  |    6 -
 gtk/gtktextview.c                    |    8 +-
 gtk/gtktoolbar.c                     |    7 +-
 gtk/gtktoolitem.c                    |    2 +-
 gtk/gtktoolitemgroup.c               |    5 +-
 gtk/gtktoolpalette.c                 |    7 +-
 gtk/gtktreeview.c                    |   18 +--
 gtk/gtktreeviewcolumn.c              |    8 +-
 gtk/gtkviewport.c                    |    6 +-
 gtk/gtkwidget.c                      |  350 ----------------------------------
 gtk/gtkwidget.h                      |   20 --
 gtk/gtkwindow.c                      |   27 +--
 gtk/inspector/inspect-button.c       |    6 -
 tests/motion-compression.c           |    1 -
 tests/testgtk.c                      |    9 -
 tests/testinput.c                    |   27 ---
 tests/testoverlay.c                  |    1 -
 tests/testpopup.c                    |    1 -
 61 files changed, 52 insertions(+), 737 deletions(-)
---
diff --git a/demos/gtk-demo/css_multiplebgs.c b/demos/gtk-demo/css_multiplebgs.c
index 2d8d935..920109c 100644
--- a/demos/gtk-demo/css_multiplebgs.c
+++ b/demos/gtk-demo/css_multiplebgs.c
@@ -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);
diff --git a/demos/gtk-demo/drawingarea.c b/demos/gtk-demo/drawingarea.c
index ec48399..a6a685b 100644
--- a/demos/gtk-demo/drawingarea.c
+++ b/demos/gtk-demo/drawingarea.c
@@ -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))
diff --git a/demos/gtk-demo/event_axes.c b/demos/gtk-demo/event_axes.c
index e1539f8..82ec258 100644
--- a/demos/gtk-demo/event_axes.c
+++ b/demos/gtk-demo/event_axes.c
@@ -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",
diff --git a/demos/gtk-demo/gestures.c b/demos/gtk-demo/gestures.c
index 1e49756..67d1e10 100644
--- a/demos/gtk-demo/gestures.c
+++ b/demos/gtk-demo/gestures.c
@@ -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,
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index fc71646..3741130 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -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
diff --git a/examples/drawing.c b/examples/drawing.c
index b5d1114..dfd7dbc 100644
--- a/examples/drawing.c
+++ b/examples/drawing.c
@@ -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);
 }
 
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index 951eb18..047653a 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -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);
 }
diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c
index dd2d78f..9618323 100644
--- a/gtk/gtkcalendar.c
+++ b/gtk/gtkcalendar.c
@@ -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);
diff --git a/gtk/gtkclipboard.c b/gtk/gtkclipboard.c
index 5314c82..b46e3b0 100644
--- a/gtk/gtkclipboard.c
+++ b/gtk/gtkclipboard.c
@@ -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",
diff --git a/gtk/gtkcoloreditor.c b/gtk/gtkcoloreditor.c
index 07dcfcc..e23fcab 100644
--- a/gtk/gtkcoloreditor.c
+++ b/gtk/gtkcoloreditor.c
@@ -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");
diff --git a/gtk/gtkcolorplane.c b/gtk/gtkcolorplane.c
index e3a66d7..8e3f453 100644
--- a/gtk/gtkcolorplane.c
+++ b/gtk/gtkcolorplane.c
@@ -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);
 
diff --git a/gtk/gtkcolorscale.c b/gtk/gtkcolorscale.c
index 417caef..928addb 100644
--- a/gtk/gtkcolorscale.c
+++ b/gtk/gtkcolorscale.c
@@ -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);
diff --git a/gtk/gtkcolorswatch.c b/gtk/gtkcolorswatch.c
index d3465b3..f395daf 100644
--- a/gtk/gtkcolorswatch.c
+++ b/gtk/gtkcolorswatch.c
@@ -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);
 }
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index c6f364c..e07a183 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -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");
diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c
index 6f89917..1a04427 100644
--- a/gtk/gtkdnd.c
+++ b/gtk/gtkdnd.c
@@ -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),
diff --git a/gtk/gtkdragsource.c b/gtk/gtkdragsource.c
index 9c627e9..e6bc185 100644
--- a/gtk/gtkdragsource.c
+++ b/gtk/gtkdragsource.c
@@ -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)
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 9b1e876..493eedc 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -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);
 
diff --git a/gtk/gtkeventbox.c b/gtk/gtkeventbox.c
index d8bb6a6..f739bb7 100644
--- a/gtk/gtkeventbox.c
+++ b/gtk/gtkeventbox.c
@@ -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);
     }
diff --git a/gtk/gtkexpander.c b/gtk/gtkexpander.c
index a256396..836bde9 100644
--- a/gtk/gtkexpander.c
+++ b/gtk/gtkexpander.c
@@ -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);
 }
diff --git a/gtk/gtkfixed.c b/gtk/gtkfixed.c
index 6a05363..2915676 100644
--- a/gtk/gtkfixed.c
+++ b/gtk/gtkfixed.c
@@ -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);
diff --git a/gtk/gtkflowbox.c b/gtk/gtkflowbox.c
index 3499fbb..c83fb32 100644
--- a/gtk/gtkflowbox.c
+++ b/gtk/gtkflowbox.c
@@ -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);
diff --git a/gtk/gtkfontchooserwidget.c b/gtk/gtkfontchooserwidget.c
index 1b0a7e4..76a8450 100644
--- a/gtk/gtkfontchooserwidget.c
+++ b/gtk/gtkfontchooserwidget.c
@@ -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));
diff --git a/gtk/gtkglarea.c b/gtk/gtkglarea.c
index 8f8f9f5..df380a0 100644
--- a/gtk/gtkglarea.c
+++ b/gtk/gtkglarea.c
@@ -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);
 
diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c
index e96b13a..8aef1fb 100644
--- a/gtk/gtkiconview.c
+++ b/gtk/gtkiconview.c
@@ -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)});
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index 39aa48b..b5d6900 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -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)
diff --git a/gtk/gtklayout.c b/gtk/gtklayout.c
index fe73830..e6c37cc 100644
--- a/gtk/gtklayout.c
+++ b/gtk/gtklayout.c
@@ -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),
diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c
index b9dd5f6..832ac5a 100644
--- a/gtk/gtklistbox.c
+++ b/gtk/gtklistbox.c
@@ -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);
 
diff --git a/gtk/gtkmagnifier.c b/gtk/gtkmagnifier.c
index f34f1bb..5b3560c 100644
--- a/gtk/gtkmagnifier.c
+++ b/gtk/gtkmagnifier.c
@@ -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;
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index 2a87460..3b699f1 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -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,
diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c
index c659d3a..90fdf61 100644
--- a/gtk/gtkmenuitem.c
+++ b/gtk/gtkmenuitem.c
@@ -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);
 }
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 7bb5890..9cd090e 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -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);
 }
diff --git a/gtk/gtkoverlay.c b/gtk/gtkoverlay.c
index d547a72..0422a4f 100644
--- a/gtk/gtkoverlay.c
+++ b/gtk/gtkoverlay.c
@@ -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);
 
diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c
index 9014875..66e4737 100644
--- a/gtk/gtkpaned.c
+++ b/gtk/gtkpaned.c
@@ -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))
diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c
index 1c19243..6516c2d 100644
--- a/gtk/gtkpathbar.c
+++ b/gtk/gtkpathbar.c
@@ -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)
     {
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index e392766..95b363e 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -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);
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index 77f6b52..de1e784 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -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);
 }
diff --git a/gtk/gtkrevealer.c b/gtk/gtkrevealer.c
index 9e9a6c8..4e53baf 100644
--- a/gtk/gtkrevealer.c
+++ b/gtk/gtkrevealer.c
@@ -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);
 
diff --git a/gtk/gtkscalebutton.c b/gtk/gtkscalebutton.c
index 8423cd6..5cc939a 100644
--- a/gtk/gtkscalebutton.c
+++ b/gtk/gtkscalebutton.c
@@ -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");
 }
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index 1a22923..69c8260 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -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);
diff --git a/gtk/gtkseparatortoolitem.c b/gtk/gtkseparatortoolitem.c
index 5e0e0d6..9d11cf5 100644
--- a/gtk/gtkseparatortoolitem.c
+++ b/gtk/gtkseparatortoolitem.c
@@ -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);
 }
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index 64d3d09..bb1883b 100644
--- a/gtk/gtkspinbutton.c
+++ b/gtk/gtkspinbutton.c
@@ -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;
diff --git a/gtk/gtkstack.c b/gtk/gtkstack.c
index 2171cfc..1cde1ae 100644
--- a/gtk/gtkstack.c
+++ b/gtk/gtkstack.c
@@ -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);
diff --git a/gtk/gtkswitch.c b/gtk/gtkswitch.c
index 5077b69..991efde 100644
--- a/gtk/gtkswitch.c
+++ b/gtk/gtkswitch.c
@@ -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);
 }
diff --git a/gtk/gtktexthandle.c b/gtk/gtktexthandle.c
index 04373fe..eff87c7 100644
--- a/gtk/gtktexthandle.c
+++ b/gtk/gtktexthandle.c
@@ -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);
 
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index e04007e..1011388 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -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});
diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c
index 2df9cb7..b4191c4 100644
--- a/gtk/gtktoolbar.c
+++ b/gtk/gtktoolbar.c
@@ -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);
 }
diff --git a/gtk/gtktoolitem.c b/gtk/gtktoolitem.c
index e7a8a8b..666ef4b 100644
--- a/gtk/gtktoolitem.c
+++ b/gtk/gtktoolitem.c
@@ -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);
 }
diff --git a/gtk/gtktoolitemgroup.c b/gtk/gtktoolitemgroup.c
index e8448c9..190ddd6 100644
--- a/gtk/gtktoolitemgroup.c
+++ b/gtk/gtktoolitemgroup.c
@@ -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);
 
diff --git a/gtk/gtktoolpalette.c b/gtk/gtktoolpalette.c
index a168679..1c934fd 100644
--- a/gtk/gtktoolpalette.c
+++ b/gtk/gtktoolpalette.c
@@ -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);
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 538e87d..cd50179 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -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,
diff --git a/gtk/gtktreeviewcolumn.c b/gtk/gtktreeviewcolumn.c
index 0e17119..df93677 100644
--- a/gtk/gtktreeviewcolumn.c
+++ b/gtk/gtktreeviewcolumn.c
@@ -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");
diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c
index ff8933c..38dd437 100644
--- a/gtk/gtkviewport.c
+++ b/gtk/gtkviewport.c
@@ -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),
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index a550394..41d5246 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -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,
@@ -9903,84 +9831,6 @@ gtk_widget_has_size_request (GtkWidget *widget)
 }
 
 /**
- * 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 widget’s 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 can’t 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 widget’s 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 can’t 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
  * @device: a #GdkDevice
@@ -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
@@ -10266,58 +9985,6 @@ gtk_widget_get_settings (GtkWidget *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
  * @ancestor: another #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]);
@@ -15406,17 +15068,6 @@ event_controller_grab_notify (GtkWidget           *widget,
 }
 
 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,
                                          GtkEventSequenceState  state,
@@ -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
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index ded422a..34a1e47 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -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);
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 9e8221e..d6efac7 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -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;
diff --git a/gtk/inspector/inspect-button.c b/gtk/inspector/inspect-button.c
index e481ec4..fde9a7a 100644
--- a/gtk/inspector/inspect-button.c
+++ b/gtk/inspector/inspect-button.c
@@ -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);
     }
diff --git a/tests/motion-compression.c b/tests/motion-compression.c
index a7d67f8..1dc7469 100644
--- a/tests/motion-compression.c
+++ b/tests/motion-compression.c
@@ -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);
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 93f8c96..1c0097b 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -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);
 
diff --git a/tests/testinput.c b/tests/testinput.c
index a7ccd8b..ef3503e 100644
--- a/tests/testinput.c
+++ b/tests/testinput.c
@@ -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);
 
diff --git a/tests/testoverlay.c b/tests/testoverlay.c
index 774731c..583443b 100644
--- a/tests/testoverlay.c
+++ b/tests/testoverlay.c
@@ -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);
diff --git a/tests/testpopup.c b/tests/testpopup.c
index a78498d..8037b3e 100644
--- a/tests/testpopup.c
+++ b/tests/testpopup.c
@@ -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);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]