Not logged inOpenClonk Forum
Up Topic Multi pointer X (MPX) for multiplaying on same computer

This board is threaded (i.e. has a tree structure). Please use the Reply button of the specific post you are referring to, not just any random button. If you want to reply to the topic in general, use the Post button near the top and bottom of the page.

Post Reply
In Response to aapo
Thanks you for your answers.

I have played with code and added hundred (not really) printf and Log to understand how flow of events works. I think this is doable.

a) How I should implement it?
X11 is handling events like this: 
switch (event.type)
  case KeyPress:
     Game.DoKeyboardInput

And XInput2 (MPX) is handling it:
switch(event.xcookie.evtype)
  case XI_KeyPress:
    Game.DoKeyboardInput

So should it be
#ifdef MPX
switch(event.xcookie.evtype)
#else
switch (event.type)
#endif

#ifdef MPX
  case KeyPress:
#else
  case XI_KeyPress:
#endif

    Game.DoKeyboardInput

Now they are guaranteed to be synced.
Another way is something like:
static void _internal_keypress(something) {
    Game.DoKeyboardInput
}

#ifdef MPX
switch(event.xcookie.evtype)
  case XI_KeyPress:
    _internal_keypress(something);
#else
switch (event.type)
  case KeyPress:
    _internal_keypress(something);
#endif

b) Should it be compile or runtime decision?
It can be easily checked with
  /* Check for XI2 support */
  int major = 2, minor = 0;
  if (XIQueryVersion(display, &major, &minor) == BadRequest) {
    printf("XI2 not available. Server supports %d.%d\n", major, minor);
  }

c) What is preferred way to send patches?
I have used to use git. I happily make smallest (=atomic) possible commits (I have never used hg).

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill