aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-11-08 04:26:57 +0800
committerChristian Persch <chpe@src.gnome.org>2004-11-08 04:26:57 +0800
commit1f545ca03b769815e6e1da4cb180c5028d69d827 (patch)
treed5723fda7fecd99a4d8b8d6fa17a43b640773b24
parent27909c033836613152167b9969b8014b98238006 (diff)
downloadgsoc2013-epiphany-1f545ca03b769815e6e1da4cb180c5028d69d827.tar
gsoc2013-epiphany-1f545ca03b769815e6e1da4cb180c5028d69d827.tar.gz
gsoc2013-epiphany-1f545ca03b769815e6e1da4cb180c5028d69d827.tar.bz2
gsoc2013-epiphany-1f545ca03b769815e6e1da4cb180c5028d69d827.tar.lz
gsoc2013-epiphany-1f545ca03b769815e6e1da4cb180c5028d69d827.tar.xz
gsoc2013-epiphany-1f545ca03b769815e6e1da4cb180c5028d69d827.tar.zst
gsoc2013-epiphany-1f545ca03b769815e6e1da4cb180c5028d69d827.zip
Sanitise the embed popup position. Fixes bug #157162.
2004-11-07 Christian Persch <chpe@cvs.gnome.org> * lib/ephy-gui.c: (ephy_gui_sanitise_popup_position), (ephy_gui_menu_position_tree_selection), (ephy_gui_menu_position_under_widget): * lib/ephy-gui.h: * src/ephy-window.c: (popup_menu_at_coords), (show_embed_popup): Sanitise the embed popup position. Fixes bug #157162.
-rw-r--r--ChangeLog10
-rw-r--r--lib/ephy-gui.c13
-rw-r--r--lib/ephy-gui.h5
-rw-r--r--src/ephy-window.c12
4 files changed, 34 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index db4b2f44a..18cbc8613 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2004-11-07 Christian Persch <chpe@cvs.gnome.org>
+ * lib/ephy-gui.c: (ephy_gui_sanitise_popup_position),
+ (ephy_gui_menu_position_tree_selection),
+ (ephy_gui_menu_position_under_widget):
+ * lib/ephy-gui.h:
+ * src/ephy-window.c: (popup_menu_at_coords), (show_embed_popup):
+
+ Sanitise the embed popup position. Fixes bug #157162.
+
+2004-11-07 Christian Persch <chpe@cvs.gnome.org>
+
* src/ephy-session.c: (offer_to_resume):
Better wording for the crash recovery dialogue. Thanks to Spark
diff --git a/lib/ephy-gui.c b/lib/ephy-gui.c
index 65e0b0de6..2e2d355c1 100644
--- a/lib/ephy-gui.c
+++ b/lib/ephy-gui.c
@@ -40,14 +40,19 @@
GtkStyle *loading_text_style = NULL;
GtkStyle *new_text_style = NULL;
-static void
-sanitize_popup_position (GtkWidget *widget, GtkMenu *menu, gint *x, gint *y)
+void
+ephy_gui_sanitise_popup_position (GtkMenu *menu,
+ GtkWidget *widget,
+ gint *x,
+ gint *y)
{
GdkScreen *screen = gtk_widget_get_screen (widget);
gint monitor_num;
GdkRectangle monitor;
GtkRequisition req;
+ g_return_if_fail (widget != NULL);
+
gtk_widget_size_request (GTK_WIDGET (menu), &req);
monitor_num = gdk_screen_get_monitor_at_point (screen, *x, *y);
@@ -92,7 +97,7 @@ ephy_gui_menu_position_tree_selection (GtkMenu *menu,
g_list_free (selected_rows);
}
- sanitize_popup_position (widget, menu, x, y);
+ ephy_gui_sanitise_popup_position (menu, widget, x, y);
}
/**
@@ -125,7 +130,7 @@ ephy_gui_menu_position_under_widget (GtkMenu *menu,
*y += w->allocation.y + w->allocation.height;
- sanitize_popup_position (w, menu, x, y);
+ ephy_gui_sanitise_popup_position (menu, w, x, y);
}
gboolean
diff --git a/lib/ephy-gui.h b/lib/ephy-gui.h
index 0c9c5a04c..caa4035d8 100644
--- a/lib/ephy-gui.h
+++ b/lib/ephy-gui.h
@@ -30,6 +30,11 @@
G_BEGIN_DECLS
+void ephy_gui_sanitise_popup_position (GtkMenu *menu,
+ GtkWidget *parent_widget,
+ gint *x,
+ gint *y);
+
void ephy_gui_menu_position_tree_selection (GtkMenu *menu,
gint *x,
gint *y,
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 2ed8e044f..f0c2455a9 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -50,6 +50,7 @@
#include "ephy-stock-icons.h"
#include "ephy-extension.h"
#include "ephy-favicon-cache.h"
+#include "ephy-gui.h"
#include <string.h>
#include <glib/gi18n.h>
@@ -1545,10 +1546,17 @@ static void
popup_menu_at_coords (GtkMenu *menu, gint *x, gint *y, gboolean *push_in,
gpointer user_data)
{
- EphyEmbedEvent *event = (EphyEmbedEvent *) user_data;
+ GtkWidget *window = GTK_WIDGET (user_data);
+ EphyEmbedEvent *event;
+
+ event = g_object_get_data (G_OBJECT (window), "context_event");
+ g_return_if_fail (event != NULL);
ephy_embed_event_get_coords (event, x, y);
+ /* FIXME: better position the popup within the window bounds? */
+ ephy_gui_sanitise_popup_position (menu, window, x, y);
+
*push_in = TRUE;
}
@@ -1761,7 +1769,7 @@ show_embed_popup (EphyWindow *window, EphyTab *tab, EphyEmbedEvent *event)
if (type == EPHY_EMBED_EVENT_KEY)
{
gtk_menu_popup (GTK_MENU (widget), NULL, NULL,
- popup_menu_at_coords, event, 0,
+ popup_menu_at_coords, window, 0,
gtk_get_current_event_time ());
gtk_menu_shell_select_first (GTK_MENU_SHELL (widget), FALSE);
}