Simplify the window size code

The correct behaviour with Gtk+ 3 seems to be achieved with the
remaining code. This should also be tested with Gtk+ 2 though.
This commit is contained in:
Pierre Pronchery 2018-10-24 23:04:03 +01:00
parent bc62620544
commit 68a2cf6c12

View File

@ -54,7 +54,6 @@ struct _DesktopIconWindow
/* functions */
/* desktopiconwindow_new */
static gboolean _on_desktopiconwindow_closex(void);
static void _on_desktopiconwindow_realize(GtkWidget * widget, gpointer data);
DesktopIconWindow * desktopiconwindow_new(DesktopIcon * icon)
{
@ -75,9 +74,6 @@ DesktopIconWindow * desktopiconwindow_new(DesktopIcon * icon)
gtk_window_set_focus_on_map(w, FALSE);
#endif
gtk_window_set_keep_below(w, TRUE);
#if !GTK_CHECK_VERSION(3, 0, 0)
gtk_window_set_resizable(w, FALSE);
#endif
gtk_window_set_skip_pager_hint(w, TRUE);
#ifdef EMBEDDED
gtk_window_set_type_hint(w, GDK_WINDOW_TYPE_HINT_UTILITY);
@ -88,8 +84,6 @@ DesktopIconWindow * desktopiconwindow_new(DesktopIcon * icon)
DESKTOPICON_MAX_WIDTH, DESKTOPICON_MAX_HEIGHT);
g_signal_connect(window->widget, "delete-event", G_CALLBACK(
_on_desktopiconwindow_closex), NULL);
g_signal_connect(window->widget, "realize", G_CALLBACK(
_on_desktopiconwindow_realize), window);
/* icon */
widget = desktopicon_get_widget(icon);
gtk_container_add(GTK_CONTAINER(window->widget), widget);
@ -103,30 +97,6 @@ static gboolean _on_desktopiconwindow_closex(void)
return TRUE;
}
static void _on_desktopiconwindow_realize(GtkWidget * widget, gpointer data)
{
DesktopIconWindow * window = data;
GdkWindow * w;
GdkGeometry geometry;
/* XXX check */
const unsigned int hints = GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE;
#ifdef DEBUG
fprintf(stderr, "DEBUG: %s()\n", __func__);
#endif
memset(&geometry, 0, sizeof(geometry));
geometry.min_width = DESKTOPICON_MIN_WIDTH;
geometry.min_height = DESKTOPICON_MIN_HEIGHT;
geometry.max_width = DESKTOPICON_MAX_WIDTH;
geometry.max_height = DESKTOPICON_MAX_HEIGHT;
#if GTK_CHECK_VERSION(2, 14, 0)
w = gtk_widget_get_window(window->widget);
#else
w = window->window;
#endif
gdk_window_set_geometry_hints(w, &geometry, hints);
}
/* desktopiconwindow_delete */
void desktopiconwindow_delete(DesktopIconWindow * window)