Menu
  • HOME
  • TAGS

CGO converting Xlib XEvent struct to byte array?

c,go,xlib,cgo

As mentioned in the cgo documentation: As Go doesn't have support for C's union type in the general case, C's union types are represented as a Go byte array with the same length. Another SO question: Golang CGo: converting union field to Go type or a go-nuts mailing list post...

xlib, remove delay when holding down a key

x11,xlib

'xset` can be used to set the rate and delay for repeating keypress events for a held-down key: http://www.x.org/archive/current/doc/man/man1/xset.1.xhtml Example here: http://linuxforcynics.com/how-to/set-keyboard-repeat-delay-and-rate...

Xlib fails (Segmentation fault) even with each connection per thread

multithreading,x11,xlib

Chances are that XOpenDisplay() uses some global variable internally that is not thread-safe or shares data between the displays. I don't think it's wise to call XOpenDisplay like that from within a thread; I suggest opening the displays sequentially first, then start the threads with a Display pointer. Or protect...

Redirect Keyboard input with XGrabKey or XGrabKeyboard

c++,keyboard,xlib

I didn't find a solution for the XGrabKeyboard problem. The XGrabKey failed for some keys because they were already grabbed by OpenBox. Openbox has some built-in hotkeys that use XGrabKey. Because I use AnyModifier, if any grab has been made that include this key then the grab will fail. For...

Xlib how to use XSaveContext/XFindContext in different programs

c++,xlib

You can't share data between two processes this way: Note that this is local to your program; the data is not stored in the server on a property list I'd suggest to use window properties as shared data storage...

How to set Xlib window background transparent?

background,transparent,xlib

You need to make sure window depth is 32 set value of alpha bits for transparent areas make sure you are running composite manager that can handle transparency correctly See my question "How to upload 32bit pixmap to server" as an example of how to set alpha channel value upd:...

Why window without borders is always on top

c,window,x11,xlib

That's how override-redirect windows are meant to behave. They are designed for implementing pop-up menus and similar windows which are transient and stay above other windows. If that's not what you want, do not use override-redirect flag. Instead, use WM hints. See here for the full list of hints. You...

X11 non-clipped child windows

x11,xlib,xcb

Yes ( you can override this if you implement your own composite manager ) Yes, unless window is added to a "save set". Yes ( but again with your own composite manager you can change visual mapping of [content of all windows hierarchy] -> [screen] any way you want...

Function XOpenDisplay with and without parameter

c,linux,xlib

You shall always check whether functions returned successfully, or not. It is not a Haskell, where all the checking done for you by monad, it is C. As for your particular case, the problem is that the function XOpenDisplay fails and returns null for you. In the next line you're...

Use Xlib inside Qt

qt,xlib

I found my error. The problem was that I was using these fonctions before the window was displayed. Display *display = QX11Info::display(); int window = QWidget::winId (); XMoveResizeWindow(display, window, 100, 100, 400, 400); This works if it is used after "show()". Sorry for that....

How to restore a window with Xlib?

linux,unix,x11,gnome,xlib

After a lot of stuggles, finally solved! In GNOME 3, windows have no "iconify/minimize" button. It appears that a window can't be minimized, neither by the user nor from code. When I called XIconifyWindow, the window wasn't minimized. If it had been minimized, I'd have gotten an "UnmapNotify" event, which...

Why I set xlib window background transparent failed?

c,linux,window,transparent,xlib

Your code works fine for me: kde: openbox + xcompmgr: Most likely you are not running composite manager. Try to start xcompmgr command Also check _NET_WM_CM_S0 selection owner - it should point to a window created by composite manager. #include <X11/Xlib.h> #include <X11/Xutil.h> #include <stdio.h> int main(int argc, char* argv[])...

window always on top using xlib

c,linux,xlib,gtk2

Yes it is possible and not complicated #include <gtk/gtk.h> int main(int argc, char **argv) { gtk_init(&argc, &argv); GtkWidget *mainwin; mainwin = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_keep_above ( (GtkWindow *) mainwin, TRUE); gtk_widget_show_all (mainwin); gtk_main (); return 0; } gtk_window_set_keep_above does trick if window manager is cooperative....

Cannot call XInitThreads

c++,sfml,xlib

"undefined reference to symbol" is a linker error, not a compiler error. If you get this message, the compiler has already finished compiled the file into an object file, but is unable to find the shared library which contains the function to link the object file into an executable. If...

WS_EX_TOOLWINDOW equivalent in xlib

c++,window,xlib

Found it: _NET_WM_STATE_SKIP_TASKBAR, Source: http://standards.freedesktop.org/wm-spec/wm-spec-1.3.html#id2507144

Query XSettings Manager for Icon Theme

c,x11,xlib,vala,freedesktop.org

There's a library called libxsettings-client that provides a C interface for accessing XSettings. You'd need to port the API to Vala, which looks pretty straight forward given how small it is (<70 lines). It would depend on x11.vapi, which is already included with Vala. Have a look at binding legacy...

al sending fake keyboard events, whitespace issues

c,linux,gtk,xlib

I just created my own translation function as you had suggested: switch (hello[i]) { case ' ': XTestFakeKeyEvent(dis, 65, True, 0); XTestFakeKeyEvent(dis, 65, False, 0); as for capital letters, I used a shift key with the regular key: case 'T': XTestFakeKeyEvent(dis, 50, True, 0); XTestFakeKeyEvent(dis, 28, True, 0); XTestFakeKeyEvent(dis, 28,...

linux x11 window manager - blocking mouse events

linux,x11,xlib,window-managers

Grab the mouse pointer and pass on the events to the destination window.

How to send click signals through a transparent window as xeyes with Xlib?

c,click,transparency,x11,xlib

Using non-rectangular windows is an extension. It's not part of the core protocol. The XShape... functions are provided in libXext. So to answer your question is that it is not possible to do this with only Xlib. There is some documentation for this library....

32bit XImage, XPutImage and alpha blending

linux,xlib

No, that's why XRender was introduced. Another option is GLX. One more option (slow): transfer previous content to client, blend in your client code and put pixmap back to server.

What are the differences between XDefaultScreen and XDefaultScreenOfDisplay?

xlib

XDefaultScreen (usually called by the macro DefaultScreen) returns the screen number which is used in most xlib functions where you want to specify a screen e.g. DefaultGC. XDefaultScreenOfDisplay (usually called by the macro DefaultScreenOfDisplay) returns a Screen pointer and is generally used when you want to find out information...

Position toolbar on reserved desktop space obtained with _NET_WM_STRUT and _NET_WM_STRUT_PARTIAL

qt,x11,xlib,xserver

The n.m.' answer is correct. I have found that for this to work reliably, the window should be of type _NET_WM_TYPE_DOCK and you must first map it then move it to position, otherwise the WM may sometimes place it outside of it own strut. – n.m. This is the code...

Why is XKeysymToKeycode() making all of my keys lowercase?

c,x11,xlib

KeySyms and KeyCodes are semantically different, and there is not a 1-1 relationship between them. A KeyCode is an arbitrary small integer representing a key on the keyboard. (Not a character. A key.) Xlib requires that key codes be in the range [8, 255], but fortunately most keyboards have only...

declared variable as float, but output is coming in integers

c++,output,xlib

It seems the members x and y are of an integral type, so the division is done on integers, which simply truncates the fractional part of the result. In other words, 50 / 100, which is 0.5, gets truncated to the 0 you see in your output. In order to...

Detecting X11 window resize towards top/left

c,x11,xlib

In Xlib use XTranslateCoordinates to translate the coordinate (0,0) in your viewport window into coordinates of the root window. This also covers the case of a stacking window manager messing with your window position.

Windows Gui and OpenGL relationship

user-interface,opengl,xlib

Xlib is the traditional client side implementation of the X11 protocol. The modern (replacement for Xlib) client side implementation would be Xcb, however OpenGL/GLX are a bit of a hassle to use with Xcb. X11 has nothing to do with Microsoft Windows. Xlib/Xcb are essentially protocol implementations that turn function...