[gtkmm] Update for the latest gtk+4 (remove most event signals)



commit ee3cad35480ae70f127f66c7fcd1fb4902a4142f
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Fri Jan 19 18:18:18 2018 +0100

    Update for the latest gtk+4 (remove most event signals)
    
    * gdk/src/display.hg: Remove supports_cursor_alpha(), supports_cursor_color(),
    get_default_cursor_size(), get_maximal_cursor_size().
    Add signal_setting_changed().
    * gtk/src/glarea.hg: Remove get/set/property_has_alpha().
    * gtk/src/widget.hg: Remove all event signals except signal_event(),
    signal_key_press_event() and signal_key_release_event().
    * gtk/src/window.hg: Add set/get/property_hide_on_close() and
    signal_close_request().
    * demos/gtk-demo/example_change_display.cc: Replace the removed
    signal_button_release_event() by signal_event().

 demos/gtk-demo/example_change_display.cc |   20 ++++++----
 gdk/src/display.hg                       |    6 +--
 gtk/src/glarea.hg                        |    3 -
 gtk/src/widget.hg                        |   60 +-----------------------------
 gtk/src/window.hg                        |    6 ++-
 5 files changed, 20 insertions(+), 75 deletions(-)
---
diff --git a/demos/gtk-demo/example_change_display.cc b/demos/gtk-demo/example_change_display.cc
index af10972..e1e1708 100644
--- a/demos/gtk-demo/example_change_display.cc
+++ b/demos/gtk-demo/example_change_display.cc
@@ -26,7 +26,7 @@
  *  - Using Gtk::Dialog
  */
 
-//TODO: Remove this undef when we know what to use instead of signal_button_release_event().
+//TODO: Remove this undef when we know what to use instead of signal_event().
 #undef GTKMM_DISABLE_DEPRECATED
 
 #include <gtkmm.h>
@@ -64,7 +64,7 @@ protected:
 
   virtual void on_display_closed(bool is_error, Glib::RefPtr<Gdk::Display> display);
 
-  virtual bool on_popup_button_release_event(const Glib::RefPtr<Gdk::EventButton>& event);
+  virtual bool on_popup_release_event(const Glib::RefPtr<Gdk::Event>& event);
 
   void on_response(int response_id) override;
 
@@ -314,10 +314,10 @@ Gtk::Window* Example_ChangeDisplay::query_for_toplevel(const Glib::RefPtr<Gdk::D
   if(grabbed == Gdk::GrabStatus::SUCCESS )
   {
     m_popup_clicked = false;
-    m_pPopup->signal_button_release_event().connect(
-      sigc::mem_fun(*this, &Example_ChangeDisplay::on_popup_button_release_event), false);
+    m_pPopup->signal_event().connect(
+      sigc::mem_fun(*this, &Example_ChangeDisplay::on_popup_release_event), false);
 
-    // Process events until clicked is set by button_release_event_cb.
+    // Process events until clicked is set by our button release event handler.
     // We pass in may_block=true since we want to wait if there
     // are no events currently.
     while (!m_popup_clicked)
@@ -358,10 +358,14 @@ Gtk::Widget* Example_ChangeDisplay::find_toplevel_at_pointer(const Glib::RefPtr<
 }
 
 
-bool Example_ChangeDisplay::on_popup_button_release_event(const Glib::RefPtr<Gdk::EventButton>& /* event */)
+bool Example_ChangeDisplay::on_popup_release_event(const Glib::RefPtr<Gdk::Event>& event)
 {
-  m_popup_clicked = true;
-  return true;
+  if (event->get_event_type() == Gdk::Event::Type::BUTTON_RELEASE)
+  {
+    m_popup_clicked = true;
+    return true;
+  }
+  return false;
 }
 
 Popup::Popup(const Glib::RefPtr<Gdk::Display>& display, const Glib::ustring& prompt)
diff --git a/gdk/src/display.hg b/gdk/src/display.hg
index 20587b1..cc88971 100644
--- a/gdk/src/display.hg
+++ b/gdk/src/display.hg
@@ -78,10 +78,6 @@ public:
   _WRAP_METHOD(const GdkKeymap* get_keymap() const, gdk_display_get_keymap, constversion)
 
   _WRAP_METHOD(void flush(), gdk_display_flush)
-  _WRAP_METHOD(bool supports_cursor_alpha() const, gdk_display_supports_cursor_alpha)
-  _WRAP_METHOD(bool supports_cursor_color() const, gdk_display_supports_cursor_color)
-  _WRAP_METHOD(guint get_default_cursor_size() const, gdk_display_get_default_cursor_size)
-  _WRAP_METHOD(void get_maximal_cursor_size(guint& width, guint& height), 
gdk_display_get_maximal_cursor_size)
 
   _WRAP_METHOD(Glib::RefPtr<Window> get_default_group(), gdk_display_get_default_group, refreturn)
   _WRAP_METHOD(Glib::RefPtr<const Window> get_default_group() const, gdk_display_get_default_group, 
refreturn, constversion)
@@ -135,6 +131,8 @@ public:
   _WRAP_SIGNAL(void monitor_added(const Glib::RefPtr<Monitor>& monitor), "monitor-added", no_default_handler)
   _WRAP_SIGNAL(void monitor_removed(const Glib::RefPtr<Monitor>& monitor), "monitor-removed", 
no_default_handler)
 
+  _WRAP_SIGNAL(void setting_changed(const Glib::ustring& setting), "setting-changed", no_default_handler)
+
   _WRAP_PROPERTY("composited", bool)
   _WRAP_PROPERTY("rgba", bool)
 
diff --git a/gtk/src/glarea.hg b/gtk/src/glarea.hg
index 6392ac9..1ef21a1 100644
--- a/gtk/src/glarea.hg
+++ b/gtk/src/glarea.hg
@@ -79,8 +79,6 @@ public:
    * @newin{3,18}
    */
   void unset_error();
-  _WRAP_METHOD(bool get_has_alpha() const, gtk_gl_area_get_has_alpha, newin "3,18")
-  _WRAP_METHOD(void set_has_alpha(bool has_alpha = true), gtk_gl_area_set_has_alpha, newin "3,18")
   _WRAP_METHOD(bool get_has_depth_buffer() const, gtk_gl_area_get_has_depth_buffer, newin "3,18")
   _WRAP_METHOD(void set_has_depth_buffer(bool has_depth_buffer = true), gtk_gl_area_set_has_depth_buffer, 
newin "3,18")
   _WRAP_METHOD(bool get_has_stencil_buffer() const, gtk_gl_area_get_has_stencil_buffer, newin "3,18")
@@ -94,7 +92,6 @@ public:
 
   _WRAP_PROPERTY("auto-render", bool, newin "3,18")
   _WRAP_PROPERTY("context", Glib::RefPtr<Gdk::GLContext>, newin "3,18")
-  _WRAP_PROPERTY("has-alpha", bool, newin "3,18")
   _WRAP_PROPERTY("has-depth-buffer", bool, newin "3,18")
   _WRAP_PROPERTY("has-stencil-buffer", bool, newin "3,18")
   _WRAP_PROPERTY("use-es", bool)
diff --git a/gtk/src/widget.hg b/gtk/src/widget.hg
index c80294f..5662822 100644
--- a/gtk/src/widget.hg
+++ b/gtk/src/widget.hg
@@ -99,8 +99,7 @@ class Widget
   _CLASS_GTKOBJECT(Widget,GtkWidget,GTK_WIDGET,Object,GObject)
   _IMPLEMENTS_INTERFACE(Buildable)
   _IMPLEMENTS_INTERFACE(Atk::Implementor, ifdef GTKMM_ATKMM_ENABLED)
-  _IGNORE(gtk_widget_destroy, gtk_widget_destroyed, gtk_widget_hide_on_delete,
-          gtk_widget_list_accel_closures)
+  _IGNORE(gtk_widget_destroy, gtk_widget_destroyed, gtk_widget_list_accel_closures)
 public:
   friend class Main;
   _CUSTOM_DTOR
@@ -582,29 +581,6 @@ public:
   _WRAP_SIGNAL(bool focus(DirectionType direction), "focus")
 #m4 _CONVERSION(`GdkEvent*',`const Glib::RefPtr<Gdk::Event>&',`Glib::wrap($3, true)')
   _WRAP_SIGNAL(bool event(const Glib::RefPtr<Gdk::Event>& gdk_event), "event", deprecated)
-  // The event_after signal can't have a default handler because the wrapped C signal has no default handler.
-#m4 _CONVERSION(`GdkEvent*',`const Glib::RefPtr<const Gdk::Event>&',`Glib::wrap($3, true)')
-  _WRAP_SIGNAL(void event_after(const Glib::RefPtr<const Gdk::Event>& gdk_event), "event_after", 
no_default_handler, deprecated)
-
-#m4 _CONVERSION(`GdkEventButton*',`const Glib::RefPtr<Gdk::EventButton>&',`Glib::wrap($3, true)')
-  /// Event triggered by user pressing button.
-  _WRAP_SIGNAL(bool button_press_event(const Glib::RefPtr<Gdk::EventButton>& 
button_event),"button_press_event", deprecated)
-
-  /// Event triggered by user releasing button.
-  _WRAP_SIGNAL(bool button_release_event(const Glib::RefPtr<Gdk::EventButton>& release_event), 
"button_release_event", deprecated)
-
-#m4 _CONVERSION(`GdkEventScroll*',`const Glib::RefPtr<Gdk::EventScroll>&',`Glib::wrap($3, true)')
-#m4 _CONVERSION(`const Glib::RefPtr<Gdk::EventScroll>&',`GdkEventScroll*',__CONVERT_REFPTR_TO_P)
-  _WRAP_SIGNAL(bool scroll_event(const Glib::RefPtr<Gdk::EventScroll>& scroll_event), "scroll_event", 
deprecated)
-
-#m4 _CONVERSION(`GdkEventMotion*',`const Glib::RefPtr<Gdk::EventMotion>&',`Glib::wrap($3, true)')
-#m4 _CONVERSION(`const Glib::RefPtr<Gdk::EventMotion>&',`GdkEventMotion*',__CONVERT_REFPTR_TO_P)
-  /// Event triggered by user moving pointer.
-  _WRAP_SIGNAL(bool motion_notify_event(const Glib::RefPtr<Gdk::EventMotion>& motion_event), 
"motion_notify_event", deprecated)
-
-#m4 _CONVERSION(`GdkEventAny*',`const Glib::RefPtr<Gdk::Event>&',`Glib::wrap((GdkEvent*)$3, true)')
-#m4 _CONVERSION(`const 
Glib::RefPtr<Gdk::Event>&',`GdkEventAny*',`reinterpret_cast<GdkEventAny*>(Glib::unwrap($3))')
-  _WRAP_SIGNAL(bool delete_event(const Glib::RefPtr<Gdk::Event>& any_event), "delete_event")
 
 #m4begin
 dnl// Hook in special code to catch explicit uses of gtk_object_destroy() by
@@ -633,31 +609,7 @@ dnl
   /// Event triggered by a key release will widget has focus.
   _WRAP_SIGNAL(bool key_release_event(const Glib::RefPtr<Gdk::EventKey>& key_event), "key_release_event")
 
-#m4 _CONVERSION(`GdkEventCrossing*',`const Glib::RefPtr<Gdk::EventCrossing>&',`Glib::wrap($3, true)')
-#m4 _CONVERSION(`const Glib::RefPtr<Gdk::EventCrossing>&',`GdkEventCrossing*',__CONVERT_REFPTR_TO_P)
-  /// Event triggered by pointer entering widget area.
-  _WRAP_SIGNAL(bool enter_notify_event(const Glib::RefPtr<Gdk::EventCrossing>& crossing_event), 
"enter_notify_event", deprecated)
-
-  /// Event triggered by pointer leaving widget area.
-  _WRAP_SIGNAL(bool leave_notify_event(const Glib::RefPtr<Gdk::EventCrossing>& crossing_event), 
"leave_notify_event", deprecated)
-
-#m4 _CONVERSION(`GdkEventConfigure*',`const Glib::RefPtr<Gdk::EventConfigure>&',`Glib::wrap($3, true)')
-#m4 _CONVERSION(`const Glib::RefPtr<Gdk::EventConfigure>&',`GdkEventConfigure*',__CONVERT_REFPTR_TO_P)
-  /// Event triggered by a window resizing.
-  _WRAP_SIGNAL(bool configure_event(const Glib::RefPtr<Gdk::EventConfigure>& configure_event), 
"configure_event")
-#m4 _CONVERSION(`GdkEventFocus*',`const Glib::RefPtr<Gdk::EventFocus>&',`Glib::wrap($3, true)')
-#m4 _CONVERSION(`const Glib::RefPtr<Gdk::EventFocus>&',`GdkEventFocus*',__CONVERT_REFPTR_TO_P)
-  _WRAP_SIGNAL(bool focus_in_event(const Glib::RefPtr<Gdk::EventFocus>& focus_event), "focus_in_event")
-  _WRAP_SIGNAL(bool focus_out_event(const Glib::RefPtr<Gdk::EventFocus>& gdk_event), "focus_out_event")
-  _WRAP_SIGNAL(bool map_event(const Glib::RefPtr<Gdk::Event>& any_event), "map_event")
-  _WRAP_SIGNAL(bool unmap_event(const Glib::RefPtr<Gdk::Event>& any_event), "unmap_event")
-#m4 _CONVERSION(`GdkEventProximity*',`const Glib::RefPtr<Gdk::EventProximity>&',`Glib::wrap($3, true)')
-#m4 _CONVERSION(`const Glib::RefPtr<Gdk::EventProximity>&',`GdkEventProximity*',__CONVERT_REFPTR_TO_P)
-  _WRAP_SIGNAL(bool proximity_in_event(const Glib::RefPtr<Gdk::EventProximity>& proximity_event), 
"proximity_in_event", deprecated)
-  _WRAP_SIGNAL(bool proximity_out_event(const Glib::RefPtr<Gdk::EventProximity>& proximity_event), 
"proximity_out_event", deprecated)
-
 #m4 _CONVERSION(`GdkDragContext*',`const Glib::RefPtr<Gdk::DragContext>&',Glib::wrap($3, true))
-
   _WRAP_SIGNAL(void drag_begin(const Glib::RefPtr<Gdk::DragContext>& context), "drag_begin")
   _WRAP_SIGNAL(void drag_end(const Glib::RefPtr<Gdk::DragContext>& context), "drag_end")
   //We use the optional custom_c_callback parameter with _WRAP_SIGNAL(),
@@ -685,19 +637,9 @@ _CONVERSION(`GdkDisplay*',`const Glib::RefPtr<Gdk::Display>&',`Glib::wrap($3, tr
   //Keybinding signals:
   _IGNORE_SIGNAL("keynav_failed")
 
-  _IGNORE_SIGNAL("destroy-event")
-
 #m4 _CONVERSION(`GtkTooltip*',`const Glib::RefPtr<Tooltip>&',`Glib::wrap($3, true)')
   _WRAP_SIGNAL(bool query_tooltip(int x, int y, bool keyboard_tooltip, const Glib::RefPtr<Tooltip>& 
tooltip), "query_tooltip")
 
-#m4 _CONVERSION(`GdkEventGrabBroken*',`const Glib::RefPtr<Gdk::EventGrabBroken>&',`Glib::wrap($3, true)')
-#m4 _CONVERSION(`const Glib::RefPtr<Gdk::EventGrabBroken>&',`GdkEventGrabBroken*',__CONVERT_REFPTR_TO_P)
-  _WRAP_SIGNAL(bool grab_broken_event(const Glib::RefPtr<Gdk::EventGrabBroken>& grab_broken_event), 
"grab_broken_event")
-
-#m4 _CONVERSION(`GdkEventTouch*',`const Glib::RefPtr<Gdk::EventTouch>&',`Glib::wrap($3, true)')
-#m4 _CONVERSION(`const Glib::RefPtr<Gdk::EventTouch>&',`GdkEventTouch*',__CONVERT_REFPTR_TO_P)
-  _WRAP_SIGNAL(bool touch_event(const Glib::RefPtr<Gdk::EventTouch>& touch_event), "touch_event", deprecated)
-
   _WRAP_PROPERTY("name", Glib::ustring)
   _WRAP_PROPERTY("parent", Container*)
   _WRAP_PROPERTY("width_request", int)
diff --git a/gtk/src/window.hg b/gtk/src/window.hg
index 4bbdb71..4e6bbd5 100644
--- a/gtk/src/window.hg
+++ b/gtk/src/window.hg
@@ -62,6 +62,7 @@ public:
   _WRAP_PROPERTY("default_width", int)
   _WRAP_PROPERTY("default_height", int)
   _WRAP_PROPERTY("destroy_with_parent", bool)
+  _WRAP_PROPERTY("hide-on-close", bool)
   _WRAP_PROPERTY("icon", Glib::RefPtr<Gdk::Texture>)
   _WRAP_PROPERTY("mnemonics-visible", bool)
   _WRAP_PROPERTY("icon-name", Glib::ustring)
@@ -85,8 +86,8 @@ public:
   _WRAP_PROPERTY("is-maximized", bool)
 
   _WRAP_SIGNAL(void set_focus(Widget* focus), "set_focus")
-
   _WRAP_SIGNAL(void keys_changed(), "keys_changed")
+  _WRAP_SIGNAL(bool close_request(), "close-request")
 
   //Keybinding signals:
   _IGNORE_SIGNAL("activate_focus")
@@ -188,6 +189,9 @@ dnl
   _WRAP_METHOD(bool get_destroy_with_parent() const, gtk_window_get_destroy_with_parent)
   // I don't that that this is ever a good thing for C++.murrayc.
 
+  _WRAP_METHOD(void set_hide_on_close(bool setting = true), gtk_window_set_hide_on_close)
+  _WRAP_METHOD(bool get_hide_on_close() const, gtk_window_get_hide_on_close)
+
   _WRAP_METHOD(void set_mnemonics_visible(bool setting = true), gtk_window_set_mnemonics_visible)
   _WRAP_METHOD(bool get_mnemonics_visible() const, gtk_window_get_mnemonics_visible)
 


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