app/display/gimpdisplayshell-callbacks.c app/display/gimpdisplayshell.c

2003-09-09  Sven Neumann  <sven@gimp.org>

	* app/display/gimpdisplayshell-callbacks.c
	* app/display/gimpdisplayshell.c
	* app/display/gimpnavigationview.c
	* app/gui/resolution-calibrate-dialog.c
	* app/widgets/gimpcontainerpopup.c
	* app/widgets/gimpdialogfactory.c
	* app/widgets/gimpeditor.c
	* app/widgets/gimppreview-popup.c
	* app/widgets/gimpwidgets-utils.c: get the size from the current
	screen, not always from the default one.

	* plug-ins/common/wmf.c: ask GIMP for the monitor resolution instead
	of taking the value from GDK.
This commit is contained in:
Sven Neumann 2003-09-09 11:35:27 +00:00 committed by Sven Neumann
parent 284b8f91d7
commit 56438a7b9b
15 changed files with 184 additions and 125 deletions

View File

@ -1,3 +1,19 @@
2003-09-09 Sven Neumann <sven@gimp.org>
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell.c
* app/display/gimpnavigationview.c
* app/gui/resolution-calibrate-dialog.c
* app/widgets/gimpcontainerpopup.c
* app/widgets/gimpdialogfactory.c
* app/widgets/gimpeditor.c
* app/widgets/gimppreview-popup.c
* app/widgets/gimpwidgets-utils.c: get the size from the current
screen, not always from the default one.
* plug-ins/common/wmf.c: ask GIMP for the monitor resolution instead
of taking the value from GDK.
2003-09-09 Michael Natterer <mitch@gimp.org>
* app/core/gimp.[ch]: added "gboolean console_messages" to the

View File

@ -55,16 +55,16 @@ resolution_calibrate_ok (GtkWidget *button,
calibrate_xres = (gdouble)ruler_width * calibrate_xres / x;
calibrate_yres = (gdouble)ruler_height * calibrate_yres / y;
chain_button = g_object_get_data (G_OBJECT (resolution_entry),
chain_button = g_object_get_data (G_OBJECT (resolution_entry),
"chain_button");
if (chain_button &&
if (chain_button &&
ABS (x -y) > GIMP_MIN_RESOLUTION)
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (chain_button), FALSE);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (resolution_entry),
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (resolution_entry),
0, calibrate_xres);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (resolution_entry),
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (resolution_entry),
1, calibrate_yres);
gtk_widget_destroy (GTK_WIDGET (data));
@ -102,15 +102,16 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry,
GtkWidget *darea;
GtkWidget *ruler;
GtkWidget *label;
GdkScreen *screen;
GList *list;
g_return_if_fail (GIMP_IS_SIZE_ENTRY (resolution_entry));
g_return_if_fail (pixbuf == NULL || GDK_IS_PIXBUF (pixbuf));
/* this dialog can only exist once */
if (calibrate_entry)
return;
return;
dialog = gimp_dialog_new (_("Calibrate Monitor Resolution"),
"calibrate_resolution",
NULL, NULL,
@ -139,8 +140,10 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry,
SET_STYLE (dialog, dialog_style);
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 8);
ruler_width = gdk_screen_width ();
ruler_height = gdk_screen_height ();
screen = gtk_widget_get_screen (dialog);
ruler_width = gdk_screen_get_width (screen);
ruler_height = gdk_screen_get_height (screen);
ruler_width = ruler_width - 300 - (ruler_width % 100);
ruler_height = ruler_height - 300 - (ruler_height % 100);
@ -149,7 +152,7 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry,
gtk_container_set_border_width (GTK_CONTAINER (table), 8);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), table);
gtk_widget_show (table);
if (pixbuf)
{
GtkWidget *image = gtk_image_new_from_pixbuf (pixbuf);
@ -175,7 +178,7 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry,
gtk_widget_show (ruler);
ebox = gtk_event_box_new ();
SET_STYLE (ebox, ruler_style);
SET_STYLE (ebox, ruler_style);
gtk_table_attach (GTK_TABLE (table), ebox, 1, 2, 1, 2,
GTK_SHRINK, GTK_SHRINK, 0, 0);
gtk_widget_show (ebox);
@ -185,7 +188,7 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry,
gtk_widget_show (table);
darea = gtk_drawing_area_new ();
SET_STYLE (darea, dialog_style);
SET_STYLE (darea, dialog_style);
gtk_widget_set_size_request (darea, 16, 16);
if (expose_callback)
g_signal_connect (darea, "expose_event",
@ -196,7 +199,7 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry,
gtk_widget_show (darea);
darea = gtk_drawing_area_new ();
SET_STYLE (darea, dialog_style);
SET_STYLE (darea, dialog_style);
gtk_widget_set_size_request (darea, 16, 16);
if (expose_callback)
g_signal_connect (darea, "expose_event",
@ -207,7 +210,7 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry,
gtk_widget_show (darea);
darea = gtk_drawing_area_new ();
SET_STYLE (darea, dialog_style);
SET_STYLE (darea, dialog_style);
gtk_widget_set_size_request (darea, 16, 16);
if (expose_callback)
g_signal_connect (darea, "expose_event",
@ -218,7 +221,7 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry,
gtk_widget_show (darea);
darea = gtk_drawing_area_new ();
SET_STYLE (darea, dialog_style);
SET_STYLE (darea, dialog_style);
gtk_widget_set_size_request (darea, 16, 16);
if (expose_callback)
g_signal_connect (darea, "expose_event",
@ -231,8 +234,8 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry,
vbox = gtk_vbox_new (FALSE, 16);
gtk_table_attach_defaults (GTK_TABLE (table), vbox, 1, 2, 1, 2);
gtk_widget_show (vbox);
label =
label =
gtk_label_new (_("Measure the rulers and enter their lengths below."));
SET_STYLE (label, ruler_style);
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
@ -244,9 +247,9 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry,
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
calibrate_xres =
calibrate_xres =
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (resolution_entry), 0);
calibrate_yres =
calibrate_yres =
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (resolution_entry), 1);
calibrate_entry =

View File

@ -1641,6 +1641,7 @@ gimp_display_shell_origin_menu_position (GtkMenu *menu,
gpointer data)
{
GtkWidget *origin;
GdkScreen *screen;
gint origin_x;
gint origin_y;
@ -1651,10 +1652,12 @@ gimp_display_shell_origin_menu_position (GtkMenu *menu,
*x = origin_x + origin->allocation.x + origin->allocation.width - 1;
*y = origin_y + origin->allocation.y + (origin->allocation.height - 1) / 2;
if (*x + GTK_WIDGET (menu)->allocation.width > gdk_screen_width ())
screen = gtk_widget_get_screen (GTK_WIDGET (menu));
if (*x + GTK_WIDGET (menu)->allocation.width > gdk_screen_get_width (screen))
*x -= (GTK_WIDGET (menu)->allocation.width + origin->allocation.width);
if (*y + GTK_WIDGET (menu)->allocation.height > gdk_screen_height ())
if (*y + GTK_WIDGET (menu)->allocation.height > gdk_screen_get_height (screen))
*y -= (GTK_WIDGET (menu)->allocation.height);
}

View File

@ -488,6 +488,7 @@ gimp_display_shell_new (GimpDisplay *gdisp,
GtkWidget *arrow;
GtkWidget *image;
GtkWidget *menubar;
GdkScreen *screen;
gint image_width, image_height;
gint n_width, n_height;
gint s_width, s_height;
@ -528,8 +529,10 @@ gimp_display_shell_new (GimpDisplay *gdisp,
* value is the same as in gimp_display_shell_shrink_wrap. It
* probably should be a user-configurable option.
*/
s_width = gdk_screen_width () * 0.75;
s_height = gdk_screen_height () * 0.75;
screen = gtk_widget_get_screen (GTK_WIDGET (shell));
s_width = gdk_screen_get_width (screen) * 0.75;
s_height = gdk_screen_get_height (screen) * 0.75;
scalesrc = SCALESRC (shell);
scaledest = SCALEDEST (shell);
@ -1592,16 +1595,19 @@ gimp_display_shell_draw_cursor (GimpDisplayShell *shell)
void
gimp_display_shell_shrink_wrap (GimpDisplayShell *shell)
{
gint disp_width, disp_height;
gint width, height;
gint shell_width, shell_height;
gint max_auto_width, max_auto_height;
gint border_x, border_y;
gint s_width, s_height;
gboolean resize = FALSE;
GdkScreen *screen;
gint disp_width, disp_height;
gint width, height;
gint shell_width, shell_height;
gint max_auto_width, max_auto_height;
gint border_x, border_y;
gint s_width, s_height;
gboolean resize = FALSE;
s_width = gdk_screen_width ();
s_height = gdk_screen_height ();
screen = gtk_widget_get_screen (GTK_WIDGET (shell));
s_width = gdk_screen_get_width (screen);
s_height = gdk_screen_get_height (screen);
width = SCALEX (shell, shell->gdisp->gimage->width);
height = SCALEY (shell, shell->gdisp->gimage->height);

View File

@ -488,6 +488,7 @@ gimp_display_shell_new (GimpDisplay *gdisp,
GtkWidget *arrow;
GtkWidget *image;
GtkWidget *menubar;
GdkScreen *screen;
gint image_width, image_height;
gint n_width, n_height;
gint s_width, s_height;
@ -528,8 +529,10 @@ gimp_display_shell_new (GimpDisplay *gdisp,
* value is the same as in gimp_display_shell_shrink_wrap. It
* probably should be a user-configurable option.
*/
s_width = gdk_screen_width () * 0.75;
s_height = gdk_screen_height () * 0.75;
screen = gtk_widget_get_screen (GTK_WIDGET (shell));
s_width = gdk_screen_get_width (screen) * 0.75;
s_height = gdk_screen_get_height (screen) * 0.75;
scalesrc = SCALESRC (shell);
scaledest = SCALEDEST (shell);
@ -1592,16 +1595,19 @@ gimp_display_shell_draw_cursor (GimpDisplayShell *shell)
void
gimp_display_shell_shrink_wrap (GimpDisplayShell *shell)
{
gint disp_width, disp_height;
gint width, height;
gint shell_width, shell_height;
gint max_auto_width, max_auto_height;
gint border_x, border_y;
gint s_width, s_height;
gboolean resize = FALSE;
GdkScreen *screen;
gint disp_width, disp_height;
gint width, height;
gint shell_width, shell_height;
gint max_auto_width, max_auto_height;
gint border_x, border_y;
gint s_width, s_height;
gboolean resize = FALSE;
s_width = gdk_screen_width ();
s_height = gdk_screen_height ();
screen = gtk_widget_get_screen (GTK_WIDGET (shell));
s_width = gdk_screen_get_width (screen);
s_height = gdk_screen_get_height (screen);
width = SCALEX (shell, shell->gdisp->gimage->width);
height = SCALEY (shell, shell->gdisp->gimage->height);

View File

@ -257,6 +257,7 @@ gimp_navigation_view_popup (GimpDisplayShell *shell,
{
GimpNavigationView *view;
GimpNavigationPreview *preview;
GdkScreen *screen;
gint x, y;
gint x_org, y_org;
@ -316,12 +317,15 @@ gimp_navigation_view_popup (GimpDisplayShell *shell,
* but then it works as usual. Probably better than a popup that
* is completely unusable in the lower right of the screen.
*
* Warping the pointer would be another solution ...
* Warping the pointer would be another solution ...
*/
x = CLAMP (x, 0, (gdk_screen_width () -
screen = gtk_widget_get_screen (widget);
x = CLAMP (x, 0, (gdk_screen_get_width (screen) -
GIMP_PREVIEW (preview)->renderer->width -
4 * widget->style->xthickness));
y = CLAMP (y, 0, (gdk_screen_height () -
y = CLAMP (y, 0, (gdk_screen_get_height (screen) -
GIMP_PREVIEW (preview)->renderer->height -
4 * widget->style->ythickness));

View File

@ -257,6 +257,7 @@ gimp_navigation_view_popup (GimpDisplayShell *shell,
{
GimpNavigationView *view;
GimpNavigationPreview *preview;
GdkScreen *screen;
gint x, y;
gint x_org, y_org;
@ -316,12 +317,15 @@ gimp_navigation_view_popup (GimpDisplayShell *shell,
* but then it works as usual. Probably better than a popup that
* is completely unusable in the lower right of the screen.
*
* Warping the pointer would be another solution ...
* Warping the pointer would be another solution ...
*/
x = CLAMP (x, 0, (gdk_screen_width () -
screen = gtk_widget_get_screen (widget);
x = CLAMP (x, 0, (gdk_screen_get_width (screen) -
GIMP_PREVIEW (preview)->renderer->width -
4 * widget->style->xthickness));
y = CLAMP (y, 0, (gdk_screen_height () -
y = CLAMP (y, 0, (gdk_screen_get_height (screen) -
GIMP_PREVIEW (preview)->renderer->height -
4 * widget->style->ythickness));

View File

@ -55,16 +55,16 @@ resolution_calibrate_ok (GtkWidget *button,
calibrate_xres = (gdouble)ruler_width * calibrate_xres / x;
calibrate_yres = (gdouble)ruler_height * calibrate_yres / y;
chain_button = g_object_get_data (G_OBJECT (resolution_entry),
chain_button = g_object_get_data (G_OBJECT (resolution_entry),
"chain_button");
if (chain_button &&
if (chain_button &&
ABS (x -y) > GIMP_MIN_RESOLUTION)
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (chain_button), FALSE);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (resolution_entry),
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (resolution_entry),
0, calibrate_xres);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (resolution_entry),
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (resolution_entry),
1, calibrate_yres);
gtk_widget_destroy (GTK_WIDGET (data));
@ -102,15 +102,16 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry,
GtkWidget *darea;
GtkWidget *ruler;
GtkWidget *label;
GdkScreen *screen;
GList *list;
g_return_if_fail (GIMP_IS_SIZE_ENTRY (resolution_entry));
g_return_if_fail (pixbuf == NULL || GDK_IS_PIXBUF (pixbuf));
/* this dialog can only exist once */
if (calibrate_entry)
return;
return;
dialog = gimp_dialog_new (_("Calibrate Monitor Resolution"),
"calibrate_resolution",
NULL, NULL,
@ -139,8 +140,10 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry,
SET_STYLE (dialog, dialog_style);
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 8);
ruler_width = gdk_screen_width ();
ruler_height = gdk_screen_height ();
screen = gtk_widget_get_screen (dialog);
ruler_width = gdk_screen_get_width (screen);
ruler_height = gdk_screen_get_height (screen);
ruler_width = ruler_width - 300 - (ruler_width % 100);
ruler_height = ruler_height - 300 - (ruler_height % 100);
@ -149,7 +152,7 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry,
gtk_container_set_border_width (GTK_CONTAINER (table), 8);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), table);
gtk_widget_show (table);
if (pixbuf)
{
GtkWidget *image = gtk_image_new_from_pixbuf (pixbuf);
@ -175,7 +178,7 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry,
gtk_widget_show (ruler);
ebox = gtk_event_box_new ();
SET_STYLE (ebox, ruler_style);
SET_STYLE (ebox, ruler_style);
gtk_table_attach (GTK_TABLE (table), ebox, 1, 2, 1, 2,
GTK_SHRINK, GTK_SHRINK, 0, 0);
gtk_widget_show (ebox);
@ -185,7 +188,7 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry,
gtk_widget_show (table);
darea = gtk_drawing_area_new ();
SET_STYLE (darea, dialog_style);
SET_STYLE (darea, dialog_style);
gtk_widget_set_size_request (darea, 16, 16);
if (expose_callback)
g_signal_connect (darea, "expose_event",
@ -196,7 +199,7 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry,
gtk_widget_show (darea);
darea = gtk_drawing_area_new ();
SET_STYLE (darea, dialog_style);
SET_STYLE (darea, dialog_style);
gtk_widget_set_size_request (darea, 16, 16);
if (expose_callback)
g_signal_connect (darea, "expose_event",
@ -207,7 +210,7 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry,
gtk_widget_show (darea);
darea = gtk_drawing_area_new ();
SET_STYLE (darea, dialog_style);
SET_STYLE (darea, dialog_style);
gtk_widget_set_size_request (darea, 16, 16);
if (expose_callback)
g_signal_connect (darea, "expose_event",
@ -218,7 +221,7 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry,
gtk_widget_show (darea);
darea = gtk_drawing_area_new ();
SET_STYLE (darea, dialog_style);
SET_STYLE (darea, dialog_style);
gtk_widget_set_size_request (darea, 16, 16);
if (expose_callback)
g_signal_connect (darea, "expose_event",
@ -231,8 +234,8 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry,
vbox = gtk_vbox_new (FALSE, 16);
gtk_table_attach_defaults (GTK_TABLE (table), vbox, 1, 2, 1, 2);
gtk_widget_show (vbox);
label =
label =
gtk_label_new (_("Measure the rulers and enter their lengths below."));
SET_STYLE (label, ruler_style);
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
@ -244,9 +247,9 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry,
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
calibrate_xres =
calibrate_xres =
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (resolution_entry), 0);
calibrate_yres =
calibrate_yres =
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (resolution_entry), 1);
calibrate_entry =

View File

@ -420,13 +420,14 @@ void
gimp_container_popup_show (GimpContainerPopup *popup,
GtkWidget *widget)
{
GtkRequisition requisition;
gint orig_x;
gint orig_y;
gint scr_width;
gint scr_height;
gint x;
gint y;
GtkRequisition requisition;
GdkScreen *screen;
gint orig_x;
gint orig_y;
gint scr_width;
gint scr_height;
gint x;
gint y;
g_return_if_fail (GIMP_IS_CONTAINER_POPUP (popup));
g_return_if_fail (GTK_IS_WIDGET (widget));
@ -440,8 +441,10 @@ gimp_container_popup_show (GimpContainerPopup *popup,
orig_y += widget->allocation.y;
}
scr_width = gdk_screen_width ();
scr_height = gdk_screen_height ();
screen = gtk_widget_get_screen (widget);
scr_width = gdk_screen_get_width (screen);
scr_height = gdk_screen_get_height (screen);
x = orig_x;
y = orig_y + widget->allocation.height;

View File

@ -90,7 +90,7 @@ static void gimp_dialog_factories_restore_foreach (gconstpointer key,
static void gimp_dialog_factories_clear_foreach (gconstpointer key,
GimpDialogFactory *factory,
gpointer data);
static void gimp_dialog_factory_get_window_info (GtkWidget *window,
static void gimp_dialog_factory_get_window_info (GtkWidget *window,
GimpSessionInfo *info);
static void gimp_dialog_factory_set_window_geometry (GtkWidget *window,
GimpSessionInfo *info);
@ -292,7 +292,7 @@ gimp_dialog_factory_from_name (const gchar *name)
factory_class = g_type_class_peek (GIMP_TYPE_DIALOG_FACTORY);
if (! factory_class)
return NULL;
/* hack to keep the toolbox on the pool position */
if (strcmp (name, "toolbox") == 0)
name = "";
@ -470,7 +470,7 @@ gimp_dialog_factory_dialog_new_internal (GimpDialogFactory *factory,
if (dialog)
{
g_object_set_data (G_OBJECT (dialog), "gimp-dialog-factory",
g_object_set_data (G_OBJECT (dialog), "gimp-dialog-factory",
factory);
g_object_set_data (G_OBJECT (dialog), "gimp-dialog-factory-entry",
entry);
@ -561,13 +561,13 @@ gimp_dialog_factory_dialog_new_internal (GimpDialogFactory *factory,
* @factory: a #GimpDialogFactory
* @identifier: the identifier of the dialog as registered with
* gimp_dialog_factory_register_entry()
* @preview_size:
*
* @preview_size:
*
* Creates a new toplevel dialog or a #GimpDockable, depending on whether
* %factory is a toplevel of dockable factory.
*
* Implicitly raises singleton dialogs.
*
*
* Return value: the newly created dialog or an already existing singleton
* dialog.
**/
@ -592,12 +592,12 @@ gimp_dialog_factory_dialog_new (GimpDialogFactory *factory,
* @identifier: the identifier of the dialog as registered with
* gimp_dialog_factory_register_entry()
* @preview_size:
*
*
* Raises an already existing toplevel dialog or #GimpDockable if it was
* already created by this %facory.
*
* Implicitly creates a new dialog if it was not found.
*
*
* Return value: the raised or newly created dialog.
**/
GtkWidget *
@ -622,14 +622,14 @@ gimp_dialog_factory_dialog_raise (GimpDialogFactory *factory,
* @identifier: the identifier of the dialog as registered with
* gimp_dialog_factory_register_entry()
* @preview_size:
*
*
* Creates a new #GimpDockable in the context of the #GimpDock it will be
* added to.
*
* Implicitly raises & returns an already existing singleton dockable,
* so callers should check that dockable->dockbook is NULL before trying
* to add it to it's #GimpDockbook.
*
*
* Return value: the newly created #GimpDockable or an already existing
* singleton dockable.
**/
@ -653,12 +653,12 @@ gimp_dialog_factory_dockable_new (GimpDialogFactory *factory,
/**
* gimp_dialog_factory_dock_new:
* @factory: a #GimpDialogFacotry
*
*
* Returns a new #GimpDock in this %factory's context. We use a function
* pointer passed to this %factory's constructor instead of simply
* gimp_dock_new() because we may want different instances of
* #GimpDialogFactory create different subclasses of #GimpDock.
*
*
* Return value: the newly created #GimpDock.
**/
GtkWidget *
@ -699,7 +699,7 @@ gimp_dialog_factory_add_dialog (GimpDialogFactory *factory,
return;
}
dialog_factory = g_object_get_data (G_OBJECT (dialog),
dialog_factory = g_object_get_data (G_OBJECT (dialog),
"gimp-dialog-factory");
entry = g_object_get_data (G_OBJECT (dialog), "gimp-dialog-factory-entry");
@ -871,7 +871,7 @@ gimp_dialog_factory_add_foreign (GimpDialogFactory *factory,
g_return_if_fail (GTK_IS_WIDGET (dialog));
g_return_if_fail (GTK_WIDGET_TOPLEVEL (dialog));
dialog_factory = g_object_get_data (G_OBJECT (dialog),
dialog_factory = g_object_get_data (G_OBJECT (dialog),
"gimp-dialog-factory");
entry = g_object_get_data (G_OBJECT (dialog), "gimp-dialog-factory-entry");
@ -898,7 +898,7 @@ gimp_dialog_factory_add_foreign (GimpDialogFactory *factory,
return;
}
g_object_set_data (G_OBJECT (dialog), "gimp-dialog-factory",
g_object_set_data (G_OBJECT (dialog), "gimp-dialog-factory",
factory);
g_object_set_data (G_OBJECT (dialog), "gimp-dialog-factory-entry",
entry);

View File

@ -202,6 +202,7 @@ gimp_editor_menu_position (GtkMenu *menu,
{
GtkRequisition requisition;
GtkWidget *editor;
GdkScreen *screen;
gint editor_x;
gint editor_y;
@ -214,13 +215,15 @@ gimp_editor_menu_position (GtkMenu *menu,
*x = editor_x + editor->allocation.x + 2;
*y = editor_y + editor->allocation.y + 2;
if (*x + requisition.width > gdk_screen_width ())
screen = gtk_widget_get_screen (GTK_WIDGET (menu));
if (*x + requisition.width > gdk_screen_get_width (screen))
*x -= requisition.width;
if (*x < 0)
*x = 0;
if (*y + requisition.height > gdk_screen_height ())
if (*y + requisition.height > gdk_screen_get_height (screen))
*y -= requisition.height;
if (*y < 0)

View File

@ -171,6 +171,7 @@ gimp_preview_popup_timeout (GimpPreviewPopup *popup)
GtkWidget *window;
GtkWidget *frame;
GtkWidget *preview;
GdkScreen *screen;
gint orig_x;
gint orig_y;
gint scr_width;
@ -198,8 +199,10 @@ gimp_preview_popup_timeout (GimpPreviewPopup *popup)
gtk_widget_show (preview);
gdk_window_get_origin (popup->widget->window, &orig_x, &orig_y);
scr_width = gdk_screen_width ();
scr_height = gdk_screen_height ();
screen = gtk_widget_get_screen (popup->widget);
scr_width = gdk_screen_get_width (screen);
scr_height = gdk_screen_get_height (screen);
x = orig_x + popup->button_x - (popup->popup_width >> 1);
y = orig_y + popup->button_y - (popup->popup_height >> 1);

View File

@ -171,6 +171,7 @@ gimp_preview_popup_timeout (GimpPreviewPopup *popup)
GtkWidget *window;
GtkWidget *frame;
GtkWidget *preview;
GdkScreen *screen;
gint orig_x;
gint orig_y;
gint scr_width;
@ -198,8 +199,10 @@ gimp_preview_popup_timeout (GimpPreviewPopup *popup)
gtk_widget_show (preview);
gdk_window_get_origin (popup->widget->window, &orig_x, &orig_y);
scr_width = gdk_screen_width ();
scr_height = gdk_screen_height ();
screen = gtk_widget_get_screen (popup->widget);
scr_width = gdk_screen_get_width (screen);
scr_height = gdk_screen_get_height (screen);
x = orig_x + popup->button_x - (popup->popup_width >> 1);
y = orig_y + popup->button_y - (popup->popup_height >> 1);

View File

@ -105,7 +105,7 @@ gimp_message_box (const gchar *stock_id,
if (msg_box->repeat_count > 1)
{
gchar *text = g_strdup_printf (_("Message repeated %d times."),
gchar *text = g_strdup_printf (_("Message repeated %d times."),
msg_box->repeat_count);
gtk_label_set_text (GTK_LABEL (msg_box->repeat_label), text);
g_free (text);
@ -169,7 +169,7 @@ gimp_message_box (const gchar *stock_id,
image = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_DIALOG);
gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
gtk_widget_show (image);
gtk_widget_show (image);
vbox = gtk_vbox_new (FALSE, 6);
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
@ -230,7 +230,7 @@ gimp_message_box_close_callback (GtkWidget *widget,
/* Destroy the box */
gtk_widget_destroy (msg_box->mbox);
/* make this box available again */
message_boxes = g_list_remove (message_boxes, msg_box);
@ -245,11 +245,12 @@ gimp_menu_position (GtkMenu *menu,
gint *y,
gpointer data)
{
GtkRequisition requisition;
gint pointer_x;
gint pointer_y;
gint screen_width;
gint screen_height;
GtkRequisition requisition;
GdkScreen *screen;
gint pointer_x;
gint pointer_y;
gint screen_width;
gint screen_height;
g_return_if_fail (GTK_IS_MENU (menu));
g_return_if_fail (x != NULL);
@ -259,8 +260,10 @@ gimp_menu_position (GtkMenu *menu,
gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
screen_width = gdk_screen_width () + 2;
screen_height = gdk_screen_height () + 2;
screen = gtk_widget_get_screen (GTK_WIDGET (menu));
screen_width = gdk_screen_get_width (screen) + 2;
screen_height = gdk_screen_get_height (screen) + 2;
*x = CLAMP (pointer_x, 2, MAX (0, screen_width - requisition.width));
*y = CLAMP (pointer_y, 2, MAX (0, screen_height - requisition.height));
@ -294,7 +297,7 @@ gimp_table_attach_stock (GtkTable *table,
gtk_table_attach (table, label, 0, 1, row, row + 1,
GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show (label);
if (widget)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
@ -307,7 +310,7 @@ gimp_table_attach_stock (GtkTable *table,
}
image = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_BUTTON);
if (image)
{
gtk_misc_set_alignment (GTK_MISC (image), 0.0, 0.5);
@ -461,7 +464,7 @@ gimp_get_mod_separator (void)
* @screen: a #GdkScreen or %NULL
* @xres: returns the horizontal screen resolution (in dpi)
* @yres: returns the vertical screen resolution (in dpi)
*
*
* Retrieves the screen resolution from GDK. If @screen is %NULL, the
* default screen is used.
**/
@ -524,12 +527,12 @@ gimp_get_screen_resolution (GdkScreen *screen,
* gimp_rgb_get_gdk_color:
* @rgb: the source color as #GimpRGB
* @gdk_color: pointer to a #GdkColor
*
*
* Initializes @gdk_color from a #GimpRGB. This function does not
* allocate the color for you. Depending on how you want to use it,
* you may have to call gdk_colormap_alloc_color().
**/
void
void
gimp_rgb_get_gdk_color (const GimpRGB *rgb,
GdkColor *gdk_color)
{
@ -537,9 +540,9 @@ gimp_rgb_get_gdk_color (const GimpRGB *rgb,
g_return_if_fail (rgb != NULL);
g_return_if_fail (gdk_color != NULL);
gimp_rgb_get_uchar (rgb, &r, &g, &b);
gdk_color->red = (r << 8) | r;
gdk_color->green = (g << 8) | g;
gdk_color->blue = (b << 8) | b;

View File

@ -1104,6 +1104,7 @@ load_image (const gchar *filename)
GdkColor *colors;
guchar *rtbl, *gtbl, *btbl;
guint rmask, gmask, bmask, rshift, gshift, bshift;
gdouble xres, yres;
int argc;
char **argv;
@ -1132,7 +1133,7 @@ load_image (const gchar *filename)
}
g_memmove (&apm_head.Key, buffer, 4);
if (GUINT32_FROM_LE (apm_head.Key) == 0x9ac6cdd7)
{
if (!ReadOK (fp, buffer + SIZE_WMFHEAD,
@ -1174,11 +1175,9 @@ load_image (const gchar *filename)
window.org_x = window.org_y = 0;
window.valid = FALSE;
#ifdef GTK_HAVE_FEATURES_1_1_2
pixs_per_in = (int) (25.4 * gdk_screen_width () / gdk_screen_width_mm ());
#else
pixs_per_in = 72;
#endif
gimp_get_monitor_resolution (&xres, &yres);
pixs_per_in = (int) ((xres + yres) / 2.0);
#ifdef DEBUG
g_print ("pixs_per_in: %d\n", pixs_per_in);
#endif
@ -1253,7 +1252,7 @@ load_image (const gchar *filename)
/* XXX */
sync_record (record.Size, 4, fp);
break;
case SaveDC:
dc = g_new (DC, 1);
if (canvas == NULL)
@ -1455,7 +1454,7 @@ load_image (const gchar *filename)
case MM_LOMETRIC:
units_per_in = 254;
goto set_window_and_viewport;
case MM_TEXT:
units_per_in = pixs_per_in;
goto set_window_and_viewport;