diff options
author | nyamatongwe <unknown> | 2007-07-07 02:54:22 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2007-07-07 02:54:22 +0000 |
commit | f6a09392bbf959d95cd112b9ce1378a0f952776f (patch) | |
tree | 7681b30a848dc22928a9a8c6fb1b1e71ea2c51fc /gtk/PlatGTK.cxx | |
parent | eaeb779814bcf5487015c8ddc99e8ff5df4ff34f (diff) | |
download | scintilla-mirror-f6a09392bbf959d95cd112b9ce1378a0f952776f.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.cxx | 27 |
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 |