Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2007-11

[OOT?] xlib+gnome: bring Run dialog up front

2 messages · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bee

Ok, I give up. :-D

How to bring the Run dialog up front?

Here's the code, I got it from
http://darkness.codefu.org/wordpress/2004/07/24/152 and translate it to pascal. It works but the dialog is not brought to front. :(

----->8--- pascal code begin --->8--------

program gnome_run;
{$MODE OBJFPC}{$H+}
uses
   x, xlib;
function FindAtom(ADisplay: PXDisplay; const AtomName: string): TAtom;
var
   FAtom: TAtom;
begin
   FAtom := XInternAtom(ADisplay, PChar(AtomName), false);
   if FAtom = None then
   begin
     Writeln('Error: can''t find requested atom.');
     Halt;
   end;
   Result := FAtom;
end;
(******** main program ********)
var
   Display: PXDisplay;
   GnomePanelAtom, RunDialogAtom: TAtom;
   ClientEvent: TXClientMessageEvent;
begin
   // open x display
   Display := XOpenDisplay(nil);
   if Display = nil then
   begin
     Writeln('Error: can''t open X display.');
     Halt;
   end;
   // find panel atoms
   GnomePanelAtom := FindAtom(Display, '_GNOME_PANEL_ACTION');
   RunDialogAtom := FindAtom(Display, '_GNOME_PANEL_ACTION_RUN_DIALOG');
   // set event properties
   ClientEvent._Type := ClientMessage;
   ClientEvent.Window := DefaultRootWindow(Display);
   ClientEvent.Message_Type := GnomePanelAtom;
   ClientEvent.Format := 32;
   ClientEvent.Data.l[0] := RunDialogAtom;
   Clientevent.Data.l[1] := TTime(0);
   // run panel
   XSendEvent(Display, ClientEvent.Window, false, StructureNotifyMask,
PXEvent(@ClientEvent));
   XCloseDisplay(Display);
end.

-----8<--- pascal code end ---8<--------

Using fpc 2.2.1 on Ubuntu Gutsy i386.

TIA.

-Bee-

has Bee.ography at:
http://beeography.wordpress.com

Reply by email