* Using Gdk layer of GtkAda
@ 2008-09-14 21:24 Ste.D
2008-09-16 2:53 ` Gene
0 siblings, 1 reply; 3+ messages in thread
From: Ste.D @ 2008-09-14 21:24 UTC (permalink / raw)
I have a large Ada/Xlib application that I wish to run on Windows.
I converted it to Gdk, and it works ok, but I'm not receiving
Expose events and only receive Configure events when the window
is de-maximized (ie. not when it is resized or maximized).
I have created a stripped down test program (see below) which
illustrates the problem.
Also, when my app calls Gtk.Clipboard.Set_Text, the Windows
clipboard is simply cleared.
Thanks in advance,
Steve D.
---
with Ada.Text_IO;
with Glib;
with Gdk.Color;
with Gdk.Drawable;
with Gdk.Event;
with Gdk.Font;
with Gdk.GC;
with Gdk.Main;
with Gdk.Window;
with Gdk.Window_Attr;
with Gtk.Widget;
procedure Gdk_Event_Test is
use type Gdk.Event.Gdk_Event;
use type Gdk.Font.Gdk_Font;
The_Window : Gdk.Window.Gdk_Window;
The_Font : Gdk.Font.Gdk_Font;
The_GC : Gdk.GC.Gdk_GC;
Black : Gdk.Color.Gdk_Color;
White : Gdk.Color.Gdk_Color;
Quit_Prog : exception;
procedure Init_X is
Window_Attr : Gdk.Window_Attr.Gdk_Window_Attr;
begin
Gdk.Main.Init;
Black := Gdk.Color.Black
(Gtk.Widget.Get_Default_Colormap);
White := Gdk.Color.White
(Gtk.Widget.Get_Default_Colormap);
Gdk.Font.Load
(Font => The_Font,
Font_Name => "Ariel");
if The_Font = Gdk.Font.Null_Font
then
Ada.Text_IO.Put_Line
("Error: Could not open font");
raise Quit_Prog;
end if;
Gdk.Window_attr.Gdk_New
(Window_Attr => Window_Attr,
Title => "Gdk Event Test",
Event_Mask => Gdk.Event.All_Events_Mask,
Window_Type => Gdk.Window.Window_Toplevel,
Width => 100,
Height => 30);
Gdk.Window.Gdk_New
(Window => The_Window,
Parent => Gdk.Window.Null_Window,
Attributes => Window_Attr,
Attributes_Mask => Gdk.Window.Wa_Title);
-- This makes no difference
--Gdk.Window.Set_Events
-- (Window => The_Window,
-- Event_Mask => Gdk.Event.All_Events_Mask);
Gdk.Window.Set_Background
(Window => The_Window,
Color => White);
Gdk.GC.Gdk_New
(GC => The_GC,
Drawable => The_Window);
Gdk.GC.Set_Foreground
(GC => The_GC,
Color => Black);
Gdk.GC.Set_Font
(GC => The_GC,
Font => The_Font);
Gdk.Window.Show (The_Window);
end Init_X;
procedure Process_Events is
An_Event : Gdk.Event.Gdk_Event;
begin
loop
loop
Gdk.Event.Get (An_Event);
exit when An_Event /= null;
delay 0.1;
end loop;
Ada.Text_IO.Put_Line
("Event Type = " &
Gdk.Event.Gdk_Event_Type'Image
(Gdk.Event.Get_Event_Type (An_Event)));
case Gdk.Event.Get_Event_Type (An_Event) is
when Gdk.Event.Expose |
Gdk.Event.Button_Press =>
Gdk.Drawable.Draw_Text
(Drawable => The_Window,
Font => The_Font,
GC => The_GC,
X => 10,
Y => 20,
Text => "Some Text");
when Gdk.Event.Delete =>
return;
when others =>
null;
end case;
Gdk.Event.Free (An_Event);
end loop;
end Process_Events;
begin
Init_X;
Process_Events;
end Gdk_Event_Test;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Using Gdk layer of GtkAda
2008-09-14 21:24 Using Gdk layer of GtkAda Ste.D
@ 2008-09-16 2:53 ` Gene
2008-09-20 11:37 ` Ste.D
0 siblings, 1 reply; 3+ messages in thread
From: Gene @ 2008-09-16 2:53 UTC (permalink / raw)
On Sep 14, 5:24 pm, "Ste.D" <no.s...@not.here> wrote:
> I have a large Ada/Xlib application that I wish to run on Windows.
>
> I converted it to Gdk, and it works ok, but I'm not receiving
> Expose events and only receive Configure events when the window
> is de-maximized (ie. not when it is resized or maximized).
>
> I have created a stripped down test program (see below) which
> illustrates the problem.
>
> Also, when my app calls Gtk.Clipboard.Set_Text, the Windows
> clipboard is simply cleared.
>
> Thanks in advance,
>
> Steve D.
>
> ---
> with Ada.Text_IO;
>
> with Glib;
>
> with Gdk.Color;
> with Gdk.Drawable;
> with Gdk.Event;
> with Gdk.Font;
> with Gdk.GC;
> with Gdk.Main;
> with Gdk.Window;
> with Gdk.Window_Attr;
>
> with Gtk.Widget;
>
> procedure Gdk_Event_Test is
>
> use type Gdk.Event.Gdk_Event;
> use type Gdk.Font.Gdk_Font;
>
> The_Window : Gdk.Window.Gdk_Window;
> The_Font : Gdk.Font.Gdk_Font;
> The_GC : Gdk.GC.Gdk_GC;
>
> Black : Gdk.Color.Gdk_Color;
> White : Gdk.Color.Gdk_Color;
>
> Quit_Prog : exception;
>
> procedure Init_X is
> Window_Attr : Gdk.Window_Attr.Gdk_Window_Attr;
> begin
>
> Gdk.Main.Init;
>
> Black := Gdk.Color.Black
> (Gtk.Widget.Get_Default_Colormap);
>
> White := Gdk.Color.White
> (Gtk.Widget.Get_Default_Colormap);
>
> Gdk.Font.Load
> (Font => The_Font,
> Font_Name => "Ariel");
>
> if The_Font = Gdk.Font.Null_Font
> then
> Ada.Text_IO.Put_Line
> ("Error: Could not open font");
>
> raise Quit_Prog;
> end if;
>
> Gdk.Window_attr.Gdk_New
> (Window_Attr => Window_Attr,
> Title => "Gdk Event Test",
> Event_Mask => Gdk.Event.All_Events_Mask,
> Window_Type => Gdk.Window.Window_Toplevel,
> Width => 100,
> Height => 30);
>
> Gdk.Window.Gdk_New
> (Window => The_Window,
> Parent => Gdk.Window.Null_Window,
> Attributes => Window_Attr,
> Attributes_Mask => Gdk.Window.Wa_Title);
>
> -- This makes no difference
> --Gdk.Window.Set_Events
> -- (Window => The_Window,
> -- Event_Mask => Gdk.Event.All_Events_Mask);
>
> Gdk.Window.Set_Background
> (Window => The_Window,
> Color => White);
>
> Gdk.GC.Gdk_New
> (GC => The_GC,
> Drawable => The_Window);
>
> Gdk.GC.Set_Foreground
> (GC => The_GC,
> Color => Black);
>
> Gdk.GC.Set_Font
> (GC => The_GC,
> Font => The_Font);
>
> Gdk.Window.Show (The_Window);
>
> end Init_X;
>
> procedure Process_Events is
> An_Event : Gdk.Event.Gdk_Event;
> begin
> loop
> loop
> Gdk.Event.Get (An_Event);
> exit when An_Event /= null;
> delay 0.1;
> end loop;
>
> Ada.Text_IO.Put_Line
> ("Event Type = " &
> Gdk.Event.Gdk_Event_Type'Image
> (Gdk.Event.Get_Event_Type (An_Event)));
>
> case Gdk.Event.Get_Event_Type (An_Event) is
> when Gdk.Event.Expose |
> Gdk.Event.Button_Press =>
>
> Gdk.Drawable.Draw_Text
> (Drawable => The_Window,
> Font => The_Font,
> GC => The_GC,
> X => 10,
> Y => 20,
> Text => "Some Text");
>
> when Gdk.Event.Delete =>
> return;
>
> when others =>
> null;
> end case;
>
> Gdk.Event.Free (An_Event);
>
> end loop;
>
> end Process_Events;
>
> begin
>
> Init_X;
>
> Process_Events;
>
> end Gdk_Event_Test;
It appears from this discussion
http://mail.gnome.org/archives/gtk-devel-list/2003-December/msg00095.html
that expose events don't make it to Gdk.Event.Get .
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Using Gdk layer of GtkAda
2008-09-16 2:53 ` Gene
@ 2008-09-20 11:37 ` Ste.D
0 siblings, 0 replies; 3+ messages in thread
From: Ste.D @ 2008-09-20 11:37 UTC (permalink / raw)
Gene wrote:
> On Sep 14, 5:24 pm, "Ste.D" <no.s...@not.here> wrote:
>> I have a large Ada/Xlib application that I wish to run on Windows.
>>
>> I converted it to Gdk, and it works ok, but I'm not receiving
>> Expose events and only receive Configure events when the window
>> is de-maximized (ie. not when it is resized or maximized).
>>
>> I have created a stripped down test program (see below) which
>> illustrates the problem.
>>
>> Also, when my app calls Gtk.Clipboard.Set_Text, the Windows
>> clipboard is simply cleared.
>>
>> Thanks in advance,
>>
>> Steve D.
>>
>> ---
>> with Ada.Text_IO;
>>
>> with Glib;
>>
>> with Gdk.Color;
>> with Gdk.Drawable;
>> with Gdk.Event;
>> with Gdk.Font;
>> with Gdk.GC;
>> with Gdk.Main;
>> with Gdk.Window;
>> with Gdk.Window_Attr;
>>
>> with Gtk.Widget;
>>
>> procedure Gdk_Event_Test is
>>
>> use type Gdk.Event.Gdk_Event;
>> use type Gdk.Font.Gdk_Font;
>>
>> The_Window : Gdk.Window.Gdk_Window;
>> The_Font : Gdk.Font.Gdk_Font;
>> The_GC : Gdk.GC.Gdk_GC;
>>
>> Black : Gdk.Color.Gdk_Color;
>> White : Gdk.Color.Gdk_Color;
>>
>> Quit_Prog : exception;
>>
>> procedure Init_X is
>> Window_Attr : Gdk.Window_Attr.Gdk_Window_Attr;
>> begin
>>
>> Gdk.Main.Init;
>>
>> Black := Gdk.Color.Black
>> (Gtk.Widget.Get_Default_Colormap);
>>
>> White := Gdk.Color.White
>> (Gtk.Widget.Get_Default_Colormap);
>>
>> Gdk.Font.Load
>> (Font => The_Font,
>> Font_Name => "Ariel");
>>
>> if The_Font = Gdk.Font.Null_Font
>> then
>> Ada.Text_IO.Put_Line
>> ("Error: Could not open font");
>>
>> raise Quit_Prog;
>> end if;
>>
>> Gdk.Window_attr.Gdk_New
>> (Window_Attr => Window_Attr,
>> Title => "Gdk Event Test",
>> Event_Mask => Gdk.Event.All_Events_Mask,
>> Window_Type => Gdk.Window.Window_Toplevel,
>> Width => 100,
>> Height => 30);
>>
>> Gdk.Window.Gdk_New
>> (Window => The_Window,
>> Parent => Gdk.Window.Null_Window,
>> Attributes => Window_Attr,
>> Attributes_Mask => Gdk.Window.Wa_Title);
>>
>> -- This makes no difference
>> --Gdk.Window.Set_Events
>> -- (Window => The_Window,
>> -- Event_Mask => Gdk.Event.All_Events_Mask);
>>
>> Gdk.Window.Set_Background
>> (Window => The_Window,
>> Color => White);
>>
>> Gdk.GC.Gdk_New
>> (GC => The_GC,
>> Drawable => The_Window);
>>
>> Gdk.GC.Set_Foreground
>> (GC => The_GC,
>> Color => Black);
>>
>> Gdk.GC.Set_Font
>> (GC => The_GC,
>> Font => The_Font);
>>
>> Gdk.Window.Show (The_Window);
>>
>> end Init_X;
>>
>> procedure Process_Events is
>> An_Event : Gdk.Event.Gdk_Event;
>> begin
>> loop
>> loop
>> Gdk.Event.Get (An_Event);
>> exit when An_Event /= null;
>> delay 0.1;
>> end loop;
>>
>> Ada.Text_IO.Put_Line
>> ("Event Type = " &
>> Gdk.Event.Gdk_Event_Type'Image
>> (Gdk.Event.Get_Event_Type (An_Event)));
>>
>> case Gdk.Event.Get_Event_Type (An_Event) is
>> when Gdk.Event.Expose |
>> Gdk.Event.Button_Press =>
>>
>> Gdk.Drawable.Draw_Text
>> (Drawable => The_Window,
>> Font => The_Font,
>> GC => The_GC,
>> X => 10,
>> Y => 20,
>> Text => "Some Text");
>>
>> when Gdk.Event.Delete =>
>> return;
>>
>> when others =>
>> null;
>> end case;
>>
>> Gdk.Event.Free (An_Event);
>>
>> end loop;
>>
>> end Process_Events;
>>
>> begin
>>
>> Init_X;
>>
>> Process_Events;
>>
>> end Gdk_Event_Test;
>
> It appears from this discussion
>
> http://mail.gnome.org/archives/gtk-devel-list/2003-December/msg00095.html
>
> that expose events don't make it to Gdk.Event.Get .
>
Oh, bugger!
I'm now trying to convert my app to Gtk and create a single Drawing_Area
widget, upon which I can then use my ported Xlib->Gdk code, only now
using callbacks for event handling.
But I'm getting a PROGRAM_ERROR as soon as i run it. I'll persevere a
bit longer but I'm disappointed that it isn't possible to use Gdk to
easily get an Xlib app up and running on Windows.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-09-20 11:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-14 21:24 Using Gdk layer of GtkAda Ste.D
2008-09-16 2:53 ` Gene
2008-09-20 11:37 ` Ste.D
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox