xlib

How to embed a program inside another using GTK, XLib or any similar?

雨燕双飞 提交于 2019-12-08 13:11:18
问题 I'm trying to make a "simple" program, all it does is to list all opened programs and, once you choose one, it opens it inside your window (like a thumbnail you may say, but you can also interact). One thing, it has to be one way only (I can't alter the embbeded program and add a "socket" or "plug" for instance). I want to be able to embbed any program (e.g. Opera, evince, JDownloader etc). Does anyone have any idea of how can I do it? If it can't be done using GTK, can it be done using X or

Use Xlib inside Qt

♀尐吖头ヾ 提交于 2019-12-08 08:12:49
问题 I would like to be able to modify the Qt window's properties with Xlib fonctions. I tried using QX11Info to get the display and QWidget::winId to get the window. Display *display = QX11Info::display(); int window = QWidget::winId (); XMoveResizeWindow(display, window, 100, 100, 400, 400); But it didn't work. I thought that maybe the window QWidget::winId () returns isn't the main one of the application. So I tried to modify its parent to see if it was the right window. Display *display =

How to draw an image from file on window with Xlib

*爱你&永不变心* 提交于 2019-12-08 07:59:45
问题 This is my code: int main() { Display *d = XOpenDisplay(0); unsigned int bitmap_width, bitmap_height; int x, y; Pixmap bitmap; if ( d ) { Window w = XCreateWindow(d, DefaultRootWindow(d), 0, 0, 400, 400, 0, CopyFromParent, CopyFromParent,CopyFromParent, 0, 0); GC gc = XCreateGC ( d, w, 0 , NULL ); int rc = XReadBitmapFile(d, w, "1.bmp", &bitmap_width, &bitmap_height, &bitmap, &x, &y); XCopyPlane(d, bitmap, w, gc,0, 0, bitmap_width, bitmap_height,0, 0, 1); XMapWindow(d, w); XFlush(d); sleep(10

How to draw an image from file on window with Xlib

孤人 提交于 2019-12-08 07:02:30
This is my code: int main() { Display *d = XOpenDisplay(0); unsigned int bitmap_width, bitmap_height; int x, y; Pixmap bitmap; if ( d ) { Window w = XCreateWindow(d, DefaultRootWindow(d), 0, 0, 400, 400, 0, CopyFromParent, CopyFromParent,CopyFromParent, 0, 0); GC gc = XCreateGC ( d, w, 0 , NULL ); int rc = XReadBitmapFile(d, w, "1.bmp", &bitmap_width, &bitmap_height, &bitmap, &x, &y); XCopyPlane(d, bitmap, w, gc,0, 0, bitmap_width, bitmap_height,0, 0, 1); XMapWindow(d, w); XFlush(d); sleep(10); } return 0; } But window is clear. I do not understand why it is not working. Where did I make

C++ and Xlib - center window

懵懂的女人 提交于 2019-12-08 06:32:28
问题 I have started to study GUI applications programming based on XLib directly and I am trying to create a centered window on the screen. I don't know the usual technique used to achieve this. My code (which doesn't work) is this (I use CodeBlocks) #include <stdio.h> #include <stdlib.h> #include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/Xos.h> #include <X11/Xatom.h> #include <X11/keysym.h> #include <GL/glew.h> #include <GL/freeglut.h> int screen; Display *display; XSetWindowAttributes

Disable actions, move, resize, minimize, etc using python-xlib

一世执手 提交于 2019-12-08 04:37:57
问题 I'm making a program where I need to lock the position of a window on the screen, one would think the easy way to do this is using _NET_WM_ALLOWED_ACTIONS but apparently didn't work or I don't know how it work xD... I tried to send an event, something like this: def getatom (atom): return self.display.intern_atom(atom) data = [getatom("_NET_WM_ACTION_ABOVE"),getatom("_NET_WM_ACTION_CLOSE"), getatom("_NET_WM_ACTION_BELOW"),getatom("_NET_WM_ACTION_CHANGE_DESKTOP"), getatom("_NET_WM_ACTION_SHADE

How to create semi transparent white window in XLib

老子叫甜甜 提交于 2019-12-08 04:28:08
问题 I would like to create a semi transparent white window in XLib, but the window is not semi translucent, it remains fully opaque. I use the compton compositor and there are transparent windows in the system, so the problem is in the code: #include <X11/Xlib.h> #include <X11/Xutil.h> #include <stdio.h> int main(int argc, char* argv[]) { Display* display = XOpenDisplay(NULL); XVisualInfo vinfo; XMatchVisualInfo(display, DefaultScreen(display), 32, TrueColor, &vinfo); XSetWindowAttributes attr;

XSelectInput is not working for ButtonPressEvents,how to do it?

你。 提交于 2019-12-07 18:12:33
问题 I am writing a simple programmes in C where i want to capture all the mouse and Keyboard events that are taking place. I tried to use "XGrabPointer" but it results in locking the screen and i can not go to other applications. I tried with "XSelectInput()" and now i am receiving the keyboard events successfully but i am not getting any mouse click events. Any idea how can i do it? The code snippet is as follows: #include <stdio.h> #include <stdlib.h> #include <X11/Xlib.h> #include <X11/Xutil.h

grabbing keyboard doesnt allow changing focus

ⅰ亾dé卋堺 提交于 2019-12-07 15:55:24
问题 as soon as i use display.grab_keyboard, no other window seems to know of its own focus. with the keyboardgrab running i can select other windows and even send keyevents to them, but if this window is a text input there will be no blinking cursor. i read something about grab_keyboard generating focusevents, but that doesnt mean it blocks all focus events, does it? what am i not getting here? from Xlib import X,XK from Xlib.display import Display import signal,sys root = None display = None def

Xlib screenshot call

久未见 提交于 2019-12-07 15:07:39
问题 After seeing the question How to take screenshot (high fps) in Linux (programming) the discussion in the comments has exposed that even thought the problem of rapidly capturing the screenshots is well described. We couldn't actually find the description of the logic behind. This question was created with intention of resolving the information regarding memory handling of the XLib screen capture Does xlib screen capture copy the memory from kernel space into user space, or is it creating the