Note on compiling SDL 2.0 under Ubuntu/Linux Mint

While compiling SDL 2.0 under Linux Mint you may get an error, containing something like

conflicting types for 'XextAddDisplay' In file included from src/video/x11/SDL_x11dyn.h

Quick googling reveals this post on Arch Linux forums, which says that after upgrading to libXext 1.3.1 XextAddDisplay function argument type has changed from “char*” to “const char*”. Function is defined in SDL_x11sym.h.

My libXext version is 1.2.1, but nevertheless I looked into the SDL_x11sym.h file. There are the following lines:

#if SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY
SDL_X11_SYM(XExtDisplayInfo*,XextAddDisplay,(XExtensionInfo* a,Display* b,_Xconst char* c,XExtensionHooks* d,int e,XPointer f),(a,b,c,d,e,f),return)
#else
SDL_X11_SYM(XExtDisplayInfo*,XextAddDisplay,(XExtensionInfo* a,Display* b,char* c,XExtensionHooks* d,int e,XPointer f),(a,b,c,d,e,f),return)
#endif

After changing “char* c” to “_Xconst char* c” on the line after #else, everything compiled just fine. As you see, those 2 lines vary only with “_Xconst char*” being put instead of “char*”. It seems like although SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY was not true for some reason, it probably should had been :)

Using HP scanner in Fedora

Having HP Deskjet F2200 printer/scanner, I had a need to scan some images, with just Fedora laptop nearby. However, it was not detected by ‘Simple Scan’ app, which I typically use.
Running

sane-find-scanner

showed, that scanner is detected indeed, but somehow unusable.
And

scanimage -L

did not identify any scanners as well.
Fortunately, I found a solution in Fedora forums:
Continue reading

Simple X11 program tutorial

The purpose of this short post is to provide a simple yet working X-Window system program. That’s something I lacked, when I looked into X11 programming. A working example of program, that goes at least a little beyound showing the black window :) Sure, it’s not hard to look through few tutrials and make a working program yourself, but I think it’s easier to loose all your motivation that way. You can just copy-paste the code and compile it right away, like gcc test.c -o test -lX11 using gcc. Anyway, here you have it, I’m providing the following code under MIT license:
Continue reading

Xfce window manager lost solution

It’s rather common and irritating problem that on xfce some vital apps (like window manager) fail to start. There is a very finely detailed description of the bug in xfce bugzilla. As you can see, problem was reported almost 2 years ago, and nothing was done about it, besides that initial bug was merged into more generic bug titled “Make sure that some vital apps are running after startup”. Anyway, I made a script based on some existing solutions, which should resolve the problem in one double-click:
Continue reading