当前位置: 首页 > 图文教程 > 操作系统 > Unix/Linux > 启动“gnome-run”对话框

Unix/Linux
Linux管理员手册(4)--内存管理
开始进入Linux的知识问答
TCP/IP基础----为Linux做准备(1)
怎样用linux拨号上网
Linux 下文件的压缩、打包与解开
Linux操作系统下的浏览器举要
Linux中的字型(FONTS)设定
用FIPS为LINUX分区
Squid -- Linux下的一个优秀代理服务器软件使用详解
基于Linux的目录服务实现
动手制做自己的Linux启动盘(1)
如何为Linux添加软件详解
LINUX的引导过程
关于Linux下编写和编译程序的几个问题
中文BluePoint Linux 1.0RC 版安装介绍(二)
怎样让你的Linux使用起来更像Windows
Linux下无线上网设置方法
Linux系统下架设CS服务器的完美方法
优化Linux系统硬盘的七个实用技巧
在Linux操作系统中如何截获系统调用

Unix/Linux 中的 启动“gnome-run”对话框


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-01   浏览: 59 ::
收藏到网摘: n/a


“gnome-run” 命令在比较新的gnome里已经没有了。只能用编程的方法来做到这一点了。这个是gnome定义的少数几个Atom之一。
void die(const char *message){ fputs(message, stderr); exit(1);}
Atom get_atom(Display *display, const char *atom_name){ Atom atom = XInternAtom(display, atom_name, False); if (atom == None) die("can't find an atom I need"); return atom;}
int main(){ Display *display; Atom gnome_panel_atom, run_atom; XClientMessageEvent event;
display = XOpenDisplay(NULL); if (display == NULL) die("can't open display");
gnome_panel_atom = get_atom(display, "_GNOME_PANEL_ACTION"); run_atom = get_atom(display, "_GNOME_PANEL_ACTION_RUN_DIALOG");
event.type = ClientMessage; event.window = DefaultRootWindow(display); event.message_type = gnome_panel_atom; event.format = 32; event.data.l[0] = run_atom; event.data.l[1] = (Time)0;
XSendEvent(display, event.window, False, StructureNotifyMask, (XEvent *)&event);

XCloseDisplay(display);
return 0;}