Author Topic: Windows + touchscreen/stylus problems + possible fix  (Read 3655 times)

Offline surt

  • Squaddie
  • *
  • Posts: 4
    • View Profile
    • Pixel Joint gallery
Windows + touchscreen/stylus problems + possible fix
« on: March 01, 2014, 11:50:49 pm »
I recently got a new tablet PC and trying to play openxcom windows daily build, but when using touch and active stylus in fullscreen the mouse cursor gets offset making it basically unusable. Works fine in windowed mode.

I've had his issue in the past with SDL based games on various devices with absolute pointing too.

Any ideas how to fix this?

EDIT:
Tried setting environment variable SDL_MOUSE_RELATIVE=0 to no effect.
grafx2 seems to have solved this problem: https://code.google.com/p/grafx2/issues/detail?id=317#c5 diff

EDIT2:
Problem also occurs on my linux desktop with my Intuos.
The following change to Cursor.cpp seems to do the trick:
Code: [Select]
Cursor::Cursor(int width, int height, int x, int y) : Surface(width, height, x, y), _color(0)
{
SDL_ShowCursor(SDL_ENABLE);
unsigned char cursor = 0;
SDL_SetCursor(SDL_CreateCursor(&cursor, &cursor, 1,1,0,0));
}

Cursor::~Cursor()
{
SDL_FreeCursor(SDL_GetCursor());
}

I'm sure it's not the best place for the code, you don't need to do this every time you create a cursor, just once at startup but it works as a quick hack.

EDIT3:
Okay, moved that code into Game.cpp in the Game constructor and destructor and remove the "SDL_ShowCursor(SDL_DISABLE);" line from the Cursor constructor and it still seems to work fine.

EDIT4:
Forked on github and sent pull request.
« Last Edit: March 02, 2014, 05:50:47 am by surt »

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: Windows + touchscreen/stylus problems + possible fix
« Reply #1 on: March 02, 2014, 06:33:06 am »
you could also try windowed borderless at your native resolution?

Offline surt

  • Squaddie
  • *
  • Posts: 4
    • View Profile
    • Pixel Joint gallery
Re: Windows + touchscreen/stylus problems + possible fix
« Reply #2 on: March 02, 2014, 07:54:44 am »
Cool didn't know about that.
Cursor moves fine, but now when using stylus I have the windows cursor drawn on top of the in-game cursor and for some reason it's stuck on the waiting cursor.
It'd still be nice to have it working properly in fullscreen.