diff options
| author | nyamatongwe <devnull@localhost> | 2002-08-23 02:44:33 +0000 | 
|---|---|---|
| committer | nyamatongwe <devnull@localhost> | 2002-08-23 02:44:33 +0000 | 
| commit | 1adc95e4c6e4635f204e3c3022d659deaf164b70 (patch) | |
| tree | c062f52682c4af96cf9547e899b42e67eaed796c | |
| parent | 56b6550c0e2f63c997f8180e3c8b56bb2736e4f9 (diff) | |
| download | scintilla-mirror-1adc95e4c6e4635f204e3c3022d659deaf164b70.tar.gz | |
Ensure popup menu is fully visible and does not overlap screen right or bottom.
| -rw-r--r-- | gtk/PlatGTK.cxx | 15 | 
1 files changed, 14 insertions, 1 deletions
| diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx index 5e6bdf48c..2edae58c7 100644 --- a/gtk/PlatGTK.cxx +++ b/gtk/PlatGTK.cxx @@ -907,7 +907,20 @@ void Menu::Destroy() {  }  void Menu::Show(Point pt, Window &) { -	gtk_item_factory_popup(reinterpret_cast<GtkItemFactory *>(id), pt.x - 4, pt.y, 3, 0); +	int screenHeight = gdk_screen_height(); +	int screenWidth = gdk_screen_width(); +	GtkItemFactory *factory = reinterpret_cast<GtkItemFactory *>(id); +	GtkWidget *widget = gtk_item_factory_get_widget(factory, "<main>"); +	gtk_widget_show_all(widget); +	GtkRequisition requisition; +	gtk_widget_size_request(widget, &requisition); +	if ((pt.x + requisition.width) > screenWidth) { +		pt.x = screenWidth - requisition.width; +	} +	if ((pt.y + requisition.height) > screenHeight) { +		pt.y = screenHeight - requisition.height; +	} +	gtk_item_factory_popup(factory, pt.x - 4, pt.y, 3, 0);  }  ElapsedTime::ElapsedTime() { | 
