[glom/gtkmm4v4] gtkmm4: Adapt to GdkEvent* to Gdk::Event* API change.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom/gtkmm4v4] gtkmm4: Adapt to GdkEvent* to Gdk::Event* API change.
- Date: Mon, 19 Jun 2017 18:39:58 +0000 (UTC)
commit 58d2501b3327b8962057d2d2da64c1541ff2003c
Author: Murray Cumming <murrayc murrayc com>
Date: Mon Jun 19 10:08:17 2017 +0200
gtkmm4: Adapt to GdkEvent* to Gdk::Event* API change.
glom/appwindow.cc | 2 +-
glom/appwindow.h | 2 +-
glom/mode_data/box_data_calendar_related.cc | 15 ++++---
glom/mode_data/box_data_calendar_related.h | 2 +-
glom/mode_data/buttonglom.cc | 13 ++++--
glom/mode_data/buttonglom.h | 2 +-
.../datawidget/cellrenderer_buttonimage.cc | 2 +-
.../datawidget/cellrenderer_buttonimage.h | 2 +-
.../datawidget/cellrenderer_buttontext.cc | 2 +-
.../mode_data/datawidget/cellrenderer_buttontext.h | 2 +-
glom/mode_data/datawidget/checkbutton.cc | 14 ++++--
glom/mode_data/datawidget/checkbutton.h | 2 +-
glom/mode_data/datawidget/combo.cc | 13 ++++--
glom/mode_data/datawidget/combo.h | 2 +-
.../mode_data/datawidget/combo_as_radio_buttons.cc | 17 +++++---
glom/mode_data/datawidget/combo_as_radio_buttons.h | 6 +-
glom/mode_data/datawidget/datawidget.cc | 13 ++++--
glom/mode_data/datawidget/datawidget.h | 2 +-
glom/mode_data/datawidget/entry.cc | 16 ++++---
glom/mode_data/datawidget/entry.h | 4 +-
glom/mode_data/datawidget/label.cc | 13 ++++--
glom/mode_data/datawidget/label.h | 2 +-
glom/mode_data/datawidget/textview.cc | 15 ++++---
glom/mode_data/datawidget/textview.h | 4 +-
glom/mode_data/db_adddel/db_adddel.cc | 17 +++++---
glom/mode_data/db_adddel/db_adddel.h | 4 +-
glom/mode_data/flowtablewithfields.cc | 15 ++++---
glom/mode_data/flowtablewithfields.h | 4 +-
.../print_layouts/window_print_layout_edit.cc | 16 ++++----
.../print_layouts/window_print_layout_edit.h | 8 ++--
glom/print_layout/canvas_print_layout.cc | 2 +-
glom/print_layout/canvas_print_layout.h | 2 +-
glom/utility_widgets/adddel/adddel.cc | 19 +++++----
glom/utility_widgets/adddel/adddel.h | 4 +-
.../canvas/canvas_group_resizable.cc | 24 ++++++------
.../canvas/canvas_group_resizable.h | 24 ++++++------
glom/utility_widgets/canvas/canvas_item_movable.cc | 42 ++++++++++----------
glom/utility_widgets/canvas/canvas_item_movable.h | 10 ++--
glom/utility_widgets/canvas/canvas_line_movable.cc | 4 +-
glom/utility_widgets/canvas/canvas_line_movable.h | 4 +-
glom/utility_widgets/imageglom.cc | 19 +++++----
glom/utility_widgets/imageglom.h | 2 +-
glom/utility_widgets/notebooklabelglom.cc | 13 ++++--
glom/utility_widgets/notebooklabelglom.h | 2 +-
44 files changed, 222 insertions(+), 180 deletions(-)
---
diff --git a/glom/appwindow.cc b/glom/appwindow.cc
index 3c01e03..2a98e2e 100644
--- a/glom/appwindow.cc
+++ b/glom/appwindow.cc
@@ -2759,7 +2759,7 @@ void AppWindow::add(Gtk::Widget& child)
m_vbox_placeHolder.pack_start(child);
}
-bool AppWindow::on_delete_event(GdkEventAny* /* event */)
+bool AppWindow::on_delete_event(Gdk::Event& /* event */)
{
//Clicking on the [x] in the title bar should be like choosing File|Close
on_menu_file_close();
diff --git a/glom/appwindow.h b/glom/appwindow.h
index dbbb31c..9eb3953 100644
--- a/glom/appwindow.h
+++ b/glom/appwindow.h
@@ -199,7 +199,7 @@ protected:
void ui_hide() override;
void ui_bring_to_front() override;
- bool on_delete_event(GdkEventAny* event) override;
+ bool on_delete_event(Gdk::Event& event) override;
void on_menu_edit_copy_activate();
void on_menu_edit_cut_activate();
diff --git a/glom/mode_data/box_data_calendar_related.cc b/glom/mode_data/box_data_calendar_related.cc
index 4d247f3..ddcf26a 100644
--- a/glom/mode_data/box_data_calendar_related.cc
+++ b/glom/mode_data/box_data_calendar_related.cc
@@ -503,7 +503,7 @@ void Box_Data_Calendar_Related::setup_menu(Gtk::Widget* /* this */)
#endif // !GLOM_ENABLE_CLIENT_ONLY
}
-void Box_Data_Calendar_Related::on_calendar_button_press_event(GdkEventButton *button_event)
+void Box_Data_Calendar_Related::on_calendar_button_press_event(Gdk::EventButton& button_event)
{
#ifndef GLOM_ENABLE_CLIENT_ONLY
//Enable/Disable items.
@@ -516,17 +516,20 @@ void Box_Data_Calendar_Related::on_calendar_button_press_event(GdkEventButton *b
}
#endif
- GdkModifierType mods;
- gdk_window_get_device_position( gtk_widget_get_window(Gtk::Widget::gobj()), button_event->device, nullptr,
nullptr, &mods );
- if(mods & GDK_BUTTON3_MASK)
+ auto gdkwindow = get_window();
+ int x = 0;
+ int y = 0;
+ Gdk::ModifierType mods;
+ gdkwindow->get_device_position(button_event.get_device(), x, y, mods);
+ if((mods & Gdk::ModifierType::BUTTON3_MASK) == Gdk::ModifierType::BUTTON3_MASK)
{
//Give user choices of actions on this item:
- m_menu_popup->popup(button_event->button, button_event->time);
+ m_menu_popup->popup(button_event.get_button(), button_event.get_time());
return; //handled.
}
else
{
- if(button_event->type == GDK_2BUTTON_PRESS)
+ if(button_event.get_event_type() == Gdk::Event::Type::DOUBLE_BUTTON_PRESS)
{
//Double-click means edit.
//Don't do this usually, because users sometimes double-click by accident when they just want to edit
a cell.
diff --git a/glom/mode_data/box_data_calendar_related.h b/glom/mode_data/box_data_calendar_related.h
index 339c26f..ab47cfa 100644
--- a/glom/mode_data/box_data_calendar_related.h
+++ b/glom/mode_data/box_data_calendar_related.h
@@ -72,7 +72,7 @@ private:
void on_calendar_month_changed();
void setup_menu(Gtk::Widget* widget);
- void on_calendar_button_press_event(GdkEventButton *event);
+ void on_calendar_button_press_event(Gdk::EventButton& event);
void on_MenuPopup_activate_Edit();
diff --git a/glom/mode_data/buttonglom.cc b/glom/mode_data/buttonglom.cc
index a0617db..245f35f 100644
--- a/glom/mode_data/buttonglom.cc
+++ b/glom/mode_data/buttonglom.cc
@@ -77,17 +77,20 @@ void ButtonGlom::on_menu_properties_activate()
delete dialog;
}
-bool ButtonGlom::on_button_press_event(GdkEventButton *button_event)
+bool ButtonGlom::on_button_press_event(Gdk::EventButton& button_event)
{
auto pApp = get_appwindow();
if(pApp && pApp->get_userlevel() == AppState::userlevels::DEVELOPER)
{
- GdkModifierType mods;
- gdk_window_get_device_position( gtk_widget_get_window (Gtk::Widget::gobj()), button_event->device,
nullptr, nullptr, &mods );
- if(mods & GDK_BUTTON3_MASK)
+ auto gdkwindow = get_window();
+ Gdk::ModifierType mods;
+ int x = 0;
+ int y = 0;
+ gdkwindow->get_device_position(button_event.get_device(), x, y, mods);
+ if((mods & Gdk::ModifierType::BUTTON3_MASK) == Gdk::ModifierType::BUTTON3_MASK)
{
//Give user choices of actions on this item:
- m_popup_menu_utils->popup(button_event->button, button_event->time);
+ m_popup_menu_utils->popup(button_event.get_button(), button_event.get_time());
return true; //We handled this event.
}
}
diff --git a/glom/mode_data/buttonglom.h b/glom/mode_data/buttonglom.h
index 31bbfc7..9db96ce 100644
--- a/glom/mode_data/buttonglom.h
+++ b/glom/mode_data/buttonglom.h
@@ -46,7 +46,7 @@ private:
#ifndef GLOM_ENABLE_CLIENT_ONLY
void on_menu_properties_activate() override;
- bool on_button_press_event(GdkEventButton *event) override;
+ bool on_button_press_event(Gdk::EventButton& event) override;
#endif // !GLOM_ENABLE_CLIENT_ONLY
};
diff --git a/glom/mode_data/datawidget/cellrenderer_buttonimage.cc
b/glom/mode_data/datawidget/cellrenderer_buttonimage.cc
index ba52f83..5cfc8ee 100644
--- a/glom/mode_data/datawidget/cellrenderer_buttonimage.cc
+++ b/glom/mode_data/datawidget/cellrenderer_buttonimage.cc
@@ -37,7 +37,7 @@ GlomCellRenderer_ButtonImage::type_signal_clicked GlomCellRenderer_ButtonImage::
return m_signal_clicked;
}
-bool GlomCellRenderer_ButtonImage::activate_vfunc(GdkEvent* event, Gtk::Widget& widget, const Glib::ustring&
path, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, Gtk::CellRendererState flags)
+bool GlomCellRenderer_ButtonImage::activate_vfunc(Gdk::Event& event, Gtk::Widget& widget, const
Glib::ustring& path, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area,
Gtk::CellRendererState flags)
{
//TODO: It would be nice to depress this like a real button.
diff --git a/glom/mode_data/datawidget/cellrenderer_buttonimage.h
b/glom/mode_data/datawidget/cellrenderer_buttonimage.h
index ecf62a0..ec53d00 100644
--- a/glom/mode_data/datawidget/cellrenderer_buttonimage.h
+++ b/glom/mode_data/datawidget/cellrenderer_buttonimage.h
@@ -38,7 +38,7 @@ public:
private:
- bool activate_vfunc(GdkEvent* event, Gtk::Widget& widget, const Glib::ustring& path, const Gdk::Rectangle&
background_area, const Gdk::Rectangle& cell_area, Gtk::CellRendererState flags) override;
+ bool activate_vfunc(Gdk::Event& event, Gtk::Widget& widget, const Glib::ustring& path, const
Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, Gtk::CellRendererState flags) override;
type_signal_clicked m_signal_clicked;
};
diff --git a/glom/mode_data/datawidget/cellrenderer_buttontext.cc
b/glom/mode_data/datawidget/cellrenderer_buttontext.cc
index 4e879aa..bbb3388 100644
--- a/glom/mode_data/datawidget/cellrenderer_buttontext.cc
+++ b/glom/mode_data/datawidget/cellrenderer_buttontext.cc
@@ -37,7 +37,7 @@ GlomCellRenderer_ButtonText::type_signal_clicked GlomCellRenderer_ButtonText::si
return m_signal_clicked;
}
-bool GlomCellRenderer_ButtonText::activate_vfunc(GdkEvent* event, Gtk::Widget& widget, const Glib::ustring&
path, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, Gtk::CellRendererState flags)
+bool GlomCellRenderer_ButtonText::activate_vfunc(Gdk::Event& event, Gtk::Widget& widget, const
Glib::ustring& path, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area,
Gtk::CellRendererState flags)
{
//TODO: It would be nice to depress this like a real button.
diff --git a/glom/mode_data/datawidget/cellrenderer_buttontext.h
b/glom/mode_data/datawidget/cellrenderer_buttontext.h
index 7848430..10b9cc4 100644
--- a/glom/mode_data/datawidget/cellrenderer_buttontext.h
+++ b/glom/mode_data/datawidget/cellrenderer_buttontext.h
@@ -38,7 +38,7 @@ public:
private:
- bool activate_vfunc(GdkEvent* event, Gtk::Widget& widget, const Glib::ustring& path, const Gdk::Rectangle&
background_area, const Gdk::Rectangle& cell_area, Gtk::CellRendererState flags) override;
+ bool activate_vfunc(Gdk::Event& event, Gtk::Widget& widget, const Glib::ustring& path, const
Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, Gtk::CellRendererState flags) override;
type_signal_clicked m_signal_clicked;
};
diff --git a/glom/mode_data/datawidget/checkbutton.cc b/glom/mode_data/datawidget/checkbutton.cc
index 814ea8e..850cb7a 100644
--- a/glom/mode_data/datawidget/checkbutton.cc
+++ b/glom/mode_data/datawidget/checkbutton.cc
@@ -38,7 +38,7 @@ CheckButton::CheckButton(const Glib::ustring& title)
}
#ifndef GLOM_ENABLE_CLIENT_ONLY
-bool CheckButton::on_button_press_event(GdkEventButton *button_event)
+bool CheckButton::on_button_press_event(Gdk::EventButton& button_event)
{
//Enable/Disable items.
//We did this earlier, but get_appwindow is more likely to work now:
@@ -56,16 +56,20 @@ bool CheckButton::on_button_press_event(GdkEventButton *button_event)
//TODO: It would be better to add it somehow to the standard context menu.
if(pApp->get_userlevel() == AppState::userlevels::DEVELOPER)
{
- GdkModifierType mods;
- gdk_window_get_device_position( gtk_widget_get_window (Gtk::Widget::gobj()), button_event->device,
nullptr, nullptr, &mods );
- if(mods & GDK_BUTTON3_MASK)
+ auto gdkwindow = get_window();
+ Gdk::ModifierType mods;
+ int x = 0;
+ int y = 0;
+ gdkwindow->get_device_position(button_event.get_device(), x, y, mods);
+ if((mods & Gdk::ModifierType::BUTTON3_MASK) == Gdk::ModifierType::BUTTON3_MASK)
{
//Give user choices of actions on this item:
- m_menu_popup->popup(button_event->button, button_event->time);
+ m_menu_popup->popup(button_event.get_button(), button_event.get_time());
return true; //We handled this event.
}
}
}
+
return Gtk::CheckButton::on_button_press_event(button_event);
}
#endif // !GLOM_ENABLE_CLIENT_ONLY
diff --git a/glom/mode_data/datawidget/checkbutton.h b/glom/mode_data/datawidget/checkbutton.h
index 7ad055a..cc72763 100644
--- a/glom/mode_data/datawidget/checkbutton.h
+++ b/glom/mode_data/datawidget/checkbutton.h
@@ -48,7 +48,7 @@ public:
private:
#ifndef GLOM_ENABLE_CLIENT_ONLY
- bool on_button_press_event(GdkEventButton *event) override;
+ bool on_button_press_event(Gdk::EventButton& event) override;
#endif // !GLOM_ENABLE_CLIENT_ONLY
AppWindow* get_appwindow() const override;
diff --git a/glom/mode_data/datawidget/combo.cc b/glom/mode_data/datawidget/combo.cc
index b3d5d49..33d3499 100644
--- a/glom/mode_data/datawidget/combo.cc
+++ b/glom/mode_data/datawidget/combo.cc
@@ -300,7 +300,7 @@ Gnome::Gda::Value ComboGlom::get_value() const
}
#ifndef GLOM_ENABLE_CLIENT_ONLY
-bool ComboGlom::on_button_press_event(GdkEventButton *button_event)
+bool ComboGlom::on_button_press_event(Gdk::EventButton& button_event)
{
g_warning("ComboGlom::on_button_press_event()");
@@ -320,12 +320,15 @@ g_warning("ComboGlom::on_button_press_event()");
//TODO: It would be better to add it somehow to the standard context menu.
if(pApp->get_userlevel() == AppState::userlevels::DEVELOPER)
{
- GdkModifierType mods;
- gdk_window_get_device_position( gtk_widget_get_window (Gtk::Widget::gobj()), button_event->device,
nullptr, nullptr, &mods );
- if(mods & GDK_BUTTON3_MASK)
+ auto gdkwindow = get_window();
+ Gdk::ModifierType mods;
+ int x = 0;
+ int y = 0;
+ gdkwindow->get_device_position(button_event.get_device(), x, y, mods);
+ if((mods & Gdk::ModifierType::BUTTON3_MASK) == Gdk::ModifierType::BUTTON3_MASK)
{
//Give user choices of actions on this item:
- m_menu_popup->popup(button_event->button, button_event->time);
+ m_menu_popup->popup(button_event.get_button(), button_event.get_time());
return true; //We handled this event.
}
}
diff --git a/glom/mode_data/datawidget/combo.h b/glom/mode_data/datawidget/combo.h
index 19ab865..dd6e120 100644
--- a/glom/mode_data/datawidget/combo.h
+++ b/glom/mode_data/datawidget/combo.h
@@ -72,7 +72,7 @@ private:
void check_for_change();
#ifndef GLOM_ENABLE_CLIENT_ONLY
- bool on_button_press_event(GdkEventButton *event) override;
+ bool on_button_press_event(Gdk::EventButton& event) override;
#endif // !GLOM_ENABLE_CLIENT_ONLY
AppWindow* get_appwindow() const override;
diff --git a/glom/mode_data/datawidget/combo_as_radio_buttons.cc
b/glom/mode_data/datawidget/combo_as_radio_buttons.cc
index 25e4000..5c51aba 100644
--- a/glom/mode_data/datawidget/combo_as_radio_buttons.cc
+++ b/glom/mode_data/datawidget/combo_as_radio_buttons.cc
@@ -248,7 +248,7 @@ Glib::ustring ComboAsRadioButtons::get_text() const
}
#ifndef GLOM_ENABLE_CLIENT_ONLY
-void ComboAsRadioButtons::show_context_menu(GdkEventButton *button_event)
+void ComboAsRadioButtons::show_context_menu(Gdk::EventButton& button_event)
{
std::cout << "ComboAsRadioButtons::show_context_menu()\n";
auto pApp = get_appwindow();
@@ -267,24 +267,27 @@ void ComboAsRadioButtons::show_context_menu(GdkEventButton *button_event)
//TODO: It would be better to add it somehow to the standard context menu.
if(pApp->get_userlevel() == AppState::userlevels::DEVELOPER)
{
- GdkModifierType mods;
- gdk_window_get_device_position( gtk_widget_get_window (Gtk::Widget::gobj()), button_event->device,
nullptr, nullptr, &mods );
- if(mods & GDK_BUTTON3_MASK)
+ auto gdkwindow = get_window();
+ Gdk::ModifierType mods;
+ int x = 0;
+ int y = 0;
+ gdkwindow->get_device_position(button_event.get_device(), x, y, mods);
+ if((mods & Gdk::ModifierType::BUTTON3_MASK) == Gdk::ModifierType::BUTTON3_MASK)
{
//Give user choices of actions on this item:
- m_menu_popup->popup(button_event->button, button_event->time);
+ m_menu_popup->popup(button_event.get_button(), button_event.get_time());
}
}
}
}
-bool ComboAsRadioButtons::on_radiobutton_button_press_event(GdkEventButton *button_event)
+bool ComboAsRadioButtons::on_radiobutton_button_press_event(Gdk::EventButton& button_event)
{
show_context_menu(button_event);
return false; //Let other signal handlers handle it too.
}
-bool ComboAsRadioButtons::on_button_press_event(GdkEventButton *button_event)
+bool ComboAsRadioButtons::on_button_press_event(Gdk::EventButton& button_event)
{
show_context_menu(button_event);
diff --git a/glom/mode_data/datawidget/combo_as_radio_buttons.h
b/glom/mode_data/datawidget/combo_as_radio_buttons.h
index cc8cd7f..32c54c8 100644
--- a/glom/mode_data/datawidget/combo_as_radio_buttons.h
+++ b/glom/mode_data/datawidget/combo_as_radio_buttons.h
@@ -82,9 +82,9 @@ private:
#ifndef GLOM_ENABLE_CLIENT_ONLY
- bool on_button_press_event(GdkEventButton *event) override;
- bool on_radiobutton_button_press_event(GdkEventButton *event);
- void show_context_menu(GdkEventButton *event);
+ bool on_button_press_event(Gdk::EventButton& event) override;
+ bool on_radiobutton_button_press_event(Gdk::EventButton& event);
+ void show_context_menu(Gdk::EventButton& event);
#endif // !GLOM_ENABLE_CLIENT_ONLY
AppWindow* get_appwindow() const override;
diff --git a/glom/mode_data/datawidget/datawidget.cc b/glom/mode_data/datawidget/datawidget.cc
index f48ac96..5611271 100644
--- a/glom/mode_data/datawidget/datawidget.cc
+++ b/glom/mode_data/datawidget/datawidget.cc
@@ -414,7 +414,7 @@ void DataWidget::set_editable(bool editable)
}
#ifndef GLOM_ENABLE_CLIENT_ONLY
-bool DataWidget::on_button_press_event(GdkEventButton *button_event)
+bool DataWidget::on_button_press_event(Gdk::EventButton& button_event)
{
//g_warning("DataWidget::on_button_press_event_popup");
@@ -435,12 +435,15 @@ bool DataWidget::on_button_press_event(GdkEventButton *button_event)
//TODO: It would be better to add it somehow to the standard context menu.
if(pApp->get_userlevel() == AppState::userlevels::DEVELOPER)
{
- GdkModifierType mods;
- gdk_window_get_device_position( gtk_widget_get_window (Gtk::Widget::gobj()), button_event->device,
nullptr, nullptr, &mods );
- if(mods & GDK_BUTTON3_MASK)
+ auto gdkwindow = get_window();
+ Gdk::ModifierType mods;
+ int x = 0;
+ int y = 0;
+ gdkwindow->get_device_position(button_event.get_device(), x, y, mods);
+ if((mods & Gdk::ModifierType::BUTTON3_MASK) == Gdk::ModifierType::BUTTON3_MASK)
{
//Give user choices of actions on this item:
- m_menu_popup->popup(button_event->button, button_event->time);
+ m_menu_popup->popup(button_event.get_button(), button_event.get_time());
return true; //We handled this event.
}
}
diff --git a/glom/mode_data/datawidget/datawidget.h b/glom/mode_data/datawidget/datawidget.h
index 51f0be0..e8494ee 100644
--- a/glom/mode_data/datawidget/datawidget.h
+++ b/glom/mode_data/datawidget/datawidget.h
@@ -94,7 +94,7 @@ private:
//Overrides of default signal handlers:
void on_widget_edited(); //From Gtk::Entry, or Gtk::CheckButton.
#ifndef GLOM_ENABLE_CLIENT_ONLY
- bool on_button_press_event(GdkEventButton* button_event) override;
+ bool on_button_press_event(Gdk::EventButton& button_event) override;
void on_child_user_requested_layout();
void on_child_user_requested_layout_properties();
void on_child_layout_item_added(LayoutWidgetBase::enumType item_type);
diff --git a/glom/mode_data/datawidget/entry.cc b/glom/mode_data/datawidget/entry.cc
index 60b1260..7416595 100644
--- a/glom/mode_data/datawidget/entry.cc
+++ b/glom/mode_data/datawidget/entry.cc
@@ -108,7 +108,7 @@ void Entry::check_for_change()
}
}
-bool Entry::on_focus_out_event(GdkEventFocus* focus_event)
+bool Entry::on_focus_out_event(Gdk::EventFocus& focus_event)
{
const auto result = Gtk::Entry::on_focus_out_event(focus_event);
@@ -178,7 +178,7 @@ Gnome::Gda::Value Entry::get_value() const
}
#ifndef GLOM_ENABLE_CLIENT_ONLY
-bool Entry::on_button_press_event(GdkEventButton *button_event)
+bool Entry::on_button_press_event(Gdk::EventButton& button_event)
{
//Enable/Disable items.
//We did this earlier, but get_appwindow is more likely to work now:
@@ -196,16 +196,18 @@ bool Entry::on_button_press_event(GdkEventButton *button_event)
//TODO: It would be better to add it somehow to the standard context menu.
if(pApp->get_userlevel() == AppState::userlevels::DEVELOPER)
{
- GdkModifierType mods;
- gdk_window_get_device_position( gtk_widget_get_window (Gtk::Widget::gobj()), button_event->device,
nullptr, nullptr, &mods );
- if(mods & GDK_BUTTON3_MASK)
+ auto gdkwindow = get_window();
+ Gdk::ModifierType mods;
+ int x = 0;
+ int y = 0;
+ gdkwindow->get_device_position(button_event.get_device(), x, y, mods);
+ if((mods & Gdk::ModifierType::BUTTON3_MASK) == Gdk::ModifierType::BUTTON3_MASK)
{
//Give user choices of actions on this item:
- m_menu_popup->popup(button_event->button, button_event->time);
+ m_menu_popup->popup(button_event.get_button(), button_event.get_time());
return true; //We handled this event.
}
}
-
}
return Gtk::Entry::on_button_press_event(button_event);
diff --git a/glom/mode_data/datawidget/entry.h b/glom/mode_data/datawidget/entry.h
index 34e2302..1f19e6f 100644
--- a/glom/mode_data/datawidget/entry.h
+++ b/glom/mode_data/datawidget/entry.h
@@ -67,12 +67,12 @@ private:
//Overrides of default signal handlers:
void on_changed() override; //From Gtk::Entry.
void on_activate() override; //From Gtk::Entry.
- bool on_focus_out_event(GdkEventFocus* focus_event) override; //From Gtk::Widget
+ bool on_focus_out_event(Gdk::EventFocus& focus_event) override; //From Gtk::Widget
void check_for_change();
#ifndef GLOM_ENABLE_CLIENT_ONLY
- bool on_button_press_event(GdkEventButton *event) override;
+ bool on_button_press_event(Gdk::EventButton& event) override;
#endif // !GLOM_ENABLE_CLIENT_ONLY
AppWindow* get_appwindow() const override;
diff --git a/glom/mode_data/datawidget/label.cc b/glom/mode_data/datawidget/label.cc
index d9020a2..fddbec2 100644
--- a/glom/mode_data/datawidget/label.cc
+++ b/glom/mode_data/datawidget/label.cc
@@ -95,17 +95,20 @@ void Label::on_menu_properties_activate()
delete dialog;
}
-bool Label::on_button_press_event(GdkEventButton *button_event)
+bool Label::on_button_press_event(Gdk::EventButton& button_event)
{
auto pApp = get_appwindow();
if(pApp && pApp->get_userlevel() == AppState::userlevels::DEVELOPER)
{
- GdkModifierType mods;
- gdk_window_get_device_position( gtk_widget_get_window (Gtk::Widget::gobj()), button_event->device,
nullptr, nullptr, &mods );
- if(mods & GDK_BUTTON3_MASK)
+ auto gdkwindow = get_window();
+ Gdk::ModifierType mods;
+ int x = 0;
+ int y = 0;
+ gdkwindow->get_device_position(button_event.get_device(), x, y, mods);
+ if((mods & Gdk::ModifierType::BUTTON3_MASK) == Gdk::ModifierType::BUTTON3_MASK)
{
//Give user choices of actions on this item:
- m_popup_menu_utils->popup(button_event->button, button_event->time);
+ m_popup_menu_utils->popup(button_event.get_button(), button_event.get_time());
return true; //We handled this event.
}
}
diff --git a/glom/mode_data/datawidget/label.h b/glom/mode_data/datawidget/label.h
index 14ba9ff..f0798ce 100644
--- a/glom/mode_data/datawidget/label.h
+++ b/glom/mode_data/datawidget/label.h
@@ -54,7 +54,7 @@ private:
Gtk::Label m_label;
#ifndef GLOM_ENABLE_CLIENT_ONLY
- bool on_button_press_event(GdkEventButton *event) override;
+ bool on_button_press_event(Gdk::EventButton& event) override;
void on_menu_properties_activate() override;
#endif // !GLOM_ENABLE_CLIENT_ONLY
diff --git a/glom/mode_data/datawidget/textview.cc b/glom/mode_data/datawidget/textview.cc
index 4f6598f..5bcb33a 100644
--- a/glom/mode_data/datawidget/textview.cc
+++ b/glom/mode_data/datawidget/textview.cc
@@ -100,7 +100,7 @@ void TextView::check_for_change()
}
}
-bool TextView::on_textview_focus_out_event(GdkEventFocus* focus_event)
+bool TextView::on_textview_focus_out_event(Gdk::EventFocus& focus_event)
{
//Call base class:
bool result = Gtk::ScrolledWindow::on_focus_out_event(focus_event);
@@ -137,7 +137,7 @@ Gnome::Gda::Value TextView::get_value() const
}
#ifndef GLOM_ENABLE_CLIENT_ONLY
-bool TextView::on_button_press_event(GdkEventButton *button_event)
+bool TextView::on_button_press_event(Gdk::EventButton& button_event)
{
//Enable/Disable items.
//We did this earlier, but get_appwindow is more likely to work now:
@@ -155,12 +155,15 @@ bool TextView::on_button_press_event(GdkEventButton *button_event)
//TODO: It would be better to add it somehow to the standard context menu.
if(pApp->get_userlevel() == AppState::userlevels::DEVELOPER)
{
- GdkModifierType mods;
- gdk_window_get_device_position( gtk_widget_get_window (Gtk::Widget::gobj()), button_event->device,
nullptr, nullptr, &mods );
- if(mods & GDK_BUTTON3_MASK)
+ auto gdkwindow = get_window();
+ Gdk::ModifierType mods;
+ int x = 0;
+ int y = 0;
+ gdkwindow->get_device_position(button_event.get_device(), x, y, mods);
+ if((mods & Gdk::ModifierType::BUTTON3_MASK) == Gdk::ModifierType::BUTTON3_MASK)
{
//Give user choices of actions on this item:
- m_menu_popup->popup(button_event->button, button_event->time);
+ m_menu_popup->popup(button_event.get_button(), button_event.get_time());
return true; //We handled this event.
}
}
diff --git a/glom/mode_data/datawidget/textview.h b/glom/mode_data/datawidget/textview.h
index 3c2e081..e984b77 100644
--- a/glom/mode_data/datawidget/textview.h
+++ b/glom/mode_data/datawidget/textview.h
@@ -66,12 +66,12 @@ public:
private:
void init();
- bool on_textview_focus_out_event(GdkEventFocus* focus_event);
+ bool on_textview_focus_out_event(Gdk::EventFocus& focus_event);
void check_for_change();
#ifndef GLOM_ENABLE_CLIENT_ONLY
- bool on_button_press_event(GdkEventButton *event) override;
+ bool on_button_press_event(Gdk::EventButton& event) override;
#endif
AppWindow* get_appwindow() const override;
diff --git a/glom/mode_data/db_adddel/db_adddel.cc b/glom/mode_data/db_adddel/db_adddel.cc
index 779057b..92056ce 100644
--- a/glom/mode_data/db_adddel/db_adddel.cc
+++ b/glom/mode_data/db_adddel/db_adddel.cc
@@ -272,7 +272,7 @@ void DbAddDel::setup_menu(Gtk::Widget* /* widget */)
#endif // !GLOM_ENABLE_CLIENT_ONLY
}
-bool DbAddDel::on_button_press_event_Popup(GdkEventButton *button_event)
+bool DbAddDel::on_button_press_event_Popup(Gdk::EventButton& button_event)
{
#ifndef GLOM_ENABLE_CLIENT_ONLY
//Enable/Disable items.
@@ -285,17 +285,20 @@ bool DbAddDel::on_button_press_event_Popup(GdkEventButton *button_event)
}
#endif
- GdkModifierType mods;
- gdk_window_get_device_position( gtk_widget_get_window(Gtk::Widget::gobj()), button_event->device, nullptr,
nullptr, &mods );
- if(mods & GDK_BUTTON3_MASK)
+ auto gdkwindow = get_window();
+ Gdk::ModifierType mods;
+ int x = 0;
+ int y = 0;
+ gdkwindow->get_device_position(button_event.get_device(), x, y, mods);
+ if((mods & Gdk::ModifierType::BUTTON3_MASK) == Gdk::ModifierType::BUTTON3_MASK)
{
//Give user choices of actions on this item:
- m_menu_popup->popup(button_event->button, button_event->time);
+ m_menu_popup->popup(button_event.get_button(), button_event.get_time());
return true; //handled.
}
else
{
- if(button_event->type == GDK_2BUTTON_PRESS)
+ if(button_event.get_event_type() == Gdk::Event::Type::DOUBLE_BUTTON_PRESS)
{
//Double-click means edit.
//Don't do this usually, because users sometimes double-click by accident when they just want to edit
a cell.
@@ -1510,7 +1513,7 @@ void DbAddDel::on_treeview_cell_edited(const Glib::ustring& path_string, const G
}
}
-void DbAddDel::on_treeview_button_press_event(GdkEventButton* button_event)
+void DbAddDel::on_treeview_button_press_event(Gdk::EventButton& button_event)
{
on_button_press_event_Popup(button_event);
}
diff --git a/glom/mode_data/db_adddel/db_adddel.h b/glom/mode_data/db_adddel/db_adddel.h
index da115ff..5ee1d95 100644
--- a/glom/mode_data/db_adddel/db_adddel.h
+++ b/glom/mode_data/db_adddel/db_adddel.h
@@ -324,8 +324,8 @@ private:
void on_treeview_columns_changed();
- bool on_button_press_event_Popup(GdkEventButton* button_event);
- void on_treeview_button_press_event(GdkEventButton* button_event);
+ bool on_button_press_event_Popup(Gdk::EventButton& button_event);
+ void on_treeview_button_press_event(Gdk::EventButton& button_event);
void on_treeview_selection_changed();
protected:
diff --git a/glom/mode_data/flowtablewithfields.cc b/glom/mode_data/flowtablewithfields.cc
index e1e260a..be1d3e6 100644
--- a/glom/mode_data/flowtablewithfields.cc
+++ b/glom/mode_data/flowtablewithfields.cc
@@ -1305,23 +1305,26 @@ void FlowTableWithFields::on_menu_delete_activate()
}
}
-void FlowTableWithFields::on_event_box_button_press_event(GdkEventButton *button_event)
+void FlowTableWithFields::on_event_box_button_press_event(Gdk::EventButton& button_event)
{
// Re-use the handler for the parent FlowTableWithFields:
on_button_press_event(button_event);
}
-bool FlowTableWithFields::on_button_press_event(GdkEventButton *button_event)
+bool FlowTableWithFields::on_button_press_event(Gdk::EventButton& button_event)
{
auto pApp = AppWindow::get_appwindow();
if(pApp && pApp->get_userlevel() == AppState::userlevels::DEVELOPER)
{
- GdkModifierType mods;
- gdk_window_get_device_position( gtk_widget_get_window (Gtk::Widget::gobj()), button_event->device,
nullptr, nullptr, &mods );
- if(mods & GDK_BUTTON3_MASK)
+ auto gdkwindow = get_window();
+ Gdk::ModifierType mods;
+ int x = 0;
+ int y = 0;
+ gdkwindow->get_device_position(button_event.get_device(), x, y, mods);
+ if((mods & Gdk::ModifierType::BUTTON3_MASK) == Gdk::ModifierType::BUTTON3_MASK)
{
//Give user choices of actions on this item:
- m_popup_menu_utils->popup(button_event->button, button_event->time);
+ m_popup_menu_utils->popup(button_event.get_button(), button_event.get_time());
return true; //We handled this event.
}
}
diff --git a/glom/mode_data/flowtablewithfields.h b/glom/mode_data/flowtablewithfields.h
index 8aafffe..591f26a 100644
--- a/glom/mode_data/flowtablewithfields.h
+++ b/glom/mode_data/flowtablewithfields.h
@@ -284,9 +284,9 @@ private:
#ifndef GLOM_ENABLE_CLIENT_ONLY
void on_menu_properties_activate() override;
void on_menu_delete_activate() override; // override this to add a dialog box
- bool on_button_press_event(GdkEventButton *event) override;
+ bool on_button_press_event(Gdk::EventButton& event) override;
- void on_event_box_button_press_event(GdkEventButton *event);
+ void on_event_box_button_press_event(Gdk::EventButton& event);
#endif // !GLOM_ENABLE_CLIENT_ONLY
};
diff --git a/glom/mode_design/print_layouts/window_print_layout_edit.cc
b/glom/mode_design/print_layouts/window_print_layout_edit.cc
index dd056c5..2fe8a3b 100644
--- a/glom/mode_design/print_layouts/window_print_layout_edit.cc
+++ b/glom/mode_design/print_layouts/window_print_layout_edit.cc
@@ -711,12 +711,12 @@ void Window_PrintLayout_Edit::setup_context_menu()
m_context_menu->attach_to_widget(*this);
}
-void Window_PrintLayout_Edit::on_canvas_motion_notify_event(GdkEventMotion* motion_event)
+void Window_PrintLayout_Edit::on_canvas_motion_notify_event(Gdk::EventMotion& motion_event)
{
//Notice that, unlike drag-motion, motion-notify-event's x/y position already
//seems to have the scrolling taken into account.
- double x = motion_event->x;
- double y = motion_event->y;
+ double x = motion_event.get_x();
+ double y = motion_event.get_y();
canvas_convert_from_drag_pixels(x, y, false /* do not adjust for scrolling */);
//gimp_ruler_set_position(m_hruler, x);
@@ -1334,7 +1334,7 @@ void Window_PrintLayout_Edit::on_scroll_value_changed()
//gimp_ruler_set_range(m_vruler, y, y + height, y + height);
}
-bool Window_PrintLayout_Edit::on_configure_event(GdkEventConfigure* configure_event)
+bool Window_PrintLayout_Edit::on_configure_event(Gdk::EventConfigure& configure_event)
{
const auto result = Gtk::Window::on_configure_event(configure_event);
@@ -1592,9 +1592,9 @@ void Window_PrintLayout_Edit::on_spinbutton_height()
m_spinbutton_height->get_value());
}
-bool Window_PrintLayout_Edit::on_hruler_button_press_event(GdkEventButton* button_event)
+bool Window_PrintLayout_Edit::on_hruler_button_press_event(Gdk::EventButton& button_event)
{
- if(button_event->button != 1)
+ if(button_event.get_button() != 1)
return true;
m_temp_rule_horizontal = true;
@@ -1602,9 +1602,9 @@ bool Window_PrintLayout_Edit::on_hruler_button_press_event(GdkEventButton* butto
return false;
}
-bool Window_PrintLayout_Edit::on_vruler_button_press_event(GdkEventButton* button_event)
+bool Window_PrintLayout_Edit::on_vruler_button_press_event(Gdk::EventButton& button_event)
{
- if(button_event->button != 1)
+ if(button_event.get_button() != 1)
return true;
m_temp_rule_horizontal = false; //vertical.
diff --git a/glom/mode_design/print_layouts/window_print_layout_edit.h
b/glom/mode_design/print_layouts/window_print_layout_edit.h
index f0d99fc..54bf288 100644
--- a/glom/mode_design/print_layouts/window_print_layout_edit.h
+++ b/glom/mode_design/print_layouts/window_print_layout_edit.h
@@ -92,7 +92,7 @@ private:
void on_menu_align_left();
void on_menu_align_right();
- void on_canvas_motion_notify_event(GdkEventMotion* motion_event);
+ void on_canvas_motion_notify_event(Gdk::EventMotion& motion_event);
void on_canvas_show_context_menu(guint button, guint32 activate_time);
void on_context_menu_insert_field();
void on_context_menu_insert_text();
@@ -115,11 +115,11 @@ private:
void on_spinbutton_width();
void on_spinbutton_height();
- bool on_hruler_button_press_event(GdkEventButton* button_event);
- bool on_vruler_button_press_event(GdkEventButton* button_event);
+ bool on_hruler_button_press_event(Gdk::EventButton& button_event);
+ bool on_vruler_button_press_event(Gdk::EventButton& button_event);
//override:
- bool on_configure_event(GdkEventConfigure* configure_event) override;
+ bool on_configure_event(Gdk::EventConfigure& configure_event) override;
void do_menu_view_show_grid(bool active);
void do_menu_view_show_rules(bool active);
diff --git a/glom/print_layout/canvas_print_layout.cc b/glom/print_layout/canvas_print_layout.cc
index 7d17e51..065a200 100644
--- a/glom/print_layout/canvas_print_layout.cc
+++ b/glom/print_layout/canvas_print_layout.cc
@@ -315,7 +315,7 @@ void Canvas_PrintLayout::on_item_show_context_menu(guint button, guint32 activat
m_context_menu->popup(button, activate_time);
}
-void Canvas_PrintLayout::on_background_button_press_event(const Glib::RefPtr<Goocanvas::Item>& /* target */,
GdkEventButton* /* event */)
+void Canvas_PrintLayout::on_background_button_press_event(const Glib::RefPtr<Goocanvas::Item>& /* target */,
Gdk::EventButton& /* event */)
{
//A click on empty space should deselect any selected items:
select_all(false);
diff --git a/glom/print_layout/canvas_print_layout.h b/glom/print_layout/canvas_print_layout.h
index 52bd1f1..853e1e4 100644
--- a/glom/print_layout/canvas_print_layout.h
+++ b/glom/print_layout/canvas_print_layout.h
@@ -124,7 +124,7 @@ private:
void on_context_menu_edit();
void on_context_menu_formatting();
void on_context_menu_delete();
- void on_background_button_press_event(const Glib::RefPtr<Goocanvas::Item>& target, GdkEventButton*
button_event);
+ void on_background_button_press_event(const Glib::RefPtr<Goocanvas::Item>& target, Gdk::EventButton&
button_event);
void on_dialog_format_hide();
#endif
diff --git a/glom/utility_widgets/adddel/adddel.cc b/glom/utility_widgets/adddel/adddel.cc
index 0b22ba6..9376b44 100644
--- a/glom/utility_widgets/adddel/adddel.cc
+++ b/glom/utility_widgets/adddel/adddel.cc
@@ -215,18 +215,21 @@ void AddDel::setup_menu(Gtk::Widget* /* widget */)
m_menu_popup->attach_to_widget(*this);
}
-void AddDel::on_button_press_event_Popup(GdkEventButton *button_event)
-{
- GdkModifierType mods;
- gdk_window_get_device_position( gtk_widget_get_window (Gtk::Widget::gobj()), button_event->device,
nullptr, nullptr, &mods );
- if(mods & GDK_BUTTON3_MASK)
+void AddDel::on_button_press_event_Popup(Gdk::EventButton& button_event)
+{
+ auto gdkwindow = get_window();
+ Gdk::ModifierType mods;
+ int x = 0;
+ int y = 0;
+ gdkwindow->get_device_position(button_event.get_device(), x, y, mods);
+ if((mods & Gdk::ModifierType::BUTTON3_MASK) == Gdk::ModifierType::BUTTON3_MASK)
{
//Give user choices of actions on this item:
- m_menu_popup->popup(button_event->button, button_event->time);
+ m_menu_popup->popup(button_event.get_button(), button_event.get_time());
}
else
{
- if(button_event->type == GDK_2BUTTON_PRESS)
+ if(button_event.get_event_type() == Gdk::Event::Type::DOUBLE_BUTTON_PRESS)
{
//Double-click means edit.
//Disable this, because it is confusing when single-click activates editable cells too.
@@ -1267,7 +1270,7 @@ AddDel::type_signal_user_activated AddDel::signal_user_activated()
return m_signal_user_activated;
}
-void AddDel::on_treeview_button_press_event(GdkEventButton* button_event)
+void AddDel::on_treeview_button_press_event(Gdk::EventButton& button_event)
{
on_button_press_event_Popup(button_event);
}
diff --git a/glom/utility_widgets/adddel/adddel.h b/glom/utility_widgets/adddel/adddel.h
index f9357d0..9fa7625 100644
--- a/glom/utility_widgets/adddel/adddel.h
+++ b/glom/utility_widgets/adddel/adddel.h
@@ -256,9 +256,9 @@ private:
void on_treeview_columns_changed();
- void on_button_press_event_Popup(GdkEventButton* button_event);
+ void on_button_press_event_Popup(Gdk::EventButton& button_event);
- void on_treeview_button_press_event(GdkEventButton* button_event);
+ void on_treeview_button_press_event(Gdk::EventButton& button_event);
bool row_has_duplicates(const Gtk::TreeModel::const_iterator& iter) const;
void warn_about_duplicate();
diff --git a/glom/utility_widgets/canvas/canvas_group_resizable.cc
b/glom/utility_widgets/canvas/canvas_group_resizable.cc
index 888c7a2..0babca6 100644
--- a/glom/utility_widgets/canvas/canvas_group_resizable.cc
+++ b/glom/utility_widgets/canvas/canvas_group_resizable.cc
@@ -631,14 +631,14 @@ void CanvasGroupResizable::on_manipulator_line_end_moved(const Glib::RefPtr<Canv
position_extras();
}
-bool CanvasGroupResizable::on_manipulator_enter_notify_event(const Glib::RefPtr<Goocanvas::Item>& /* target
*/, GdkEventCrossing* /* event */)
+bool CanvasGroupResizable::on_manipulator_enter_notify_event(const Glib::RefPtr<Goocanvas::Item>& /* target
*/, Gdk::EventCrossing& /* event */)
{
m_in_manipulator = true;
set_manipulators_visibility(Goocanvas::ItemVisibility::VISIBLE);
return false;
}
-bool CanvasGroupResizable::on_manipulator_leave_notify_event(const Glib::RefPtr<Goocanvas::Item>& /* target
*/, GdkEventCrossing* /* event */)
+bool CanvasGroupResizable::on_manipulator_leave_notify_event(const Glib::RefPtr<Goocanvas::Item>& /* target
*/, Gdk::EventCrossing& /* event */)
{
m_in_manipulator = false;
set_manipulators_visibility(Goocanvas::ItemVisibility::INVISIBLE);
@@ -720,12 +720,12 @@ void CanvasGroupResizable::on_manipulator_edge_moved(const Glib::RefPtr<CanvasIt
}
-void CanvasGroupResizable::on_child_button_press_event(const Glib::RefPtr<Goocanvas::Item>& target,
GdkEventButton* event)
+void CanvasGroupResizable::on_child_button_press_event(const Glib::RefPtr<Goocanvas::Item>& target,
Gdk::EventButton& event)
{
CanvasItemMovable::on_button_press_event(target, event);
}
-void CanvasGroupResizable::on_child_motion_notify_event(const Glib::RefPtr<Goocanvas::Item>& target,
GdkEventMotion* event)
+void CanvasGroupResizable::on_child_motion_notify_event(const Glib::RefPtr<Goocanvas::Item>& target,
Gdk::EventMotion& event)
{
//std::cout << "CanvasGroupResizable::on_motion_notify_event()\n";
@@ -734,7 +734,7 @@ void CanvasGroupResizable::on_child_motion_notify_event(const Glib::RefPtr<Gooca
position_extras();
}
-void CanvasGroupResizable::on_child_button_release_event(const Glib::RefPtr<Goocanvas::Item>& target,
GdkEventButton* event)
+void CanvasGroupResizable::on_child_button_release_event(const Glib::RefPtr<Goocanvas::Item>& target,
Gdk::EventButton& event)
{
CanvasItemMovable::on_button_release_event(target, event);
}
@@ -742,17 +742,17 @@ void CanvasGroupResizable::on_child_button_release_event(const Glib::RefPtr<Gooc
/*
-bool CanvasGroupResizable::on_manipulator_button_press_event(const Glib::RefPtr<Goocanvas::Item>& target,
GdkEventButton* event, Manipulators manipulator)
+bool CanvasGroupResizable::on_manipulator_button_press_event(const Glib::RefPtr<Goocanvas::Item>& target,
Gdk::EventButton& event, Manipulators manipulator)
{
return true;
}
-bool CanvasGroupResizable::on_manipulator_button_release_event(const Glib::RefPtr<Goocanvas::Item>& target,
GdkEventButton* event, Manipulators manipulator)
+bool CanvasGroupResizable::on_manipulator_button_release_event(const Glib::RefPtr<Goocanvas::Item>& target,
Gdk::EventButton& event, Manipulators manipulator)
{
return true;
}
-bool CanvasGroupResizable::on_manipulator_motion_notify_event(const Glib::RefPtr<Goocanvas::Item>& target,
GdkEventMotion* event, Manipulators manipulator)
+bool CanvasGroupResizable::on_manipulator_motion_notify_event(const Glib::RefPtr<Goocanvas::Item>& target,
Gdk::EventMotion& event, Manipulators manipulator)
{
return true;
}
@@ -787,14 +787,14 @@ void CanvasGroupResizable::set_manipulators_visibility(Goocanvas::ItemVisibility
}
-bool CanvasGroupResizable::on_rect_enter_notify_event(const Glib::RefPtr<Goocanvas::Item>& /* target */,
GdkEventCrossing* /* event */)
+bool CanvasGroupResizable::on_rect_enter_notify_event(const Glib::RefPtr<Goocanvas::Item>& /* target */,
Gdk::EventCrossing& /* event */)
{
set_manipulators_visibility(Goocanvas::ItemVisibility::VISIBLE);
return true;
}
-bool CanvasGroupResizable::on_rect_leave_notify_event(const Glib::RefPtr<Goocanvas::Item>& /* target */,
GdkEventCrossing* /* event */)
+bool CanvasGroupResizable::on_rect_leave_notify_event(const Glib::RefPtr<Goocanvas::Item>& /* target */,
Gdk::EventCrossing& /* event */)
{
//std::cout << "CanvasGroupResizable::on_rect_leave_notify_event\n";
@@ -808,7 +808,7 @@ bool CanvasGroupResizable::on_rect_leave_notify_event(const Glib::RefPtr<Goocanv
return false;
}
-bool CanvasGroupResizable::on_resizer_enter_notify_event(const Glib::RefPtr<Goocanvas::Item>& target,
GdkEventCrossing* event)
+bool CanvasGroupResizable::on_resizer_enter_notify_event(const Glib::RefPtr<Goocanvas::Item>& target,
Gdk::EventCrossing& event)
{
CanvasItemMovable::on_enter_notify_event(target, event);
@@ -817,7 +817,7 @@ bool CanvasGroupResizable::on_resizer_enter_notify_event(const Glib::RefPtr<Gooc
return true;
}
-bool CanvasGroupResizable::on_resizer_leave_notify_event(const Glib::RefPtr<Goocanvas::Item>& target,
GdkEventCrossing* event)
+bool CanvasGroupResizable::on_resizer_leave_notify_event(const Glib::RefPtr<Goocanvas::Item>& target,
Gdk::EventCrossing& event)
{
CanvasItemMovable::on_leave_notify_event(target, event);
diff --git a/glom/utility_widgets/canvas/canvas_group_resizable.h
b/glom/utility_widgets/canvas/canvas_group_resizable.h
index 66a0f82..0eaa59a 100644
--- a/glom/utility_widgets/canvas/canvas_group_resizable.h
+++ b/glom/utility_widgets/canvas/canvas_group_resizable.h
@@ -88,16 +88,16 @@ private:
void snap_position(Corners corner, double& x, double& y) const;
- bool on_rect_enter_notify_event(const Glib::RefPtr<Goocanvas::Item>& target, GdkEventCrossing* event);
- bool on_rect_leave_notify_event(const Glib::RefPtr<Goocanvas::Item>& target, GdkEventCrossing* event);
+ bool on_rect_enter_notify_event(const Glib::RefPtr<Goocanvas::Item>& target, Gdk::EventCrossing& event);
+ bool on_rect_leave_notify_event(const Glib::RefPtr<Goocanvas::Item>& target, Gdk::EventCrossing& event);
- bool on_resizer_enter_notify_event(const Glib::RefPtr<Goocanvas::Item>& target, GdkEventCrossing* event);
- bool on_resizer_leave_notify_event(const Glib::RefPtr<Goocanvas::Item>& target, GdkEventCrossing* event);
+ bool on_resizer_enter_notify_event(const Glib::RefPtr<Goocanvas::Item>& target, Gdk::EventCrossing& event);
+ bool on_resizer_leave_notify_event(const Glib::RefPtr<Goocanvas::Item>& target, Gdk::EventCrossing& event);
- void on_child_button_press_event(const Glib::RefPtr<Goocanvas::Item>& target, GdkEventButton* event);
- void on_child_button_release_event(const Glib::RefPtr<Goocanvas::Item>& target, GdkEventButton* event);
- void on_child_motion_notify_event(const Glib::RefPtr<Goocanvas::Item>& target, GdkEventMotion* event);
+ void on_child_button_press_event(const Glib::RefPtr<Goocanvas::Item>& target, Gdk::EventButton& event);
+ void on_child_button_release_event(const Glib::RefPtr<Goocanvas::Item>& target, Gdk::EventButton& event);
+ void on_child_motion_notify_event(const Glib::RefPtr<Goocanvas::Item>& target, Gdk::EventMotion& event);
enum class Manipulators
{
@@ -143,15 +143,15 @@ private:
void on_manipulator_corner_moved(const Glib::RefPtr<CanvasItemMovable>& item, double x_offset, double
y_offset, Manipulators manipulator_id);
void on_manipulator_edge_moved(const Glib::RefPtr<CanvasItemMovable>& item, double x_offset, double
y_offset, Manipulators manipulator_id);
void on_manipulator_line_end_moved(const Glib::RefPtr<CanvasItemMovable>& item, double x_offset, double
y_offset, Manipulators manipulator_id);
- bool on_manipulator_enter_notify_event(const Glib::RefPtr<Goocanvas::Item>& target, GdkEventCrossing*
event);
- bool on_manipulator_leave_notify_event(const Glib::RefPtr<Goocanvas::Item>& target, GdkEventCrossing*
event);
+ bool on_manipulator_enter_notify_event(const Glib::RefPtr<Goocanvas::Item>& target, Gdk::EventCrossing&
event);
+ bool on_manipulator_leave_notify_event(const Glib::RefPtr<Goocanvas::Item>& target, Gdk::EventCrossing&
event);
bool get_is_line() const;
- //bool on_manipulator_button_press_event(const Glib::RefPtr<Goocanvas::Item>& target, GdkEventButton*
event, Manipulators manipulator);
- //bool on_manipulator_button_release_event(const Glib::RefPtr<Goocanvas::Item>& target, GdkEventButton*
event, Manipulators manipulator);
- //bool on_manipulator_motion_notify_event(const Glib::RefPtr<Goocanvas::Item>& target, GdkEventMotion*
event, Manipulators manipulator);
+ //bool on_manipulator_button_press_event(const Glib::RefPtr<Goocanvas::Item>& target, Gdk::EventButton&
event, Manipulators manipulator);
+ //bool on_manipulator_button_release_event(const Glib::RefPtr<Goocanvas::Item>& target, Gdk::EventButton&
event, Manipulators manipulator);
+ //bool on_manipulator_motion_notify_event(const Glib::RefPtr<Goocanvas::Item>& target, Gdk::EventMotion&
event, Manipulators manipulator);
static Glib::RefPtr<CanvasRectMovable> create_corner_manipulator();
static Glib::RefPtr<CanvasLineMovable> create_edge_manipulator();
diff --git a/glom/utility_widgets/canvas/canvas_item_movable.cc
b/glom/utility_widgets/canvas/canvas_item_movable.cc
index 6b4ec7a..c692dd4 100644
--- a/glom/utility_widgets/canvas/canvas_item_movable.cc
+++ b/glom/utility_widgets/canvas/canvas_item_movable.cc
@@ -34,9 +34,9 @@
namespace {
-static Glib::RefPtr<Gdk::Cursor> create_drag_cursor(GdkEventAny* event, Gdk::Cursor::Type cursor_type)
+static Glib::RefPtr<Gdk::Cursor> create_drag_cursor(Gdk::Event& event, Gdk::Cursor::Type cursor_type)
{
- auto window = Glib::wrap(event->window, true);
+ auto window = event.get_window();
auto display = window->get_display();
return Gdk::Cursor::create(display, cursor_type);
}
@@ -69,13 +69,13 @@ CanvasItemMovable::CanvasItemMovable()
*/
}
-void CanvasItemMovable::on_button_press_event(const Glib::RefPtr<Goocanvas::Item>& target, GdkEventButton*
event)
+void CanvasItemMovable::on_button_press_event(const Glib::RefPtr<Goocanvas::Item>& target, Gdk::EventButton&
event)
{
//std::cout << G_STRFUNC << ": DEBUG\n";
m_shift_click = false;
- switch(event->button)
+ switch(event.get_button())
{
case 1:
{
@@ -84,8 +84,8 @@ void CanvasItemMovable::on_button_press_event(const Glib::RefPtr<Goocanvas::Item
auto item = target;
- m_drag_start_cursor_x = event->x;
- m_drag_start_cursor_y = event->y;
+ m_drag_start_cursor_x = event.get_x();
+ m_drag_start_cursor_y = event.get_y();
get_xy(m_drag_start_position_x, m_drag_start_position_y);
m_drag_latest_position_x = m_drag_start_position_x;
@@ -96,22 +96,22 @@ void CanvasItemMovable::on_button_press_event(const Glib::RefPtr<Goocanvas::Item
{
canvas->pointer_grab(item,
Gdk::EventMask::POINTER_MOTION_MASK | Gdk::EventMask::BUTTON_RELEASE_MASK,
- create_drag_cursor((GdkEventAny*)event, m_drag_cursor_type),
- event->time);
+ create_drag_cursor(event, m_drag_cursor_type),
+ event.get_time());
}
m_dragging = true;
//Holding down shift when pressing the mouse down
//means that any selection (decided later) will be a multiple selection.
- if(event->state & GDK_SHIFT_MASK)
+ if((event.get_state() & Gdk::ModifierType::SHIFT_MASK) == Gdk::ModifierType::SHIFT_MASK)
m_shift_click = true;
return; // true; // Handled.
}
case 3:
{
- m_signal_show_context.emit(event->button, event->time);
+ m_signal_show_context.emit(event.get_button(), event.get_time());
return; // false; // Not fully Handled.
}
default:
@@ -122,21 +122,21 @@ void CanvasItemMovable::on_button_press_event(const Glib::RefPtr<Goocanvas::Item
return; // false; // Not handled. Pass it to an item lower in the z order, if any.
}
-void CanvasItemMovable::on_motion_notify_event(const Glib::RefPtr<Goocanvas::Item>& target, GdkEventMotion*
event)
+void CanvasItemMovable::on_motion_notify_event(const Glib::RefPtr<Goocanvas::Item>& target,
Gdk::EventMotion& event)
{
if(!m_allow_vertical_movement && !m_allow_horizontal_movement)
return; // false; // Not handled. Let it be handled by an item lower in the z order, or a parent group,
if any.
auto item = target;
- if(item && m_dragging && (event->state & static_cast<guint>(Gdk::ModifierType::BUTTON1_MASK)))
+ if(item && m_dragging && (event.get_state() & Gdk::ModifierType::BUTTON1_MASK) ==
Gdk::ModifierType::BUTTON1_MASK)
{
- const double offset_x = event->x - m_drag_start_cursor_x;
- const double offset_y = event->y - m_drag_start_cursor_y;
+ const double offset_x = event.get_x() - m_drag_start_cursor_x;
+ const double offset_y = event.get_y() - m_drag_start_cursor_y;
// Inkscape uses the Ctrl key to restrict movement to horizontal or vertical,
// so let's do that too.
- if( (event->state & static_cast<guint>(Gdk::ModifierType::CONTROL_MASK)) && !m_dragging_vertical_only &&
!m_dragging_horizontal_only )
+ if( (event.get_state() & Gdk::ModifierType::CONTROL_MASK) == Gdk::ModifierType::CONTROL_MASK &&
!m_dragging_vertical_only && !m_dragging_horizontal_only )
{
//Decide whether to restrict to vertical or horizontal movement:
//Whichever has the greatest offset already will be the axis that we restrict movement to.
@@ -151,7 +151,7 @@ void CanvasItemMovable::on_motion_notify_event(const Glib::RefPtr<Goocanvas::Ite
m_dragging_horizontal_only = false;
}
}
- else if( !(event->state & static_cast<guint>(Gdk::ModifierType::CONTROL_MASK)) &&
(m_dragging_vertical_only || m_dragging_horizontal_only))
+ else if( !((event.get_state() & Gdk::ModifierType::CONTROL_MASK) == Gdk::ModifierType::CONTROL_MASK) &&
(m_dragging_vertical_only || m_dragging_horizontal_only))
{
//Ctrl was released, so allow full movement again:
m_dragging_vertical_only = false;
@@ -196,7 +196,7 @@ void CanvasItemMovable::on_motion_notify_event(const Glib::RefPtr<Goocanvas::Ite
return; // false; //We didn't handle this event.
}
-void CanvasItemMovable::on_button_release_event(const Glib::RefPtr<Goocanvas::Item>& target, GdkEventButton*
event)
+void CanvasItemMovable::on_button_release_event(const Glib::RefPtr<Goocanvas::Item>& target,
Gdk::EventButton& event)
{
//std::cout << G_STRFUNC << ": DEBUG\n";
@@ -205,7 +205,7 @@ void CanvasItemMovable::on_button_release_event(const Glib::RefPtr<Goocanvas::It
auto canvas = get_parent_canvas_widget();
if(canvas)
- canvas->pointer_ungrab(target, event->time);
+ canvas->pointer_ungrab(target, event.get_time());
m_dragging = false;
@@ -242,15 +242,15 @@ void CanvasItemMovable::on_button_release_event(const Glib::RefPtr<Goocanvas::It
return; // true;
}
-void CanvasItemMovable::on_enter_notify_event(const Glib::RefPtr<Goocanvas::Item>& /* target */,
GdkEventCrossing* event)
+void CanvasItemMovable::on_enter_notify_event(const Glib::RefPtr<Goocanvas::Item>& /* target */,
Gdk::EventCrossing& event)
{
- set_cursor(create_drag_cursor((GdkEventAny*)event, m_drag_cursor_type));
+ set_cursor(create_drag_cursor(event, m_drag_cursor_type));
//return false; //We didn't fully handle this event - let other signal handlers (even for other items)
handle it too.
}
-void CanvasItemMovable::on_leave_notify_event(const Glib::RefPtr<Goocanvas::Item>& /* target */,
GdkEventCrossing* /* event */)
+void CanvasItemMovable::on_leave_notify_event(const Glib::RefPtr<Goocanvas::Item>& /* target */,
Gdk::EventCrossing& /* event */)
{
unset_cursor();
diff --git a/glom/utility_widgets/canvas/canvas_item_movable.h
b/glom/utility_widgets/canvas/canvas_item_movable.h
index 45a41ea..92d522b 100644
--- a/glom/utility_widgets/canvas/canvas_item_movable.h
+++ b/glom/utility_widgets/canvas/canvas_item_movable.h
@@ -134,11 +134,11 @@ private:
public:
//These should really be protected, but the compiler doesn't allow it:
- void on_button_press_event(const Glib::RefPtr<Goocanvas::Item>& target, GdkEventButton* event);
- void on_motion_notify_event(const Glib::RefPtr<Goocanvas::Item>& target, GdkEventMotion* event);
- void on_button_release_event(const Glib::RefPtr<Goocanvas::Item>& target, GdkEventButton* event);
- void on_enter_notify_event(const Glib::RefPtr<Goocanvas::Item>& target, GdkEventCrossing* event);
- void on_leave_notify_event(const Glib::RefPtr<Goocanvas::Item>& target, GdkEventCrossing* event);
+ void on_button_press_event(const Glib::RefPtr<Goocanvas::Item>& target, Gdk::EventButton& event);
+ void on_motion_notify_event(const Glib::RefPtr<Goocanvas::Item>& target, Gdk::EventMotion& event);
+ void on_button_release_event(const Glib::RefPtr<Goocanvas::Item>& target, Gdk::EventButton& event);
+ void on_enter_notify_event(const Glib::RefPtr<Goocanvas::Item>& target, Gdk::EventCrossing& event);
+ void on_leave_notify_event(const Glib::RefPtr<Goocanvas::Item>& target, Gdk::EventCrossing& event);
private:
bool m_dragging;
diff --git a/glom/utility_widgets/canvas/canvas_line_movable.cc
b/glom/utility_widgets/canvas/canvas_line_movable.cc
index 0b2640e..750f3a7 100644
--- a/glom/utility_widgets/canvas/canvas_line_movable.cc
+++ b/glom/utility_widgets/canvas/canvas_line_movable.cc
@@ -80,7 +80,7 @@ void CanvasLineMovable::set_hover_color(const Glib::ustring& color)
m_hover_color = color;
}
-bool CanvasLineMovable::on_enter_notify_event(const Glib::RefPtr<Item>& target, GdkEventCrossing* event)
+bool CanvasLineMovable::on_enter_notify_event(const Glib::RefPtr<Item>& target, Gdk::EventCrossing& event)
{
if(!m_hover_color.empty())
{
@@ -92,7 +92,7 @@ bool CanvasLineMovable::on_enter_notify_event(const Glib::RefPtr<Item>& target,
return Goocanvas::Polyline::on_enter_notify_event(target, event);
}
-bool CanvasLineMovable::on_leave_notify_event(const Glib::RefPtr<Item>& target, GdkEventCrossing* event)
+bool CanvasLineMovable::on_leave_notify_event(const Glib::RefPtr<Item>& target, Gdk::EventCrossing& event)
{
if(!m_hover_color.empty())
property_stroke_color_gdk_rgba() = m_stroke_color;
diff --git a/glom/utility_widgets/canvas/canvas_line_movable.h
b/glom/utility_widgets/canvas/canvas_line_movable.h
index 0bb55b0..66b3661 100644
--- a/glom/utility_widgets/canvas/canvas_line_movable.h
+++ b/glom/utility_widgets/canvas/canvas_line_movable.h
@@ -48,8 +48,8 @@ public:
private:
Goocanvas::Canvas* get_parent_canvas_widget() override;
- bool on_enter_notify_event(const Glib::RefPtr<Item>& target, GdkEventCrossing* event) override;
- bool on_leave_notify_event(const Glib::RefPtr<Item>& target, GdkEventCrossing* event) override;
+ bool on_enter_notify_event(const Glib::RefPtr<Item>& target, Gdk::EventCrossing& event) override;
+ bool on_leave_notify_event(const Glib::RefPtr<Item>& target, Gdk::EventCrossing& event) override;
Gdk::RGBA m_stroke_color;
Glib::ustring m_hover_color;
diff --git a/glom/utility_widgets/imageglom.cc b/glom/utility_widgets/imageglom.cc
index 5ecc4cc..644f1ce 100644
--- a/glom/utility_widgets/imageglom.cc
+++ b/glom/utility_widgets/imageglom.cc
@@ -156,10 +156,13 @@ void ImageGlom::set_layout_item(const std::shared_ptr<LayoutItem>& layout_item,
#endif
}
-bool ImageGlom::on_button_press_event(GdkEventButton *button_event)
+bool ImageGlom::on_button_press_event(Gdk::EventButton& button_event)
{
- GdkModifierType mods;
- gdk_window_get_device_position( gtk_widget_get_window (Gtk::Widget::gobj()), button_event->device,
nullptr, nullptr, &mods );
+ auto gdkwindow = get_window();
+ Gdk::ModifierType mods;
+ int x = 0;
+ int y = 0;
+ gdkwindow->get_device_position(button_event.get_device(), x, y, mods);
//Enable/Disable items.
//We did this earlier, but get_appwindow is more likely to work now:
@@ -180,10 +183,10 @@ bool ImageGlom::on_button_press_event(GdkEventButton *button_event)
#ifndef GLOM_ENABLE_CLIENT_ONLY
if(pApp->get_userlevel() == AppState::userlevels::DEVELOPER)
{
- if(mods & GDK_BUTTON3_MASK)
+ if((mods & Gdk::ModifierType::BUTTON3_MASK) == Gdk::ModifierType::BUTTON3_MASK)
{
//Give user choices of actions on this item:
- popup_menu(button_event->button, button_event->time);
+ popup_menu(button_event.get_button(), button_event.get_time());
return true; //We handled this event.
}
@@ -192,17 +195,17 @@ bool ImageGlom::on_button_press_event(GdkEventButton *button_event)
#endif // !GLOM_ENABLE_CLIENT_ONLY
{
// We cannot be in developer mode in client only mode.
- if(mods & GDK_BUTTON3_MASK)
+ if((mods & Gdk::ModifierType::BUTTON3_MASK) == Gdk::ModifierType::BUTTON3_MASK)
{
//Give user choices of actions on this item:
- popup_menu(button_event->button, button_event->time);
+ popup_menu(button_event.get_button(), button_event.get_time());
return true; //We handled this event.
}
}
//Single-click to select file:
- if(mods & GDK_BUTTON1_MASK)
+ if((mods & Gdk::ModifierType::BUTTON1_MASK) == Gdk::ModifierType::BUTTON1_MASK)
{
on_menupopup_activate_select_file();
return true; //We handled this event.
diff --git a/glom/utility_widgets/imageglom.h b/glom/utility_widgets/imageglom.h
index fef94ee..0255f97 100644
--- a/glom/utility_widgets/imageglom.h
+++ b/glom/utility_widgets/imageglom.h
@@ -70,7 +70,7 @@ private:
void on_size_allocate(Gtk::Allocation& allocation) override;
- bool on_button_press_event(GdkEventButton *event) override;
+ bool on_button_press_event(Gdk::EventButton& event) override;
void on_menupopup_activate_open_file();
void on_menupopup_activate_open_file_with();
diff --git a/glom/utility_widgets/notebooklabelglom.cc b/glom/utility_widgets/notebooklabelglom.cc
index d56d481..b06de10 100644
--- a/glom/utility_widgets/notebooklabelglom.cc
+++ b/glom/utility_widgets/notebooklabelglom.cc
@@ -121,17 +121,20 @@ void NotebookLabel::setup_menu(Gtk::Widget* /* widget */)
m_popup_menu->attach_to_widget(*this);
}
-bool NotebookLabel::on_button_press_event(GdkEventButton *button_event)
+bool NotebookLabel::on_button_press_event(Gdk::EventButton& button_event)
{
auto pApp = get_appwindow();
if(pApp && pApp->get_userlevel() == AppState::userlevels::DEVELOPER)
{
- GdkModifierType mods;
- gdk_window_get_device_position( gtk_widget_get_window (Gtk::Widget::gobj()), button_event->device,
nullptr, nullptr, &mods );
- if(mods & GDK_BUTTON3_MASK)
+ auto gdkwindow = get_window();
+ Gdk::ModifierType mods;
+ int x = 0;
+ int y = 0;
+ gdkwindow->get_device_position(button_event.get_device(), x, y, mods);
+ if((mods & Gdk::ModifierType::BUTTON3_MASK) == Gdk::ModifierType::BUTTON3_MASK)
{
//Give user choices of actions on this item:
- m_popup_menu->popup(button_event->button, button_event->time);
+ m_popup_menu->popup(button_event.get_button(), button_event.get_time());
return true; //We handled this event.
}
}
diff --git a/glom/utility_widgets/notebooklabelglom.h b/glom/utility_widgets/notebooklabelglom.h
index da2db54..c6294c2 100644
--- a/glom/utility_widgets/notebooklabelglom.h
+++ b/glom/utility_widgets/notebooklabelglom.h
@@ -55,7 +55,7 @@ private:
void on_menu_new_group_activate();
void on_menu_delete_activate();
- bool on_button_press_event(GdkEventButton *event) override;
+ bool on_button_press_event(Gdk::EventButton& event) override;
Glib::RefPtr<Gio::SimpleAction> m_new_group;
Glib::RefPtr<Gio::SimpleAction> m_deelete;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]