]>
Dogcows Code - chaz/openbox/blob - tools/gnome-panel-control/gnome-panel-control.c
13 int main(int argc
, char **argv
)
18 for (i
= 1; i
< argc
; ++i
) {
19 if (!strcmp(argv
[i
], "--help")) {
23 if (!strcmp(argv
[i
], "--main-menu")) {
27 if (!strcmp(argv
[i
], "--run-dialog")) {
34 printf("Usage: gnome-panel-control ACTION\n\n");
36 printf(" --help Display this help and exit\n");
37 printf(" --main-menu Show the main menu\n");
38 printf(" --run-dialog Show the run dialog\n\n");
45 XClientMessageEvent ce
;
49 d
= XOpenDisplay(NULL
);
52 "Unable to open the X display specified by the DISPLAY "
53 "environment variable. Ensure you have permission to "
54 "connect to the display.");
57 root
= RootWindowOfScreen(DefaultScreenOfDisplay(d
));
61 act_atom
= XInternAtom(d
, "_GNOME_PANEL_ACTION_MAIN_MENU", False
);
64 act_atom
= XInternAtom(d
, "_GNOME_PANEL_ACTION_RUN_DIALOG", False
);
70 /* Generate a timestamp */
75 win
= XCreateSimpleWindow(d
, root
, 0, 0, 1, 1, 0, 0, 0);
77 XSelectInput(d
, win
, PropertyChangeMask
);
79 XChangeProperty(d
, win
, act_atom
, act_atom
, 8,
80 PropModeAppend
, NULL
, 0);
81 XWindowEvent(d
, win
, PropertyChangeMask
, &event
);
83 XDestroyWindow(d
, win
);
85 timestamp
= event
.xproperty
.time
;
88 ce
.type
= ClientMessage
;
90 ce
.message_type
= XInternAtom(d
, "_GNOME_PANEL_ACTION", False
);
92 ce
.data
.l
[0] = act_atom
;
93 ce
.data
.l
[1] = timestamp
;
94 XSendEvent(d
, root
, False
, StructureNotifyMask
, (XEvent
*) &ce
);
This page took 0.036698 seconds and 4 git commands to generate.