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
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to