static ClutterStageWindow * clutter_backend_egl_create_stage (ClutterBackend *backend, ClutterStage *wrapper, GError **error) { ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (backend); ClutterStageX11 *stage_x11; ClutterStageWindow *stage; CLUTTER_NOTE (BACKEND, "Creating stage of type '%s'", g_type_name (CLUTTER_STAGE_TYPE)); stage = g_object_new (CLUTTER_TYPE_STAGE_EGL, NULL); /* copy backend data into the stage */ stage_x11 = CLUTTER_STAGE_X11 (stage); stage_x11->wrapper = wrapper; CLUTTER_NOTE (MISC, "EGLX stage created (display:%p, screen:%d, root:%u)", backend_x11->xdpy, backend_x11->xscreen_num, (unsigned int) backend_x11->xwin_root); return stage; }
static ClutterFeatureFlags clutter_backend_real_get_features (ClutterBackend *backend) { ClutterFeatureFlags flags = 0; if (cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_MULTIPLE_ONSCREEN)) { CLUTTER_NOTE (BACKEND, "Cogl supports multiple onscreen framebuffers"); flags |= CLUTTER_FEATURE_STAGE_MULTIPLE; } else { CLUTTER_NOTE (BACKEND, "Cogl only supports one onscreen framebuffer"); flags |= CLUTTER_FEATURE_STAGE_STATIC; } if (cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_SWAP_THROTTLE)) { CLUTTER_NOTE (BACKEND, "Cogl supports swap buffers throttling"); flags |= CLUTTER_FEATURE_SYNC_TO_VBLANK; } else CLUTTER_NOTE (BACKEND, "Cogl doesn't support swap buffers throttling"); if (cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_SWAP_BUFFERS_EVENT)) { CLUTTER_NOTE (BACKEND, "Cogl supports swap buffers complete events"); flags |= CLUTTER_FEATURE_SWAP_EVENTS; } return flags; }
static void wait_for_vblank (ClutterBackendGLX *backend_glx) { if (backend_glx->vblank_type == CLUTTER_VBLANK_NONE) return; if (backend_glx->wait_video_sync) { unsigned int retraceCount; CLUTTER_NOTE (BACKEND, "Waiting for vblank (wait_video_sync)"); backend_glx->get_video_sync (&retraceCount); backend_glx->wait_video_sync (2, (retraceCount + 1) % 2, &retraceCount); } else { #ifdef HAVE_DRM drm_wait_vblank_t blank; CLUTTER_NOTE (BACKEND, "Waiting for vblank (drm)"); blank.request.type = _DRM_VBLANK_RELATIVE; blank.request.sequence = 1; blank.request.signal = 0; drm_wait_vblank (backend_glx->dri_fd, &blank); #else CLUTTER_NOTE (BACKEND, "No vblank mechanism found"); #endif /* HAVE_DRM */ } }
static void set_foreign_window_callback (ClutterActor *actor, void *data) { ForeignWindowData *fwd = data; CLUTTER_NOTE (BACKEND, "Setting foreign window (0x%x)", (guint) fwd->hwnd); if (fwd->destroy_old_hwnd && fwd->stage_win32->hwnd != NULL) { CLUTTER_NOTE (BACKEND, "Destroying previous window (0x%x)", (guint) fwd->stage_win32->hwnd); DestroyWindow (fwd->stage_win32->hwnd); } fwd->stage_win32->hwnd = fwd->hwnd; fwd->stage_win32->is_foreign_win = TRUE; fwd->stage_win32->win_width = fwd->geom.width; fwd->stage_win32->win_height = fwd->geom.height; clutter_actor_set_size (actor, fwd->geom.width, fwd->geom.height); /* calling this with the stage unrealized will unset the stage * from the GL context; once the stage is realized the GL context * will be set again */ clutter_stage_ensure_current (CLUTTER_STAGE (actor)); }
gboolean _clutter_feature_init (GError **error) { ClutterMainContext *context; CLUTTER_NOTE (MISC, "checking features"); if (!__features) { CLUTTER_NOTE (MISC, "allocating features data"); __features = g_new0 (ClutterFeatures, 1); __features->features_set = FALSE; /* don't rely on zero-ing */ } if (__features->features_set) return TRUE; context = _clutter_context_get_default (); /* makes sure we have a GL context; if we have, this is a no-op */ if (!_clutter_backend_create_context (context->backend, error)) return FALSE; __features->flags = (clutter_features_from_cogl (cogl_get_features ()) | _clutter_backend_get_features (context->backend)); __features->features_set = TRUE; CLUTTER_NOTE (MISC, "features checked"); return TRUE; }
static void clutter_device_manager_win32_constructed (GObject *gobject) { ClutterDeviceManager *manager = CLUTTER_DEVICE_MANAGER (gobject); ClutterDeviceManagerWin32 *manager_win32; ClutterInputDevice *device; device = g_object_new (CLUTTER_TYPE_INPUT_DEVICE, "id", 0, "name", "Core Pointer", "device-type", CLUTTER_POINTER_DEVICE, "device-mode", CLUTTER_INPUT_MODE_MASTER, "has-cursor", TRUE, "enabled", TRUE, NULL); CLUTTER_NOTE (BACKEND, "Added core pointer device"); _clutter_device_manager_add_device (manager, device); device = g_object_new (CLUTTER_TYPE_INPUT_DEVICE, "id", 1, "name", "Core Keyboard", "device-type", CLUTTER_KEYBOARD_DEVICE, "device-mode", CLUTTER_INPUT_MODE_MASTER, "enabled", TRUE, NULL); CLUTTER_NOTE (BACKEND, "Added core keyboard device"); _clutter_device_manager_add_device (manager, device); manager_win32 = CLUTTER_DEVICE_MANAGER_WIN32 (manager); _clutter_input_device_set_associated_device (manager_win32->core_pointer, manager_win32->core_keyboard); _clutter_input_device_set_associated_device (manager_win32->core_keyboard, manager_win32->core_pointer); }
ClutterFeatureFlags clutter_backend_win32_get_features (ClutterBackend *backend) { ClutterBackendClass *parent_class; ClutterFeatureFlags flags; parent_class = CLUTTER_BACKEND_CLASS (clutter_backend_win32_parent_class); flags = CLUTTER_FEATURE_STAGE_USER_RESIZE | CLUTTER_FEATURE_STAGE_CURSOR; if (cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_MULTIPLE_ONSCREEN)) { CLUTTER_NOTE (BACKEND, "Cogl supports multiple onscreen framebuffers"); flags |= CLUTTER_FEATURE_STAGE_MULTIPLE; } else { CLUTTER_NOTE (BACKEND, "Cogl only supports one onscreen framebuffer"); flags |= CLUTTER_FEATURE_STAGE_STATIC; } if (cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_SWAP_THROTTLE)) { CLUTTER_NOTE (BACKEND, "Cogl supports swap buffers throttling"); flags |= CLUTTER_FEATURE_SYNC_TO_VBLANK; } else CLUTTER_NOTE (BACKEND, "Cogl doesn't support swap buffers throttling"); CLUTTER_NOTE (BACKEND, "backend features checked"); return flags; }
static void clutter_backend_win32_dispose (GObject *gobject) { ClutterBackend *backend = CLUTTER_BACKEND (gobject); ClutterBackendWin32 *backend_win32 = CLUTTER_BACKEND_WIN32 (gobject); ClutterStageManager *stage_manager; CLUTTER_NOTE (BACKEND, "Disposing the of stages"); stage_manager = clutter_stage_manager_get_default (); g_object_unref (stage_manager); CLUTTER_NOTE (BACKEND, "Removing the event source"); _clutter_backend_win32_events_uninit (CLUTTER_BACKEND (backend_win32)); /* Unrealize all shaders, since the GL context is going away */ _clutter_shader_release_all (); G_OBJECT_CLASS (clutter_backend_win32_parent_class)->dispose (gobject); if (backend->cogl_context) { cogl_object_unref (backend->cogl_context); backend->cogl_context = NULL; } }
static void notify_cb (GObject *object, GParamSpec *param_spec, ClutterBehaviour *behave) { ClutterBehaviourClass *klass; klass = CLUTTER_BEHAVIOUR_GET_CLASS (behave); CLUTTER_NOTE (BEHAVIOUR, "notify::alpha"); /* no actors, we can stop right here */ if (behave->priv->actors == NULL) return; if (klass->alpha_notify) { gdouble alpha_value = clutter_alpha_get_alpha (behave->priv->alpha); CLUTTER_NOTE (BEHAVIOUR, "calling %s::alpha_notify (%p, %.4f)", g_type_name (G_TYPE_FROM_CLASS (klass)), behave, alpha_value); klass->alpha_notify (behave, alpha_value); } }
void _clutter_feature_init (void) { ClutterMainContext *context; CLUTTER_NOTE (MISC, "checking features"); if (!__features) { CLUTTER_NOTE (MISC, "allocating features data"); __features = g_new0 (ClutterFeatures, 1); __features->features_set = FALSE; /* don't rely on zero-ing */ } if (__features->features_set) return; context = _clutter_context_get_default (); __features->flags = (_clutter_features_from_cogl (cogl_get_features ()) | _clutter_backend_get_features (context->backend)); __features->features_set = TRUE; CLUTTER_NOTE (MISC, "features checked"); }
static ClutterStageWindow * clutter_backend_glx_create_stage (ClutterBackend *backend, ClutterStage *wrapper, GError **error) { ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (backend); ClutterStageWindow *stage_window; ClutterStageX11 *stage_x11; CLUTTER_NOTE (BACKEND, "Creating stage of type '%s'", g_type_name (CLUTTER_STAGE_TYPE)); stage_window = g_object_new (CLUTTER_TYPE_STAGE_GLX, NULL); /* copy backend data into the stage */ stage_x11 = CLUTTER_STAGE_X11 (stage_window); stage_x11->wrapper = wrapper; CLUTTER_NOTE (BACKEND, "GLX stage created[%p] (dpy:%p, screen:%d, root:%u, wrap:%p)", stage_window, backend_x11->xdpy, backend_x11->xscreen_num, (unsigned int) backend_x11->xwin_root, wrapper); return stage_window; }
static void clutter_glx_texture_pixmap_update_area (ClutterX11TexturePixmap *texture, gint x, gint y, gint width, gint height) { ClutterGLXTexturePixmapPrivate *priv; Display *dpy; CLUTTER_NOTE (TEXTURE, "Updating texture pixmap"); priv = CLUTTER_GLX_TEXTURE_PIXMAP (texture)->priv; dpy = clutter_x11_get_default_display(); if (!CLUTTER_ACTOR_IS_REALIZED (texture)) return; if (priv->use_fallback) { CLUTTER_NOTE (TEXTURE, "Falling back to X11"); parent_class->update_area (texture, x, y, width, height); return; } if (priv->glx_pixmap == None) return; if (texture_bind (CLUTTER_GLX_TEXTURE_PIXMAP(texture))) { CLUTTER_NOTE (TEXTURE, "Really updating via GLX"); clutter_x11_trap_x_errors (); (_gl_bind_tex_image) (dpy, priv->glx_pixmap, GLX_FRONT_LEFT_EXT, NULL); XSync (clutter_x11_get_default_display(), FALSE); /* Note above fires X error for non name pixmaps - but * things still seem to work - i.e pixmap updated */ if (clutter_x11_untrap_x_errors ()) CLUTTER_NOTE (TEXTURE, "Update bind_tex_image failed"); priv->bound = TRUE; } else g_warning ("Failed to bind initial tex"); if (CLUTTER_ACTOR_IS_VISIBLE (CLUTTER_ACTOR(texture))) clutter_actor_queue_redraw (CLUTTER_ACTOR(texture)); }
void _clutter_backend_ensure_context (ClutterBackend *backend, ClutterStage *stage) { static ClutterStage *current_context_stage = NULL; ClutterBackendClass *klass; g_return_if_fail (CLUTTER_IS_BACKEND (backend)); g_return_if_fail (CLUTTER_IS_STAGE (stage)); if (current_context_stage != stage || !CLUTTER_ACTOR_IS_REALIZED (stage)) { ClutterStage *new_stage = NULL; if (!CLUTTER_ACTOR_IS_REALIZED (stage)) { new_stage = NULL; CLUTTER_NOTE (MULTISTAGE, "Stage [%p] is not realized, unsetting the stage", stage); } else { new_stage = stage; CLUTTER_NOTE (MULTISTAGE, "Setting the new stage [%p]", new_stage); } klass = CLUTTER_BACKEND_GET_CLASS (backend); if (G_LIKELY (klass->ensure_context)) klass->ensure_context (backend, new_stage); /* FIXME: With a NULL stage and thus no active context it may make more * sense to clean the context but then re call with the default stage * so at least there is some kind of context in place (as to avoid * potential issue of GL calls with no context) */ current_context_stage = new_stage; /* if the new stage has a different size than the previous one * we need to update the viewport; we do it by simply setting the * SYNC_MATRICES flag and letting the next redraw cycle take care * of calling glViewport() */ if (current_context_stage) { CLUTTER_SET_PRIVATE_FLAGS (current_context_stage, CLUTTER_ACTOR_SYNC_MATRICES); } } else CLUTTER_NOTE (MULTISTAGE, "Stage is the same"); }
static void clutter_backend_x11_create_device_manager (ClutterBackendX11 *backend_x11) { ClutterEventTranslator *translator; ClutterBackend *backend; #ifdef HAVE_XINPUT_2 if (clutter_enable_xinput) { int event_base, first_event, first_error; if (XQueryExtension (backend_x11->xdpy, "XInputExtension", &event_base, &first_event, &first_error)) { int major = 2; int minor = 3; if (XIQueryVersion (backend_x11->xdpy, &major, &minor) != BadRequest) { CLUTTER_NOTE (BACKEND, "Creating XI2 device manager"); backend_x11->has_xinput = TRUE; backend_x11->device_manager = g_object_new (CLUTTER_TYPE_DEVICE_MANAGER_XI2, "backend", backend_x11, "opcode", event_base, NULL); backend_x11->xi_minor = minor; } } } if (backend_x11->device_manager == NULL) #endif /* HAVE_XINPUT_2 */ { CLUTTER_NOTE (BACKEND, "Creating Core device manager"); backend_x11->has_xinput = FALSE; backend_x11->device_manager = g_object_new (CLUTTER_TYPE_DEVICE_MANAGER_X11, "backend", backend_x11, NULL); backend_x11->xi_minor = -1; } backend = CLUTTER_BACKEND (backend_x11); backend->device_manager = backend_x11->device_manager; translator = CLUTTER_EVENT_TRANSLATOR (backend_x11->device_manager); _clutter_backend_add_event_translator (backend, translator); }
static void clutter_group_real_paint (ClutterActor *actor) { ClutterGroupPrivate *priv = CLUTTER_GROUP (actor)->priv; CLUTTER_NOTE (PAINT, "ClutterGroup paint enter '%s'", _clutter_actor_get_debug_name (actor)); g_list_foreach (priv->children, (GFunc) clutter_actor_paint, NULL); CLUTTER_NOTE (PAINT, "ClutterGroup paint leave '%s'", _clutter_actor_get_debug_name (actor)); }
static gboolean clutter_backend_glx_create_context (ClutterBackend *backend, gboolean is_offscreen, GError **error) { ClutterBackendGLX *backend_glx = CLUTTER_BACKEND_GLX (backend); ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (backend); if (backend_glx->gl_context == None) { XVisualInfo *xvisinfo; xvisinfo = clutter_backend_x11_get_visual_info (backend_x11, is_offscreen); CLUTTER_NOTE (GL, "Creating GL Context (display: %p, %s)", backend_x11->xdpy, is_offscreen ? "offscreen" : "onscreen"); backend_glx->gl_context = glXCreateContext (backend_x11->xdpy, xvisinfo, 0, is_offscreen ? False : True); XFree (xvisinfo); if (backend_glx->gl_context == None) { g_set_error (error, CLUTTER_INIT_ERROR, CLUTTER_INIT_ERROR_BACKEND, "Unable to create suitable %s GL context", is_offscreen ? "offscreen" : "onscreen"); return FALSE; } if (!is_offscreen) { gboolean is_direct; is_direct = glXIsDirect (backend_x11->xdpy, backend_glx->gl_context); CLUTTER_NOTE (GL, "Setting %s context", is_direct ? "direct" : "indirect"); _cogl_set_indirect_context (!is_direct); } } return TRUE; }
/* * _clutter_input_device_update: * @device: a #ClutterInputDevice * * Updates the input @device by determining the #ClutterActor underneath the * pointer's cursor * * This function calls _clutter_input_device_set_actor() if needed. * * This function only works for #ClutterInputDevice of type * %CLUTTER_POINTER_DEVICE. * * Since: 1.2 */ ClutterActor * _clutter_input_device_update (ClutterInputDevice *device, gboolean emit_crossing) { ClutterStage *stage; ClutterActor *new_cursor_actor; ClutterActor *old_cursor_actor; gint x, y; if (device->device_type == CLUTTER_KEYBOARD_DEVICE) return NULL; stage = device->stage; if (G_UNLIKELY (stage == NULL)) { CLUTTER_NOTE (EVENT, "No stage defined for device '%s'", clutter_input_device_get_device_name (device)); return NULL; } clutter_input_device_get_device_coords (device, &x, &y); old_cursor_actor = device->cursor_actor; new_cursor_actor = _clutter_do_pick (stage, x, y, CLUTTER_PICK_REACTIVE); /* if the pick could not find an actor then we do not update the * input device, to avoid ghost enter/leave events; the pick should * never fail, except for bugs in the glReadPixels() implementation * in which case this is the safest course of action anyway */ if (new_cursor_actor == NULL) return NULL; CLUTTER_NOTE (EVENT, "Actor under cursor (device %d, at %d, %d): %s", clutter_input_device_get_device_id (device), x, y, clutter_actor_get_name (new_cursor_actor) != NULL ? clutter_actor_get_name (new_cursor_actor) : G_OBJECT_TYPE_NAME (new_cursor_actor)); /* short-circuit here */ if (new_cursor_actor == old_cursor_actor) return old_cursor_actor; _clutter_input_device_set_actor (device, new_cursor_actor, emit_crossing); return device->cursor_actor; }
static ClutterTranslateReturn clutter_keymap_x11_translate_event (ClutterEventTranslator *translator, gpointer native, ClutterEvent *event) { ClutterKeymapX11 *keymap_x11 = CLUTTER_KEYMAP_X11 (translator); ClutterBackendX11 *backend_x11; ClutterTranslateReturn retval; XEvent *xevent; backend_x11 = CLUTTER_BACKEND_X11 (keymap_x11->backend); if (!backend_x11->use_xkb) return CLUTTER_TRANSLATE_CONTINUE; xevent = native; retval = CLUTTER_TRANSLATE_CONTINUE; #ifdef HAVE_XKB if (xevent->type == keymap_x11->xkb_event_base) { XkbEvent *xkb_event = (XkbEvent *) xevent; switch (xkb_event->any.xkb_type) { case XkbStateNotify: CLUTTER_NOTE (EVENT, "Updating keyboard state"); update_direction (keymap_x11, XkbStateGroup (&xkb_event->state)); update_locked_mods (keymap_x11, xkb_event->state.locked_mods); retval = CLUTTER_TRANSLATE_REMOVE; break; case XkbNewKeyboardNotify: case XkbMapNotify: CLUTTER_NOTE (EVENT, "Updating keyboard mapping"); XkbRefreshKeyboardMapping (&xkb_event->map); backend_x11->keymap_serial += 1; retval = CLUTTER_TRANSLATE_REMOVE; break; default: break; } } #endif /* HAVE_XKB */ return retval; }
static gboolean clutter_backend_sdl_post_parse (ClutterBackend *backend, GError **error) { int err; if (SDL_Init (SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0) { g_set_error (error, CLUTTER_INIT_ERROR, CLUTTER_INIT_ERROR_BACKEND, "Unable to Initialize SDL"); return FALSE; } #if defined(WIN32) err = SDL_GL_LoadLibrary ("opengl32.dll"); #elif defined(__linux__) || defined(__FreeBSD__) err = SDL_GL_LoadLibrary ("libGL.so"); #else #error Your platform is not supported err = 1; #endif if (err != 0) { g_set_error (error, CLUTTER_INIT_ERROR, CLUTTER_INIT_ERROR_BACKEND, SDL_GetError ()); return FALSE; } CLUTTER_NOTE (BACKEND, "SDL successfully initialized"); return TRUE; }
static void settings_update_resolution (ClutterSettings *self) { const char *scale_env = NULL; if (self->font_dpi > 0) self->resolution = (gdouble) self->font_dpi / 1024.0; else self->resolution = 96.0; scale_env = g_getenv ("GDK_DPI_SCALE"); if (scale_env != NULL) { double scale = g_ascii_strtod (scale_env, NULL); if (scale != 0 && self->resolution > 0) self->resolution *= scale; } CLUTTER_NOTE (BACKEND, "New resolution: %.2f (%s)", self->resolution, self->unscaled_font_dpi > 0 ? "unscaled" : "scaled"); if (self->backend != NULL) g_signal_emit_by_name (self->backend, "resolution-changed"); }
/*< internal > * clutter_input_device_set_associated_device: * @device: a #ClutterInputDevice * @associated: (allow-none): a #ClutterInputDevice, or %NULL * * Sets the associated device for @device. * * This function keeps a reference on the associated device. */ void _clutter_input_device_set_associated_device (ClutterInputDevice *device, ClutterInputDevice *associated) { if (device->associated == associated) return; if (device->associated != NULL) g_object_unref (device->associated); device->associated = associated; if (device->associated != NULL) g_object_ref (device->associated); CLUTTER_NOTE (MISC, "Associating device '%s' to device '%s'", clutter_input_device_get_device_name (device), device->associated != NULL ? clutter_input_device_get_device_name (device->associated) : "(none)"); if (device->device_mode != CLUTTER_INPUT_MODE_MASTER) { if (device->associated != NULL) device->device_mode = CLUTTER_INPUT_MODE_SLAVE; else device->device_mode = CLUTTER_INPUT_MODE_FLOATING; g_object_notify_by_pspec (G_OBJECT (device), obj_props[PROP_DEVICE_MODE]); } }
static void update_locked_mods (ClutterKeymapX11 *keymap_x11, gint locked_mods) { #if 0 gboolean old_caps_lock_state, old_num_lock_state; old_caps_lock_state = keymap_x11->caps_lock_state; old_num_lock_state = keymap_x11->num_lock_state; #endif keymap_x11->caps_lock_state = (locked_mods & CLUTTER_LOCK_MASK) != 0; keymap_x11->num_lock_state = (locked_mods & keymap_x11->num_lock_mask) != 0; CLUTTER_NOTE (BACKEND, "Locks state changed - Num: %s, Caps: %s", keymap_x11->num_lock_state ? "set" : "unset", keymap_x11->caps_lock_state ? "set" : "unset"); #if 0 /* Add signal to ClutterBackend? */ if ((keymap_x11->caps_lock_state != old_caps_lock_state) || (keymap_x11->num_lock_state != old_num_lock_state)) g_signal_emit_by_name (keymap_x11->backend, "key-lock-changed"); #endif }
static gboolean clutter_backend_egl_post_parse (ClutterBackend *backend, GError **error) { ClutterBackendEGL *backend_egl = CLUTTER_BACKEND_EGL(backend); EGLBoolean status; backend_egl->edpy = eglGetDisplay (EGL_DEFAULT_DISPLAY); status = eglInitialize (backend_egl->edpy, &backend_egl->egl_version_major, &backend_egl->egl_version_minor); if (status != EGL_TRUE) { g_set_error (error, CLUTTER_INIT_ERROR, CLUTTER_INIT_ERROR_BACKEND, "Unable to Initialize EGL"); return FALSE; } CLUTTER_NOTE (BACKEND, "EGL Reports version %i.%i", backend_egl->egl_version_major, backend_egl->egl_version_minor); return TRUE; }
static void clutter_backend_real_font_changed (ClutterBackend *backend) { backend->priv->units_per_em = get_units_per_em (backend, NULL); CLUTTER_NOTE (BACKEND, "Units per em: %.2f", backend->priv->units_per_em); }
void _clutter_device_manager_wayland_add_input_group (ClutterDeviceManager *manager, uint32_t id) { ClutterBackend *backend = _clutter_device_manager_get_backend (manager); ClutterBackendWayland *backend_wayland = CLUTTER_BACKEND_WAYLAND (backend); ClutterInputDeviceWayland *device; device = g_object_new (CLUTTER_TYPE_INPUT_DEVICE_WAYLAND, "id", id, "device-type", CLUTTER_POINTER_DEVICE, "name", "wayland device", "enabled", TRUE, NULL); device->input_device = wl_display_bind (backend_wayland->wayland_display, id, &wl_input_device_interface); wl_input_device_add_listener (device->input_device, &_clutter_input_device_wayland_listener, device); wl_input_device_set_user_data (device->input_device, device); device->xkb = _clutter_xkb_desc_new (NULL, option_xkb_layout, option_xkb_variant, option_xkb_options); if (!device->xkb) CLUTTER_NOTE (BACKEND, "Failed to compile keymap"); _clutter_device_manager_add_device (manager, CLUTTER_INPUT_DEVICE (device)); }
static void send_wmspec_change_state (ClutterBackendX11 *backend_x11, Window window, Atom state, gboolean add) { XClientMessageEvent xclient; CLUTTER_NOTE (BACKEND, "%s NET_WM state", add ? "adding" : "removing"); memset (&xclient, 0, sizeof (xclient)); xclient.type = ClientMessage; xclient.window = window; xclient.message_type = backend_x11->atom_NET_WM_STATE; xclient.format = 32; xclient.data.l[0] = add ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE; xclient.data.l[1] = state; xclient.data.l[2] = 0; xclient.data.l[3] = 0; xclient.data.l[4] = 0; XSendEvent (backend_x11->xdpy, DefaultRootWindow (backend_x11->xdpy), False, SubstructureRedirectMask | SubstructureNotifyMask, (XEvent *)&xclient); }
GSource * _clutter_x11_event_source_new (ClutterBackendX11 *backend_x11) { ClutterEventSource *event_source; int connection_number; GSource *source; gchar *name; connection_number = ConnectionNumber (backend_x11->xdpy); CLUTTER_NOTE (EVENT, "Connection number: %d", connection_number); source = g_source_new (&event_funcs, sizeof (ClutterEventSource)); event_source = (ClutterEventSource *) source; name = g_strdup_printf ("Clutter X11 Event (connection: %d)", connection_number); g_source_set_name (source, name); g_free (name); event_source->backend = backend_x11; event_source->event_poll_fd.fd = connection_number; event_source->event_poll_fd.events = G_IO_IN; g_source_add_poll (source, &event_source->event_poll_fd); g_source_set_can_recurse (source, TRUE); return source; }
static void clutter_shader_effect_set_actor (ClutterActorMeta *meta, ClutterActor *actor) { ClutterShaderEffect *self = CLUTTER_SHADER_EFFECT (meta); ClutterShaderEffectPrivate *priv = self->priv; ClutterActorMetaClass *parent; if (!clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL)) { /* if we don't have support for GLSL shaders then we * forcibly disable the ActorMeta */ g_warning ("Unable to use the ShaderEffect: the graphics hardware " "or the current GL driver does not implement support " "for the GLSL shading language."); clutter_actor_meta_set_enabled (meta, FALSE); return; } parent = CLUTTER_ACTOR_META_CLASS (clutter_shader_effect_parent_class); parent->set_actor (meta, actor); /* we keep a back pointer here */ priv->actor = clutter_actor_meta_get_actor (meta); if (priv->actor == NULL) return; CLUTTER_NOTE (SHADER, "Preparing shader effect of type '%s'", G_OBJECT_TYPE_NAME (meta)); }
static void start_entry (ClutterScoreEntry *entry) { ClutterScorePrivate *priv = entry->score->priv; /* timelines attached to a marker might already be playing when we * end up here from the ::completed handler, so we need to perform * this check to avoid restarting those timelines */ if (clutter_timeline_is_playing (entry->timeline)) return; entry->complete_id = g_signal_connect (entry->timeline, "completed", G_CALLBACK (on_timeline_completed), entry); CLUTTER_NOTE (SCHEDULER, "timeline [%p] ('%lu') started", entry->timeline, entry->id); if (G_UNLIKELY (priv->running_timelines == NULL)) priv->running_timelines = g_hash_table_new (NULL, NULL); g_hash_table_insert (priv->running_timelines, GUINT_TO_POINTER (entry->id), entry); clutter_timeline_start (entry->timeline); g_signal_emit (entry->score, score_signals[TIMELINE_STARTED], 0, entry->timeline); }
static void clutter_backend_real_resolution_changed (ClutterBackend *backend) { ClutterBackendPrivate *priv = backend->priv; ClutterMainContext *context; ClutterSettings *settings; gdouble resolution; gint dpi; settings = clutter_settings_get_default (); g_object_get (settings, "font-dpi", &dpi, NULL); if (dpi < 0) resolution = 96.0; else resolution = dpi / 1024.0; context = _clutter_context_get_default (); if (context->font_map != NULL) cogl_pango_font_map_set_resolution (context->font_map, resolution); priv->units_per_em = get_units_per_em (backend, NULL); priv->units_serial += 1; CLUTTER_NOTE (BACKEND, "Units per em: %.2f", priv->units_per_em); }