Tag: x11

x11 – XGrabKeyboard后无法移动窗口

在调用XGrabKeyboard() ,我的应用程序捕获并显示所有按键/释放按键,包括GUI和PrintScreen键。 但是,用户无法再移动应用程序的窗口。 到目前为止,这发生在Fedora 17和Ubuntu 12.04上。 如何在XGrabKeyboard()的影响下允许用户移动应用程序? 以下是我的Qt应用程序的示例代码: bool KeyboardStatus::x11Event(XEvent *event) { switch (event->type) { case FocusIn: XGrabKeyboard(x11Info().display(), winId(), false, GrabModeAsync, GrabModeAsync, CurrentTime); break; case FocusOut: XUngrabKeyboard(x11Info().display(), CurrentTime); break; case KeyPress: // Display which key was pressed to user return true; case KeyRelease: // Display which key was released to user return true; } return […]

什么(~0L)是什么意思?

我正在做一些X11 ctypes编码,我不知道C但需要一些帮助来理解这一点。 在下面的C代码中(可能是C ++我不确定)我们看到(~0L)这是什么意思? 在Javascript和Python中~0表示-1 。 812 int result = GetProperty(window, property_name, 813 (~0L), // (all of them) 814 &type, &format, &num_items, &properties); 谢谢

如何使用XCB将关键事件发送到应用程序?

如何使用XCB从另一个程序向一个窗口(当前活动窗口)发送按键按键或按键释放事件? 我找到了一些使用XLib教程,但是我想使用XCB 。 我想我将不得不调用xcb_send_event ,但是我不知道将它作为参数传递给它。

与xlib链接需要做什么?

我正在使用GCC,我需要添加哪些开关才能与Xlib链接? 搜索之后,我找到的只是-lX11 ,但这给了我ld: library not found for -lX11 我正在使用mac(10.6),但我不喜欢Mac特有的任何东西。

有没有办法在X11中更改ConfigureNotify事件频率?

我有一个小图形程序,它使用ConfigureNotify事件来检测窗口大小调整和重绘应用程序。 但是,当拖动窗口resize时,resize事件似乎有点慢,这导致重绘不稳定。 有没有办法配置此事件率? 除此之外,有没有办法检测resize的开始/结束,以便我可以推迟重绘,直到达到最终大小?

如何确定使用哪种D-Bus绑定

如果屏幕保护程序正在运行或屏幕被锁定,我正试图检测所有Linux。 人们推荐dbus。 所以现在我试图用x11或C API自动检测什么样的dbus可用,然后使用它。 像qdubs,gdbus等? 谢谢

如何在XLib中创建半透明白色窗口

我想在XLib中创建一个半透明的白色窗口,但窗口不是半透明的,它仍然是完全不透明的。 我使用compton合成器,系统中有透明窗口,所以问题在于代码: #include #include #include int main(int argc, char* argv[]) { Display* display = XOpenDisplay(NULL); XVisualInfo vinfo; XMatchVisualInfo(display, DefaultScreen(display), 32, TrueColor, &vinfo); XSetWindowAttributes attr; attr.colormap = XCreateColormap(display, DefaultRootWindow(display), vinfo.visual, AllocNone); attr.border_pixel = 0; attr.background_pixel = 0x80ffffff; Window win = XCreateWindow(display, DefaultRootWindow(display), 0, 0, 300, 200, 0, vinfo.depth, InputOutput, vinfo.visual, CWColormap | CWBorderPixel | CWBackPixel, &attr); […]

用libx11截取屏幕截图

我目前正在尝试使用libx11截取屏幕截图 #include #include #include int main(void) { XImage* pic; Display* dpl; unsigned int buffer_size; dpl = XOpenDisplay(“127.0.0.1:0.0”); pic = XGetImage(dpl, RootWindow(dpl, DefaultScreen(dpl)), 10, 10, 201, 201, AllPlanes, ZPixmap); } 如果我使用-lX11编译代码并运行它,我会不断收到分段错误。 有任何想法吗? 提前致谢!

使用Xlib获取鼠标点击坐标

我想知道如何在屏幕上的任何位置使用Xlib获取鼠标点击的x和y坐标。 我发现这个post获取当前指针的位置 如何在X中获取当前鼠标(指针)位置坐标 , 但我不知道如何修改它,以便在单击鼠标时获取xy坐标。 我试过写这段代码,但它什么也没做。 #include #include #include #include int main (){ int x=-1,y=-1; XEvent event; int button; Display *display = XOpenDisplay(NULL); if (display == NULL) { fprintf(stderr, “Cannot connect to X server!\n”); exit (EXIT_FAILURE); } Window root= XDefaultRootWindow(display); XSelectInput(display, root, ButtonReleaseMask) ; while(1){ XNextEvent(display,&event); switch(event.type){ case ButtonRelease: switch(event.xbutton.button){ case Button1: x=event.xbutton.x; y=event.xbutton.y; button=Button1; […]

“X11 / Xlib.h”:mac os x mountain lion上没有这样的文件或目录

当我编写一个简单的程序时,我遇到了这个: #include #include #include Display* display; int main(){ display = XOpenDisplay(“”); if (display == NULL) { printf(“Cannot connect\n”); exit (-1); } else{ printf(“Success!\n”); XCloseDisplay(display); } } 仅供参考,我安装了xQuartz。 我用“g ++ -o ex ex.cpp -L / usr / X11R6 / lib -lX11”命令编译该程序。