Re: gtk_window_set_transient_for just works to dialog?
- From: Andy Stewart <lazycat manatee gmail com>
- To: gtk-list gnome org
- Subject: Re: gtk_window_set_transient_for just works to dialog?
- Date: Mon, 12 Oct 2009 18:37:16 +0800
Hi David,
First, thanks for your reply.
David Nečas <yeti physics muni cz> writes:
> On Mon, Oct 12, 2009 at 09:58:45AM +0800, Andy Stewart wrote:
>> Hi all,
>>
>> I have problem with function `gtk_window_set_transient_for`,
>> I use gtk2hs (Haskell binding for Gtk+),
>> so don't care gtk2hs binding problem and Haskell code format, you can test my problem in C code.
>
> I tried to test in C code...
>
>> I have two window: `windowA` and `windowB`, I want make `windowB`
>> keep above `windowA` and make `windowB` modal, `windowA` has created.
>>
>> ------------------------------> code start <------------------------------
>> windowB <- windowNew
>> windowSetTransientFor windowB windowA
>> windowSetModal windowB True
>> ------------------------------> code end <------------------------------
>>
>> But above code can't work, `windowB` don't display anything, `windowB` display blank.
>
> ...and it works exactly as it should.
>
> #include <gtk/gtk.h>
>
> int
> main(int argc, char *argv[])
> {
> GtkWidget *windowA, *windowB, *entry;
>
> gtk_init(&argc, &argv);
>
> windowA = gtk_window_new(GTK_WINDOW_TOPLEVEL);
> gtk_window_set_default_size(GTK_WINDOW(windowA), 300, 240);
> g_signal_connect(windowA, "destroy", G_CALLBACK(gtk_main_quit), NULL);
> entry = gtk_entry_new();
> gtk_entry_set_text(GTK_ENTRY(entry), "Window A");
> gtk_container_add(GTK_CONTAINER(windowA), entry);
> gtk_widget_show_all(windowA);
>
> windowB = gtk_window_new(GTK_WINDOW_TOPLEVEL);
> gtk_window_set_default_size(GTK_WINDOW(windowB), 200, 160);
> gtk_window_set_transient_for(GTK_WINDOW(windowB), GTK_WINDOW(windowA));
> gtk_window_set_position(GTK_WINDOW(windowB), GTK_WIN_POS_CENTER_ON_PARENT);
> gtk_window_set_modal(GTK_WINDOW(windowB), TRUE);
> entry = gtk_entry_new();
> gtk_entry_set_text(GTK_ENTRY(entry), "Window B");
> gtk_container_add(GTK_CONTAINER(windowB), entry);
> gtk_widget_show_all(windowB);
>
> gtk_main();
>
> return 0;
> }
After run your program, then i check mine.
I found where the problem.
You use fucntion `gtk_window_fullscreen` to make `windowA` fullscreen.
Then recompile you code, you will find `windowB` can't display
correctly.
It's works fine when `windowB` is `Dialog`.
I have test C code and Haskell code, both can't work.
So i think maybe this is a bug of Gtk+ C code.
Another problem is when `windowB` is `Dialog`, `windowB` and `windowA` share `One
Focus` when you type `Alt+Tab` to switch application windows.
But if we make `windowB` is `Window` and not `Dialog`, `windowB` and
`windowA` have `Two Focus` when you type `Alt+Tab`.
What do you think?
Cheers,
-- Andy
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]