Commit 6c524ea1 authored by Michael Natterer's avatar Michael Natterer 😴

app: GimpSessionInfo: use brute force to position dialogs

Window managers are such a crap. So on top of all friendly hinting and
geometry setting, simply use gtk_window_move() whenever a session
managed GtkDialog is shown. It should be very hard to ignore that, but
of course the WM has the last word no matter how hard we try.

Note: this code should be more complex and the signal connection
should happen in GimpDialogFactory. Left it in GimpSessionInfo for now
until it got a bit of testing.
parent c629cbeb
......@@ -72,6 +72,8 @@ static gboolean gimp_session_info_deserialize (GimpConfig *conf
gint nest_level,
gpointer data);
static gboolean gimp_session_info_is_for_dock_window (GimpSessionInfo *info);
static void gimp_session_info_dialog_show (GtkWidget *widget,
GimpSessionInfo *info);
G_DEFINE_TYPE_WITH_CODE (GimpSessionInfo, gimp_session_info, GIMP_TYPE_OBJECT,
......@@ -117,6 +119,8 @@ gimp_session_info_finalize (GObject *object)
gimp_session_info_clear_info (info);
gimp_session_info_set_widget (info, NULL);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
......@@ -432,6 +436,14 @@ gimp_session_info_is_for_dock_window (GimpSessionInfo *info)
return entry_state_for_dock && widget_state_for_dock;
}
static void
gimp_session_info_dialog_show (GtkWidget *widget,
GimpSessionInfo *info)
{
gtk_window_move (GTK_WINDOW (widget),
info->p->x, info->p->y);
}
/* public functions */
......@@ -616,6 +628,18 @@ gimp_session_info_apply_geometry (GimpSessionInfo *info)
if (use_size)
gtk_window_set_default_size (GTK_WINDOW (info->p->widget),
info->p->width, info->p->height);
/* Window managers and windowing systems suck. They have their own
* ideas about WM standards and when it's appropriate to honor
* user/application-set window positions and when not. Therefore,
* use brute force and "manually" position dialogs whenever they
* are shown. This is important especially for transient dialog,
* because window managers behave even "smarter" then...
*/
if (GTK_IS_DIALOG (info->p->widget))
g_signal_connect (info->p->widget, "show",
G_CALLBACK (gimp_session_info_dialog_show),
info);
}
/**
......@@ -745,12 +769,12 @@ gimp_session_info_clear_info (GimpSessionInfo *info)
info->p->aux_info = NULL;
}
if (info->p->docks)
{
g_list_free_full (info->p->docks,
(GDestroyNotify) gimp_session_info_dock_free);
info->p->docks = NULL;
}
if (info->p->docks)
{
g_list_free_full (info->p->docks,
(GDestroyNotify) gimp_session_info_dock_free);
info->p->docks = NULL;
}
}
gboolean
......@@ -808,6 +832,11 @@ gimp_session_info_set_widget (GimpSessionInfo *info,
{
g_return_if_fail (GIMP_IS_SESSION_INFO (info));
if (GTK_IS_DIALOG (info->p->widget))
g_signal_handlers_disconnect_by_func (info->p->widget,
gimp_session_info_dialog_show,
info);
info->p->widget = widget;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment