/* Query if long-press events should be handled and signals emitted */ static void _xfdashboard_click_action_query_long_press(XfdashboardClickAction *self) { XfdashboardClickActionPrivate *priv; ClutterActor *actor; gboolean result; gint timeout; g_return_if_fail(XFDASHBOARD_IS_CLICK_ACTION(self)); priv=self->priv; result=FALSE; /* If no duration was set get default one from settings */ if(priv->longPressDuration<0) { ClutterSettings *settings=clutter_settings_get_default(); g_object_get(settings, "long-press-duration", &timeout, NULL); } else timeout=priv->longPressDuration; /* Emit signal to determine if long-press should be supported */ actor=clutter_actor_meta_get_actor(CLUTTER_ACTOR_META(self)); g_signal_emit(self, XfdashboardClickActionSignals[SIGNAL_LONG_PRESS], 0, actor, CLUTTER_LONG_PRESS_QUERY, &result); if(result) { priv->longPressID=clutter_threads_add_timeout(timeout, _xfdashboard_click_action_emit_long_press, self); } }
static inline void click_action_query_long_press (ClutterClickAction *action) { ClutterClickActionPrivate *priv = action->priv; ClutterActor *actor; gboolean result = FALSE; gint timeout; if (priv->long_press_duration < 0) { ClutterSettings *settings = clutter_settings_get_default (); g_object_get (settings, "long-press-duration", &timeout, NULL); } else timeout = priv->long_press_duration; actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action)); g_signal_emit (action, click_signals[LONG_PRESS], 0, actor, CLUTTER_LONG_PRESS_QUERY, &result); if (result) { priv->long_press_id = clutter_threads_add_timeout (timeout, click_action_emit_long_press, action); } }
/** * clutter_timeline_start: * @timeline: A #ClutterTimeline * * Starts the #ClutterTimeline playing. **/ void clutter_timeline_start (ClutterTimeline *timeline) { ClutterTimelinePrivate *priv; g_return_if_fail (CLUTTER_IS_TIMELINE (timeline)); priv = timeline->priv; if (priv->delay_id || priv->is_playing) return; if (priv->duration == 0) return; if (priv->delay) priv->delay_id = clutter_threads_add_timeout (priv->delay, delay_timeout_func, timeline); else { priv->msecs_delta = 0; set_is_playing (timeline, TRUE); g_signal_emit (timeline, timeline_signals[STARTED], 0); } }
static void start_toggle_slowkeys (ClutterInputDeviceEvdev *device) { if (device->toggle_slowkeys_timer != 0) return; device->toggle_slowkeys_timer = clutter_threads_add_timeout (8 * 1000 /* 8 secs */, trigger_toggle_slowkeys, device); }
static void start_bounce_keys (ClutterEvent *event, ClutterInputDeviceEvdev *device) { stop_bounce_keys (device); device->debounce_key = ((ClutterKeyEvent *) event)->hardware_keycode; device->debounce_timer = clutter_threads_add_timeout (get_debounce_delay (CLUTTER_INPUT_DEVICE (device)), clear_bounce_keys, device); }
G_MODULE_EXPORT int test_cogl_shader_arbfp_main (int argc, char *argv[]) { ClutterActor *stage; char *file; GError *error; ClutterColor stage_color = { 0x61, 0x64, 0x8c, 0xff }; if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) return 1; stage = clutter_stage_new (); clutter_stage_set_title (CLUTTER_STAGE (stage), "Assembly Shader Test"); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL); error = NULL; redhand = cogl_texture_new_from_file (file, 0, COGL_PIXEL_FORMAT_ANY, &error); if (redhand == COGL_INVALID_HANDLE) g_error ("image load failed: %s", error->message); material = cogl_material_new (); cogl_material_set_layer (material, 0, redhand); set_shader_num (0); g_signal_connect_after (stage, "paint", G_CALLBACK (paint_cb), NULL); clutter_actor_set_reactive (stage, TRUE); g_signal_connect (stage, "button-release-event", G_CALLBACK (button_release_cb), NULL); g_signal_connect (stage, "key-release-event", G_CALLBACK (key_release_cb), NULL); g_signal_connect (stage, "delete-event", G_CALLBACK (destroy_window_cb), NULL); timeout_id = clutter_threads_add_timeout (1000, timeout_cb, NULL); clutter_threads_add_idle (idle_cb, stage); clutter_actor_show (stage); clutter_main (); return EXIT_SUCCESS; }
int context_noya_activate(void *ctx, void *userdata) { ClutterActor *stage; atomic_set(&c_running, 1); stage = clutter_stage_get_default(); clutter_stage_set_color(CLUTTER_STAGE(stage), &stage_color); c_scene = na_scene_load(g_options.scene_fn); if ( c_scene == NULL ) { l_errorf("unable to load scene"); na_quit(); return -1; } /* initialize actors */ LIST_INIT(&manager_actors_list); /* initialize modules */ na_module_yield(NA_MOD_MODULE, thread_manager_mod_init, c_scene); /* listening events */ na_event_observe(NA_EV_OBJECT_NEW, manager_event_object_new, NULL); na_event_observe(NA_EV_OBJECT_SET, manager_event_object_set, NULL); na_event_observe(NA_EV_OBJECT_DEL, manager_event_object_del, NULL); na_event_observe(NA_EV_CURSOR_NEW, manager_event_cursor_new, NULL); na_event_observe(NA_EV_CURSOR_SET, manager_event_cursor_set, NULL); na_event_observe(NA_EV_CURSOR_DEL, manager_event_cursor_del, NULL); clutter_threads_add_timeout(25, manager_renderer_update, NULL); return 0; }
static void start_slow_keys (ClutterEvent *event, ClutterInputDeviceEvdev *device, ClutterEmitInputDeviceEvent emit_event_func) { SlowKeysEventPending *slow_keys_event; ClutterKeyEvent *key_event = (ClutterKeyEvent *) event; if (key_event->flags & CLUTTER_EVENT_FLAG_REPEATED) return; slow_keys_event = g_new0 (SlowKeysEventPending, 1); slow_keys_event->device = device; slow_keys_event->event = clutter_event_copy (event); slow_keys_event->emit_event_func = emit_event_func; slow_keys_event->timer = clutter_threads_add_timeout (get_slow_keys_delay (CLUTTER_INPUT_DEVICE (device)), trigger_slow_keys, slow_keys_event); device->slow_keys_list = g_list_append (device->slow_keys_list, slow_keys_event); if (device->a11y_flags & CLUTTER_A11Y_SLOW_KEYS_BEEP_PRESS) clutter_input_device_evdev_bell_notify (); }
G_MODULE_EXPORT gint test_texture_async_main (int argc, char *argv[]) { ClutterActor *stage; ClutterColor stage_color = { 0x12, 0x34, 0x56, 0xff }; GError *error; gchar *path; clutter_init (&argc, &argv); g_thread_init (NULL); stage = clutter_stage_get_default (); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_actor_show (stage); g_signal_connect (stage, "button-press-event", G_CALLBACK (clutter_main_quit), NULL); error = NULL; path = (argc > 1) ? g_strdup (argv[1]) : g_build_filename (TESTS_DATADIR, "redhand.png", NULL); clutter_threads_add_timeout (500, task, path); clutter_main (); g_free (path); /*g_object_unref (depth_behavior); g_object_unref (timeline);*/ return EXIT_SUCCESS; }
G_MODULE_EXPORT int test_pixmap_main (int argc, char **argv) { GOptionContext *context; Display *xdpy; int screen; ClutterActor *group = NULL, *label, *stage, *tex; Pixmap pixmap; const ClutterColor gry = { 0x99, 0x99, 0x99, 0xFF }; Window win_remote; guint w, h, d; GC gc; ClutterTimeline *timeline; ClutterAlpha *alpha; ClutterBehaviour *depth_behavior; int i; int row_height; #ifdef CLUTTER_WINDOWING_X11 clutter_set_windowing_backend (CLUTTER_WINDOWING_X11); #endif if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) return 1; #ifdef CLUTTER_WINDOWING_X11 if (!clutter_check_windowing_backend (CLUTTER_WINDOWING_X11)) g_error ("test-pixmap requires the X11 Clutter backend."); #endif xdpy = clutter_x11_get_default_display (); XSynchronize (xdpy, True); context = g_option_context_new (" - test-pixmap options"); g_option_context_add_main_entries (context, g_options, NULL); g_option_context_parse (context, &argc, &argv, NULL); pixmap = create_pixmap (&w, &h, &d); screen = DefaultScreen(xdpy); win_remote = XCreateSimpleWindow (xdpy, DefaultRootWindow(xdpy), 0, 0, 200, 200, 0, WhitePixel(xdpy, screen), WhitePixel(xdpy, screen)); XMapWindow (xdpy, win_remote); stage = clutter_stage_new (); clutter_actor_set_position (stage, 0, 150); clutter_actor_set_background_color (stage, &gry); clutter_stage_set_title (CLUTTER_STAGE (stage), "X11 Texture from Pixmap"); g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); timeline = clutter_timeline_new (5000); g_signal_connect (timeline, "completed", G_CALLBACK (timeline_completed), NULL); alpha = clutter_alpha_new_full (timeline, CLUTTER_LINEAR); depth_behavior = clutter_behaviour_depth_new (alpha, -2500, 400); if (!disable_x11) { group = clutter_group_new (); clutter_container_add_actor (CLUTTER_CONTAINER (stage), group); label = clutter_text_new_with_text ("fixed", "ClutterX11Texture (Window)"); clutter_container_add_actor (CLUTTER_CONTAINER (group), label); tex = clutter_x11_texture_pixmap_new_with_window (win_remote); clutter_container_add_actor (CLUTTER_CONTAINER (group), tex); clutter_actor_set_position (tex, 0, 20); clutter_x11_texture_pixmap_set_automatic (CLUTTER_X11_TEXTURE_PIXMAP (tex), TRUE); clutter_texture_set_filter_quality (CLUTTER_TEXTURE (tex), CLUTTER_TEXTURE_QUALITY_HIGH); clutter_actor_set_position (group, 0, 0); if (!disable_animation) clutter_behaviour_apply (depth_behavior, group); } if (group) row_height = clutter_actor_get_height (group); else row_height = 0; /* NB: We only draw on the window after being redirected, so we dont * have to worry about handling expose events... */ gc = XCreateGC (xdpy, win_remote, 0, NULL); XSetForeground (xdpy, gc, BlackPixel (xdpy, screen)); XSetLineAttributes(xdpy, gc, 5, LineSolid, CapButt, JoinMiter); for (i = 0; i < 10; i++) XDrawLine (xdpy, win_remote, gc, 0+i*20, 0, 10+i*20+i, 200); group = clutter_group_new (); clutter_container_add_actor (CLUTTER_CONTAINER (stage), group); label = clutter_text_new_with_text ("fixed", "ClutterX11Texture (Pixmap)"); clutter_container_add_actor (CLUTTER_CONTAINER (group), label); tex = clutter_x11_texture_pixmap_new_with_pixmap (pixmap); clutter_x11_texture_pixmap_set_automatic (CLUTTER_X11_TEXTURE_PIXMAP (tex), TRUE); clutter_container_add_actor (CLUTTER_CONTAINER (group), tex); clutter_actor_set_position (tex, 0, 20); clutter_texture_set_filter_quality (CLUTTER_TEXTURE (tex), CLUTTER_TEXTURE_QUALITY_HIGH); /* oddly, the actor's size is 0 until it is realized, even though pixmap-height is set */ clutter_actor_set_position (group, 0, row_height); if (!disable_animation) clutter_behaviour_apply (depth_behavior, group); g_signal_connect (stage, "key-release-event", G_CALLBACK (stage_key_release_cb), (gpointer)pixmap); g_signal_connect (stage, "button-press-event", G_CALLBACK (stage_button_press_cb), (gpointer)pixmap); clutter_actor_show (stage); if (!disable_animation) clutter_timeline_start (timeline); clutter_threads_add_timeout (1000, draw_arc, GUINT_TO_POINTER (pixmap)); clutter_main (); return EXIT_SUCCESS; }
static gboolean trigger_mousekeys_move (gpointer data) { ClutterInputDeviceEvdev *device = data; gint dx = 0; gint dy = 0; if (device->mousekeys_first_motion_time == 0) { /* This is the first move, Secdule at mk_init_delay */ device->move_mousekeys_timer = clutter_threads_add_timeout (device->mousekeys_init_delay, trigger_mousekeys_move, device); } else { /* More moves, reschedule at mk_interval */ device->move_mousekeys_timer = clutter_threads_add_timeout (100, /* msec between mousekey events */ trigger_mousekeys_move, device); } /* Pointer motion */ switch (device->last_mousekeys_key) { case XKB_KEY_KP_Home: case XKB_KEY_KP_7: case XKB_KEY_KP_Up: case XKB_KEY_KP_8: case XKB_KEY_KP_Page_Up: case XKB_KEY_KP_9: dy = -1; break; case XKB_KEY_KP_End: case XKB_KEY_KP_1: case XKB_KEY_KP_Down: case XKB_KEY_KP_2: case XKB_KEY_KP_Page_Down: case XKB_KEY_KP_3: dy = 1; break; default: break; } switch (device->last_mousekeys_key) { case XKB_KEY_KP_Home: case XKB_KEY_KP_7: case XKB_KEY_KP_Left: case XKB_KEY_KP_4: case XKB_KEY_KP_End: case XKB_KEY_KP_1: dx = -1; break; case XKB_KEY_KP_Page_Up: case XKB_KEY_KP_9: case XKB_KEY_KP_Right: case XKB_KEY_KP_6: case XKB_KEY_KP_Page_Down: case XKB_KEY_KP_3: dx = 1; break; default: break; } if (dx != 0 || dy != 0) emulate_pointer_motion (device, dx, dy); /* We reschedule each time */ return G_SOURCE_REMOVE; }
G_MODULE_EXPORT gint test_texture_quality_main (int argc, char *argv[]) { ClutterTimeline *timeline; ClutterAlpha *alpha; ClutterBehaviour *depth_behavior; ClutterActor *stage; ClutterActor *image; ClutterColor stage_color = { 0x12, 0x34, 0x56, 0xff }; ClutterFog stage_fog = { 10.0, -50.0 }; GError *error; gchar *file; if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) return 1; stage = clutter_stage_new (); clutter_actor_set_background_color (stage, &stage_color); clutter_stage_set_use_fog (CLUTTER_STAGE (stage), TRUE); clutter_stage_set_fog (CLUTTER_STAGE (stage), &stage_fog); g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); g_signal_connect (stage, "button-press-event", G_CALLBACK (clutter_main_quit), NULL); if (argc < 2) g_print ("Hint: the redhand.png isn't a good test image for this test.\n" "This test can take any image file as an argument\n"); file = (argc > 1) ? g_strdup (argv[1]) : g_build_filename (TESTS_DATADIR, "redhand.png", NULL); error = NULL; image = clutter_texture_new_from_file (file, &error); if (error) g_error ("Unable to load image: %s", error->message); g_free (file); /* center the image */ clutter_actor_set_position (image, (clutter_actor_get_width (stage) - clutter_actor_get_width (image))/2, (clutter_actor_get_height (stage) - clutter_actor_get_height (image))/2); clutter_container_add (CLUTTER_CONTAINER (stage), image, NULL); timeline = clutter_timeline_new (5000); g_signal_connect (timeline, "completed", G_CALLBACK (timeline_completed), NULL); alpha = clutter_alpha_new_full (timeline, CLUTTER_LINEAR); depth_behavior = clutter_behaviour_depth_new (alpha, -2500, 400); clutter_behaviour_apply (depth_behavior, image); clutter_actor_show (stage); clutter_timeline_start (timeline); clutter_threads_add_timeout (10000, change_filter, image); clutter_main (); g_object_unref (depth_behavior); g_object_unref (timeline); return EXIT_SUCCESS; }
static ClutterTranslateReturn clutter_stage_x11_translate_event (ClutterEventTranslator *translator, gpointer native, ClutterEvent *event) { ClutterStageX11 *stage_x11; ClutterStageCogl *stage_cogl; ClutterTranslateReturn res = CLUTTER_TRANSLATE_CONTINUE; ClutterBackendX11 *backend_x11; Window stage_xwindow; XEvent *xevent = native; ClutterStage *stage; stage_cogl = clutter_x11_get_stage_window_from_window (xevent->xany.window); if (stage_cogl == NULL) return CLUTTER_TRANSLATE_CONTINUE; stage = stage_cogl->wrapper; stage_x11 = CLUTTER_STAGE_X11 (stage_cogl); backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend); stage_xwindow = stage_x11->xwin; switch (xevent->type) { case ConfigureNotify: if (!stage_x11->is_foreign_xwin) { gboolean size_changed = FALSE; CLUTTER_NOTE (BACKEND, "ConfigureNotify[%x] (%d, %d)", (unsigned int) stage_x11->xwin, xevent->xconfigure.width, xevent->xconfigure.height); /* When fullscreen, we'll keep the xwin_width/height variables to track the old size of the window and we'll assume all ConfigureNotifies constitute a size change */ if (_clutter_stage_is_fullscreen (stage)) size_changed = TRUE; else if ((stage_x11->xwin_width != xevent->xconfigure.width) || (stage_x11->xwin_height != xevent->xconfigure.height)) { size_changed = TRUE; stage_x11->xwin_width = xevent->xconfigure.width; stage_x11->xwin_height = xevent->xconfigure.height; } clutter_actor_set_size (CLUTTER_ACTOR (stage), xevent->xconfigure.width, xevent->xconfigure.height); CLUTTER_UNSET_PRIVATE_FLAGS (stage_cogl->wrapper, CLUTTER_IN_RESIZE); if (size_changed) { /* XXX: This is a workaround for a race condition when * resizing windows while there are in-flight * glXCopySubBuffer blits happening. * * The problem stems from the fact that rectangles for the * blits are described relative to the bottom left of the * window and because we can't guarantee control over the X * window gravity used when resizing so the gravity is * typically NorthWest not SouthWest. * * This means if you grow a window vertically the server * will make sure to place the old contents of the window * at the top-left/north-west of your new larger window, but * that may happen asynchronous to GLX preparing to do a * blit specified relative to the bottom-left/south-west of * the window (based on the old smaller window geometry). * * When the GLX issued blit finally happens relative to the * new bottom of your window, the destination will have * shifted relative to the top-left where all the pixels you * care about are so it will result in a nasty artefact * making resizing look very ugly! * * We can't currently fix this completely, in-part because * the window manager tends to trample any gravity we might * set. This workaround instead simply disables blits for a * while if we are notified of any resizes happening so if * the user is resizing a window via the window manager then * they may see an artefact for one frame but then we will * fallback to redrawing the full stage until the cooling * off period is over. */ if (stage_x11->clipped_redraws_cool_off) g_source_remove (stage_x11->clipped_redraws_cool_off); stage_x11->clipped_redraws_cool_off = clutter_threads_add_timeout (1000, clipped_redraws_cool_off_cb, stage_x11); /* Queue a relayout - we want glViewport to be called * with the correct values, and this is done in ClutterStage * via cogl_onscreen_clutter_backend_set_size (). * * We queue a relayout, because if this ConfigureNotify is * in response to a size we set in the application, the * set_size() call above is essentially a null-op. * * Make sure we do this only when the size has changed, * otherwise we end up relayouting on window moves. */ clutter_actor_queue_relayout (CLUTTER_ACTOR (stage)); /* the resize process is complete, so we can ask the stage * to set up the GL viewport with the new size */ clutter_stage_ensure_viewport (stage); } } break; case PropertyNotify: if (xevent->xproperty.atom == backend_x11->atom_NET_WM_STATE && xevent->xproperty.window == stage_xwindow && !stage_x11->is_foreign_xwin) { Atom type; gint format; gulong n_items, bytes_after; guchar *data = NULL; gboolean fullscreen_set = FALSE; clutter_x11_trap_x_errors (); XGetWindowProperty (backend_x11->xdpy, stage_xwindow, backend_x11->atom_NET_WM_STATE, 0, G_MAXLONG, False, XA_ATOM, &type, &format, &n_items, &bytes_after, &data); clutter_x11_untrap_x_errors (); if (type != None && data != NULL) { gboolean is_fullscreen = FALSE; Atom *atoms = (Atom *) data; gulong i; for (i = 0; i < n_items; i++) { if (atoms[i] == backend_x11->atom_NET_WM_STATE_FULLSCREEN) fullscreen_set = TRUE; } is_fullscreen = _clutter_stage_is_fullscreen (stage_cogl->wrapper); if (fullscreen_set != is_fullscreen) { if (fullscreen_set) _clutter_stage_update_state (stage_cogl->wrapper, 0, CLUTTER_STAGE_STATE_FULLSCREEN); else _clutter_stage_update_state (stage_cogl->wrapper, CLUTTER_STAGE_STATE_FULLSCREEN, 0); } XFree (data); } } break; case FocusIn: if (!_clutter_stage_is_activated (stage_cogl->wrapper)) { _clutter_stage_update_state (stage_cogl->wrapper, 0, CLUTTER_STAGE_STATE_ACTIVATED); } break; case FocusOut: if (_clutter_stage_is_activated (stage_cogl->wrapper)) { _clutter_stage_update_state (stage_cogl->wrapper, CLUTTER_STAGE_STATE_ACTIVATED, 0); } break; case EnterNotify: #if HAVE_XFIXES if (!stage_x11->is_cursor_visible && !stage_x11->cursor_hidden_xfixes) { XFixesHideCursor (backend_x11->xdpy, stage_x11->xwin); stage_x11->cursor_hidden_xfixes = TRUE; } #endif break; case LeaveNotify: #if HAVE_XFIXES if (stage_x11->cursor_hidden_xfixes) { XFixesShowCursor (backend_x11->xdpy, stage_x11->xwin); stage_x11->cursor_hidden_xfixes = FALSE; } #endif break; case Expose: { XExposeEvent *expose = (XExposeEvent *) xevent; cairo_rectangle_int_t clip; CLUTTER_NOTE (EVENT, "expose for stage: %s[%p], win:0x%x - " "redrawing area (x: %d, y: %d, width: %d, height: %d)", _clutter_actor_get_debug_name (CLUTTER_ACTOR (stage)), stage, (unsigned int) stage_xwindow, expose->x, expose->y, expose->width, expose->height); clip.x = expose->x; clip.y = expose->y; clip.width = expose->width; clip.height = expose->height; clutter_actor_queue_redraw_with_clip (CLUTTER_ACTOR (stage), &clip); } break; case DestroyNotify: CLUTTER_NOTE (EVENT, "Destroy notification received for stage %s[%p], win:0x%x", _clutter_actor_get_debug_name (CLUTTER_ACTOR (stage)), stage, (unsigned int) stage_xwindow); event->any.type = CLUTTER_DESTROY_NOTIFY; event->any.stage = stage; res = CLUTTER_TRANSLATE_QUEUE; break; case ClientMessage: CLUTTER_NOTE (EVENT, "Client message for stage %s[%p], win:0x%x", _clutter_actor_get_debug_name (CLUTTER_ACTOR (stage)), stage, (unsigned int) stage_xwindow); if (handle_wm_protocols_event (backend_x11, stage_x11, xevent)) { event->any.type = CLUTTER_DELETE; event->any.stage = stage; res = CLUTTER_TRANSLATE_QUEUE; } break; case MappingNotify: CLUTTER_NOTE (EVENT, "Refresh keyboard mapping"); XRefreshKeyboardMapping (&xevent->xmapping); backend_x11->keymap_serial += 1; res = CLUTTER_TRANSLATE_REMOVE; break; default: res = CLUTTER_TRANSLATE_CONTINUE; break; } return res; }
/* Pointer was moved over actor with tooltip */ static gboolean _xfdashboard_tooltip_action_on_motion_event(XfdashboardTooltipAction *self, ClutterEvent *inEvent, gpointer inUserData) { XfdashboardTooltipActionPrivate *priv; ClutterActor *actor; guint tooltipTimeout; ClutterActor *stage; g_return_val_if_fail(XFDASHBOARD_IS_TOOLTIP_ACTION(self), CLUTTER_EVENT_PROPAGATE); g_return_val_if_fail(CLUTTER_IS_ACTOR(inUserData), CLUTTER_EVENT_PROPAGATE); priv=self->priv; actor=CLUTTER_ACTOR(inUserData); tooltipTimeout=0; /* Do nothing if tooltip is already visible */ if(priv->isVisible) return(CLUTTER_EVENT_PROPAGATE); /* Remove any timeout source we have added for this actor */ if(priv->timeoutSourceID!=0) { g_source_remove(priv->timeoutSourceID); priv->timeoutSourceID=0; } /* Remember position and actor */ clutter_event_get_position(inEvent, &priv->lastPosition); _xfdashboard_tooltip_last_event_actor=actor; /* Set up new timeout source */ #if GTK_CHECK_VERSION(3, 14 ,0) /* Since GTK+ version 3.10 the setting "gtk-tooltip-timeout" is * not supported anymore and ignored by GTK+ derived application. * So we should also. We set the timeout statically to the default * duration which GTK+ is also using. * This also prevents warning about forthcoming deprecation of this * setting printed to console. */ tooltipTimeout=DEFAULT_TOOLTIP_TIMEOUT; #else /* Get configured duration when a tooltip should be shown from * GTK+ settings. */ g_object_get(gtk_settings_get_default(), "gtk-tooltip-timeout", &tooltipTimeout, NULL); #endif priv->timeoutSourceID=clutter_threads_add_timeout(tooltipTimeout, (GSourceFunc)_xfdashboard_tooltip_action_on_timeout, self); /* Capture next events to check if tooltip should be hidden again */ stage=clutter_actor_get_stage(actor); if(stage && XFDASHBOARD_IS_STAGE(stage)) { g_warn_if_fail((priv->captureSignalID==0 && priv->captureSignalActor==NULL) || (priv->captureSignalID!=0 && priv->captureSignalActor==stage)); if((priv->captureSignalID==0 && priv->captureSignalActor==NULL) || (priv->captureSignalID && priv->captureSignalActor!=stage)) { if(priv->captureSignalActor) g_signal_handler_disconnect(priv->captureSignalActor, priv->captureSignalID); priv->captureSignalActor=NULL; priv->captureSignalID=0; priv->captureSignalActor=stage; priv->captureSignalID=g_signal_connect_swapped(stage, "captured-event", G_CALLBACK(_xfdashboard_tooltip_action_on_captured_event_after_tooltip), self); } } return(CLUTTER_EVENT_PROPAGATE); }