app: keep docks on the monitor in gimp_ui_configurer_move_docks_to_window()
and don't move them to the very left and right of the screen, which might be on different monitors. Also clean up the function.
This commit is contained in:
@ -76,7 +76,7 @@ static void gimp_ui_configurer_separate_docks (GimpUIC
|
|||||||
GimpImageWindow *source_image_window);
|
GimpImageWindow *source_image_window);
|
||||||
static void gimp_ui_configurer_move_docks_to_window (GimpUIConfigurer *ui_configurer,
|
static void gimp_ui_configurer_move_docks_to_window (GimpUIConfigurer *ui_configurer,
|
||||||
GimpDockColumns *dock_columns,
|
GimpDockColumns *dock_columns,
|
||||||
GimpAlignmentType screen_side_destination);
|
GimpAlignmentType screen_side);
|
||||||
static void gimp_ui_configurer_separate_shells (GimpUIConfigurer *ui_configurer,
|
static void gimp_ui_configurer_separate_shells (GimpUIConfigurer *ui_configurer,
|
||||||
GimpImageWindow *source_image_window);
|
GimpImageWindow *source_image_window);
|
||||||
static void gimp_ui_configurer_configure_for_single_window (GimpUIConfigurer *ui_configurer);
|
static void gimp_ui_configurer_configure_for_single_window (GimpUIConfigurer *ui_configurer);
|
||||||
@ -321,8 +321,7 @@ gimp_ui_configurer_separate_docks (GimpUIConfigurer *ui_configurer,
|
|||||||
/**
|
/**
|
||||||
* gimp_ui_configurer_move_docks_to_window:
|
* gimp_ui_configurer_move_docks_to_window:
|
||||||
* @dock_columns:
|
* @dock_columns:
|
||||||
* @screen_side_destination: At what side of the screen the dock window
|
* @screen_side: At what side of the screen the dock window should be put.
|
||||||
* should be put.
|
|
||||||
*
|
*
|
||||||
* Moves docks in @dock_columns into a new #GimpDockWindow and
|
* Moves docks in @dock_columns into a new #GimpDockWindow and
|
||||||
* position it on the screen in a non-overlapping manner.
|
* position it on the screen in a non-overlapping manner.
|
||||||
@ -330,27 +329,34 @@ gimp_ui_configurer_separate_docks (GimpUIConfigurer *ui_configurer,
|
|||||||
static void
|
static void
|
||||||
gimp_ui_configurer_move_docks_to_window (GimpUIConfigurer *ui_configurer,
|
gimp_ui_configurer_move_docks_to_window (GimpUIConfigurer *ui_configurer,
|
||||||
GimpDockColumns *dock_columns,
|
GimpDockColumns *dock_columns,
|
||||||
GimpAlignmentType screen_side_destination)
|
GimpAlignmentType screen_side)
|
||||||
{
|
{
|
||||||
GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (dock_columns));
|
GdkScreen *screen;
|
||||||
gint monitor = gimp_widget_get_monitor (GTK_WIDGET (dock_columns));
|
gint monitor;
|
||||||
GList *docks = g_list_copy (gimp_dock_columns_get_docks (dock_columns));
|
GdkRectangle monitor_rect;
|
||||||
GList *iter = NULL;
|
GList *docks;
|
||||||
gboolean contains_toolbox = FALSE;
|
GList *iter;
|
||||||
GtkWidget *dock_window = NULL;
|
gboolean contains_toolbox = FALSE;
|
||||||
GtkAllocation original_size = { 0, 0, 0, 0 };
|
GtkWidget *dock_window;
|
||||||
|
GtkAllocation original_size;
|
||||||
|
gchar geometry[32];
|
||||||
|
|
||||||
/* Are there docks to move at all? */
|
docks = g_list_copy (gimp_dock_columns_get_docks (dock_columns));
|
||||||
if (! docks)
|
if (! docks)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
screen = gtk_widget_get_screen (GTK_WIDGET (dock_columns));
|
||||||
|
monitor = gimp_widget_get_monitor (GTK_WIDGET (dock_columns));
|
||||||
|
|
||||||
|
gdk_screen_get_monitor_geometry (screen, monitor, &monitor_rect);
|
||||||
|
|
||||||
/* Remember the size so we can set the new dock window to the same
|
/* Remember the size so we can set the new dock window to the same
|
||||||
* size
|
* size
|
||||||
*/
|
*/
|
||||||
gtk_widget_get_allocation (GTK_WIDGET (dock_columns), &original_size);
|
gtk_widget_get_allocation (GTK_WIDGET (dock_columns), &original_size);
|
||||||
|
|
||||||
/* Do we need a toolbox window? */
|
/* Do we need a toolbox window? */
|
||||||
for (iter = docks; iter; iter = iter->next)
|
for (iter = docks; iter; iter = g_list_next (iter))
|
||||||
{
|
{
|
||||||
GimpDock *dock = GIMP_DOCK (iter->data);
|
GimpDock *dock = GIMP_DOCK (iter->data);
|
||||||
|
|
||||||
@ -377,7 +383,7 @@ gimp_ui_configurer_move_docks_to_window (GimpUIConfigurer *ui_configurer,
|
|||||||
-1 /*view_size*/,
|
-1 /*view_size*/,
|
||||||
FALSE /*present*/);
|
FALSE /*present*/);
|
||||||
|
|
||||||
for (iter = docks; iter; iter = iter->next)
|
for (iter = docks; iter; iter = g_list_next (iter))
|
||||||
{
|
{
|
||||||
GimpDock *dock = GIMP_DOCK (iter->data);
|
GimpDock *dock = GIMP_DOCK (iter->data);
|
||||||
|
|
||||||
@ -389,12 +395,24 @@ gimp_ui_configurer_move_docks_to_window (GimpUIConfigurer *ui_configurer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Position the window */
|
/* Position the window */
|
||||||
if (screen_side_destination == GIMP_ALIGN_LEFT)
|
if (screen_side == GIMP_ALIGN_LEFT)
|
||||||
gtk_window_parse_geometry (GTK_WINDOW (dock_window), "+0+0");
|
{
|
||||||
else if (screen_side_destination == GIMP_ALIGN_RIGHT)
|
g_snprintf (geometry, sizeof (geometry), "%+d%+d",
|
||||||
gtk_window_parse_geometry (GTK_WINDOW (dock_window), "-0+0");
|
monitor_rect.x,
|
||||||
|
monitor_rect.y);
|
||||||
|
}
|
||||||
|
else if (screen_side == GIMP_ALIGN_RIGHT)
|
||||||
|
{
|
||||||
|
g_snprintf (geometry, sizeof (geometry), "%+d%+d",
|
||||||
|
monitor_rect.x + monitor_rect.width - original_size.width,
|
||||||
|
monitor_rect.y);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
g_assert_not_reached ();
|
{
|
||||||
|
g_assert_not_reached ();
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_window_parse_geometry (GTK_WINDOW (dock_window), geometry);
|
||||||
|
|
||||||
/* Try to keep the same size */
|
/* Try to keep the same size */
|
||||||
gtk_window_set_default_size (GTK_WINDOW (dock_window),
|
gtk_window_set_default_size (GTK_WINDOW (dock_window),
|
||||||
|
Reference in New Issue
Block a user