aboutsummaryrefslogtreecommitdiffhomepage
path: root/gtk/PlatGTK.cxx
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2007-07-07 02:54:22 +0000
committernyamatongwe <devnull@localhost>2007-07-07 02:54:22 +0000
commit3f2f73d410c84aa74ec109085e51e3338b6b532b (patch)
tree7681b30a848dc22928a9a8c6fb1b1e71ea2c51fc /gtk/PlatGTK.cxx
parent4747b6df30d5d411aafa631fa4436bce0acddfb6 (diff)
downloadscintilla-mirror-3f2f73d410c84aa74ec109085e51e3338b6b532b.tar.gz
Allows the popup to be displayed below as long as it can fit on the monitor
the cursor is on rather than flipping up above the current point when near bottom of window. Implemented for GTK+ by John Ehresman. Partial Windows implementation #ifdefed out because it uses calls unavailable on Windows 95.
Diffstat (limited to 'gtk/PlatGTK.cxx')
-rw-r--r--gtk/PlatGTK.cxx27
1 files changed, 27 insertions, 0 deletions
diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx
index 72e6eff83..4a7b2ed8d 100644
--- a/gtk/PlatGTK.cxx
+++ b/gtk/PlatGTK.cxx
@@ -1874,6 +1874,33 @@ void Window::SetTitle(const char *s) {
gtk_window_set_title(GTK_WINDOW(id), s);
}
+/* Returns rectangle of monitor pt is on, both rect and pt are in Window's
+ gdk window coordinates */
+PRectangle Window::GetMonitorRect(Point pt) {
+ gint x_offset, y_offset;
+
+ gdk_window_get_origin(PWidget(id)->window, &x_offset, &y_offset);
+
+// gtk 2.2+
+#if GTK_MAJOR_VERSION > 2 || (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 2)
+ {
+ GdkScreen* screen;
+ gint monitor_num;
+ GdkRectangle rect;
+
+ screen = gtk_widget_get_screen(PWidget(id));
+ monitor_num = gdk_screen_get_monitor_at_point(screen, pt.x + x_offset, pt.y + y_offset);
+ gdk_screen_get_monitor_geometry(screen, monitor_num, &rect);
+ rect.x -= x_offset;
+ rect.y -= y_offset;
+ return PRectangle(rect.x, rect.y, rect.x + rect.width, rect.y + rect.height);
+ }
+#else
+ return PRectangle(-x_offset, -y_offset, (-x_offset) + gdk_screen_width(),
+ (-y_offset) + gdk_screen_height());
+#endif
+}
+
struct ListImage {
const char *xpm_data;
#if GTK_MAJOR_VERSION < 2