Comment 2 for bug 960893

Revision history for this message
Ricardo Salveti (rsalveti) wrote :

Here's the code that checks for a valid input and fail:
clutter-backend.c + 459:
clutter_backend_real_init_events (ClutterBackend *backend)
...
  input_backend = g_getenv ("CLUTTER_INPUT_BACKEND");
  if (input_backend != NULL)
    input_backend = g_intern_string (input_backend);
...
#ifdef CLUTTER_INPUT_X11
  if (clutter_check_windowing_backend (CLUTTER_WINDOWING_X11) &&
      (input_backend == NULL || input_backend == I_(CLUTTER_INPUT_X11)))
    {
      _clutter_backend_x11_events_init (backend);
    }
  else
#endif
....
  if (input_backend != NULL)
    {
      if (input_backend != I_(CLUTTER_INPUT_NULL))
        g_error ("Unrecognized input backend '%s'", input_backend);
    }
  else
    g_error ("Unknown input backend");

As CLUTTER_INPUT_X11 exists, it'll first try to check the windowing_backend and then set the input_backend.

Here's what happen at clutter_check_windowing_backend:
clutter-main.c + 3672:
  ClutterMainContext *context = _clutter_context_get_default ();

  g_return_val_if_fail (backend_type != NULL, FALSE);

  backend_type = g_intern_string (backend_type);
...
#ifdef CLUTTER_WINDOWING_EGL
  if (backend_type == I_(CLUTTER_WINDOWING_EGL) &&
      CLUTTER_IS_BACKEND_EGL_NATIVE (context->backend))
    return TRUE;
  else
#endif
...
#ifdef CLUTTER_WINDOWING_X11
  if (backend_type == I_(CLUTTER_WINDOWING_X11) &&
      CLUTTER_IS_BACKEND_X11 (context->backend))
    return TRUE;
  else
#endif
  return FALSE;

As backend_type is "x11" (CLUTTER_WINDOWING_X11), it'll skip the EGL verification, but will fail while checking the X11 backend.

When running with GDB the check CLUTTER_IS_BACKEND_X11 (context->backend) returned FALSE, breaking the logic and then skipping any input method initialization.

Gdb output:
(gdb) p context
$1 = (ClutterMainContext *) 0x19a20
(gdb) p context->backend->cogl_display
$2 = (CoglDisplay *) 0x16928
(gdb) p context->backend->cogl_renderer
$3 = (CoglRenderer *) 0x1fc90
(gdb) p context->backend->cogl_renderer->connected
$4 = 1
(gdb) p context->backend->cogl_renderer->winsys_id_override
$5 = COGL_WINSYS_ID_ANY
(gdb) p context->backend->cogl_renderer->constraints
$6 = (GList *) 0x0
(gdb) p context->backend->cogl_renderer->foreign_xdpy
$7 = (Display *) 0x0
(gdb) p context->backend->cogl_renderer->driver
$8 = COGL_DRIVER_GLES2
(gdb) p backend_type
$9 = 0x1a483 "x11"