WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: FLTK question - Xorg without window manager  (Read 3455 times)

Offline Alatun

  • Newbie
  • *
  • Posts: 41
FLTK question - Xorg without window manager
« on: March 22, 2016, 07:16:46 AM »
Because of problems with Xvesa I need to switch to Xorg, which causes some new problems.

Currently I'm starting X without any window manager. I don't want a window manager, because
users are no allowed anything besides the RDP client and I need to disable various stuff window
managers offer.
Then I'm starting my RDP-client. If the RDP-client terminates, I'm starting a modified version of
exittc (Shutdown, reboot, restart RDP).

I have good knowledge about general C programming and Windows API functions, but my knowledge
about X programming and FLTK is next to nil. The concepts here seem similar to Windows, so doing
basic stuff works, but I'm still struggling with advanced stuff.

With Xvesa everything was fine. After switching to Xorg, when the modified version of exittc is being
started there is no mouse cursor visible.

Somewhere I found a note stating this: "mouse cursor stays hidden until the first call to XDefineCursor()"

Because exittc is written for FLTK I'm having problems how to add a call that does XDefineCursor().
FLTK wants to add an abstraction layer to X, so how would you do this in FLTK?

I added this code:
Code: [Select]
window->cursor(FL_CURSOR_DEFAULT);

after

Code: [Select]
window->show(argc,argv);

This shows a mouse cursor as soon as the mouse is being moved inside the exittc window.
But initially the mouse cursor is hidden and you need some wild mouse movement until your
mouse cursor enters the exittc window, which is not acceptable for end users.

Probably I need to do something similar for the "X root window" or how this may be called.
Is this possible in FLTK and how to do it?

Any help or idea how to deal with this problem is appreciated.

Thanks in advance.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11619
Re: FLTK question - Xorg without window manager
« Reply #1 on: March 22, 2016, 09:43:19 AM »
Hi Alatun
Quote
I have good knowledge about general C programming and Windows API functions, but my knowledge
about X programming and FLTK is next to nil.
Good sources for the X API are few and far in between. One of the best I've found is:
https://tronche.com/gui/x/xlib/
After setting the cursor, try issuing an  XFlush(display)  command. See:
https://tronche.com/gui/x/xlib/event-handling/XFlush.html
To find the value to pass to  Xflush , track down the FLTK equivalent of  XOpenDisplay().

Offline Alatun

  • Newbie
  • *
  • Posts: 41
Re: FLTK question - Xorg without window manager
« Reply #2 on: March 22, 2016, 10:33:42 AM »
Thanks for your links.

Already found some info.

Including "FL/x.H" gives you some access to several native X resources. "fl_display" seems to be the handle to X server.

This code seems to do the trick:
Code: [Select]
  myCursor = XCreateFontCursor(fl_display,XC_X_cursor);
  XDefineCursor(fl_display,XDefaultRootWindow(fl_display),myCursor);