mirror of https://github.com/GNOME/gimp.git
wrap gui_libs_init() so we don't need to include gui.h from main.c
2003-05-28 Sven Neumann <sven@gimp.org> * app/app_procs.[ch]: wrap gui_libs_init() so we don't need to include gui.h from main.c * app/main.c: changed accordingly. * app/gui/gui.[ch]: added a GdkScreen parameter to gui_get_screen_resolution(). Use NULL if you want the default screen. * app/gui/preferences-dialog.c * app/gui/user-install-dialog.c: changed accordingly. * app/display/gimpdisplayshell-scale.c: use the monitor resolution stored in the GimpDisplayShell object. * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell.c: get the monitor resolution for the widget's GdkScreen. Set it in the realize method so it gets changed when the image window is migrated to another screen.
This commit is contained in:
parent
ad3efec7d2
commit
698a4ad07e
22
ChangeLog
22
ChangeLog
|
@ -1,3 +1,25 @@
|
|||
2003-05-28 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/app_procs.[ch]: wrap gui_libs_init() so we don't need to
|
||||
include gui.h from main.c
|
||||
|
||||
* app/main.c: changed accordingly.
|
||||
|
||||
* app/gui/gui.[ch]: added a GdkScreen parameter to
|
||||
gui_get_screen_resolution(). Use NULL if you want the default
|
||||
screen.
|
||||
|
||||
* app/gui/preferences-dialog.c
|
||||
* app/gui/user-install-dialog.c: changed accordingly.
|
||||
|
||||
* app/display/gimpdisplayshell-scale.c: use the monitor resolution
|
||||
stored in the GimpDisplayShell object.
|
||||
|
||||
* app/display/gimpdisplayshell-handlers.c
|
||||
* app/display/gimpdisplayshell.c: get the monitor resolution for
|
||||
the widget's GdkScreen. Set it in the realize method so it gets
|
||||
changed when the image window is migrated to another screen.
|
||||
|
||||
2003-05-28 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/gui/image-menu.c
|
||||
|
|
|
@ -279,6 +279,12 @@ app_init (gint gimp_argc,
|
|||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
app_gui_init (gint *argc,
|
||||
gchar ***argv)
|
||||
{
|
||||
return gui_libs_init (argc, argv);
|
||||
}
|
||||
|
||||
/* private functions */
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#ifndef __APP_PROCS_H__
|
||||
#define __APP_PROCS_H__
|
||||
|
||||
|
||||
#ifndef GIMP_APP_GLUE_COMPILATION
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: Dont #include "app_procs.h"
|
||||
|
@ -33,8 +34,11 @@
|
|||
extern Gimp *the_gimp;
|
||||
|
||||
|
||||
void app_init (gint gimp_argc,
|
||||
gchar **gimp_argv);
|
||||
void app_init (gint gimp_argc,
|
||||
gchar **gimp_argv);
|
||||
|
||||
gboolean app_gui_init (gint *gimp_argc,
|
||||
gchar ***gimp_argv);
|
||||
|
||||
|
||||
#endif /* __APP_PROCS_H__ */
|
||||
|
|
|
@ -369,7 +369,7 @@ prefs_res_source_callback (GtkWidget *widget,
|
|||
|
||||
if (from_gdk)
|
||||
{
|
||||
gui_get_screen_resolution (&xres, &yres);
|
||||
gui_get_screen_resolution (NULL, &xres, &yres);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1635,7 +1635,7 @@ prefs_dialog_new (Gimp *gimp,
|
|||
gdouble xres, yres;
|
||||
gchar *str;
|
||||
|
||||
gui_get_screen_resolution (&xres, &yres);
|
||||
gui_get_screen_resolution (NULL, &xres, &yres);
|
||||
|
||||
str = g_strdup_printf (_("(Currently %d x %d dpi)"),
|
||||
ROUND (xres), ROUND (yres));
|
||||
|
|
|
@ -1240,7 +1240,7 @@ user_install_resolution (GimpRc *gimprc)
|
|||
gchar *pixels_per_unit;
|
||||
gchar *str;
|
||||
|
||||
gui_get_screen_resolution (&xres, &yres);
|
||||
gui_get_screen_resolution (NULL, &xres, &yres);
|
||||
|
||||
add_label (GTK_BOX (resolution_page),
|
||||
_("GIMP can obtain this information from the windowing system.\n"
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
#include "widgets/gimpitemfactory.h"
|
||||
#include "widgets/gimpmenufactory.h"
|
||||
|
||||
#include "gui/gui.h"
|
||||
#include "gui/info-window.h"
|
||||
|
||||
#include "tools/tool_manager.h"
|
||||
|
@ -89,6 +90,7 @@ static void gimp_display_shell_class_init (GimpDisplayShellClass *klass)
|
|||
static void gimp_display_shell_init (GimpDisplayShell *shell);
|
||||
|
||||
static void gimp_display_shell_destroy (GtkObject *object);
|
||||
static void gimp_display_shell_realize (GtkWidget *widget);
|
||||
static gboolean gimp_display_shell_delete_event (GtkWidget *widget,
|
||||
GdkEventAny *aevent);
|
||||
|
||||
|
@ -174,6 +176,7 @@ gimp_display_shell_class_init (GimpDisplayShellClass *klass)
|
|||
|
||||
object_class->destroy = gimp_display_shell_destroy;
|
||||
|
||||
widget_class->realize = gimp_display_shell_realize;
|
||||
widget_class->delete_event = gimp_display_shell_delete_event;
|
||||
widget_class->popup_menu = gimp_display_shell_popup_menu;
|
||||
|
||||
|
@ -397,6 +400,33 @@ gimp_display_shell_destroy (GtkObject *object)
|
|||
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_display_shell_realize (GtkWidget *widget)
|
||||
{
|
||||
GimpDisplayShell *shell;
|
||||
GimpDisplayConfig *config;
|
||||
|
||||
GTK_WIDGET_CLASS (parent_class)->realize (widget);
|
||||
|
||||
shell = GIMP_DISPLAY_SHELL (widget);
|
||||
config = GIMP_DISPLAY_CONFIG (shell->gdisp->gimage->gimp->config);
|
||||
|
||||
/* We set the monitor resolution in the realize method so that
|
||||
* it is changed when the display shell is migrated to another screen.
|
||||
*/
|
||||
if (GIMP_DISPLAY_CONFIG (config)->monitor_res_from_gdk)
|
||||
{
|
||||
gui_get_screen_resolution (gtk_widget_get_screen (widget),
|
||||
&shell->monitor_xres,
|
||||
&shell->monitor_yres);
|
||||
}
|
||||
else
|
||||
{
|
||||
shell->monitor_xres = GIMP_DISPLAY_CONFIG (config)->monitor_xres;
|
||||
shell->monitor_yres = GIMP_DISPLAY_CONFIG (config)->monitor_yres;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_display_shell_delete_event (GtkWidget *widget,
|
||||
GdkEventAny *aevent)
|
||||
|
|
|
@ -108,8 +108,6 @@ gimp_display_shell_connect (GimpDisplayShell *shell)
|
|||
|
||||
display_config = GIMP_DISPLAY_CONFIG (gimage->gimp->config);
|
||||
|
||||
shell->monitor_xres = display_config->monitor_xres;
|
||||
shell->monitor_yres = display_config->monitor_yres;
|
||||
shell->padding_mode = display_config->canvas_padding_mode;
|
||||
shell->padding_color = display_config->canvas_padding_color;
|
||||
|
||||
|
@ -424,8 +422,17 @@ gimp_display_shell_monitor_res_notify_handler (GObject *config,
|
|||
GParamSpec *param_spec,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
shell->monitor_xres = GIMP_DISPLAY_CONFIG (config)->monitor_xres;
|
||||
shell->monitor_yres = GIMP_DISPLAY_CONFIG (config)->monitor_yres;
|
||||
if (GIMP_DISPLAY_CONFIG (config)->monitor_res_from_gdk)
|
||||
{
|
||||
gui_get_screen_resolution (gtk_widget_get_screen (shell),
|
||||
&shell->monitor_xres,
|
||||
&shell->monitor_yres);
|
||||
}
|
||||
else
|
||||
{
|
||||
shell->monitor_xres = GIMP_DISPLAY_CONFIG (config)->monitor_xres;
|
||||
shell->monitor_yres = GIMP_DISPLAY_CONFIG (config)->monitor_yres;
|
||||
}
|
||||
|
||||
if (! shell->dot_for_dot)
|
||||
{
|
||||
|
|
|
@ -368,12 +368,10 @@ gimp_display_shell_scale_fit (GimpDisplayShell *shell)
|
|||
|
||||
if (! shell->dot_for_dot)
|
||||
{
|
||||
GimpDisplayConfig *config = GIMP_DISPLAY_CONFIG (gimage->gimp->config);
|
||||
|
||||
image_width = ROUND (image_width *
|
||||
config->monitor_xres / gimage->xresolution);
|
||||
shell->monitor_xres / gimage->xresolution);
|
||||
image_height = ROUND (image_height *
|
||||
config->monitor_yres / gimage->yresolution);
|
||||
shell->monitor_xres / gimage->yresolution);
|
||||
}
|
||||
|
||||
zoom_factor = MIN ((gdouble) shell->disp_width / (gdouble) image_width,
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
#include "widgets/gimpitemfactory.h"
|
||||
#include "widgets/gimpmenufactory.h"
|
||||
|
||||
#include "gui/gui.h"
|
||||
#include "gui/info-window.h"
|
||||
|
||||
#include "tools/tool_manager.h"
|
||||
|
@ -89,6 +90,7 @@ static void gimp_display_shell_class_init (GimpDisplayShellClass *klass)
|
|||
static void gimp_display_shell_init (GimpDisplayShell *shell);
|
||||
|
||||
static void gimp_display_shell_destroy (GtkObject *object);
|
||||
static void gimp_display_shell_realize (GtkWidget *widget);
|
||||
static gboolean gimp_display_shell_delete_event (GtkWidget *widget,
|
||||
GdkEventAny *aevent);
|
||||
|
||||
|
@ -174,6 +176,7 @@ gimp_display_shell_class_init (GimpDisplayShellClass *klass)
|
|||
|
||||
object_class->destroy = gimp_display_shell_destroy;
|
||||
|
||||
widget_class->realize = gimp_display_shell_realize;
|
||||
widget_class->delete_event = gimp_display_shell_delete_event;
|
||||
widget_class->popup_menu = gimp_display_shell_popup_menu;
|
||||
|
||||
|
@ -397,6 +400,33 @@ gimp_display_shell_destroy (GtkObject *object)
|
|||
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_display_shell_realize (GtkWidget *widget)
|
||||
{
|
||||
GimpDisplayShell *shell;
|
||||
GimpDisplayConfig *config;
|
||||
|
||||
GTK_WIDGET_CLASS (parent_class)->realize (widget);
|
||||
|
||||
shell = GIMP_DISPLAY_SHELL (widget);
|
||||
config = GIMP_DISPLAY_CONFIG (shell->gdisp->gimage->gimp->config);
|
||||
|
||||
/* We set the monitor resolution in the realize method so that
|
||||
* it is changed when the display shell is migrated to another screen.
|
||||
*/
|
||||
if (GIMP_DISPLAY_CONFIG (config)->monitor_res_from_gdk)
|
||||
{
|
||||
gui_get_screen_resolution (gtk_widget_get_screen (widget),
|
||||
&shell->monitor_xres,
|
||||
&shell->monitor_yres);
|
||||
}
|
||||
else
|
||||
{
|
||||
shell->monitor_xres = GIMP_DISPLAY_CONFIG (config)->monitor_xres;
|
||||
shell->monitor_yres = GIMP_DISPLAY_CONFIG (config)->monitor_yres;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_display_shell_delete_event (GtkWidget *widget,
|
||||
GdkEventAny *aevent)
|
||||
|
|
|
@ -281,7 +281,7 @@ gui_init (Gimp *gimp)
|
|||
{
|
||||
gdouble xres, yres;
|
||||
|
||||
gui_get_screen_resolution (&xres, &yres);
|
||||
gui_get_screen_resolution (NULL, &xres, &yres);
|
||||
|
||||
g_object_set (gimp->config,
|
||||
"monitor-xresolution", xres,
|
||||
|
@ -347,22 +347,27 @@ gui_post_init (Gimp *gimp)
|
|||
}
|
||||
|
||||
void
|
||||
gui_get_screen_resolution (gdouble *xres,
|
||||
gdouble *yres)
|
||||
gui_get_screen_resolution (GdkScreen *screen,
|
||||
gdouble *xres,
|
||||
gdouble *yres)
|
||||
{
|
||||
gint width, height;
|
||||
gint width_mm, height_mm;
|
||||
gdouble x = 0.0;
|
||||
gdouble y = 0.0;
|
||||
|
||||
g_return_if_fail (screen == NULL || GDK_IS_SCREEN (screen));
|
||||
g_return_if_fail (xres != NULL);
|
||||
g_return_if_fail (yres != NULL);
|
||||
|
||||
width = gdk_screen_width ();
|
||||
height = gdk_screen_height ();
|
||||
if (!screen)
|
||||
screen = gdk_screen_get_default ();
|
||||
|
||||
width_mm = gdk_screen_width_mm ();
|
||||
height_mm = gdk_screen_height_mm ();
|
||||
width = gdk_screen_get_width (screen);
|
||||
height = gdk_screen_get_height (screen);
|
||||
|
||||
width_mm = gdk_screen_get_width_mm (screen);
|
||||
height_mm = gdk_screen_get_height_mm (screen);
|
||||
|
||||
/*
|
||||
* From xdpyinfo.c:
|
||||
|
@ -391,8 +396,8 @@ gui_get_screen_resolution (gdouble *xres,
|
|||
}
|
||||
|
||||
/* round the value to full integers to give more pleasant results */
|
||||
*xres = RINT (x);
|
||||
*yres = RINT (y);
|
||||
*xres = ROUND (x);
|
||||
*yres = ROUND (y);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -33,7 +33,8 @@ void gui_restore (Gimp *gimp,
|
|||
gboolean restore_session);
|
||||
void gui_post_init (Gimp *gimp);
|
||||
|
||||
void gui_get_screen_resolution (gdouble *xres,
|
||||
void gui_get_screen_resolution (GdkScreen *screen,
|
||||
gdouble *xres,
|
||||
gdouble *yres);
|
||||
|
||||
|
||||
|
|
|
@ -369,7 +369,7 @@ prefs_res_source_callback (GtkWidget *widget,
|
|||
|
||||
if (from_gdk)
|
||||
{
|
||||
gui_get_screen_resolution (&xres, &yres);
|
||||
gui_get_screen_resolution (NULL, &xres, &yres);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1635,7 +1635,7 @@ prefs_dialog_new (Gimp *gimp,
|
|||
gdouble xres, yres;
|
||||
gchar *str;
|
||||
|
||||
gui_get_screen_resolution (&xres, &yres);
|
||||
gui_get_screen_resolution (NULL, &xres, &yres);
|
||||
|
||||
str = g_strdup_printf (_("(Currently %d x %d dpi)"),
|
||||
ROUND (xres), ROUND (yres));
|
||||
|
|
|
@ -1240,7 +1240,7 @@ user_install_resolution (GimpRc *gimprc)
|
|||
gchar *pixels_per_unit;
|
||||
gchar *str;
|
||||
|
||||
gui_get_screen_resolution (&xres, &yres);
|
||||
gui_get_screen_resolution (NULL, &xres, &yres);
|
||||
|
||||
add_label (GTK_BOX (resolution_page),
|
||||
_("GIMP can obtain this information from the windowing system.\n"
|
||||
|
|
|
@ -44,8 +44,6 @@
|
|||
|
||||
#include "core/core-types.h"
|
||||
|
||||
#include "gui/gui.h"
|
||||
|
||||
#include "appenv.h"
|
||||
#include "app_procs.h"
|
||||
#include "errors.h"
|
||||
|
@ -169,7 +167,7 @@ main (int argc,
|
|||
}
|
||||
else
|
||||
{
|
||||
if (! gui_libs_init (&argc, &argv))
|
||||
if (! app_gui_init (&argc, &argv))
|
||||
{
|
||||
const gchar *msg;
|
||||
|
||||
|
|
Loading…
Reference in New Issue