On Wed, Jun 27, 2007 at 05:03:48PM -0700, David J. Andruczyk wrote:
> I have an app that creates a window.  inside this
> window is an eventbox and inside that is a GtkFixed
> (no slapping me for using a GtkFixed, it works well
> for this purpose)
> 
> I want to be a be able to scale the window to ANY
> size. (yes i know the fixed widget doesn't handle
> scaling, I plan on handling that once i can sort out
> the resizing problems)
> 
> I've used gtk_window_set_geometry_hints to set the
> aspect ratio, and minimum size.  The problem is  the
> windows ALWAYS default displays at the minimum size.
> NOT at a size I specify using (gtk_window_resize) or
> similar.
> If I do NOT set the minimum geometry hint. I CAN set
> the size to be larger than the Fixed widget (with its
> children).
> 
> All I want to be able to do is tell GTK/window manager
>  that there's a window that can be no smaller than
> 100x100 and no larger than 1000x1000, and I want ot be
> able ot set the size to any point in between those
> extremes. (GTK ignores me, when using the hints)
> 
> any ideas?

Where exactly is the problem?  This works flawlessly for me:

===========================================================
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>

static gboolean
key_press(GtkWidget *widget,
          GdkEventKey *event)
{
    if (event->keyval >= GDK_0 && event->keyval <= GDK_9) {
        gint size = 60*(event->keyval - GDK_0 + 1);

        gtk_window_resize(GTK_WINDOW(widget), size, size);
        return TRUE;
    }
    return FALSE;
}

int
main(int argc, char *argv[])
{
    GtkWidget *window, *fixed, *widget;
    GdkGeometry geometry = { 60, 60, 600, 600, 0, 0, 0, 0, 0.0, 0.0, 0 };
    gint i;

    gtk_init(&argc, &argv);
    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);

    fixed = gtk_fixed_new();
    gtk_container_add(GTK_CONTAINER(window), fixed);

    for (i = 0; i < 33; i++) {
        widget = gtk_label_new("Bloody");
        gtk_fixed_put(GTK_FIXED(fixed), widget,
                      g_random_int_range(0, 560), g_random_int_range(0, 590));
    }

    gtk_window_set_geometry_hints(GTK_WINDOW(window), NULL, &geometry,
                                  GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE);
    gtk_window_set_default_size(GTK_WINDOW(window), 300, 300);
    g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
    g_signal_connect(window, "key-press-event", G_CALLBACK(key_press), NULL);

    g_print("Press 0-9 to resize me.\n");

    gtk_widget_show_all(window);
    gtk_main();

    return 0;
}
===========================================================

Yeti

--
http://gwyddion.net/
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to