Clamp the new size to the screen. Part of bug 129020.

Fri Mar 12 23:37:15 2004  Soeren Sandmann  <sandmann@daimi.au.dk>

	* gtk/gtkfilechooserdialog.c
	(file_chooser_widget_default_realized_size_changed): Clamp the
	new size to the screen. Part of bug 129020.
This commit is contained in:
Soeren Sandmann 2004-03-12 22:41:32 +00:00 committed by Søren Sandmann Pedersen
parent 1c188e7c2b
commit 543b1c2f78
6 changed files with 59 additions and 4 deletions

View File

@ -1,3 +1,9 @@
Fri Mar 12 23:37:15 2004 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtkfilechooserdialog.c
(file_chooser_widget_default_realized_size_changed): Clamp the
new size to the screen.
Fri Mar 12 15:06:44 2004 Owen Taylor <otaylor@redhat.com>
* gtk/gtkexpander.c (gtk_expander_realize): Create the

View File

@ -1,3 +1,9 @@
Fri Mar 12 23:37:15 2004 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtkfilechooserdialog.c
(file_chooser_widget_default_realized_size_changed): Clamp the
new size to the screen.
Fri Mar 12 15:06:44 2004 Owen Taylor <otaylor@redhat.com>
* gtk/gtkexpander.c (gtk_expander_realize): Create the

View File

@ -1,3 +1,9 @@
Fri Mar 12 23:37:15 2004 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtkfilechooserdialog.c
(file_chooser_widget_default_realized_size_changed): Clamp the
new size to the screen.
Fri Mar 12 15:06:44 2004 Owen Taylor <otaylor@redhat.com>
* gtk/gtkexpander.c (gtk_expander_realize): Create the

View File

@ -1,3 +1,9 @@
Fri Mar 12 23:37:15 2004 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtkfilechooserdialog.c
(file_chooser_widget_default_realized_size_changed): Clamp the
new size to the screen.
Fri Mar 12 15:06:44 2004 Owen Taylor <otaylor@redhat.com>
* gtk/gtkexpander.c (gtk_expander_realize): Create the

View File

@ -1,3 +1,9 @@
Fri Mar 12 23:37:15 2004 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtkfilechooserdialog.c
(file_chooser_widget_default_realized_size_changed): Clamp the
new size to the screen.
Fri Mar 12 15:06:44 2004 Owen Taylor <otaylor@redhat.com>
* gtk/gtkexpander.c (gtk_expander_realize): Create the

View File

@ -211,6 +211,29 @@ file_chooser_widget_update_hints (GtkFileChooserDialog *dialog)
GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE);
}
static void
clamp_to_screen (GtkWidget *widget,
gint *width,
gint *height)
{
GdkScreen *screen;
int monitor_num;
GdkRectangle monitor;
g_return_if_fail (GTK_WIDGET_REALIZED (widget));
screen = gtk_widget_get_screen (widget);
monitor_num = gdk_screen_get_monitor_at_window (screen, widget->window);
gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
if (width)
*width = MIN (*width, (monitor.width * 3) / 4);
if (height)
*height = MIN (*height, (monitor.height * 3) / 4);
}
static void
file_chooser_widget_default_realized_size_changed (GtkWidget *widget,
GtkFileChooserDialog *dialog)
@ -289,12 +312,14 @@ file_chooser_widget_default_realized_size_changed (GtkWidget *widget,
priv->resize_horizontally = resize_horizontally;
priv->resize_vertically = resize_vertically;
/* FIXME: We should make sure that we arent' bigger than the current screen */
if (dx != 0 || dy != 0)
{
gtk_window_resize (GTK_WINDOW (dialog),
cur_width + dx,
cur_height + dy);
gint new_width = cur_width + dx;
gint new_height = cur_height + dy;
clamp_to_screen (GTK_WIDGET (dialog), &new_width, &new_height);
gtk_window_resize (GTK_WINDOW (dialog), new_width, new_height);
}
/* Only store the size if we can resize in that direction. */