[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 304/473: Fix undefined behavior in slot parameter types.
noreply at xfce.org
noreply at xfce.org
Mon Feb 16 23:57:54 CET 2015
This is an automated email from the git hooks/post-receive script.
gottcode pushed a commit to branch master
in repository panel-plugins/xfce4-whiskermenu-plugin.
commit 8889cc55bd56e186e2346eedeff650dfdbf4d0ce
Author: Graeme Gott <graeme at gottcode.org>
Date: Sat Dec 14 16:02:10 2013 -0500
Fix undefined behavior in slot parameter types.
---
panel-plugin/launcher-view.cpp | 20 ++++++-----
panel-plugin/launcher-view.h | 8 ++---
panel-plugin/page.cpp | 14 ++++----
panel-plugin/page.h | 4 +--
panel-plugin/plugin.cpp | 5 +--
panel-plugin/plugin.h | 2 +-
panel-plugin/resizer-widget.cpp | 17 +++++-----
panel-plugin/resizer-widget.h | 8 ++---
panel-plugin/search-page.cpp | 7 ++--
panel-plugin/search-page.h | 2 +-
panel-plugin/window.cpp | 70 +++++++++++++++++++++++----------------
panel-plugin/window.h | 16 ++++-----
12 files changed, 97 insertions(+), 76 deletions(-)
diff --git a/panel-plugin/launcher-view.cpp b/panel-plugin/launcher-view.cpp
index f623485..dbcb035 100644
--- a/panel-plugin/launcher-view.cpp
+++ b/panel-plugin/launcher-view.cpp
@@ -258,9 +258,10 @@ void LauncherView::create_column()
//-----------------------------------------------------------------------------
-gboolean LauncherView::on_key_press_event(GtkWidget*, GdkEventKey* event)
+gboolean LauncherView::on_key_press_event(GtkWidget*, GdkEvent* event)
{
- if ((event->keyval == GDK_KEY_Up) || (event->keyval == GDK_KEY_Down))
+ GdkEventKey* key_event = reinterpret_cast<GdkEventKey*>(event);
+ if ((key_event->keyval == GDK_KEY_Up) || (key_event->keyval == GDK_KEY_Down))
{
gtk_tree_view_set_hover_selection(m_view, false);
}
@@ -269,9 +270,10 @@ gboolean LauncherView::on_key_press_event(GtkWidget*, GdkEventKey* event)
//-----------------------------------------------------------------------------
-gboolean LauncherView::on_key_release_event(GtkWidget*, GdkEventKey* event)
+gboolean LauncherView::on_key_release_event(GtkWidget*, GdkEvent* event)
{
- if ((event->keyval == GDK_KEY_Up) || (event->keyval == GDK_KEY_Down))
+ GdkEventKey* key_event = reinterpret_cast<GdkEventKey*>(event);
+ if ((key_event->keyval == GDK_KEY_Up) || (key_event->keyval == GDK_KEY_Down))
{
gtk_tree_view_set_hover_selection(m_view, true);
}
@@ -280,9 +282,10 @@ gboolean LauncherView::on_key_release_event(GtkWidget*, GdkEventKey* event)
//-----------------------------------------------------------------------------
-gboolean LauncherView::on_button_press_event(GtkWidget*, GdkEventButton* event)
+gboolean LauncherView::on_button_press_event(GtkWidget*, GdkEvent* event)
{
- if (event->button != 1)
+ GdkEventButton* button_event = reinterpret_cast<GdkEventButton*>(event);
+ if (button_event->button != 1)
{
return false;
}
@@ -315,9 +318,10 @@ gboolean LauncherView::on_button_press_event(GtkWidget*, GdkEventButton* event)
//-----------------------------------------------------------------------------
-gboolean LauncherView::on_button_release_event(GtkWidget*, GdkEventButton* event)
+gboolean LauncherView::on_button_release_event(GtkWidget*, GdkEvent* event)
{
- if (event->button != 1)
+ GdkEventButton* button_event = reinterpret_cast<GdkEventButton*>(event);
+ if (button_event->button != 1)
{
return false;
}
diff --git a/panel-plugin/launcher-view.h b/panel-plugin/launcher-view.h
index c8dbc5c..e5f2030 100644
--- a/panel-plugin/launcher-view.h
+++ b/panel-plugin/launcher-view.h
@@ -70,10 +70,10 @@ public:
private:
void create_column();
- gboolean on_key_press_event(GtkWidget*, GdkEventKey* event);
- gboolean on_key_release_event(GtkWidget*, GdkEventKey* event);
- gboolean on_button_press_event(GtkWidget*, GdkEventButton* event);
- gboolean on_button_release_event(GtkWidget*, GdkEventButton* event);
+ gboolean on_key_press_event(GtkWidget*, GdkEvent* event);
+ gboolean on_key_release_event(GtkWidget*, GdkEvent* event);
+ gboolean on_button_press_event(GtkWidget*, GdkEvent* event);
+ gboolean on_button_release_event(GtkWidget*, GdkEvent* event);
void on_drag_data_get(GtkWidget*, GdkDragContext*, GtkSelectionData* data, guint info, guint);
void on_drag_end(GtkWidget*, GdkDragContext*);
diff --git a/panel-plugin/page.cpp b/panel-plugin/page.cpp
index ff35a3d..1ead140 100644
--- a/panel-plugin/page.cpp
+++ b/panel-plugin/page.cpp
@@ -137,13 +137,14 @@ void Page::item_activated(GtkTreeView* view, GtkTreePath* path, GtkTreeViewColum
//-----------------------------------------------------------------------------
-gboolean Page::view_button_press_event(GtkWidget* view, GdkEventButton* event)
+gboolean Page::view_button_press_event(GtkWidget* view, GdkEvent* event)
{
+ GdkEventButton* event_button = reinterpret_cast<GdkEventButton*>(event);
GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
GtkTreeIter iter;
if (gtk_tree_selection_get_selected(selection, NULL, &iter)
- && (event->type == GDK_BUTTON_PRESS)
- && (event->button == 3))
+ && (event_button->type == GDK_BUTTON_PRESS)
+ && (event_button->button == 3))
{
create_context_menu(&iter, event);
return true;
@@ -169,8 +170,9 @@ gboolean Page::view_popup_menu_event(GtkWidget* view)
//-----------------------------------------------------------------------------
-void Page::create_context_menu(GtkTreeIter* iter, GdkEventButton* event)
+void Page::create_context_menu(GtkTreeIter* iter, GdkEvent* event)
{
+ GdkEventButton* event_button = reinterpret_cast<GdkEventButton*>(event);
m_selected_path = gtk_tree_model_get_path(m_view->get_model(), iter);
Launcher* launcher = get_selected_launcher();
if (!launcher)
@@ -225,8 +227,8 @@ void Page::create_context_menu(GtkTreeIter* iter, GdkEventButton* event)
GtkMenuPositionFunc position_func = NULL;
if (event)
{
- button = event->button;
- event_time = event->time;
+ button = event_button->button;
+ event_time = event_button->time;
}
else
{
diff --git a/panel-plugin/page.h b/panel-plugin/page.h
index 6195104..c11f75e 100644
--- a/panel-plugin/page.h
+++ b/panel-plugin/page.h
@@ -54,7 +54,7 @@ protected:
private:
virtual bool remember_launcher(Launcher* launcher);
void item_activated(GtkTreeView* view, GtkTreePath* path, GtkTreeViewColumn*);
- gboolean view_button_press_event(GtkWidget* view, GdkEventButton* event);
+ gboolean view_button_press_event(GtkWidget* view, GdkEvent* event);
gboolean view_popup_menu_event(GtkWidget* view);
void on_unmap();
void destroy_context_menu(GtkMenuShell* menu);
@@ -63,7 +63,7 @@ private:
void add_selected_to_favorites();
void remove_selected_from_favorites();
Launcher* get_selected_launcher() const;
- void create_context_menu(GtkTreeIter* iter, GdkEventButton* event);
+ void create_context_menu(GtkTreeIter* iter, GdkEvent* event);
virtual void extend_context_menu(GtkWidget* menu);
static void position_context_menu(GtkMenu*, gint* x, gint* y, gboolean* push_in, Page* page);
diff --git a/panel-plugin/plugin.cpp b/panel-plugin/plugin.cpp
index 0bab215..3095b3c 100644
--- a/panel-plugin/plugin.cpp
+++ b/panel-plugin/plugin.cpp
@@ -241,9 +241,10 @@ void Plugin::set_configure_enabled(bool enabled)
//-----------------------------------------------------------------------------
-gboolean Plugin::button_clicked(GtkWidget*, GdkEventButton* event)
+gboolean Plugin::button_clicked(GtkWidget*, GdkEvent* event)
{
- if (event->button != 1 || event->state & GDK_CONTROL_MASK)
+ GdkEventButton* event_button = reinterpret_cast<GdkEventButton*>(event);
+ if (event_button->button != 1 || event_button->state & GDK_CONTROL_MASK)
{
return false;
}
diff --git a/panel-plugin/plugin.h b/panel-plugin/plugin.h
index 54f5d38..c6b8227 100644
--- a/panel-plugin/plugin.h
+++ b/panel-plugin/plugin.h
@@ -58,7 +58,7 @@ public:
void set_configure_enabled(bool enabled);
private:
- gboolean button_clicked(GtkWidget*, GdkEventButton* event);
+ gboolean button_clicked(GtkWidget*, GdkEvent* event);
void menu_hidden();
void configure();
#if (LIBXFCE4PANEL_CHECK_VERSION(4,9,0))
diff --git a/panel-plugin/resizer-widget.cpp b/panel-plugin/resizer-widget.cpp
index afe3f36..9147700 100644
--- a/panel-plugin/resizer-widget.cpp
+++ b/panel-plugin/resizer-widget.cpp
@@ -101,20 +101,21 @@ void ResizerWidget::set_corner(Corner corner)
//-----------------------------------------------------------------------------
-gboolean ResizerWidget::on_button_press_event(GtkWidget*, GdkEventButton* event)
+gboolean ResizerWidget::on_button_press_event(GtkWidget*, GdkEvent* event)
{
+ GdkEventButton* event_button = reinterpret_cast<GdkEventButton*>(event);
gtk_window_begin_resize_drag(m_window,
m_edge,
- event->button,
- event->x_root,
- event->y_root,
- event->time);
+ event_button->button,
+ event_button->x_root,
+ event_button->y_root,
+ event_button->time);
return true;
}
//-----------------------------------------------------------------------------
-gboolean ResizerWidget::on_enter_notify_event(GtkWidget* widget, GdkEventCrossing*)
+gboolean ResizerWidget::on_enter_notify_event(GtkWidget* widget, GdkEvent*)
{
gtk_widget_set_state(widget, GTK_STATE_PRELIGHT);
GdkWindow* window = gtk_widget_get_window(widget);
@@ -124,7 +125,7 @@ gboolean ResizerWidget::on_enter_notify_event(GtkWidget* widget, GdkEventCrossin
//-----------------------------------------------------------------------------
-gboolean ResizerWidget::on_leave_notify_event(GtkWidget* widget, GdkEventCrossing*)
+gboolean ResizerWidget::on_leave_notify_event(GtkWidget* widget, GdkEvent*)
{
gtk_widget_set_state(widget, GTK_STATE_NORMAL);
GdkWindow* window = gtk_widget_get_window(widget);
@@ -134,7 +135,7 @@ gboolean ResizerWidget::on_leave_notify_event(GtkWidget* widget, GdkEventCrossin
//-----------------------------------------------------------------------------
-gboolean ResizerWidget::on_expose_event(GtkWidget* widget, GdkEventExpose*)
+gboolean ResizerWidget::on_expose_event(GtkWidget* widget, GdkEvent*)
{
cairo_t* cr = gdk_cairo_create(gtk_widget_get_window(widget));
diff --git a/panel-plugin/resizer-widget.h b/panel-plugin/resizer-widget.h
index 7cbb10d..4422700 100644
--- a/panel-plugin/resizer-widget.h
+++ b/panel-plugin/resizer-widget.h
@@ -46,10 +46,10 @@ public:
void set_corner(Corner corner);
private:
- gboolean on_button_press_event(GtkWidget*, GdkEventButton* event);
- gboolean on_enter_notify_event(GtkWidget* widget, GdkEventCrossing*);
- gboolean on_leave_notify_event(GtkWidget* widget, GdkEventCrossing*);
- gboolean on_expose_event(GtkWidget* widget, GdkEventExpose*);
+ gboolean on_button_press_event(GtkWidget*, GdkEvent* event);
+ gboolean on_enter_notify_event(GtkWidget* widget, GdkEvent*);
+ gboolean on_leave_notify_event(GtkWidget* widget, GdkEvent*);
+ gboolean on_expose_event(GtkWidget* widget, GdkEvent*);
private:
GtkWindow* m_window;
diff --git a/panel-plugin/search-page.cpp b/panel-plugin/search-page.cpp
index 5c6271f..df284f4 100644
--- a/panel-plugin/search-page.cpp
+++ b/panel-plugin/search-page.cpp
@@ -184,9 +184,10 @@ void SearchPage::clear_search(GtkEntry* entry, GtkEntryIconPosition icon_pos, Gd
//-----------------------------------------------------------------------------
-gboolean SearchPage::search_entry_key_press(GtkWidget* widget, GdkEventKey* event)
+gboolean SearchPage::search_entry_key_press(GtkWidget* widget, GdkEvent* event)
{
- if (event->keyval == GDK_Escape)
+ GdkEventKey* key_event = reinterpret_cast<GdkEventKey*>(event);
+ if (key_event->keyval == GDK_Escape)
{
GtkEntry* entry = GTK_ENTRY(widget);
const gchar* text = gtk_entry_get_text(entry);
@@ -200,7 +201,7 @@ gboolean SearchPage::search_entry_key_press(GtkWidget* widget, GdkEventKey* even
return false;
}
}
- else if (event->keyval == GDK_Return)
+ else if (key_event->keyval == GDK_Return)
{
GtkTreePath* path = get_view()->get_selected_path();
if (path)
diff --git a/panel-plugin/search-page.h b/panel-plugin/search-page.h
index 2a4d776..a0925ed 100644
--- a/panel-plugin/search-page.h
+++ b/panel-plugin/search-page.h
@@ -40,7 +40,7 @@ public:
private:
void clear_search(GtkEntry* entry, GtkEntryIconPosition icon_pos, GdkEvent*);
- gboolean search_entry_key_press(GtkWidget* widget, GdkEventKey* event);
+ gboolean search_entry_key_press(GtkWidget* widget, GdkEvent* event);
private:
Query m_query;
diff --git a/panel-plugin/window.cpp b/panel-plugin/window.cpp
index 51714fd..83b9f75 100644
--- a/panel-plugin/window.cpp
+++ b/panel-plugin/window.cpp
@@ -613,22 +613,25 @@ void Window::unset_items()
//-----------------------------------------------------------------------------
-gboolean Window::on_enter_notify_event(GtkWidget*, GdkEventCrossing* event)
+gboolean Window::on_enter_notify_event(GtkWidget*, GdkEvent* event)
{
- if ( (event->detail == GDK_NOTIFY_INFERIOR)
- || (event->mode == GDK_CROSSING_GRAB)
- || (event->mode == GDK_CROSSING_GTK_GRAB) )
+ GdkEventCrossing* crossing_event = reinterpret_cast<GdkEventCrossing*>(event);
+ if ((crossing_event->detail == GDK_NOTIFY_INFERIOR)
+ || (crossing_event->mode == GDK_CROSSING_GRAB)
+ || (crossing_event->mode == GDK_CROSSING_GTK_GRAB))
{
return false;
}
// Don't grab cursor over menu
- if ((event->x_root >= m_geometry.x) && (event->x_root < (m_geometry.x + m_geometry.width))
- && (event->y_root >= m_geometry.y) && (event->y_root < (m_geometry.y + m_geometry.height)))
+ if ((crossing_event->x_root >= m_geometry.x)
+ && (crossing_event->x_root < (m_geometry.x + m_geometry.width))
+ && (crossing_event->y_root >= m_geometry.y)
+ && (crossing_event->y_root < (m_geometry.y + m_geometry.height)))
{
if (gdk_pointer_is_grabbed())
{
- gdk_pointer_ungrab(gtk_get_current_event_time());
+ gdk_pointer_ungrab(crossing_event->time);
}
}
@@ -637,24 +640,27 @@ gboolean Window::on_enter_notify_event(GtkWidget*, GdkEventCrossing* event)
//-----------------------------------------------------------------------------
-gboolean Window::on_leave_notify_event(GtkWidget*, GdkEventCrossing* event)
+gboolean Window::on_leave_notify_event(GtkWidget*, GdkEvent* event)
{
- if ( (event->detail == GDK_NOTIFY_INFERIOR)
- || (event->mode != GDK_CROSSING_NORMAL) )
+ GdkEventCrossing* crossing_event = reinterpret_cast<GdkEventCrossing*>(event);
+ if ((crossing_event->detail == GDK_NOTIFY_INFERIOR)
+ || (crossing_event->mode != GDK_CROSSING_NORMAL))
{
return false;
}
// Track mouse clicks outside of menu
- if ((event->x_root <= m_geometry.x) || (event->x_root >= m_geometry.x + m_geometry.width)
- || (event->y_root <= m_geometry.y) || (event->y_root >= m_geometry.y + m_geometry.height))
+ if ((crossing_event->x_root <= m_geometry.x)
+ || (crossing_event->x_root >= m_geometry.x + m_geometry.width)
+ || (crossing_event->y_root <= m_geometry.y)
+ || (crossing_event->y_root >= m_geometry.y + m_geometry.height))
{
gdk_pointer_grab(gtk_widget_get_window(GTK_WIDGET(m_window)), true,
GdkEventMask(
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK
),
- NULL, NULL, event->time);
+ NULL, NULL, crossing_event->time);
}
return false;
@@ -662,7 +668,7 @@ gboolean Window::on_leave_notify_event(GtkWidget*, GdkEventCrossing* event)
//-----------------------------------------------------------------------------
-gboolean Window::on_focus_in_event(GtkWidget*, GdkEventFocus*)
+gboolean Window::on_focus_in_event(GtkWidget*, GdkEvent*)
{
gdk_pointer_grab(gtk_widget_get_window(GTK_WIDGET(m_window)), true,
GdkEventMask(
@@ -675,11 +681,14 @@ gboolean Window::on_focus_in_event(GtkWidget*, GdkEventFocus*)
//-----------------------------------------------------------------------------
-gboolean Window::on_button_press_event(GtkWidget*, GdkEventButton* event)
+gboolean Window::on_button_press_event(GtkWidget*, GdkEvent* event)
{
// Hide menu if user clicks outside
- if ((event->x_root <= m_geometry.x) || (event->x_root >= m_geometry.x + m_geometry.width)
- || (event->y_root <= m_geometry.y) || (event->y_root >= m_geometry.y + m_geometry.height))
+ GdkEventButton* button_event = reinterpret_cast<GdkEventButton*>(event);
+ if ((button_event->x_root <= m_geometry.x)
+ || (button_event->x_root >= m_geometry.x + m_geometry.width)
+ || (button_event->y_root <= m_geometry.y)
+ || (button_event->y_root >= m_geometry.y + m_geometry.height))
{
hide();
}
@@ -688,17 +697,19 @@ gboolean Window::on_button_press_event(GtkWidget*, GdkEventButton* event)
//-----------------------------------------------------------------------------
-gboolean Window::on_key_press_event(GtkWidget* widget, GdkEventKey* event)
+gboolean Window::on_key_press_event(GtkWidget* widget, GdkEvent* event)
{
+ GdkEventKey* key_event = reinterpret_cast<GdkEventKey*>(event);
+
// Hide if escape is pressed and there is no text in search entry
- if ( (event->keyval == GDK_Escape) && exo_str_is_empty(gtk_entry_get_text(m_search_entry)) )
+ if ( (key_event->keyval == GDK_Escape) && exo_str_is_empty(gtk_entry_get_text(m_search_entry)) )
{
hide();
return true;
}
// Make up and down keys always scroll current list of applications
- if ((event->keyval == GDK_KEY_Up) || (event->keyval == GDK_KEY_Down))
+ if ((key_event->keyval == GDK_KEY_Up) || (key_event->keyval == GDK_KEY_Down))
{
GtkWidget* view = NULL;
if (gtk_widget_get_visible(m_search_results->get_widget()))
@@ -729,14 +740,14 @@ gboolean Window::on_key_press_event(GtkWidget* widget, GdkEventKey* event)
//-----------------------------------------------------------------------------
-gboolean Window::on_key_press_event_after(GtkWidget* widget, GdkEventKey* event)
+gboolean Window::on_key_press_event_after(GtkWidget* widget, GdkEvent* event)
{
// Pass unhandled key presses to search entry
GtkWidget* search_entry = GTK_WIDGET(m_search_entry);
if ((widget != search_entry) && (gtk_window_get_focus(m_window) != search_entry))
{
gtk_widget_grab_focus(search_entry);
- gtk_window_propagate_key_event(m_window, event);
+ gtk_window_propagate_key_event(m_window, reinterpret_cast<GdkEventKey*>(event));
return true;
}
return false;
@@ -744,7 +755,7 @@ gboolean Window::on_key_press_event_after(GtkWidget* widget, GdkEventKey* event)
//-----------------------------------------------------------------------------
-gboolean Window::on_map_event(GtkWidget*, GdkEventAny*)
+gboolean Window::on_map_event(GtkWidget*, GdkEvent*)
{
m_favorites->reset_selection();
@@ -766,14 +777,15 @@ gboolean Window::on_map_event(GtkWidget*, GdkEventAny*)
//-----------------------------------------------------------------------------
-gboolean Window::on_configure_event(GtkWidget*, GdkEventConfigure* event)
+gboolean Window::on_configure_event(GtkWidget*, GdkEvent* event)
{
- if (event->width && event->height)
+ GdkEventConfigure* configure_event = reinterpret_cast<GdkEventConfigure*>(event);
+ if (configure_event->width && configure_event->height)
{
- m_geometry.x = event->x;
- m_geometry.y = event->y;
- m_geometry.width = event->width;
- m_geometry.height = event->height;
+ m_geometry.x = configure_event->x;
+ m_geometry.y = configure_event->y;
+ m_geometry.width = configure_event->width;
+ m_geometry.height = configure_event->height;
}
return false;
}
diff --git a/panel-plugin/window.h b/panel-plugin/window.h
index 720ba80..1f4afc1 100644
--- a/panel-plugin/window.h
+++ b/panel-plugin/window.h
@@ -73,14 +73,14 @@ public:
void unset_items();
private:
- gboolean on_enter_notify_event(GtkWidget*, GdkEventCrossing* event);
- gboolean on_leave_notify_event(GtkWidget*, GdkEventCrossing* event);
- gboolean on_focus_in_event(GtkWidget*, GdkEventFocus*);
- gboolean on_button_press_event(GtkWidget*, GdkEventButton* event);
- gboolean on_key_press_event(GtkWidget* widget, GdkEventKey* event);
- gboolean on_key_press_event_after(GtkWidget* widget, GdkEventKey* event);
- gboolean on_map_event(GtkWidget*, GdkEventAny*);
- gboolean on_configure_event(GtkWidget*, GdkEventConfigure* event);
+ gboolean on_enter_notify_event(GtkWidget*, GdkEvent* event);
+ gboolean on_leave_notify_event(GtkWidget*, GdkEvent* event);
+ gboolean on_focus_in_event(GtkWidget*, GdkEvent*);
+ gboolean on_button_press_event(GtkWidget*, GdkEvent* event);
+ gboolean on_key_press_event(GtkWidget* widget, GdkEvent* event);
+ gboolean on_key_press_event_after(GtkWidget* widget, GdkEvent* event);
+ gboolean on_map_event(GtkWidget*, GdkEvent*);
+ gboolean on_configure_event(GtkWidget*, GdkEvent* event);
void favorites_toggled();
void recent_toggled();
void category_toggled();
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list