+static PlayerType
+get_player_type(Display *dpy, char *rsrc)
+{
+ PlayerType result;
+ char *s = get_string_resource(dpy, rsrc, "String");
+ if (!strcmp(s, "ai") || !strcmp(s, "AI"))
+ {
+ result = PLAYER_AI;
+ }
+# ifndef HAVE_JWXYZ
+ else if (!strcmp(s, "mouse"))
+ {
+ result = PLAYER_MOUSE;
+ }
+# endif
+ else if (!strcmp(s, "tab") || !strcmp(s, "tablet"))
+ {
+ result = PLAYER_TABLET;
+ }
+ else if (!strcmp(s, "kb") || !strcmp(s, "keyb") || !strcmp(s, "keyboard") ||
+ !strcmp(s, "right") || !strcmp(s, "kbright") ||
+ !strcmp(s, "arrows"))
+ {
+ result = PLAYER_KEYBOARD;
+ }
+ else if (!strcmp(s, "left") || !strcmp(s, "kbleft") ||
+ !strcmp(s, "ws") || !strcmp(s, "wasd"))
+ {
+ result = PLAYER_KEYBOARD_LEFT;
+ }
+ else
+ {
+ fprintf(stderr, "%s: invalid player type\n", progname);
+ result = PLAYER_AI;
+ }
+ free(s);
+ return result;
+}
+
+static void
+do_shape (struct state *st, const XWindowAttributes *xgwa)
+{
+ st->w = xgwa->width;
+ st->h = xgwa->height;
+ st->screen_h = XHeightOfScreen(xgwa->screen);
+ st->screen_h_mm = XHeightMMOfScreen(xgwa->screen);
+}
+
+#ifndef HAVE_JWXYZ
+static Bool
+needs_grab (struct state *st)
+{
+ return
+ st->l_paddle.player == PLAYER_MOUSE ||
+ st->r_paddle.player == PLAYER_MOUSE;
+/*
+ st->l_paddle.player == PLAYER_TABLET ||
+ st->r_paddle.player == PLAYER_TABLET;
+ */
+}
+
+static void
+grab_pointer (struct state *st)
+{
+ st->is_focused = True;
+ XGrabPointer(st->dpy, st->window, True, PointerMotionMask, GrabModeAsync,
+ GrabModeAsync, st->window, st->null_cursor, CurrentTime);
+}
+#endif /* !HAVE_JWXYZ */
+