Different behavior for a none decoration widget on Windows and Linux



Hello, Could anyone can help.

I created a none decoration widget using the following code.

And I compiled the code on Window 7 using Mingw with GTK+ 2.24.10.

Also I compiled the code on Linux using gcc (GCC) 4.4.6
with gtk2-devel-2.18.9-6.el6.x86_64.

When the widget shows, there was a item appeared on the bottom task bar on
both Windows 7 and Linux.

If I clicked the item on the Linux task bar, the widget minimized.

But when I clicked the item on the Window task bar, the widget does not
minimized to the task bar.

So could anybody tell me how could the widget minimized to the bottom task
bar when clicking on it for a Windows GTK+ application.

Thanks.

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include <stdlib.h>
#include <gtk/gtk.h>

int main (int argc, char *argv[]) {
    GtkWidget *button;
    GtkWidget *win = NULL;
    GtkWidget *vbox = NULL;

    // Initialize GTK+
    g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING, (GLogFunc) gtk_false,
NULL);
    gtk_init (&argc, &argv);
    g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING, g_log_default_handler,
NULL);

    /* Create the main window */
    win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_widget_set_size_request(win, 800, 600);
    gtk_window_set_decorated (GTK_WINDOW(win), FALSE);
    gtk_widget_set_can_focus(win, TRUE);
    gtk_window_set_resizable(GTK_WINDOW(win), TRUE);
    gtk_container_set_border_width (GTK_CONTAINER (win), 0);
    gtk_window_set_title (GTK_WINDOW (win), "Hello World");
    gtk_window_set_position (GTK_WINDOW (win), GTK_WIN_POS_CENTER);

    gtk_widget_realize (win);

    g_signal_connect (win, "destroy", gtk_main_quit, NULL);

    /* Create a vertical box with buttons */
    vbox = gtk_vbox_new (FALSE, 0);
    gtk_container_add (GTK_CONTAINER (win), vbox);

    button = gtk_button_new_from_stock (GTK_STOCK_DIALOG_INFO);
    gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);

    button = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
    g_signal_connect (button, "clicked", gtk_main_quit, NULL);
    gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);

    /* Enter the main loop */
    gtk_widget_show_all (win);
    gtk_main ();
    gdk_threads_leave();
    return 0;
}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]