Compare commits
	
		
			129 Commits
		
	
	
		
			3.33.90
			...
			wip/kms-co
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 9582f7b207 | ||
|   | 5fa38f4cd5 | ||
|   | 0ae31a45ab | ||
|   | 14c706e51b | ||
|   | a70823dd1c | ||
|   | fdda8adfcf | ||
|   | 8f242f8bf0 | ||
|   | 36a14e65c2 | ||
|   | 6ed5d2e2b4 | ||
|   | d4eb222644 | ||
|   | a14fd1b955 | ||
|   | ab1107973b | ||
|   | 4ab483d991 | ||
|   | dabf72f3c0 | ||
|   | 907a1f5e48 | ||
|   | 97140ab634 | ||
|   | dc9c5417bc | ||
|   | 556e7694de | ||
|   | 1a5cba5df5 | ||
|   | cd0990c581 | ||
|   | 96e831dd8a | ||
|   | 65fde269c6 | ||
|   | ad138210b3 | ||
|   | 6968f17f3f | ||
|   | 7e69d1400a | ||
|   | ccefa87351 | ||
|   | a3c97ee535 | ||
|   | 77229f99b8 | ||
|   | a51437ee2b | ||
|   | 78232fa3eb | ||
|   | 433e1b388d | ||
|   | 9b7d918537 | ||
|   | 4c59eb0910 | ||
|   | 5cfea4fee3 | ||
|   | 7275cf60bd | ||
|   | acbefa5263 | ||
|   | 2b64861ee1 | ||
|   | ea90b803fa | ||
|   | 56e8aab280 | ||
|   | 1b58341e50 | ||
|   | 634c31d7cb | ||
|   | b8dcd5f842 | ||
|   | 14e02635ff | ||
|   | 9b3b5badfb | ||
|   | 47c1558287 | ||
|   | cc7e843c44 | ||
|   | cfb8f18cef | ||
|   | c0a71720af | ||
|   | 8b03d9ecc3 | ||
|   | ea54ce7d96 | ||
|   | cb31e3e12a | ||
|   | c710a56903 | ||
|   | 96d5bde9b7 | ||
|   | ad72fa46b0 | ||
|   | fa4580de53 | ||
|   | 5e343e2c16 | ||
|   | ef93bb6471 | ||
|   | d6aaef9954 | ||
|   | 2ca351366e | ||
|   | f54bf022bd | ||
|   | e56df455ae | ||
|   | 54101b1948 | ||
|   | 829d9c863c | ||
|   | f304fa4869 | ||
|   | a32559e5ae | ||
|   | 8e13292d62 | ||
|   | 29ea5306eb | ||
|   | fb9e8768a3 | ||
|   | c747be84d9 | ||
|   | 2d7adb90c8 | ||
|   | 6b35a4901e | ||
|   | 4c1fde9deb | ||
|   | 425e65049b | ||
|   | d3f30d9ece | ||
|   | 75cffd0ec4 | ||
|   | e33d6b2908 | ||
|   | a50907513a | ||
|   | c0130ca8f7 | ||
|   | 9d4e4e2bd4 | ||
|   | bdc7cc8ab9 | ||
|   | 13deb22223 | ||
|   | 220e4caf36 | ||
|   | 5c617ac286 | ||
|   | bc08ad2fbb | ||
|   | 0947bc37d3 | ||
|   | 959eb98090 | ||
|   | 32dcf77a8f | ||
|   | 75349f8cde | ||
|   | eac227a203 | ||
|   | bc166aa6b4 | ||
|   | 5fa8b24b2b | ||
|   | 9d65eab549 | ||
|   | c4a9117ef8 | ||
|   | 0db38c4999 | ||
|   | 8ee00cee60 | ||
|   | 984aad4b86 | ||
|   | 9af90bf9c1 | ||
|   | 12ea2fcb51 | ||
|   | 55cd110c63 | ||
|   | f37a172dc7 | ||
|   | ad62a659eb | ||
|   | 15c9458e92 | ||
|   | a3baf14e72 | ||
|   | f57ce7254d | ||
|   | 4d8190972d | ||
|   | b7ef8796b2 | ||
|   | 7e8a864992 | ||
|   | f3660dc60e | ||
|   | 0eb355e29d | ||
|   | 3ccb7cf4b2 | ||
|   | 578ff22464 | ||
|   | 73db35c53c | ||
|   | 76445bcb97 | ||
|   | 6792903c4f | ||
|   | 17c217848d | ||
|   | 07de258f48 | ||
|   | ee3e195b79 | ||
|   | a0bdf44c2d | ||
|   | 3259c7e150 | ||
|   | e9e28baab7 | ||
|   | d20f6c7969 | ||
|   | 93c7d571af | ||
|   | d526283ab9 | ||
|   | 782056adab | ||
|   | 0521706617 | ||
|   | 989a281b5f | ||
|   | 18838bcefc | ||
|   | f780706f09 | ||
|   | 358911a049 | 
| @@ -72,7 +72,7 @@ can-build-gnome-shell: | ||||
|     - meson install --no-rebuild -C build | ||||
|   script: | ||||
|     - .gitlab-ci/checkout-gnome-shell.sh | ||||
|     - meson gnome-shell gnome-shell/build --prefix /usr | ||||
|     - meson gnome-shell gnome-shell/build --prefix /usr -Dman=false | ||||
|     - ninja -C gnome-shell/build install | ||||
|   only: | ||||
|     - merge_requests | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| # Rebuild and push with | ||||
| # | ||||
| #     cd .gitlab-ci/ | ||||
| #     docker build -t registry.gitlab.gnome.org/gnome/mutter/master:v2 . | ||||
| #     docker build --no-cache -t registry.gitlab.gnome.org/gnome/mutter/master:v2 . | ||||
| #     docker push registry.gitlab.gnome.org/gnome/mutter/master:v2 | ||||
| # | ||||
|  | ||||
| @@ -13,6 +13,7 @@ RUN dnf -y update && dnf -y upgrade && \ | ||||
|     dnf copr enable -y fmuellner/gnome-shell-ci && \ | ||||
|     dnf copr enable -y jadahl/mutter-ci && \ | ||||
|     dnf copr enable -y hergertme/sysprof-3 && \ | ||||
|     dnf -y update && dnf -y upgrade && \ | ||||
|  | ||||
|     dnf builddep -y mutter && \ | ||||
|  | ||||
| @@ -31,6 +32,8 @@ RUN dnf -y update && dnf -y upgrade && \ | ||||
|  | ||||
|     # GNOME Shell | ||||
|     dnf builddep -y gnome-shell --setopt=install_weak_deps=False && \ | ||||
|     # New dep this cycle | ||||
|     dnf install -y 'pkgconfig(gnome-autoar-0)' && \ | ||||
|     dnf remove -y gnome-bluetooth-libs-devel dbus-glib-devel upower-devel python3-devel && \ | ||||
|     dnf remove -y --noautoremove mutter mutter-devel && \ | ||||
|  | ||||
|   | ||||
							
								
								
									
										21
									
								
								NEWS
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								NEWS
									
									
									
									
									
								
							| @@ -1,3 +1,24 @@ | ||||
| 3.33.91 | ||||
| ======= | ||||
| * Fix primary selection copy and paste between X11 and wayland [Hans; #702] | ||||
| * Improve monitor hotplug support [Hans; !713] | ||||
| * Remove a source of frame skips [Daniel; !719] | ||||
| * Fix windows being lowered after unmaximizing with double click [Olivier; #88] | ||||
| * Remove Clutter API for global grabs [Jonas D.; !536] | ||||
| * Improve processing of incompressible events [Daniel; !711] | ||||
| * Add xdg-output v3 support [Olivier; !704] | ||||
| * Misc. bug fixes and cleanups [Jonas Å., Marco, Carlos, Adam, Albert, Niels, | ||||
|   Olivier, Florian; !722, !385, !728, !726, !500, !731, !727, !700, !735, !738] | ||||
|  | ||||
| Contributors: | ||||
|   Jonas Ådahl, Albert Vaca Cintora, Jonas Dreßler, Olivier Fourdan, | ||||
|   Carlos Garnacho, Hans de Goede, Niels De Graef, Adam Jackson, Florian Müllner, | ||||
|   Marco Trevisan (Treviño), Daniel van Vugt | ||||
|  | ||||
| Translators: | ||||
|   Asier Sarasua Garmendia [eu], Kukuh Syafaat [id], Florentina Mușat [ro], | ||||
|   Aurimas Černius [lt], Daniel Mustieles [es] | ||||
|  | ||||
| 3.33.90 | ||||
| ======= | ||||
| * Fix visibility of clones with hidden source [Florian; #683] | ||||
|   | ||||
| @@ -737,11 +737,7 @@ cally_actor_grab_focus (AtkComponent    *component) | ||||
|  * | ||||
|  * This gets the top level origin, it is, the position of the stage in | ||||
|  * the global screen. You can see it as the absolute display position | ||||
|  * of the stage. | ||||
|  * | ||||
|  * FIXME: only the case with x11 is implemented, other backends are | ||||
|  * required | ||||
|  * | ||||
|  * of the stage. This is 0,0 for a compositor. | ||||
|  */ | ||||
| void | ||||
| _cally_actor_get_top_level_origin (ClutterActor *actor, | ||||
| @@ -749,54 +745,11 @@ _cally_actor_get_top_level_origin (ClutterActor *actor, | ||||
|                                    gint         *yp) | ||||
| { | ||||
|   /* default values */ | ||||
|   gint x = 0; | ||||
|   gint y = 0; | ||||
|  | ||||
| #ifdef CLUTTER_WINDOWING_X11 | ||||
|   if (clutter_check_windowing_backend (CLUTTER_WINDOWING_X11)) | ||||
|     { | ||||
|       ClutterActor *stage      = NULL; | ||||
|       Display *display    = NULL; | ||||
|       Window root_window; | ||||
|       Window stage_window; | ||||
|       Window child; | ||||
|       gint return_val = 0; | ||||
|  | ||||
|       stage = clutter_actor_get_stage (actor); | ||||
|  | ||||
|       /* FIXME: what happens if you use another display with | ||||
|          clutter_backend_x11_set_display ?*/ | ||||
|       display = clutter_x11_get_default_display (); | ||||
|       root_window = clutter_x11_get_root_window (); | ||||
|       stage_window = clutter_x11_get_stage_window (CLUTTER_STAGE (stage)); | ||||
|  | ||||
|       return_val = XTranslateCoordinates (display, stage_window, root_window, | ||||
|                                           0, 0, &x, &y, | ||||
|                                           &child); | ||||
|  | ||||
|       if (!return_val) | ||||
|         g_warning ("[x11] We were not able to get proper absolute " | ||||
|                    "position of the stage"); | ||||
|     } | ||||
|   else | ||||
| #endif | ||||
|     { | ||||
|       static gboolean yet_warned = FALSE; | ||||
|  | ||||
|       if (!yet_warned) | ||||
|         { | ||||
|           yet_warned = TRUE; | ||||
|  | ||||
|           g_warning ("The current Clutter backend does not support using " | ||||
|                      "atk_component_get_extents() with ATK_XY_SCREEN."); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   if (xp) | ||||
|     *xp = x; | ||||
|     *xp = 0; | ||||
|  | ||||
|   if (yp) | ||||
|     *yp = y; | ||||
|     *yp = 0; | ||||
| } | ||||
|  | ||||
| /* AtkAction implementation */ | ||||
|   | ||||
| @@ -297,8 +297,6 @@ const gchar *                   _clutter_actor_get_debug_name | ||||
| void                            _clutter_actor_push_clone_paint                         (void); | ||||
| void                            _clutter_actor_pop_clone_paint                          (void); | ||||
|  | ||||
| guint32                         _clutter_actor_get_pick_id                              (ClutterActor *self); | ||||
|  | ||||
| void                            _clutter_actor_shader_pre_paint                         (ClutterActor *actor, | ||||
|                                                                                          gboolean      repeat); | ||||
| void                            _clutter_actor_shader_post_paint                        (ClutterActor *actor); | ||||
|   | ||||
| @@ -736,8 +736,6 @@ struct _ClutterActorPrivate | ||||
|  | ||||
|   gchar *name; /* a non-unique name, used for debugging */ | ||||
|  | ||||
|   gint32 pick_id; /* per-stage unique id, used for picking */ | ||||
|  | ||||
|   /* a back-pointer to the Pango context that we can use | ||||
|    * to create pre-configured PangoLayout | ||||
|    */ | ||||
| @@ -1290,6 +1288,105 @@ clutter_actor_verify_map_state (ClutterActor *self) | ||||
|  | ||||
| #endif /* CLUTTER_ENABLE_DEBUG */ | ||||
|  | ||||
| static gboolean | ||||
| _clutter_actor_transform_local_box_to_stage (ClutterActor          *self, | ||||
|                                              ClutterStage          *stage, | ||||
|                                              const ClutterActorBox *box, | ||||
|                                              ClutterPoint           vertices[4]) | ||||
| { | ||||
|   CoglFramebuffer *fb = cogl_get_draw_framebuffer (); | ||||
|   CoglMatrix stage_transform, inv_stage_transform; | ||||
|   CoglMatrix modelview, transform_to_stage; | ||||
|   int v; | ||||
|  | ||||
|   clutter_actor_get_transform (CLUTTER_ACTOR (stage), &stage_transform); | ||||
|   if (!cogl_matrix_get_inverse (&stage_transform, &inv_stage_transform)) | ||||
|     return FALSE; | ||||
|   cogl_framebuffer_get_modelview_matrix (fb, &modelview); | ||||
|   cogl_matrix_multiply (&transform_to_stage, &inv_stage_transform, &modelview); | ||||
|  | ||||
|   vertices[0].x = box->x1; | ||||
|   vertices[0].y = box->y1; | ||||
|  | ||||
|   vertices[1].x = box->x2; | ||||
|   vertices[1].y = box->y1; | ||||
|  | ||||
|   vertices[2].x = box->x2; | ||||
|   vertices[2].y = box->y2; | ||||
|  | ||||
|   vertices[3].x = box->x1; | ||||
|   vertices[3].y = box->y2; | ||||
|  | ||||
|   for (v = 0; v < 4; v++) | ||||
|     { | ||||
|       float z = 0.f; | ||||
|       float w = 1.f; | ||||
|  | ||||
|       cogl_matrix_transform_point (&transform_to_stage, | ||||
|                                    &vertices[v].x, | ||||
|                                    &vertices[v].y, | ||||
|                                    &z, | ||||
|                                    &w); | ||||
|     } | ||||
|  | ||||
|   return TRUE; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_actor_pick_box: | ||||
|  * @self: The #ClutterActor being "pick" painted. | ||||
|  * @box: A rectangle in the actor's own local coordinates. | ||||
|  * | ||||
|  * Logs (does a virtual paint of) a rectangle for picking. Note that @box is | ||||
|  * in the actor's own local coordinates, so is usually {0,0,width,height} | ||||
|  * to include the whole actor. That is unless the actor has a shaped input | ||||
|  * region in which case you may wish to log the (multiple) smaller rectangles | ||||
|  * that make up the input region. | ||||
|  */ | ||||
| void | ||||
| clutter_actor_pick_box (ClutterActor          *self, | ||||
|                         const ClutterActorBox *box) | ||||
| { | ||||
|   ClutterStage *stage; | ||||
|   ClutterPoint vertices[4]; | ||||
|  | ||||
|   g_return_if_fail (CLUTTER_IS_ACTOR (self)); | ||||
|   g_return_if_fail (box != NULL); | ||||
|  | ||||
|   if (box->x1 >= box->x2 || box->y1 >= box->y2) | ||||
|     return; | ||||
|  | ||||
|   stage = CLUTTER_STAGE (_clutter_actor_get_stage_internal (self)); | ||||
|  | ||||
|   if (_clutter_actor_transform_local_box_to_stage (self, stage, box, vertices)) | ||||
|     clutter_stage_log_pick (stage, vertices, self); | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| _clutter_actor_push_pick_clip (ClutterActor          *self, | ||||
|                                const ClutterActorBox *clip) | ||||
| { | ||||
|   ClutterStage *stage; | ||||
|   ClutterPoint vertices[4]; | ||||
|  | ||||
|   stage = CLUTTER_STAGE (_clutter_actor_get_stage_internal (self)); | ||||
|  | ||||
|   if (!_clutter_actor_transform_local_box_to_stage (self, stage, clip, vertices)) | ||||
|     return FALSE; | ||||
|  | ||||
|   clutter_stage_push_pick_clip (stage, vertices); | ||||
|   return TRUE; | ||||
| } | ||||
|  | ||||
| static void | ||||
| _clutter_actor_pop_pick_clip (ClutterActor *self) | ||||
| { | ||||
|   ClutterActor *stage; | ||||
|  | ||||
|   stage = _clutter_actor_get_stage_internal (self); | ||||
|   clutter_stage_pop_pick_clip (CLUTTER_STAGE (stage)); | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_actor_set_mapped (ClutterActor *self, | ||||
|                           gboolean      mapped) | ||||
| @@ -1518,8 +1615,7 @@ clutter_actor_update_map_state (ClutterActor  *self, | ||||
| static void | ||||
| clutter_actor_real_map (ClutterActor *self) | ||||
| { | ||||
|   ClutterActorPrivate *priv = self->priv; | ||||
|   ClutterActor *stage, *iter; | ||||
|   ClutterActor *iter; | ||||
|  | ||||
|   g_assert (!CLUTTER_ACTOR_IS_MAPPED (self)); | ||||
|  | ||||
| @@ -1530,13 +1626,6 @@ clutter_actor_real_map (ClutterActor *self) | ||||
|  | ||||
|   self->priv->needs_paint_volume_update = TRUE; | ||||
|  | ||||
|   stage = _clutter_actor_get_stage_internal (self); | ||||
|   priv->pick_id = _clutter_stage_acquire_pick_id (CLUTTER_STAGE (stage), self); | ||||
|  | ||||
|   CLUTTER_NOTE (ACTOR, "Pick id '%d' for actor '%s'", | ||||
|                 priv->pick_id, | ||||
|                 _clutter_actor_get_debug_name (self)); | ||||
|  | ||||
|   clutter_actor_ensure_resource_scale (self); | ||||
|  | ||||
|   /* notify on parent mapped before potentially mapping | ||||
| @@ -1641,11 +1730,6 @@ clutter_actor_real_unmap (ClutterActor *self) | ||||
|  | ||||
|       stage = CLUTTER_STAGE (_clutter_actor_get_stage_internal (self)); | ||||
|  | ||||
|       if (stage != NULL) | ||||
|         _clutter_stage_release_pick_id (stage, priv->pick_id); | ||||
|  | ||||
|       priv->pick_id = -1; | ||||
|  | ||||
|       if (stage != NULL && | ||||
|           clutter_stage_get_key_focus (stage) == self) | ||||
|         { | ||||
| @@ -2264,46 +2348,16 @@ static void | ||||
| clutter_actor_real_pick (ClutterActor       *self, | ||||
| 			 const ClutterColor *color) | ||||
| { | ||||
|   CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer (); | ||||
|  | ||||
|   /* the default implementation is just to paint a rectangle | ||||
|    * with the same size of the actor using the passed color | ||||
|    */ | ||||
|   if (clutter_actor_should_pick_paint (self)) | ||||
|     { | ||||
|       static CoglPipeline *default_pick_pipeline = NULL; | ||||
|       ClutterActorBox box = { 0, }; | ||||
|       CoglPipeline *pick_pipeline; | ||||
|       float width, height; | ||||
|       ClutterActorBox box = { | ||||
|         .x1 = 0, | ||||
|         .y1 = 0, | ||||
|         .x2 = clutter_actor_get_width (self), | ||||
|         .y2 = clutter_actor_get_height (self), | ||||
|       }; | ||||
|  | ||||
|       if (G_UNLIKELY (default_pick_pipeline == NULL)) | ||||
|         { | ||||
|           CoglContext *ctx = | ||||
|             clutter_backend_get_cogl_context (clutter_get_default_backend ()); | ||||
|  | ||||
|           default_pick_pipeline = cogl_pipeline_new (ctx); | ||||
|         } | ||||
|  | ||||
|       g_assert (default_pick_pipeline != NULL); | ||||
|       pick_pipeline = cogl_pipeline_copy (default_pick_pipeline); | ||||
|  | ||||
|       clutter_actor_get_allocation_box (self, &box); | ||||
|  | ||||
|       width = box.x2 - box.x1; | ||||
|       height = box.y2 - box.y1; | ||||
|  | ||||
|       cogl_pipeline_set_color4ub (pick_pipeline, | ||||
|                                   color->red, | ||||
|                                   color->green, | ||||
|                                   color->blue, | ||||
|                                   color->alpha); | ||||
|  | ||||
|       cogl_framebuffer_draw_rectangle (framebuffer, | ||||
|                                        pick_pipeline, | ||||
|                                        0, 0, | ||||
|                                        width, height); | ||||
|  | ||||
|       cogl_object_unref (pick_pipeline); | ||||
|       clutter_actor_pick_box (self, &box); | ||||
|     } | ||||
|  | ||||
|   /* XXX - this thoroughly sucks, but we need to maintain compatibility | ||||
| @@ -3594,15 +3648,6 @@ _clutter_actor_update_last_paint_volume (ClutterActor *self) | ||||
|   priv->last_paint_volume_valid = TRUE; | ||||
| } | ||||
|  | ||||
| guint32 | ||||
| _clutter_actor_get_pick_id (ClutterActor *self) | ||||
| { | ||||
|   if (self->priv->pick_id < 0) | ||||
|     return 0; | ||||
|  | ||||
|   return self->priv->pick_id; | ||||
| } | ||||
|  | ||||
| /* This is the same as clutter_actor_add_effect except that it doesn't | ||||
|    queue a redraw and it doesn't notify on the effect property */ | ||||
| static void | ||||
| @@ -3834,6 +3879,7 @@ clutter_actor_paint (ClutterActor *self) | ||||
| { | ||||
|   ClutterActorPrivate *priv; | ||||
|   ClutterPickMode pick_mode; | ||||
|   ClutterActorBox clip; | ||||
|   gboolean clip_set = FALSE; | ||||
|   ClutterStage *stage; | ||||
|  | ||||
| @@ -3927,26 +3973,40 @@ clutter_actor_paint (ClutterActor *self) | ||||
|  | ||||
|   if (priv->has_clip) | ||||
|     { | ||||
|       CoglFramebuffer *fb = _clutter_stage_get_active_framebuffer (stage); | ||||
|       cogl_framebuffer_push_rectangle_clip (fb, | ||||
|                                             priv->clip.origin.x, | ||||
|                                             priv->clip.origin.y, | ||||
|                                             priv->clip.origin.x + priv->clip.size.width, | ||||
|                                             priv->clip.origin.y + priv->clip.size.height); | ||||
|       clip.x1 = priv->clip.origin.x; | ||||
|       clip.y1 = priv->clip.origin.y; | ||||
|       clip.x2 = priv->clip.origin.x + priv->clip.size.width; | ||||
|       clip.y2 = priv->clip.origin.y + priv->clip.size.height; | ||||
|       clip_set = TRUE; | ||||
|     } | ||||
|   else if (priv->clip_to_allocation) | ||||
|     { | ||||
|       CoglFramebuffer *fb = _clutter_stage_get_active_framebuffer (stage); | ||||
|       gfloat width, height; | ||||
|  | ||||
|       width  = priv->allocation.x2 - priv->allocation.x1; | ||||
|       height = priv->allocation.y2 - priv->allocation.y1; | ||||
|  | ||||
|       cogl_framebuffer_push_rectangle_clip (fb, 0, 0, width, height); | ||||
|       clip.x1 = 0.f; | ||||
|       clip.y1 = 0.f; | ||||
|       clip.x2 = priv->allocation.x2 - priv->allocation.x1; | ||||
|       clip.y2 = priv->allocation.y2 - priv->allocation.y1; | ||||
|       clip_set = TRUE; | ||||
|     } | ||||
|  | ||||
|   if (clip_set) | ||||
|     { | ||||
|       if (pick_mode == CLUTTER_PICK_NONE) | ||||
|         { | ||||
|           CoglFramebuffer *fb = _clutter_stage_get_active_framebuffer (stage); | ||||
|  | ||||
|           cogl_framebuffer_push_rectangle_clip (fb, | ||||
|                                                 clip.x1, | ||||
|                                                 clip.y1, | ||||
|                                                 clip.x2, | ||||
|                                                 clip.y2); | ||||
|         } | ||||
|       else | ||||
|         { | ||||
|           if (!_clutter_actor_push_pick_clip (self, &clip)) | ||||
|             clip_set = FALSE; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   if (pick_mode == CLUTTER_PICK_NONE) | ||||
|     { | ||||
|       /* We check whether we need to add the flatten effect before | ||||
| @@ -4025,9 +4085,16 @@ clutter_actor_paint (ClutterActor *self) | ||||
| done: | ||||
|   if (clip_set) | ||||
|     { | ||||
|       CoglFramebuffer *fb = _clutter_stage_get_active_framebuffer (stage); | ||||
|       if (pick_mode == CLUTTER_PICK_NONE) | ||||
|         { | ||||
|           CoglFramebuffer *fb = _clutter_stage_get_active_framebuffer (stage); | ||||
|  | ||||
|       cogl_framebuffer_pop_clip (fb); | ||||
|           cogl_framebuffer_pop_clip (fb); | ||||
|         } | ||||
|       else | ||||
|         { | ||||
|           _clutter_actor_pop_pick_clip (self); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   cogl_pop_matrix (); | ||||
| @@ -4098,11 +4165,12 @@ clutter_actor_continue_paint (ClutterActor *self) | ||||
|         { | ||||
|           ClutterColor col = { 0, }; | ||||
|  | ||||
|           _clutter_id_to_color (_clutter_actor_get_pick_id (self), &col); | ||||
|  | ||||
|           /* Actor will then paint silhouette of itself in supplied | ||||
|            * color.  See clutter_stage_get_actor_at_pos() for where | ||||
|            * picking is enabled. | ||||
|           /* The actor will log a silhouette of itself to the stage pick log. | ||||
|            * Note that the picking color is no longer used as the "log" instead | ||||
|            * keeps a weak pointer to the actor itself. But we keep the color | ||||
|            * parameter for now so as to maintain ABI compatibility. The color | ||||
|            * parameter can be removed when someone feels like breaking the ABI | ||||
|            * along with gnome-shell. | ||||
|            * | ||||
|            * XXX:2.0 - Call the pick() virtual directly | ||||
|            */ | ||||
| @@ -8005,8 +8073,7 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
| 		  G_TYPE_FROM_CLASS (object_class), | ||||
|                   G_SIGNAL_RUN_CLEANUP | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS, | ||||
| 		  G_STRUCT_OFFSET (ClutterActorClass, destroy), | ||||
| 		  NULL, NULL, | ||||
| 		  _clutter_marshal_VOID__VOID, | ||||
| 		  NULL, NULL, NULL, | ||||
| 		  G_TYPE_NONE, 0); | ||||
|   /** | ||||
|    * ClutterActor::show: | ||||
| @@ -8022,8 +8089,7 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
| 		  G_TYPE_FROM_CLASS (object_class), | ||||
| 		  G_SIGNAL_RUN_FIRST, | ||||
| 		  G_STRUCT_OFFSET (ClutterActorClass, show), | ||||
| 		  NULL, NULL, | ||||
| 		  _clutter_marshal_VOID__VOID, | ||||
| 		  NULL, NULL, NULL, | ||||
| 		  G_TYPE_NONE, 0); | ||||
|   /** | ||||
|    * ClutterActor::hide: | ||||
| @@ -8039,8 +8105,7 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
| 		  G_TYPE_FROM_CLASS (object_class), | ||||
| 		  G_SIGNAL_RUN_FIRST, | ||||
| 		  G_STRUCT_OFFSET (ClutterActorClass, hide), | ||||
| 		  NULL, NULL, | ||||
| 		  _clutter_marshal_VOID__VOID, | ||||
| 		  NULL, NULL, NULL, | ||||
| 		  G_TYPE_NONE, 0); | ||||
|   /** | ||||
|    * ClutterActor::parent-set: | ||||
| @@ -8056,8 +8121,7 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (object_class), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   G_STRUCT_OFFSET (ClutterActorClass, parent_set), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__OBJECT, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 1, | ||||
|                   CLUTTER_TYPE_ACTOR); | ||||
|  | ||||
| @@ -8125,6 +8189,9 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
| 		  G_TYPE_BOOLEAN, 2, | ||||
|                   CLUTTER_TYPE_ACTOR, | ||||
|                   CLUTTER_TYPE_PAINT_VOLUME); | ||||
|   g_signal_set_va_marshaller (actor_signals[QUEUE_REDRAW], | ||||
|                               G_TYPE_FROM_CLASS (object_class), | ||||
|                               _clutter_marshal_BOOLEAN__OBJECT_BOXEDv); | ||||
|  | ||||
|   /** | ||||
|    * ClutterActor::queue-relayout: | ||||
| @@ -8149,8 +8216,7 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
| 		  G_SIGNAL_RUN_LAST | | ||||
|                   G_SIGNAL_NO_HOOKS, | ||||
| 		  G_STRUCT_OFFSET (ClutterActorClass, queue_relayout), | ||||
| 		  NULL, NULL, | ||||
| 		  _clutter_marshal_VOID__VOID, | ||||
| 		  NULL, NULL, NULL, | ||||
| 		  G_TYPE_NONE, 0); | ||||
|  | ||||
|   /** | ||||
| @@ -8177,6 +8243,9 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
| 		  _clutter_marshal_BOOLEAN__BOXED, | ||||
| 		  G_TYPE_BOOLEAN, 1, | ||||
| 		  CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); | ||||
|   g_signal_set_va_marshaller (actor_signals[EVENT], | ||||
|                               G_TYPE_FROM_CLASS (object_class), | ||||
|                               _clutter_marshal_BOOLEAN__BOXEDv); | ||||
|   /** | ||||
|    * ClutterActor::button-press-event: | ||||
|    * @actor: the actor which received the event | ||||
| @@ -8199,6 +8268,9 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
| 		  _clutter_marshal_BOOLEAN__BOXED, | ||||
| 		  G_TYPE_BOOLEAN, 1, | ||||
| 		  CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); | ||||
|   g_signal_set_va_marshaller (actor_signals[BUTTON_PRESS_EVENT], | ||||
|                               G_TYPE_FROM_CLASS (object_class), | ||||
|                               _clutter_marshal_BOOLEAN__BOXEDv); | ||||
|   /** | ||||
|    * ClutterActor::button-release-event: | ||||
|    * @actor: the actor which received the event | ||||
| @@ -8221,6 +8293,9 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
| 		  _clutter_marshal_BOOLEAN__BOXED, | ||||
| 		  G_TYPE_BOOLEAN, 1, | ||||
| 		  CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); | ||||
|   g_signal_set_va_marshaller (actor_signals[BUTTON_RELEASE_EVENT], | ||||
|                               G_TYPE_FROM_CLASS (object_class), | ||||
|                               _clutter_marshal_BOOLEAN__BOXEDv); | ||||
|   /** | ||||
|    * ClutterActor::scroll-event: | ||||
|    * @actor: the actor which received the event | ||||
| @@ -8243,6 +8318,9 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
| 		  _clutter_marshal_BOOLEAN__BOXED, | ||||
| 		  G_TYPE_BOOLEAN, 1, | ||||
| 		  CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); | ||||
|   g_signal_set_va_marshaller (actor_signals[SCROLL_EVENT], | ||||
|                               G_TYPE_FROM_CLASS (object_class), | ||||
|                               _clutter_marshal_BOOLEAN__BOXEDv); | ||||
|   /** | ||||
|    * ClutterActor::key-press-event: | ||||
|    * @actor: the actor which received the event | ||||
| @@ -8265,6 +8343,9 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
| 		  _clutter_marshal_BOOLEAN__BOXED, | ||||
| 		  G_TYPE_BOOLEAN, 1, | ||||
| 		  CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); | ||||
|   g_signal_set_va_marshaller (actor_signals[KEY_PRESS_EVENT], | ||||
|                               G_TYPE_FROM_CLASS (object_class), | ||||
|                               _clutter_marshal_BOOLEAN__BOXEDv); | ||||
|   /** | ||||
|    * ClutterActor::key-release-event: | ||||
|    * @actor: the actor which received the event | ||||
| @@ -8288,6 +8369,9 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
| 		  _clutter_marshal_BOOLEAN__BOXED, | ||||
| 		  G_TYPE_BOOLEAN, 1, | ||||
| 		  CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); | ||||
|   g_signal_set_va_marshaller (actor_signals[KEY_RELEASE_EVENT], | ||||
|                               G_TYPE_FROM_CLASS (object_class), | ||||
|                               _clutter_marshal_BOOLEAN__BOXEDv); | ||||
|   /** | ||||
|    * ClutterActor::motion-event: | ||||
|    * @actor: the actor which received the event | ||||
| @@ -8310,6 +8394,9 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
| 		  _clutter_marshal_BOOLEAN__BOXED, | ||||
| 		  G_TYPE_BOOLEAN, 1, | ||||
| 		  CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); | ||||
|   g_signal_set_va_marshaller (actor_signals[MOTION_EVENT], | ||||
|                               G_TYPE_FROM_CLASS (object_class), | ||||
|                               _clutter_marshal_BOOLEAN__BOXEDv); | ||||
|  | ||||
|   /** | ||||
|    * ClutterActor::key-focus-in: | ||||
| @@ -8324,8 +8411,7 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
| 		  G_TYPE_FROM_CLASS (object_class), | ||||
| 		  G_SIGNAL_RUN_LAST, | ||||
| 		  G_STRUCT_OFFSET (ClutterActorClass, key_focus_in), | ||||
| 		  NULL, NULL, | ||||
| 		  _clutter_marshal_VOID__VOID, | ||||
| 		  NULL, NULL, NULL, | ||||
| 		  G_TYPE_NONE, 0); | ||||
|  | ||||
|   /** | ||||
| @@ -8341,8 +8427,7 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
| 		  G_TYPE_FROM_CLASS (object_class), | ||||
| 		  G_SIGNAL_RUN_LAST, | ||||
| 		  G_STRUCT_OFFSET (ClutterActorClass, key_focus_out), | ||||
| 		  NULL, NULL, | ||||
| 		  _clutter_marshal_VOID__VOID, | ||||
| 		  NULL, NULL, NULL, | ||||
| 		  G_TYPE_NONE, 0); | ||||
|  | ||||
|   /** | ||||
| @@ -8366,6 +8451,9 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
| 		  _clutter_marshal_BOOLEAN__BOXED, | ||||
| 		  G_TYPE_BOOLEAN, 1, | ||||
| 		  CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); | ||||
|   g_signal_set_va_marshaller (actor_signals[ENTER_EVENT], | ||||
|                               G_TYPE_FROM_CLASS (object_class), | ||||
|                               _clutter_marshal_BOOLEAN__BOXEDv); | ||||
|  | ||||
|   /** | ||||
|    * ClutterActor::leave-event: | ||||
| @@ -8388,6 +8476,9 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
| 		  _clutter_marshal_BOOLEAN__BOXED, | ||||
| 		  G_TYPE_BOOLEAN, 1, | ||||
| 		  CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); | ||||
|   g_signal_set_va_marshaller (actor_signals[LEAVE_EVENT], | ||||
|                               G_TYPE_FROM_CLASS (object_class), | ||||
|                               _clutter_marshal_BOOLEAN__BOXEDv); | ||||
|  | ||||
|   /** | ||||
|    * ClutterActor::captured-event: | ||||
| @@ -8416,6 +8507,9 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
| 		  _clutter_marshal_BOOLEAN__BOXED, | ||||
| 		  G_TYPE_BOOLEAN, 1, | ||||
| 		  CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); | ||||
|   g_signal_set_va_marshaller (actor_signals[CAPTURED_EVENT], | ||||
|                               G_TYPE_FROM_CLASS (object_class), | ||||
|                               _clutter_marshal_BOOLEAN__BOXEDv); | ||||
|  | ||||
|   /** | ||||
|    * ClutterActor::paint: | ||||
| @@ -8446,8 +8540,7 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
|                   G_SIGNAL_NO_HOOKS | | ||||
|                   G_SIGNAL_DEPRECATED, | ||||
|                   G_STRUCT_OFFSET (ClutterActorClass, paint), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__VOID, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 0); | ||||
|   /** | ||||
|    * ClutterActor::realize: | ||||
| @@ -8466,8 +8559,7 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (object_class), | ||||
|                   G_SIGNAL_RUN_LAST | G_SIGNAL_DEPRECATED, | ||||
|                   G_STRUCT_OFFSET (ClutterActorClass, realize), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__VOID, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 0); | ||||
|   /** | ||||
|    * ClutterActor::unrealize: | ||||
| @@ -8486,8 +8578,7 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (object_class), | ||||
|                   G_SIGNAL_RUN_LAST | G_SIGNAL_DEPRECATED, | ||||
|                   G_STRUCT_OFFSET (ClutterActorClass, unrealize), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__VOID, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 0); | ||||
|  | ||||
|   /** | ||||
| @@ -8515,8 +8606,7 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (object_class), | ||||
|                   G_SIGNAL_RUN_LAST | G_SIGNAL_DEPRECATED, | ||||
|                   G_STRUCT_OFFSET (ClutterActorClass, pick), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__BOXED, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 1, | ||||
|                   CLUTTER_TYPE_COLOR | G_SIGNAL_TYPE_STATIC_SCOPE); | ||||
|  | ||||
| @@ -8545,6 +8635,9 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
|                   G_TYPE_NONE, 2, | ||||
|                   CLUTTER_TYPE_ACTOR_BOX | G_SIGNAL_TYPE_STATIC_SCOPE, | ||||
|                   CLUTTER_TYPE_ALLOCATION_FLAGS); | ||||
|   g_signal_set_va_marshaller (actor_signals[ALLOCATION_CHANGED], | ||||
|                               G_TYPE_FROM_CLASS (object_class), | ||||
|                               _clutter_marshal_VOID__BOXED_FLAGSv); | ||||
|  | ||||
|   /** | ||||
|    * ClutterActor::transitions-completed: | ||||
| @@ -8560,8 +8653,7 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (object_class), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   0, | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__VOID, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 0); | ||||
|  | ||||
|   /** | ||||
| @@ -8589,6 +8681,9 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
|                   G_TYPE_NONE, 2, | ||||
|                   G_TYPE_STRING, | ||||
|                   G_TYPE_BOOLEAN); | ||||
|   g_signal_set_va_marshaller (actor_signals[TRANSITION_STOPPED], | ||||
|                               G_TYPE_FROM_CLASS (object_class), | ||||
|                               _clutter_marshal_VOID__STRING_BOOLEANv); | ||||
|  | ||||
|   /** | ||||
|    * ClutterActor::touch-event: | ||||
| @@ -8612,6 +8707,9 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
| 		  _clutter_marshal_BOOLEAN__BOXED, | ||||
| 		  G_TYPE_BOOLEAN, 1, | ||||
| 		  CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); | ||||
|   g_signal_set_va_marshaller (actor_signals[TOUCH_EVENT], | ||||
|                               G_TYPE_FROM_CLASS (object_class), | ||||
|                               _clutter_marshal_BOOLEAN__BOXEDv); | ||||
| } | ||||
|  | ||||
| static void | ||||
| @@ -8621,8 +8719,6 @@ clutter_actor_init (ClutterActor *self) | ||||
|  | ||||
|   self->priv = priv = clutter_actor_get_instance_private (self); | ||||
|  | ||||
|   priv->pick_id = -1; | ||||
|  | ||||
|   priv->opacity = 0xff; | ||||
|   priv->show_on_set_parent = TRUE; | ||||
|   priv->resource_scale = -1.0f; | ||||
|   | ||||
| @@ -902,6 +902,10 @@ void                            clutter_actor_bind_model_with_properties | ||||
|                                                                                  const char                 *first_model_property, | ||||
|                                                                                  ...); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void clutter_actor_pick_box (ClutterActor          *self, | ||||
|                              const ClutterActorBox *box); | ||||
|  | ||||
| G_END_DECLS | ||||
|  | ||||
| #endif /* __CLUTTER_ACTOR_H__ */ | ||||
|   | ||||
| @@ -50,7 +50,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterConstraint, g_object_unref) | ||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterContainer, g_object_unref) | ||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDeformEffect, g_object_unref) | ||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDesaturateEffect, g_object_unref) | ||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDeviceManager, g_object_unref) | ||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDragAction, g_object_unref) | ||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDropAction, g_object_unref) | ||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterEffect, g_object_unref) | ||||
|   | ||||
| @@ -27,8 +27,6 @@ | ||||
| #include <clutter/clutter-keymap.h> | ||||
| #include <clutter/clutter-stage-window.h> | ||||
|  | ||||
| #include "clutter-event-translator.h" | ||||
|  | ||||
| #define CLUTTER_BACKEND_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BACKEND, ClutterBackendClass)) | ||||
| #define CLUTTER_IS_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BACKEND)) | ||||
| #define CLUTTER_BACKEND_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BACKEND, ClutterBackendClass)) | ||||
| @@ -58,7 +56,7 @@ struct _ClutterBackend | ||||
|   gfloat units_per_em; | ||||
|   gint32 units_serial; | ||||
|  | ||||
|   GList *event_translators; | ||||
|   ClutterStageWindow *stage_window; | ||||
|  | ||||
|   ClutterInputMethod *input_method; | ||||
|  | ||||
| @@ -93,12 +91,6 @@ struct _ClutterBackendClass | ||||
|                                                 GError         **error); | ||||
|   ClutterDeviceManager *(* get_device_manager) (ClutterBackend  *backend); | ||||
|  | ||||
|   void                  (* copy_event_data)    (ClutterBackend     *backend, | ||||
|                                                 const ClutterEvent *src, | ||||
|                                                 ClutterEvent       *dest); | ||||
|   void                  (* free_event_data)    (ClutterBackend     *backend, | ||||
|                                                 ClutterEvent       *event); | ||||
|  | ||||
|   gboolean              (* translate_event)    (ClutterBackend     *backend, | ||||
|                                                 gpointer            native, | ||||
|                                                 ClutterEvent       *event); | ||||
| @@ -136,17 +128,11 @@ void                    _clutter_backend_copy_event_data                (Clutter | ||||
|                                                                          ClutterEvent           *dest); | ||||
| void                    _clutter_backend_free_event_data                (ClutterBackend         *backend, | ||||
|                                                                          ClutterEvent           *event); | ||||
| CLUTTER_EXPORT | ||||
| gboolean                _clutter_backend_translate_event                (ClutterBackend         *backend, | ||||
|                                                                          gpointer                native, | ||||
|                                                                          ClutterEvent           *event); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void                    _clutter_backend_add_event_translator           (ClutterBackend         *backend, | ||||
|                                                                          ClutterEventTranslator *translator); | ||||
|  | ||||
| void                    _clutter_backend_remove_event_translator        (ClutterBackend         *backend, | ||||
|                                                                          ClutterEventTranslator *translator); | ||||
|  | ||||
| ClutterFeatureFlags     _clutter_backend_get_features                   (ClutterBackend         *backend); | ||||
|  | ||||
| gfloat                  _clutter_backend_get_units_per_em               (ClutterBackend         *backend, | ||||
| @@ -160,6 +146,9 @@ void                    _clutter_backend_reset_cogl_framebuffer         (Clutter | ||||
|  | ||||
| void                    clutter_set_allowed_drivers                     (const char             *drivers); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| ClutterStageWindow *    clutter_backend_get_stage_window                (ClutterBackend         *backend); | ||||
|  | ||||
| G_END_DECLS | ||||
|  | ||||
| #endif /* __CLUTTER_BACKEND_PRIVATE_H__ */ | ||||
|   | ||||
| @@ -62,9 +62,6 @@ | ||||
| #ifdef CLUTTER_INPUT_X11 | ||||
| #include "x11/clutter-backend-x11.h" | ||||
| #endif | ||||
| #ifdef CLUTTER_INPUT_EVDEV | ||||
| #include "evdev/clutter-device-manager-evdev.h" | ||||
| #endif | ||||
| #ifdef CLUTTER_WINDOWING_EGL | ||||
| #include "egl/clutter-backend-eglnative.h" | ||||
| #endif | ||||
| @@ -104,10 +101,12 @@ clutter_backend_dispose (GObject *gobject) | ||||
|   /* clear the events still in the queue of the main context */ | ||||
|   _clutter_clear_events_queue (); | ||||
|  | ||||
|   /* remove all event translators */ | ||||
|   g_clear_pointer (&backend->event_translators, g_list_free); | ||||
|  | ||||
|   g_clear_pointer (&backend->dummy_onscreen, cogl_object_unref); | ||||
|   if (backend->stage_window) | ||||
|     { | ||||
|       g_object_remove_weak_pointer (G_OBJECT (backend->stage_window), | ||||
|                                     (gpointer *) &backend->stage_window); | ||||
|     } | ||||
|  | ||||
|   G_OBJECT_CLASS (clutter_backend_parent_class)->dispose (gobject); | ||||
| } | ||||
| @@ -397,7 +396,7 @@ clutter_backend_real_create_context (ClutterBackend  *backend, | ||||
|       else | ||||
|         g_set_error_literal (error, CLUTTER_INIT_ERROR, | ||||
|                              CLUTTER_INIT_ERROR_BACKEND, | ||||
|                             _("Unable to initialize the Clutter backend: no available drivers found.")); | ||||
|                              "Unable to initialize the Clutter backend: no available drivers found."); | ||||
|  | ||||
|       return FALSE; | ||||
|     } | ||||
| @@ -526,40 +525,7 @@ _clutter_create_backend (void) | ||||
| static void | ||||
| clutter_backend_real_init_events (ClutterBackend *backend) | ||||
| { | ||||
|   const char *input_backend = NULL; | ||||
|  | ||||
|   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 | ||||
| #ifdef CLUTTER_INPUT_EVDEV | ||||
|   /* Evdev can be used regardless of the windowing system */ | ||||
|   if ((input_backend != NULL && strcmp (input_backend, CLUTTER_INPUT_EVDEV) == 0) | ||||
| #ifdef CLUTTER_WINDOWING_EGL | ||||
|       /* but we do want to always use it for EGL native */ | ||||
|       || clutter_check_windowing_backend (CLUTTER_WINDOWING_EGL) | ||||
| #endif | ||||
|       ) | ||||
|     { | ||||
|       _clutter_events_evdev_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"); | ||||
|   g_error ("Unknown input backend"); | ||||
| } | ||||
|  | ||||
| static ClutterDeviceManager * | ||||
| @@ -586,34 +552,6 @@ clutter_backend_real_get_keymap (ClutterBackend *backend) | ||||
|   return backend->keymap; | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| clutter_backend_real_translate_event (ClutterBackend *backend, | ||||
|                                       gpointer        native, | ||||
|                                       ClutterEvent   *event) | ||||
| { | ||||
|   GList *l; | ||||
|  | ||||
|   for (l = backend->event_translators; | ||||
|        l != NULL; | ||||
|        l = l->next) | ||||
|     { | ||||
|       ClutterEventTranslator *translator = l->data; | ||||
|       ClutterTranslateReturn retval; | ||||
|  | ||||
|       retval = _clutter_event_translator_translate_event (translator, | ||||
|                                                           native, | ||||
|                                                           event); | ||||
|  | ||||
|       if (retval == CLUTTER_TRANSLATE_QUEUE) | ||||
|         return TRUE; | ||||
|  | ||||
|       if (retval == CLUTTER_TRANSLATE_REMOVE) | ||||
|         return FALSE; | ||||
|     } | ||||
|  | ||||
|   return FALSE; | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_backend_class_init (ClutterBackendClass *klass) | ||||
| { | ||||
| @@ -636,8 +574,7 @@ clutter_backend_class_init (ClutterBackendClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (klass), | ||||
|                   G_SIGNAL_RUN_FIRST, | ||||
|                   G_STRUCT_OFFSET (ClutterBackendClass, resolution_changed), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__VOID, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 0); | ||||
|  | ||||
|   /** | ||||
| @@ -654,8 +591,7 @@ clutter_backend_class_init (ClutterBackendClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (klass), | ||||
|                   G_SIGNAL_RUN_FIRST, | ||||
|                   G_STRUCT_OFFSET (ClutterBackendClass, font_changed), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__VOID, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 0); | ||||
|  | ||||
|   /** | ||||
| @@ -672,8 +608,7 @@ clutter_backend_class_init (ClutterBackendClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (klass), | ||||
|                   G_SIGNAL_RUN_FIRST, | ||||
|                   G_STRUCT_OFFSET (ClutterBackendClass, settings_changed), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__VOID, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 0); | ||||
|  | ||||
|   klass->resolution_changed = clutter_backend_real_resolution_changed; | ||||
| @@ -681,7 +616,6 @@ clutter_backend_class_init (ClutterBackendClass *klass) | ||||
|  | ||||
|   klass->init_events = clutter_backend_real_init_events; | ||||
|   klass->get_device_manager = clutter_backend_real_get_device_manager; | ||||
|   klass->translate_event = clutter_backend_real_translate_event; | ||||
|   klass->create_context = clutter_backend_real_create_context; | ||||
|   klass->get_features = clutter_backend_real_get_features; | ||||
|   klass->get_keymap = clutter_backend_real_get_keymap; | ||||
| @@ -761,6 +695,10 @@ _clutter_backend_create_stage (ClutterBackend  *backend, | ||||
|  | ||||
|   g_assert (CLUTTER_IS_STAGE_WINDOW (stage_window)); | ||||
|  | ||||
|   backend->stage_window = stage_window; | ||||
|   g_object_add_weak_pointer (G_OBJECT (backend->stage_window), | ||||
|                              (gpointer *) &backend->stage_window); | ||||
|  | ||||
|   return stage_window; | ||||
| } | ||||
|  | ||||
| @@ -845,37 +783,24 @@ _clutter_backend_copy_event_data (ClutterBackend     *backend, | ||||
|                                   const ClutterEvent *src, | ||||
|                                   ClutterEvent       *dest) | ||||
| { | ||||
|   ClutterEventExtenderInterface *iface; | ||||
|   ClutterBackendClass *klass; | ||||
|   ClutterDeviceManagerClass *device_manager_class; | ||||
|   ClutterDeviceManager *device_manager; | ||||
|  | ||||
|   klass = CLUTTER_BACKEND_GET_CLASS (backend); | ||||
|   if (CLUTTER_IS_EVENT_EXTENDER (backend->device_manager)) | ||||
|     { | ||||
|       iface = CLUTTER_EVENT_EXTENDER_GET_IFACE (backend->device_manager); | ||||
|       iface->copy_event_data (CLUTTER_EVENT_EXTENDER (backend->device_manager), | ||||
|                               src, dest); | ||||
|     } | ||||
|   else if (klass->copy_event_data != NULL) | ||||
|     klass->copy_event_data (backend, src, dest); | ||||
|   device_manager = clutter_device_manager_get_default (); | ||||
|   device_manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager); | ||||
|   device_manager_class->copy_event_data (device_manager, src, dest); | ||||
| } | ||||
|  | ||||
| void | ||||
| _clutter_backend_free_event_data (ClutterBackend *backend, | ||||
|                                   ClutterEvent   *event) | ||||
| { | ||||
|   ClutterEventExtenderInterface *iface; | ||||
|   ClutterBackendClass *klass; | ||||
|   ClutterDeviceManagerClass *device_manager_class; | ||||
|   ClutterDeviceManager *device_manager; | ||||
|  | ||||
|   klass = CLUTTER_BACKEND_GET_CLASS (backend); | ||||
|  | ||||
|   if (CLUTTER_IS_EVENT_EXTENDER (backend->device_manager)) | ||||
|     { | ||||
|       iface = CLUTTER_EVENT_EXTENDER_GET_IFACE (backend->device_manager); | ||||
|       iface->free_event_data (CLUTTER_EVENT_EXTENDER (backend->device_manager), | ||||
|                               event); | ||||
|     } | ||||
|   else if (klass->free_event_data != NULL) | ||||
|     klass->free_event_data (backend, event); | ||||
|   device_manager = clutter_device_manager_get_default (); | ||||
|   device_manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager); | ||||
|   device_manager_class->free_event_data (device_manager, event); | ||||
| } | ||||
|  | ||||
| /** | ||||
| @@ -1021,28 +946,6 @@ _clutter_backend_translate_event (ClutterBackend *backend, | ||||
|                                                                event); | ||||
| } | ||||
|  | ||||
| void | ||||
| _clutter_backend_add_event_translator (ClutterBackend         *backend, | ||||
|                                        ClutterEventTranslator *translator) | ||||
| { | ||||
|   if (g_list_find (backend->event_translators, translator) != NULL) | ||||
|     return; | ||||
|  | ||||
|   backend->event_translators = | ||||
|     g_list_prepend (backend->event_translators, translator); | ||||
| } | ||||
|  | ||||
| void | ||||
| _clutter_backend_remove_event_translator (ClutterBackend         *backend, | ||||
|                                           ClutterEventTranslator *translator) | ||||
| { | ||||
|   if (g_list_find (backend->event_translators, translator) == NULL) | ||||
|     return; | ||||
|  | ||||
|   backend->event_translators = | ||||
|     g_list_remove (backend->event_translators, translator); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_backend_get_cogl_context: (skip) | ||||
|  * @backend: a #ClutterBackend | ||||
| @@ -1190,3 +1093,9 @@ clutter_backend_get_keymap (ClutterBackend *backend) | ||||
| { | ||||
|   return CLUTTER_BACKEND_GET_CLASS (backend)->get_keymap (backend); | ||||
| } | ||||
|  | ||||
| ClutterStageWindow * | ||||
| clutter_backend_get_stage_window (ClutterBackend *backend) | ||||
| { | ||||
|   return backend->stage_window; | ||||
| } | ||||
|   | ||||
| @@ -570,6 +570,68 @@ G_DEFINE_BOXED_TYPE_WITH_CODE (ClutterPoint, clutter_point, | ||||
|                                clutter_point_free, | ||||
|                                CLUTTER_REGISTER_INTERVAL_PROGRESS (clutter_point_progress)) | ||||
|  | ||||
| static int | ||||
| clutter_point_compare_line (const ClutterPoint *p, | ||||
|                             const ClutterPoint *a, | ||||
|                             const ClutterPoint *b) | ||||
| { | ||||
|   float x1 = b->x - a->x; | ||||
|   float y1 = b->y - a->y; | ||||
|   float x2 = p->x - a->x; | ||||
|   float y2 = p->y - a->y; | ||||
|   float cross_z = x1 * y2 - y1 * x2; | ||||
|  | ||||
|   if (cross_z > 0.f) | ||||
|     return 1; | ||||
|   else if (cross_z < 0.f) | ||||
|     return -1; | ||||
|   else | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_point_inside_quadrilateral: | ||||
|  * @point: a #ClutterPoint to test | ||||
|  * @vertices: array of vertices of the quadrilateral, in clockwise order, | ||||
|  *            from top-left to bottom-left | ||||
|  * | ||||
|  * Determines whether a point is inside the convex quadrilateral provided, | ||||
|  * and not on any of its edges or vertices. | ||||
|  * | ||||
|  * Returns: %TRUE if @point is inside the quadrilateral | ||||
|  */ | ||||
| gboolean | ||||
| clutter_point_inside_quadrilateral (const ClutterPoint *point, | ||||
|                                     const ClutterPoint *vertices) | ||||
| { | ||||
|   unsigned int i; | ||||
|   int first_side; | ||||
|  | ||||
|   first_side = 0; | ||||
|  | ||||
|   for (i = 0; i < 4; i++) | ||||
|     { | ||||
|       int side; | ||||
|  | ||||
|       side = clutter_point_compare_line (point, | ||||
|                                          &vertices[i], | ||||
|                                          &vertices[(i + 1) % 4]); | ||||
|  | ||||
|       if (side) | ||||
|         { | ||||
|           if (first_side == 0) | ||||
|             first_side = side; | ||||
|           else if (side != first_side) | ||||
|             return FALSE; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   if (first_side == 0) | ||||
|     return FALSE; | ||||
|  | ||||
|   return TRUE; | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| /* | ||||
|   | ||||
| @@ -666,8 +666,7 @@ clutter_click_action_class_init (ClutterClickActionClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (klass), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   G_STRUCT_OFFSET (ClutterClickActionClass, clicked), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__OBJECT, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 1, | ||||
|                   CLUTTER_TYPE_ACTOR); | ||||
|  | ||||
|   | ||||
| @@ -197,8 +197,7 @@ clutter_container_default_init (ClutterContainerInterface *iface) | ||||
|                   iface_type, | ||||
|                   G_SIGNAL_RUN_FIRST, | ||||
|                   G_STRUCT_OFFSET (ClutterContainerIface, actor_added), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__OBJECT, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 1, | ||||
|                   CLUTTER_TYPE_ACTOR); | ||||
|   /** | ||||
| @@ -216,8 +215,7 @@ clutter_container_default_init (ClutterContainerInterface *iface) | ||||
|                   iface_type, | ||||
|                   G_SIGNAL_RUN_FIRST, | ||||
|                   G_STRUCT_OFFSET (ClutterContainerIface, actor_removed), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__OBJECT, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 1, | ||||
|                   CLUTTER_TYPE_ACTOR); | ||||
|  | ||||
|   | ||||
| @@ -129,8 +129,7 @@ clutter_content_default_init (ClutterContentInterface *iface) | ||||
|                   G_TYPE_FROM_INTERFACE (iface), | ||||
|                   G_SIGNAL_RUN_FIRST, | ||||
|                   G_STRUCT_OFFSET (ClutterContentInterface, attached), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__OBJECT, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 1, | ||||
|                   CLUTTER_TYPE_ACTOR); | ||||
|  | ||||
| @@ -149,8 +148,7 @@ clutter_content_default_init (ClutterContentInterface *iface) | ||||
|                   G_TYPE_FROM_INTERFACE (iface), | ||||
|                   G_SIGNAL_RUN_FIRST, | ||||
|                   G_STRUCT_OFFSET (ClutterContentInterface, detached), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__OBJECT, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 1, | ||||
|                   CLUTTER_TYPE_ACTOR); | ||||
| } | ||||
|   | ||||
| @@ -30,7 +30,6 @@ typedef enum | ||||
| typedef enum | ||||
| { | ||||
|   CLUTTER_DEBUG_NOP_PICKING         = 1 << 0, | ||||
|   CLUTTER_DEBUG_DUMP_PICK_BUFFERS   = 1 << 1 | ||||
| } ClutterPickDebugFlag; | ||||
|  | ||||
| typedef enum | ||||
|   | ||||
| @@ -80,6 +80,7 @@ typedef struct _ClutterPtrA11yData | ||||
|   gboolean dwell_drag_started; | ||||
|   gboolean dwell_gesture_started; | ||||
|   guint dwell_timer; | ||||
|   guint dwell_position_timer; | ||||
|  | ||||
|   guint secondary_click_timer; | ||||
|   gboolean secondary_click_triggered; | ||||
| @@ -193,34 +194,15 @@ struct _ClutterInputDeviceClass | ||||
|                                    ClutterEmitInputDeviceEvent emit_event_func); | ||||
| }; | ||||
|  | ||||
| /* Platform-dependent interface */ | ||||
| typedef struct _ClutterEventExtender ClutterEventExtender; | ||||
| typedef struct _ClutterEventExtenderInterface ClutterEventExtenderInterface; | ||||
|  | ||||
| #define CLUTTER_TYPE_EVENT_EXTENDER         (clutter_event_extender_get_type ()) | ||||
| #define CLUTTER_EVENT_EXTENDER(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), CLUTTER_TYPE_EVENT_EXTENDER, ClutterEventExtender)) | ||||
| #define CLUTTER_IS_EVENT_EXTENDER(o)	     (G_TYPE_CHECK_INSTANCE_TYPE ((o), CLUTTER_TYPE_EVENT_EXTENDER)) | ||||
| #define CLUTTER_EVENT_EXTENDER_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), CLUTTER_TYPE_EVENT_EXTENDER, ClutterEventExtenderInterface)) | ||||
|  | ||||
| struct _ClutterEventExtenderInterface | ||||
| { | ||||
|   GTypeInterface g_iface; | ||||
|  | ||||
|   void (* copy_event_data) (ClutterEventExtender *event_extender, | ||||
|                             const ClutterEvent   *src, | ||||
|                             ClutterEvent         *dest); | ||||
|   void (* free_event_data) (ClutterEventExtender *event_extender, | ||||
|                             ClutterEvent         *event); | ||||
| }; | ||||
|  | ||||
| GType           clutter_event_extender_get_type        (void) G_GNUC_CONST; | ||||
|  | ||||
| /* device manager */ | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_device_manager_add_device              (ClutterDeviceManager *device_manager, | ||||
|                                                                  ClutterInputDevice   *device); | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_device_manager_remove_device           (ClutterDeviceManager *device_manager, | ||||
|                                                                  ClutterInputDevice   *device); | ||||
| void            _clutter_device_manager_update_devices          (ClutterDeviceManager *device_manager); | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_device_manager_select_stage_events     (ClutterDeviceManager *device_manager, | ||||
|                                                                  ClutterStage         *stage); | ||||
| ClutterBackend *_clutter_device_manager_get_backend             (ClutterDeviceManager *device_manager); | ||||
| @@ -230,23 +212,31 @@ void            _clutter_device_manager_compress_motion         (ClutterDeviceMa | ||||
|                                                                  const ClutterEvent   *to_discard); | ||||
|  | ||||
| /* input device */ | ||||
| CLUTTER_EXPORT | ||||
| gboolean        _clutter_input_device_has_sequence              (ClutterInputDevice   *device, | ||||
|                                                                  ClutterEventSequence *sequence); | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_input_device_add_event_sequence        (ClutterInputDevice   *device, | ||||
|                                                                  ClutterEvent         *event); | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_input_device_remove_event_sequence     (ClutterInputDevice   *device, | ||||
|                                                                  ClutterEvent         *event); | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_input_device_set_coords                (ClutterInputDevice   *device, | ||||
|                                                                  ClutterEventSequence *sequence, | ||||
|                                                                  gfloat                x, | ||||
|                                                                  gfloat                y, | ||||
|                                                                  ClutterStage         *stage); | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_input_device_set_state                 (ClutterInputDevice   *device, | ||||
|                                                                  ClutterModifierType   state); | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_input_device_set_time                  (ClutterInputDevice   *device, | ||||
|                                                                  guint32               time_); | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_input_device_set_stage                 (ClutterInputDevice   *device, | ||||
|                                                                  ClutterStage         *stage); | ||||
| CLUTTER_EXPORT | ||||
| ClutterStage *  _clutter_input_device_get_stage                 (ClutterInputDevice   *device); | ||||
| void            _clutter_input_device_set_actor                 (ClutterInputDevice   *device, | ||||
|                                                                  ClutterEventSequence *sequence, | ||||
| @@ -255,44 +245,57 @@ void            _clutter_input_device_set_actor                 (ClutterInputDev | ||||
| ClutterActor *  _clutter_input_device_update                    (ClutterInputDevice   *device, | ||||
|                                                                  ClutterEventSequence *sequence, | ||||
|                                                                  gboolean              emit_crossing); | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_input_device_set_n_keys                (ClutterInputDevice   *device, | ||||
|                                                                  guint                 n_keys); | ||||
| CLUTTER_EXPORT | ||||
| guint           _clutter_input_device_add_axis                  (ClutterInputDevice   *device, | ||||
|                                                                  ClutterInputAxis      axis, | ||||
|                                                                  gdouble               min_value, | ||||
|                                                                  gdouble               max_value, | ||||
|                                                                  gdouble               resolution); | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_input_device_reset_axes                (ClutterInputDevice   *device); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_input_device_set_associated_device     (ClutterInputDevice   *device, | ||||
|                                                                  ClutterInputDevice   *associated); | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_input_device_add_slave                 (ClutterInputDevice   *master, | ||||
|                                                                  ClutterInputDevice   *slave); | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_input_device_remove_slave              (ClutterInputDevice   *master, | ||||
|                                                                  ClutterInputDevice   *slave); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| gboolean        _clutter_input_device_translate_axis            (ClutterInputDevice   *device, | ||||
|                                                                  guint                 index_, | ||||
|                                                                  gdouble               value, | ||||
|                                                                  gdouble              *axis_value); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_input_device_add_scroll_info           (ClutterInputDevice   *device, | ||||
|                                                                  guint                 index_, | ||||
|                                                                  ClutterScrollDirection direction, | ||||
|                                                                  gdouble               increment); | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_input_device_reset_scroll_info         (ClutterInputDevice   *device); | ||||
| CLUTTER_EXPORT | ||||
| gboolean        _clutter_input_device_get_scroll_delta          (ClutterInputDevice   *device, | ||||
|                                                                  guint                 index_, | ||||
|                                                                  gdouble               value, | ||||
|                                                                  ClutterScrollDirection *direction_p, | ||||
|                                                                  gdouble                *delta_p); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| ClutterInputDeviceTool * clutter_input_device_lookup_tool       (ClutterInputDevice         *device, | ||||
|                                                                  guint64                     serial, | ||||
|                                                                  ClutterInputDeviceToolType  type); | ||||
| CLUTTER_EXPORT | ||||
| void            clutter_input_device_add_tool                   (ClutterInputDevice     *device, | ||||
|                                                                  ClutterInputDeviceTool *tool); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void            clutter_input_device_update_from_tool           (ClutterInputDevice     *device, | ||||
|                                                                  ClutterInputDeviceTool *tool); | ||||
|  | ||||
|   | ||||
| @@ -91,22 +91,14 @@ G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterDeviceManager, | ||||
|                                      clutter_device_manager, | ||||
|                                      G_TYPE_OBJECT) | ||||
|  | ||||
| G_DEFINE_INTERFACE (ClutterEventExtender, | ||||
|                     clutter_event_extender, | ||||
|                     CLUTTER_TYPE_DEVICE_MANAGER) | ||||
|  | ||||
| static void | ||||
| clutter_event_extender_default_init (ClutterEventExtenderInterface *iface) | ||||
| { | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_device_manager_set_property (GObject      *gobject, | ||||
|                                      guint         prop_id, | ||||
|                                      const GValue *value, | ||||
|                                      GParamSpec   *pspec) | ||||
| { | ||||
|   ClutterDeviceManagerPrivate *priv = CLUTTER_DEVICE_MANAGER (gobject)->priv; | ||||
|   ClutterDeviceManager *self = CLUTTER_DEVICE_MANAGER (gobject); | ||||
|   ClutterDeviceManagerPrivate *priv = clutter_device_manager_get_instance_private (self); | ||||
|  | ||||
|   switch (prop_id) | ||||
|     { | ||||
| @@ -125,7 +117,8 @@ clutter_device_manager_get_property (GObject    *gobject, | ||||
|                                      GValue     *value, | ||||
|                                      GParamSpec *pspec) | ||||
| { | ||||
|   ClutterDeviceManagerPrivate *priv = CLUTTER_DEVICE_MANAGER (gobject)->priv; | ||||
|   ClutterDeviceManager *self = CLUTTER_DEVICE_MANAGER (gobject); | ||||
|   ClutterDeviceManagerPrivate *priv = clutter_device_manager_get_instance_private (self); | ||||
|  | ||||
|   switch (prop_id) | ||||
|     { | ||||
| @@ -171,8 +164,7 @@ clutter_device_manager_class_init (ClutterDeviceManagerClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (klass), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   0, | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__OBJECT, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 1, | ||||
|                   CLUTTER_TYPE_INPUT_DEVICE); | ||||
|  | ||||
| @@ -191,8 +183,7 @@ clutter_device_manager_class_init (ClutterDeviceManagerClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (klass), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   0, | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__OBJECT, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 1, | ||||
|                   CLUTTER_TYPE_INPUT_DEVICE); | ||||
|  | ||||
| @@ -291,6 +282,7 @@ clutter_device_manager_class_init (ClutterDeviceManagerClass *klass) | ||||
|    * @manager: the #ClutterDeviceManager that emitted the signal | ||||
|    * @device: the core pointer #ClutterInputDevice | ||||
|    * @timeout_type: the type of timeout #ClutterPointerA11yTimeoutType | ||||
|    * @clicked: %TRUE if the timeout finished and triggered a click | ||||
|    * | ||||
|    * The ::ptr-a11y-timeout-stopped signal is emitted when a running | ||||
|    * pointer accessibility timeout delay is stopped, either because | ||||
| @@ -302,16 +294,16 @@ clutter_device_manager_class_init (ClutterDeviceManagerClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (klass), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   0, NULL, NULL, | ||||
|                   _clutter_marshal_VOID__OBJECT_FLAGS, | ||||
|                   G_TYPE_NONE, 2, | ||||
|                   _clutter_marshal_VOID__OBJECT_FLAGS_BOOLEAN, | ||||
|                   G_TYPE_NONE, 3, | ||||
|                   CLUTTER_TYPE_INPUT_DEVICE, | ||||
|                   CLUTTER_TYPE_POINTER_A11Y_TIMEOUT_TYPE); | ||||
|                   CLUTTER_TYPE_POINTER_A11Y_TIMEOUT_TYPE, | ||||
|                   G_TYPE_BOOLEAN); | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_device_manager_init (ClutterDeviceManager *self) | ||||
| { | ||||
|   self->priv = clutter_device_manager_get_instance_private (self); | ||||
| } | ||||
|  | ||||
| /** | ||||
| @@ -330,7 +322,7 @@ clutter_device_manager_get_default (void) | ||||
| { | ||||
|   ClutterBackend *backend = clutter_get_default_backend (); | ||||
|  | ||||
|   return backend->device_manager; | ||||
|   return CLUTTER_BACKEND_GET_CLASS (backend)->get_device_manager (backend); | ||||
| } | ||||
|  | ||||
| /** | ||||
| @@ -554,9 +546,11 @@ _clutter_device_manager_update_devices (ClutterDeviceManager *device_manager) | ||||
| ClutterBackend * | ||||
| _clutter_device_manager_get_backend (ClutterDeviceManager *manager) | ||||
| { | ||||
|   ClutterDeviceManagerPrivate *priv = clutter_device_manager_get_instance_private (manager); | ||||
|  | ||||
|   g_return_val_if_fail (CLUTTER_IS_DEVICE_MANAGER (manager), NULL); | ||||
|  | ||||
|   return manager->priv->backend; | ||||
|   return priv->backend; | ||||
| } | ||||
|  | ||||
| /** | ||||
| @@ -625,13 +619,14 @@ clutter_device_manager_set_kbd_a11y_settings (ClutterDeviceManager   *device_man | ||||
|                                               ClutterKbdA11ySettings *settings) | ||||
| { | ||||
|   ClutterDeviceManagerClass *manager_class; | ||||
|   ClutterDeviceManagerPrivate *priv = clutter_device_manager_get_instance_private (device_manager); | ||||
|  | ||||
|   g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager)); | ||||
|  | ||||
|   if (are_kbd_a11y_settings_equal (&device_manager->priv->kbd_a11y_settings, settings)) | ||||
|   if (are_kbd_a11y_settings_equal (&priv->kbd_a11y_settings, settings)) | ||||
|     return; | ||||
|  | ||||
|   device_manager->priv->kbd_a11y_settings = *settings; | ||||
|   priv->kbd_a11y_settings = *settings; | ||||
|  | ||||
|   manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager); | ||||
|   if (manager_class->apply_kbd_a11y_settings) | ||||
| @@ -642,9 +637,11 @@ void | ||||
| clutter_device_manager_get_kbd_a11y_settings (ClutterDeviceManager   *device_manager, | ||||
|                                               ClutterKbdA11ySettings *settings) | ||||
| { | ||||
|   ClutterDeviceManagerPrivate *priv = clutter_device_manager_get_instance_private (device_manager); | ||||
|  | ||||
|   g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager)); | ||||
|  | ||||
|   *settings = device_manager->priv->kbd_a11y_settings; | ||||
|   *settings = priv->kbd_a11y_settings; | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| @@ -687,17 +684,20 @@ void | ||||
| clutter_device_manager_set_pointer_a11y_settings (ClutterDeviceManager       *device_manager, | ||||
|                                                   ClutterPointerA11ySettings *settings) | ||||
| { | ||||
|   ClutterDeviceManagerPrivate *priv = | ||||
|     clutter_device_manager_get_instance_private (device_manager); | ||||
|  | ||||
|   g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager)); | ||||
|  | ||||
|   if (are_pointer_a11y_settings_equal (&device_manager->priv->pointer_a11y_settings, settings)) | ||||
|   if (are_pointer_a11y_settings_equal (&priv->pointer_a11y_settings, settings)) | ||||
|     return; | ||||
|  | ||||
|   if (device_manager->priv->pointer_a11y_settings.controls == 0 && settings->controls != 0) | ||||
|   if (priv->pointer_a11y_settings.controls == 0 && settings->controls != 0) | ||||
|     clutter_device_manager_enable_pointer_a11y (device_manager); | ||||
|   else if (device_manager->priv->pointer_a11y_settings.controls != 0 && settings->controls == 0) | ||||
|   else if (priv->pointer_a11y_settings.controls != 0 && settings->controls == 0) | ||||
|     clutter_device_manager_disable_pointer_a11y (device_manager); | ||||
|  | ||||
|   device_manager->priv->pointer_a11y_settings = *settings; | ||||
|   priv->pointer_a11y_settings = *settings; | ||||
| } | ||||
|  | ||||
| /** | ||||
| @@ -711,9 +711,12 @@ void | ||||
| clutter_device_manager_get_pointer_a11y_settings (ClutterDeviceManager       *device_manager, | ||||
|                                                   ClutterPointerA11ySettings *settings) | ||||
| { | ||||
|   ClutterDeviceManagerPrivate *priv = | ||||
|     clutter_device_manager_get_instance_private (device_manager); | ||||
|  | ||||
|   g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager)); | ||||
|  | ||||
|   *settings = device_manager->priv->pointer_a11y_settings; | ||||
|   *settings = priv->pointer_a11y_settings; | ||||
| } | ||||
|  | ||||
| /** | ||||
| @@ -727,7 +730,10 @@ void | ||||
| clutter_device_manager_set_pointer_a11y_dwell_click_type (ClutterDeviceManager             *device_manager, | ||||
|                                                           ClutterPointerA11yDwellClickType  click_type) | ||||
| { | ||||
|   ClutterDeviceManagerPrivate *priv = | ||||
|     clutter_device_manager_get_instance_private (device_manager); | ||||
|  | ||||
|   g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager)); | ||||
|  | ||||
|   device_manager->priv->pointer_a11y_settings.dwell_click_type = click_type; | ||||
|   priv->pointer_a11y_settings.dwell_click_type = click_type; | ||||
| } | ||||
|   | ||||
| @@ -33,16 +33,12 @@ | ||||
|  | ||||
| G_BEGIN_DECLS | ||||
|  | ||||
| #define CLUTTER_TYPE_DEVICE_MANAGER             (clutter_device_manager_get_type ()) | ||||
| #define CLUTTER_DEVICE_MANAGER(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_DEVICE_MANAGER, ClutterDeviceManager)) | ||||
| #define CLUTTER_IS_DEVICE_MANAGER(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_DEVICE_MANAGER)) | ||||
| #define CLUTTER_DEVICE_MANAGER_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_DEVICE_MANAGER, ClutterDeviceManagerClass)) | ||||
| #define CLUTTER_IS_DEVICE_MANAGER_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_DEVICE_MANAGER)) | ||||
| #define CLUTTER_DEVICE_MANAGER_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_DEVICE_MANAGER, ClutterDeviceManagerClass)) | ||||
| #define CLUTTER_TYPE_DEVICE_MANAGER (clutter_device_manager_get_type ()) | ||||
| CLUTTER_EXPORT | ||||
| G_DECLARE_DERIVABLE_TYPE (ClutterDeviceManager, clutter_device_manager, | ||||
|                           CLUTTER, DEVICE_MANAGER, GObject) | ||||
|  | ||||
| typedef struct _ClutterDeviceManager            ClutterDeviceManager; | ||||
| typedef struct _ClutterDeviceManagerPrivate     ClutterDeviceManagerPrivate; | ||||
| typedef struct _ClutterDeviceManagerClass       ClutterDeviceManagerClass; | ||||
|  | ||||
| /** | ||||
|  * ClutterVirtualDeviceType: | ||||
| @@ -94,21 +90,6 @@ typedef struct _ClutterPointerA11ySettings | ||||
|   gint dwell_threshold; | ||||
| } ClutterPointerA11ySettings; | ||||
|  | ||||
| /** | ||||
|  * ClutterDeviceManager: | ||||
|  * | ||||
|  * The #ClutterDeviceManager structure contains only private data | ||||
|  * | ||||
|  * Since: 1.2 | ||||
|  */ | ||||
| struct _ClutterDeviceManager | ||||
| { | ||||
|   /*< private >*/ | ||||
|   GObject parent_instance; | ||||
|  | ||||
|   ClutterDeviceManagerPrivate *priv; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * ClutterDeviceManagerClass: | ||||
|  * | ||||
| @@ -142,12 +123,17 @@ struct _ClutterDeviceManagerClass | ||||
|   /* Keyboard accessbility */ | ||||
|   void                (* apply_kbd_a11y_settings) (ClutterDeviceManager   *device_manger, | ||||
|                                                    ClutterKbdA11ySettings *settings); | ||||
|   /* padding */ | ||||
|   gpointer _padding[6]; | ||||
| }; | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| GType clutter_device_manager_get_type (void) G_GNUC_CONST; | ||||
|   /* Event platform data */ | ||||
|   void (* copy_event_data) (ClutterDeviceManager *device_manager, | ||||
|                             const ClutterEvent   *src, | ||||
|                             ClutterEvent         *dest); | ||||
|   void (* free_event_data) (ClutterDeviceManager *device_manager, | ||||
|                             ClutterEvent         *event); | ||||
|  | ||||
|   /* padding */ | ||||
|   gpointer _padding[4]; | ||||
| }; | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| ClutterDeviceManager *clutter_device_manager_get_default     (void); | ||||
|   | ||||
| @@ -428,8 +428,7 @@ clutter_drop_action_class_init (ClutterDropActionClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (klass), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   G_STRUCT_OFFSET (ClutterDropActionClass, over_in), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__OBJECT, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 1, | ||||
|                   CLUTTER_TYPE_ACTOR); | ||||
|  | ||||
| @@ -448,8 +447,7 @@ clutter_drop_action_class_init (ClutterDropActionClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (klass), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   G_STRUCT_OFFSET (ClutterDropActionClass, over_out), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__OBJECT, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 1, | ||||
|                   CLUTTER_TYPE_ACTOR); | ||||
|  | ||||
|   | ||||
| @@ -5,22 +5,28 @@ | ||||
|  | ||||
| G_BEGIN_DECLS | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_event_set_pointer_emulated     (ClutterEvent       *event, | ||||
|                                                          gboolean            is_emulated); | ||||
|  | ||||
| /* Reinjecting queued events for processing */ | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_process_event                  (ClutterEvent       *event); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| gboolean        _clutter_event_process_filters          (ClutterEvent       *event); | ||||
|  | ||||
| /* clears the event queue inside the main context */ | ||||
| void            _clutter_clear_events_queue             (void); | ||||
| void            _clutter_clear_events_queue_for_stage   (ClutterStage       *stage); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_event_set_platform_data        (ClutterEvent       *event, | ||||
|                                                          gpointer            data); | ||||
| CLUTTER_EXPORT | ||||
| gpointer        _clutter_event_get_platform_data        (const ClutterEvent *event); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_event_set_state_full           (ClutterEvent        *event, | ||||
| 							 ClutterModifierType  button_state, | ||||
| 							 ClutterModifierType  base_state, | ||||
| @@ -28,6 +34,7 @@ void            _clutter_event_set_state_full           (ClutterEvent        *ev | ||||
| 							 ClutterModifierType  locked_state, | ||||
| 							 ClutterModifierType  effective_state); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_event_push                     (const ClutterEvent *event, | ||||
|                                                          gboolean            do_copy); | ||||
|  | ||||
|   | ||||
| @@ -1,38 +0,0 @@ | ||||
| #include "clutter-build-config.h" | ||||
|  | ||||
| #include "clutter-event-translator.h" | ||||
|  | ||||
| #include "clutter-backend.h" | ||||
| #include "clutter-private.h" | ||||
|  | ||||
| #define clutter_event_translator_get_type       _clutter_event_translator_get_type | ||||
|  | ||||
| typedef ClutterEventTranslatorIface     ClutterEventTranslatorInterface; | ||||
|  | ||||
| G_DEFINE_INTERFACE (ClutterEventTranslator, clutter_event_translator, G_TYPE_OBJECT); | ||||
|  | ||||
| static ClutterTranslateReturn | ||||
| default_translate_event (ClutterEventTranslator *translator, | ||||
|                          gpointer                native, | ||||
|                          ClutterEvent           *event) | ||||
| { | ||||
|   return CLUTTER_TRANSLATE_CONTINUE; | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_event_translator_default_init (ClutterEventTranslatorIface *iface) | ||||
| { | ||||
|   iface->translate_event = default_translate_event; | ||||
| } | ||||
|  | ||||
| ClutterTranslateReturn | ||||
| _clutter_event_translator_translate_event (ClutterEventTranslator *translator, | ||||
|                                            gpointer                native, | ||||
|                                            ClutterEvent           *translated) | ||||
| { | ||||
|   ClutterEventTranslatorIface *iface; | ||||
|  | ||||
|   iface = CLUTTER_EVENT_TRANSLATOR_GET_IFACE (translator); | ||||
|  | ||||
|   return iface->translate_event (translator, native, translated); | ||||
| } | ||||
| @@ -1,42 +0,0 @@ | ||||
| #ifndef __CLUTTER_EVENT_TRANSLATOR_H__ | ||||
| #define __CLUTTER_EVENT_TRANSLATOR_H__ | ||||
|  | ||||
| #include <glib-object.h> | ||||
| #include <clutter/clutter-event.h> | ||||
|  | ||||
| G_BEGIN_DECLS | ||||
|  | ||||
| #define CLUTTER_TYPE_EVENT_TRANSLATOR           (_clutter_event_translator_get_type ()) | ||||
| #define CLUTTER_EVENT_TRANSLATOR(obj)           (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_EVENT_TRANSLATOR, ClutterEventTranslator)) | ||||
| #define CLUTTER_IS_EVENT_TRANSLATOR(obj)        (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_EVENT_TRANSLATOR)) | ||||
| #define CLUTTER_EVENT_TRANSLATOR_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CLUTTER_TYPE_EVENT_TRANSLATOR, ClutterEventTranslatorIface)) | ||||
|  | ||||
| typedef struct _ClutterEventTranslator          ClutterEventTranslator; | ||||
| typedef struct _ClutterEventTranslatorIface     ClutterEventTranslatorIface; | ||||
|  | ||||
| typedef enum | ||||
| { | ||||
|   CLUTTER_TRANSLATE_CONTINUE, | ||||
|   CLUTTER_TRANSLATE_REMOVE, | ||||
|   CLUTTER_TRANSLATE_QUEUE | ||||
| } ClutterTranslateReturn; | ||||
|  | ||||
| struct _ClutterEventTranslatorIface | ||||
| { | ||||
|   GTypeInterface g_iface; | ||||
|  | ||||
|   ClutterTranslateReturn (* translate_event) (ClutterEventTranslator *translator, | ||||
|                                               gpointer                native, | ||||
|                                               ClutterEvent           *translated); | ||||
| }; | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| GType _clutter_event_translator_get_type (void) G_GNUC_CONST; | ||||
|  | ||||
| ClutterTranslateReturn _clutter_event_translator_translate_event (ClutterEventTranslator *translator, | ||||
|                                                                   gpointer                native, | ||||
|                                                                   ClutterEvent           *translated); | ||||
|  | ||||
| G_END_DECLS | ||||
|  | ||||
| #endif /* __CLUTTER_EVENT_TRANSLATOR_H__ */ | ||||
| @@ -804,8 +804,7 @@ clutter_gesture_action_class_init (ClutterGestureActionClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (klass), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   G_STRUCT_OFFSET (ClutterGestureActionClass, gesture_end), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__OBJECT, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 1, | ||||
|                   CLUTTER_TYPE_ACTOR); | ||||
|  | ||||
| @@ -827,8 +826,7 @@ clutter_gesture_action_class_init (ClutterGestureActionClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (klass), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   G_STRUCT_OFFSET (ClutterGestureActionClass, gesture_cancel), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__OBJECT, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 1, | ||||
|                   CLUTTER_TYPE_ACTOR); | ||||
| } | ||||
|   | ||||
| @@ -256,7 +256,7 @@ clutter_image_set_data (ClutterImage     *image, | ||||
|     { | ||||
|       g_set_error_literal (error, CLUTTER_IMAGE_ERROR, | ||||
|                            CLUTTER_IMAGE_ERROR_INVALID_DATA, | ||||
|                            _("Unable to load image data")); | ||||
|                            "Unable to load image data"); | ||||
|       return FALSE; | ||||
|     } | ||||
|  | ||||
| @@ -325,7 +325,7 @@ clutter_image_set_bytes (ClutterImage     *image, | ||||
|     { | ||||
|       g_set_error_literal (error, CLUTTER_IMAGE_ERROR, | ||||
|                            CLUTTER_IMAGE_ERROR_INVALID_DATA, | ||||
|                            _("Unable to load image data")); | ||||
|                            "Unable to load image data"); | ||||
|       return FALSE; | ||||
|     } | ||||
|  | ||||
| @@ -419,7 +419,7 @@ clutter_image_set_area (ClutterImage                 *image, | ||||
|     { | ||||
|       g_set_error_literal (error, CLUTTER_IMAGE_ERROR, | ||||
|                            CLUTTER_IMAGE_ERROR_INVALID_DATA, | ||||
|                            _("Unable to load image data")); | ||||
|                            "Unable to load image data"); | ||||
|       return FALSE; | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -1925,6 +1925,157 @@ _clutter_input_device_reset_scroll_info (ClutterInputDevice *device) | ||||
|     } | ||||
| } | ||||
|  | ||||
| static void | ||||
| on_grab_actor_destroy (ClutterActor       *actor, | ||||
|                        ClutterInputDevice *device) | ||||
| { | ||||
|   switch (device->device_type) | ||||
|     { | ||||
|     case CLUTTER_POINTER_DEVICE: | ||||
|     case CLUTTER_TABLET_DEVICE: | ||||
|       device->pointer_grab_actor = NULL; | ||||
|       break; | ||||
|  | ||||
|     case CLUTTER_KEYBOARD_DEVICE: | ||||
|       device->keyboard_grab_actor = NULL; | ||||
|       break; | ||||
|  | ||||
|     default: | ||||
|       g_assert_not_reached (); | ||||
|     } | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_input_device_grab: | ||||
|  * @device: a #ClutterInputDevice | ||||
|  * @actor: a #ClutterActor | ||||
|  * | ||||
|  * Acquires a grab on @actor for the given @device. | ||||
|  * | ||||
|  * Any event coming from @device will be delivered to @actor, bypassing | ||||
|  * the usual event delivery mechanism, until the grab is released by | ||||
|  * calling clutter_input_device_ungrab(). | ||||
|  * | ||||
|  * The grab is client-side: even if the windowing system used by the Clutter | ||||
|  * backend has the concept of "device grabs", Clutter will not use them. | ||||
|  * | ||||
|  * Only #ClutterInputDevice of types %CLUTTER_POINTER_DEVICE, | ||||
|  * %CLUTTER_TABLET_DEVICE and %CLUTTER_KEYBOARD_DEVICE can hold a grab. | ||||
|  * | ||||
|  * Since: 1.10 | ||||
|  */ | ||||
| void | ||||
| clutter_input_device_grab (ClutterInputDevice *device, | ||||
|                            ClutterActor       *actor) | ||||
| { | ||||
|   ClutterActor **grab_actor; | ||||
|  | ||||
|   g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device)); | ||||
|   g_return_if_fail (CLUTTER_IS_ACTOR (actor)); | ||||
|  | ||||
|   switch (device->device_type) | ||||
|     { | ||||
|     case CLUTTER_POINTER_DEVICE: | ||||
|     case CLUTTER_TABLET_DEVICE: | ||||
|       grab_actor = &device->pointer_grab_actor; | ||||
|       break; | ||||
|  | ||||
|     case CLUTTER_KEYBOARD_DEVICE: | ||||
|       grab_actor = &device->keyboard_grab_actor; | ||||
|       break; | ||||
|  | ||||
|     default: | ||||
|       g_critical ("Only pointer and keyboard devices can grab an actor"); | ||||
|       return; | ||||
|     } | ||||
|  | ||||
|   if (*grab_actor != NULL) | ||||
|     { | ||||
|       g_signal_handlers_disconnect_by_func (*grab_actor, | ||||
|                                             G_CALLBACK (on_grab_actor_destroy), | ||||
|                                             device); | ||||
|     } | ||||
|  | ||||
|   *grab_actor = actor; | ||||
|  | ||||
|   g_signal_connect (*grab_actor, | ||||
|                     "destroy", | ||||
|                     G_CALLBACK (on_grab_actor_destroy), | ||||
|                     device); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_input_device_ungrab: | ||||
|  * @device: a #ClutterInputDevice | ||||
|  * | ||||
|  * Releases the grab on the @device, if one is in place. | ||||
|  * | ||||
|  * Since: 1.10 | ||||
|  */ | ||||
| void | ||||
| clutter_input_device_ungrab (ClutterInputDevice *device) | ||||
| { | ||||
|   ClutterActor **grab_actor; | ||||
|  | ||||
|   g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device)); | ||||
|  | ||||
|   switch (device->device_type) | ||||
|     { | ||||
|     case CLUTTER_POINTER_DEVICE: | ||||
|     case CLUTTER_TABLET_DEVICE: | ||||
|       grab_actor = &device->pointer_grab_actor; | ||||
|       break; | ||||
|  | ||||
|     case CLUTTER_KEYBOARD_DEVICE: | ||||
|       grab_actor = &device->keyboard_grab_actor; | ||||
|       break; | ||||
|  | ||||
|     default: | ||||
|       return; | ||||
|     } | ||||
|  | ||||
|   if (*grab_actor == NULL) | ||||
|     return; | ||||
|  | ||||
|   g_signal_handlers_disconnect_by_func (*grab_actor, | ||||
|                                         G_CALLBACK (on_grab_actor_destroy), | ||||
|                                         device); | ||||
|  | ||||
|   *grab_actor = NULL; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_input_device_get_grabbed_actor: | ||||
|  * @device: a #ClutterInputDevice | ||||
|  * | ||||
|  * Retrieves a pointer to the #ClutterActor currently grabbing all | ||||
|  * the events coming from @device. | ||||
|  * | ||||
|  * Return value: (transfer none): a #ClutterActor, or %NULL | ||||
|  * | ||||
|  * Since: 1.10 | ||||
|  */ | ||||
| ClutterActor * | ||||
| clutter_input_device_get_grabbed_actor (ClutterInputDevice *device) | ||||
| { | ||||
|   g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), NULL); | ||||
|  | ||||
|   switch (device->device_type) | ||||
|     { | ||||
|     case CLUTTER_POINTER_DEVICE: | ||||
|     case CLUTTER_TABLET_DEVICE: | ||||
|       return device->pointer_grab_actor; | ||||
|  | ||||
|     case CLUTTER_KEYBOARD_DEVICE: | ||||
|       return device->keyboard_grab_actor; | ||||
|  | ||||
|     default: | ||||
|       g_critical ("Only pointer and keyboard devices can grab an actor"); | ||||
|     } | ||||
|  | ||||
|   return NULL; | ||||
| } | ||||
|  | ||||
| static void | ||||
| on_grab_sequence_actor_destroy (ClutterActor       *actor, | ||||
|                                 ClutterInputDevice *device) | ||||
|   | ||||
| @@ -27,14 +27,19 @@ | ||||
|  | ||||
| G_BEGIN_DECLS | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void _clutter_input_pointer_a11y_add_device      (ClutterInputDevice   *device); | ||||
| CLUTTER_EXPORT | ||||
| void _clutter_input_pointer_a11y_remove_device   (ClutterInputDevice   *device); | ||||
| CLUTTER_EXPORT | ||||
| void _clutter_input_pointer_a11y_on_motion_event (ClutterInputDevice   *device, | ||||
|                                                   float                 x, | ||||
|                                                   float                 y); | ||||
| CLUTTER_EXPORT | ||||
| void _clutter_input_pointer_a11y_on_button_event (ClutterInputDevice   *device, | ||||
|                                                   int                   button, | ||||
|                                                   gboolean              pressed); | ||||
| CLUTTER_EXPORT | ||||
| gboolean _clutter_is_input_pointer_a11y_enabled  (ClutterInputDevice     *device); | ||||
|  | ||||
| G_END_DECLS | ||||
|   | ||||
| @@ -99,7 +99,7 @@ get_dwell_click_type (ClutterInputDevice *device) | ||||
|   ClutterPointerA11ySettings settings; | ||||
|  | ||||
|   clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings); | ||||
| # | ||||
|  | ||||
|   return settings.dwell_click_type; | ||||
| } | ||||
|  | ||||
| @@ -171,7 +171,8 @@ trigger_secondary_click (gpointer data) | ||||
|   g_signal_emit_by_name (device->device_manager, | ||||
|                          "ptr-a11y-timeout-stopped", | ||||
|                          device, | ||||
|                          CLUTTER_A11Y_TIMEOUT_TYPE_SECONDARY_CLICK); | ||||
|                          CLUTTER_A11Y_TIMEOUT_TYPE_SECONDARY_CLICK, | ||||
|                          TRUE); | ||||
|  | ||||
|   return G_SOURCE_REMOVE; | ||||
| } | ||||
| @@ -202,7 +203,8 @@ stop_secondary_click_timeout (ClutterInputDevice *device) | ||||
|       g_signal_emit_by_name (device->device_manager, | ||||
|                              "ptr-a11y-timeout-stopped", | ||||
|                              device, | ||||
|                              CLUTTER_A11Y_TIMEOUT_TYPE_SECONDARY_CLICK); | ||||
|                              CLUTTER_A11Y_TIMEOUT_TYPE_SECONDARY_CLICK, | ||||
|                              FALSE); | ||||
|     } | ||||
|   device->ptr_a11y_data->secondary_click_triggered = FALSE; | ||||
| } | ||||
| @@ -438,7 +440,8 @@ trigger_dwell_gesture (gpointer data) | ||||
|   g_signal_emit_by_name (device->device_manager, | ||||
|                          "ptr-a11y-timeout-stopped", | ||||
|                          device, | ||||
|                          CLUTTER_A11Y_TIMEOUT_TYPE_GESTURE); | ||||
|                          CLUTTER_A11Y_TIMEOUT_TYPE_GESTURE, | ||||
|                          TRUE); | ||||
|  | ||||
|   return G_SOURCE_REMOVE; | ||||
| } | ||||
| @@ -469,7 +472,8 @@ trigger_dwell_click (gpointer data) | ||||
|   g_signal_emit_by_name (device->device_manager, | ||||
|                          "ptr-a11y-timeout-stopped", | ||||
|                          device, | ||||
|                          CLUTTER_A11Y_TIMEOUT_TYPE_DWELL); | ||||
|                          CLUTTER_A11Y_TIMEOUT_TYPE_DWELL, | ||||
|                          TRUE); | ||||
|  | ||||
|   if (get_dwell_mode (device) == CLUTTER_A11Y_DWELL_MODE_GESTURE) | ||||
|     { | ||||
| @@ -514,10 +518,41 @@ stop_dwell_timeout (ClutterInputDevice *device) | ||||
|       g_signal_emit_by_name (device->device_manager, | ||||
|                              "ptr-a11y-timeout-stopped", | ||||
|                              device, | ||||
|                              CLUTTER_A11Y_TIMEOUT_TYPE_DWELL); | ||||
|                              CLUTTER_A11Y_TIMEOUT_TYPE_DWELL, | ||||
|                              FALSE); | ||||
|     } | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| trigger_dwell_position_timeout (gpointer data) | ||||
| { | ||||
|   ClutterInputDevice *device = data; | ||||
|  | ||||
|   device->ptr_a11y_data->dwell_position_timer = 0; | ||||
|  | ||||
|   if (is_dwell_click_enabled (device)) | ||||
|     { | ||||
|       if (!pointer_has_moved (device)) | ||||
|         start_dwell_timeout (device); | ||||
|     } | ||||
|  | ||||
|   return G_SOURCE_REMOVE; | ||||
| } | ||||
|  | ||||
| static void | ||||
| start_dwell_position_timeout (ClutterInputDevice *device) | ||||
| { | ||||
|   device->ptr_a11y_data->dwell_position_timer = | ||||
|     clutter_threads_add_timeout (100, trigger_dwell_position_timeout, device); | ||||
| } | ||||
|  | ||||
| static void | ||||
| stop_dwell_position_timeout (ClutterInputDevice *device) | ||||
| { | ||||
|   g_clear_handle_id (&device->ptr_a11y_data->dwell_position_timer, | ||||
|                      g_source_remove); | ||||
| } | ||||
|  | ||||
| static void | ||||
| update_dwell_position (ClutterInputDevice *device) | ||||
| { | ||||
| @@ -570,6 +605,7 @@ _clutter_input_pointer_a11y_remove_device (ClutterInputDevice *device) | ||||
|   if (is_dwell_dragging (device)) | ||||
|     emit_dwell_click (device, CLUTTER_A11Y_DWELL_CLICK_TYPE_DRAG); | ||||
|  | ||||
|   stop_dwell_position_timeout (device); | ||||
|   stop_dwell_timeout (device); | ||||
|   stop_secondary_click_timeout (device); | ||||
|  | ||||
| @@ -597,10 +633,13 @@ _clutter_input_pointer_a11y_on_motion_event (ClutterInputDevice *device, | ||||
|  | ||||
|   if (is_dwell_click_enabled (device)) | ||||
|     { | ||||
|       stop_dwell_position_timeout (device); | ||||
|  | ||||
|       if (should_stop_dwell (device)) | ||||
|         stop_dwell_timeout (device); | ||||
|       else if (should_start_dwell (device)) | ||||
|         start_dwell_timeout (device); | ||||
|  | ||||
|       if (should_start_dwell (device)) | ||||
|         start_dwell_position_timeout (device); | ||||
|     } | ||||
|  | ||||
|   if (should_update_dwell_position (device)) | ||||
| @@ -622,6 +661,8 @@ _clutter_input_pointer_a11y_on_button_event (ClutterInputDevice *device, | ||||
|     { | ||||
|       device->ptr_a11y_data->n_btn_pressed++; | ||||
|  | ||||
|       stop_dwell_position_timeout (device); | ||||
|  | ||||
|       if (is_dwell_click_enabled (device)) | ||||
|         stop_dwell_timeout (device); | ||||
|  | ||||
|   | ||||
| @@ -444,8 +444,7 @@ clutter_layout_manager_class_init (ClutterLayoutManagerClass *klass) | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   G_STRUCT_OFFSET (ClutterLayoutManagerClass, | ||||
|                                    layout_changed), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__VOID, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 0); | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -129,7 +129,6 @@ static const GDebugKey clutter_debug_keys[] = { | ||||
|  | ||||
| static const GDebugKey clutter_pick_debug_keys[] = { | ||||
|   { "nop-picking", CLUTTER_DEBUG_NOP_PICKING }, | ||||
|   { "dump-pick-buffers", CLUTTER_DEBUG_DUMP_PICK_BUFFERS }, | ||||
| }; | ||||
|  | ||||
| static const GDebugKey clutter_paint_debug_keys[] = { | ||||
| @@ -401,125 +400,6 @@ clutter_disable_accessibility (void) | ||||
|   clutter_enable_accessibility = FALSE; | ||||
| } | ||||
|  | ||||
| void | ||||
| _clutter_id_to_color (guint         id_, | ||||
|                       ClutterColor *col) | ||||
| { | ||||
|   ClutterMainContext *ctx; | ||||
|   gint red, green, blue; | ||||
|  | ||||
|   ctx = _clutter_context_get_default (); | ||||
|  | ||||
|   if (ctx->fb_g_mask == 0) | ||||
|     { | ||||
|       /* Figure out framebuffer masks used for pick */ | ||||
|       cogl_get_bitmasks (&ctx->fb_r_mask, | ||||
| 			 &ctx->fb_g_mask, | ||||
| 			 &ctx->fb_b_mask, NULL); | ||||
|  | ||||
|       ctx->fb_r_mask_used = ctx->fb_r_mask; | ||||
|       ctx->fb_g_mask_used = ctx->fb_g_mask; | ||||
|       ctx->fb_b_mask_used = ctx->fb_b_mask; | ||||
|  | ||||
|       /* XXX - describe what "fuzzy picking" is */ | ||||
|       if (clutter_use_fuzzy_picking) | ||||
| 	{ | ||||
| 	  ctx->fb_r_mask_used--; | ||||
| 	  ctx->fb_g_mask_used--; | ||||
| 	  ctx->fb_b_mask_used--; | ||||
| 	} | ||||
|     } | ||||
|  | ||||
|   /* compute the numbers we'll store in the components */ | ||||
|   red   = (id_ >> (ctx->fb_g_mask_used+ctx->fb_b_mask_used)) | ||||
|         & (0xff >> (8-ctx->fb_r_mask_used)); | ||||
|   green = (id_ >> ctx->fb_b_mask_used) | ||||
|         & (0xff >> (8-ctx->fb_g_mask_used)); | ||||
|   blue  = (id_) | ||||
|         & (0xff >> (8-ctx->fb_b_mask_used)); | ||||
|  | ||||
|   /* shift left bits a bit and add one, this circumvents | ||||
|    * at least some potential rounding errors in GL/GLES | ||||
|    * driver / hw implementation. | ||||
|    */ | ||||
|   if (ctx->fb_r_mask_used != ctx->fb_r_mask) | ||||
|     red = red * 2; | ||||
|   if (ctx->fb_g_mask_used != ctx->fb_g_mask) | ||||
|     green = green * 2; | ||||
|   if (ctx->fb_b_mask_used != ctx->fb_b_mask) | ||||
|     blue  = blue  * 2; | ||||
|  | ||||
|   /* shift up to be full 8bit values */ | ||||
|   red   = (red   << (8 - ctx->fb_r_mask)) | (0x7f >> (ctx->fb_r_mask_used)); | ||||
|   green = (green << (8 - ctx->fb_g_mask)) | (0x7f >> (ctx->fb_g_mask_used)); | ||||
|   blue  = (blue  << (8 - ctx->fb_b_mask)) | (0x7f >> (ctx->fb_b_mask_used)); | ||||
|  | ||||
|   col->red   = red; | ||||
|   col->green = green; | ||||
|   col->blue  = blue; | ||||
|   col->alpha = 0xff; | ||||
|  | ||||
|   /* XXX: We rotate the nibbles of the colors here so that there is a | ||||
|    * visible variation between colors of sequential actor identifiers; | ||||
|    * otherwise pick buffers dumped to an image will pretty much just look | ||||
|    * black. | ||||
|    */ | ||||
|   if (G_UNLIKELY (clutter_pick_debug_flags & CLUTTER_DEBUG_DUMP_PICK_BUFFERS)) | ||||
|     { | ||||
|       col->red   = (col->red << 4)   | (col->red >> 4); | ||||
|       col->green = (col->green << 4) | (col->green >> 4); | ||||
|       col->blue  = (col->blue << 4)  | (col->blue >> 4); | ||||
|     } | ||||
| } | ||||
|  | ||||
| guint | ||||
| _clutter_pixel_to_id (guchar pixel[4]) | ||||
| { | ||||
|   ClutterMainContext *ctx; | ||||
|   gint red, green, blue; | ||||
|   guint retval; | ||||
|  | ||||
|   ctx = _clutter_context_get_default (); | ||||
|  | ||||
|   /* reduce the pixel components to the number of bits actually used of the | ||||
|    * 8bits. | ||||
|    */ | ||||
|   if (G_UNLIKELY (clutter_pick_debug_flags & CLUTTER_DEBUG_DUMP_PICK_BUFFERS)) | ||||
|     { | ||||
|       guchar tmp; | ||||
|  | ||||
|       /* XXX: In _clutter_id_to_color we rotated the nibbles of the colors so | ||||
|        * that there is a visible variation between colors of sequential actor | ||||
|        * identifiers (otherwise pick buffers dumped to an image will pretty | ||||
|        * much just look black.) Here we reverse that rotation. | ||||
|        */ | ||||
|       tmp = ((pixel[0] << 4) | (pixel[0] >> 4)); | ||||
|       red = tmp >> (8 - ctx->fb_r_mask); | ||||
|       tmp = ((pixel[1] << 4) | (pixel[1] >> 4)); | ||||
|       green = tmp >> (8 - ctx->fb_g_mask); | ||||
|       tmp = ((pixel[2] << 4) | (pixel[2] >> 4)); | ||||
|       blue = tmp >> (8 - ctx->fb_b_mask); | ||||
|     } | ||||
|   else | ||||
|     { | ||||
|       red   = pixel[0] >> (8 - ctx->fb_r_mask); | ||||
|       green = pixel[1] >> (8 - ctx->fb_g_mask); | ||||
|       blue  = pixel[2] >> (8 - ctx->fb_b_mask); | ||||
|     } | ||||
|  | ||||
|   /* divide potentially by two if 'fuzzy' */ | ||||
|   red   = red   >> (ctx->fb_r_mask - ctx->fb_r_mask_used); | ||||
|   green = green >> (ctx->fb_g_mask - ctx->fb_g_mask_used); | ||||
|   blue  = blue  >> (ctx->fb_b_mask - ctx->fb_b_mask_used); | ||||
|  | ||||
|   /* combine the correct per component values into the final id */ | ||||
|   retval = blue | ||||
|          + (green <<  ctx->fb_b_mask_used) | ||||
|          + (red << (ctx->fb_b_mask_used + ctx->fb_g_mask_used)); | ||||
|  | ||||
|   return retval; | ||||
| } | ||||
|  | ||||
| static CoglPangoFontMap * | ||||
| clutter_context_get_pango_fontmap (void) | ||||
| { | ||||
| @@ -1279,8 +1159,8 @@ clutter_get_option_group (void) | ||||
|   context = _clutter_context_get_default (); | ||||
|  | ||||
|   group = g_option_group_new ("clutter", | ||||
|                               _("Clutter Options"), | ||||
|                               _("Show Clutter Options"), | ||||
|                               "Clutter Options", | ||||
|                               "Show Clutter Options", | ||||
|                               NULL, | ||||
|                               NULL); | ||||
|  | ||||
| @@ -1701,37 +1581,19 @@ static inline void | ||||
| emit_pointer_event (ClutterEvent       *event, | ||||
|                     ClutterInputDevice *device) | ||||
| { | ||||
|   ClutterMainContext *context = _clutter_context_get_default (); | ||||
|  | ||||
|   if (_clutter_event_process_filters (event)) | ||||
|     return; | ||||
|  | ||||
|   if (context->pointer_grab_actor == NULL && | ||||
|       (device == NULL || device->pointer_grab_actor == NULL)) | ||||
|     { | ||||
|       /* no grab, time to capture and bubble */ | ||||
|       emit_event_chain (event); | ||||
|     } | ||||
|   if (device != NULL && device->pointer_grab_actor != NULL) | ||||
|     clutter_actor_event (device->pointer_grab_actor, event, FALSE); | ||||
|   else | ||||
|     { | ||||
|       if (context->pointer_grab_actor != NULL) | ||||
|         { | ||||
|           /* global grab */ | ||||
|           clutter_actor_event (context->pointer_grab_actor, event, FALSE); | ||||
|         } | ||||
|       else if (device != NULL && device->pointer_grab_actor != NULL) | ||||
|         { | ||||
|           /* per device grab */ | ||||
|           clutter_actor_event (device->pointer_grab_actor, event, FALSE); | ||||
|         } | ||||
|     } | ||||
|     emit_event_chain (event); | ||||
| } | ||||
|  | ||||
| static inline void | ||||
| emit_crossing_event (ClutterEvent       *event, | ||||
|                      ClutterInputDevice *device) | ||||
| { | ||||
|   ClutterMainContext *context = _clutter_context_get_default (); | ||||
|   ClutterEventSequence *sequence = clutter_event_get_event_sequence (event); | ||||
|   ClutterActor *grab_actor = NULL; | ||||
|  | ||||
| @@ -1745,9 +1607,7 @@ emit_crossing_event (ClutterEvent       *event, | ||||
|     } | ||||
|   else | ||||
|     { | ||||
|       if (context->pointer_grab_actor != NULL) | ||||
|         grab_actor = context->pointer_grab_actor; | ||||
|       else if (device != NULL && device->pointer_grab_actor != NULL) | ||||
|       if (device != NULL && device->pointer_grab_actor != NULL) | ||||
|         grab_actor = device->pointer_grab_actor; | ||||
|     } | ||||
|  | ||||
| @@ -1788,30 +1648,13 @@ static inline void | ||||
| emit_keyboard_event (ClutterEvent       *event, | ||||
|                      ClutterInputDevice *device) | ||||
| { | ||||
|   ClutterMainContext *context = _clutter_context_get_default (); | ||||
|  | ||||
|   if (_clutter_event_process_filters (event)) | ||||
|     return; | ||||
|  | ||||
|   if (context->keyboard_grab_actor == NULL && | ||||
|       (device == NULL || device->keyboard_grab_actor == NULL)) | ||||
|     { | ||||
|       /* no grab, time to capture and bubble */ | ||||
|       emit_event_chain (event); | ||||
|     } | ||||
|   if (device != NULL && device->keyboard_grab_actor != NULL) | ||||
|     clutter_actor_event (device->keyboard_grab_actor, event, FALSE); | ||||
|   else | ||||
|     { | ||||
|       if (context->keyboard_grab_actor != NULL) | ||||
|         { | ||||
|           /* global key grab */ | ||||
|           clutter_actor_event (context->keyboard_grab_actor, event, FALSE); | ||||
|         } | ||||
|       else if (device != NULL && device->keyboard_grab_actor != NULL) | ||||
|         { | ||||
|           /* per-device key grab */ | ||||
|           clutter_actor_event (context->keyboard_grab_actor, event, FALSE); | ||||
|         } | ||||
|     } | ||||
|     emit_event_chain (event); | ||||
| } | ||||
|  | ||||
| static inline void | ||||
| @@ -1985,7 +1828,8 @@ _clutter_process_event_details (ClutterActor        *stage, | ||||
|  | ||||
|       case CLUTTER_MOTION: | ||||
| #ifdef CLUTTER_WINDOWING_X11 | ||||
|         if (!clutter_check_windowing_backend (CLUTTER_WINDOWING_X11)) | ||||
|         if (!clutter_check_windowing_backend (CLUTTER_WINDOWING_X11) && | ||||
|             !(event->any.flags & CLUTTER_EVENT_FLAG_SYNTHETIC)) | ||||
|           { | ||||
|             if (_clutter_is_input_pointer_a11y_enabled (device)) | ||||
|               { | ||||
| @@ -2009,15 +1853,7 @@ _clutter_process_event_details (ClutterActor        *stage, | ||||
|             if (_clutter_event_process_filters (event)) | ||||
|               break; | ||||
|  | ||||
|             /* global grabs */ | ||||
|             if (context->pointer_grab_actor != NULL) | ||||
|               { | ||||
|                 clutter_actor_event (context->pointer_grab_actor, | ||||
|                                      event, | ||||
|                                      FALSE); | ||||
|                 break; | ||||
|               } | ||||
|             else if (device != NULL && device->pointer_grab_actor != NULL) | ||||
|             if (device != NULL && device->pointer_grab_actor != NULL) | ||||
|               { | ||||
|                 clutter_actor_event (device->pointer_grab_actor, | ||||
|                                      event, | ||||
| @@ -2380,332 +2216,6 @@ clutter_get_default_frame_rate (void) | ||||
|   return context->frame_rate; | ||||
| } | ||||
|  | ||||
| static void | ||||
| on_grab_actor_destroy (ClutterActor       *actor, | ||||
|                        ClutterInputDevice *device) | ||||
| { | ||||
|   if (device == NULL) | ||||
|     { | ||||
|       ClutterMainContext *context = _clutter_context_get_default (); | ||||
|  | ||||
|       if (context->pointer_grab_actor == actor) | ||||
|         clutter_ungrab_pointer (); | ||||
|  | ||||
|       if (context->keyboard_grab_actor == actor) | ||||
|         clutter_ungrab_keyboard (); | ||||
|  | ||||
|       return; | ||||
|     } | ||||
|  | ||||
|   switch (device->device_type) | ||||
|     { | ||||
|     case CLUTTER_POINTER_DEVICE: | ||||
|       device->pointer_grab_actor = NULL; | ||||
|       break; | ||||
|  | ||||
|     case CLUTTER_KEYBOARD_DEVICE: | ||||
|       device->keyboard_grab_actor = NULL; | ||||
|       break; | ||||
|  | ||||
|     default: | ||||
|       g_assert_not_reached (); | ||||
|     } | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_grab_pointer: | ||||
|  * @actor: a #ClutterActor | ||||
|  * | ||||
|  * Grabs pointer events, after the grab is done all pointer related events | ||||
|  * (press, motion, release, enter, leave and scroll) are delivered to this | ||||
|  * actor directly without passing through both capture and bubble phases of | ||||
|  * the event delivery chain. The source set in the event will be the actor | ||||
|  * that would have received the event if the pointer grab was not in effect. | ||||
|  * | ||||
|  * Grabs completely override the entire event delivery chain | ||||
|  * done by Clutter. Pointer grabs should only be used as a last resource; | ||||
|  * using the #ClutterActor::captured-event signal should always be the | ||||
|  * preferred way to intercept event delivery to reactive actors. | ||||
|  * | ||||
|  * This function should rarely be used. | ||||
|  * | ||||
|  * If a grab is required, you are strongly encouraged to use a specific | ||||
|  * input device by calling clutter_input_device_grab(). | ||||
|  * | ||||
|  * Since: 0.6 | ||||
|  */ | ||||
| void | ||||
| clutter_grab_pointer (ClutterActor *actor) | ||||
| { | ||||
|   ClutterMainContext *context; | ||||
|  | ||||
|   g_return_if_fail (actor == NULL || CLUTTER_IS_ACTOR (actor)); | ||||
|  | ||||
|   context = _clutter_context_get_default (); | ||||
|  | ||||
|   if (context->pointer_grab_actor == actor) | ||||
|     return; | ||||
|  | ||||
|   if (context->pointer_grab_actor != NULL) | ||||
|     { | ||||
|       g_signal_handlers_disconnect_by_func (context->pointer_grab_actor, | ||||
|                                             G_CALLBACK (on_grab_actor_destroy), | ||||
|                                             NULL); | ||||
|       context->pointer_grab_actor = NULL; | ||||
|     } | ||||
|  | ||||
|   if (actor != NULL) | ||||
|     { | ||||
|       context->pointer_grab_actor = actor; | ||||
|  | ||||
|       g_signal_connect (context->pointer_grab_actor, "destroy", | ||||
|                         G_CALLBACK (on_grab_actor_destroy), | ||||
|                         NULL); | ||||
|     } | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_input_device_grab: | ||||
|  * @device: a #ClutterInputDevice | ||||
|  * @actor: a #ClutterActor | ||||
|  * | ||||
|  * Acquires a grab on @actor for the given @device. | ||||
|  * | ||||
|  * Any event coming from @device will be delivered to @actor, bypassing | ||||
|  * the usual event delivery mechanism, until the grab is released by | ||||
|  * calling clutter_input_device_ungrab(). | ||||
|  * | ||||
|  * The grab is client-side: even if the windowing system used by the Clutter | ||||
|  * backend has the concept of "device grabs", Clutter will not use them. | ||||
|  * | ||||
|  * Only #ClutterInputDevice of types %CLUTTER_POINTER_DEVICE and | ||||
|  * %CLUTTER_KEYBOARD_DEVICE can hold a grab. | ||||
|  * | ||||
|  * Since: 1.10 | ||||
|  */ | ||||
| void | ||||
| clutter_input_device_grab (ClutterInputDevice *device, | ||||
|                            ClutterActor       *actor) | ||||
| { | ||||
|   ClutterActor **grab_actor; | ||||
|  | ||||
|   g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device)); | ||||
|   g_return_if_fail (CLUTTER_IS_ACTOR (actor)); | ||||
|  | ||||
|   switch (device->device_type) | ||||
|     { | ||||
|     case CLUTTER_POINTER_DEVICE: | ||||
|     case CLUTTER_TABLET_DEVICE: | ||||
|       grab_actor = &(device->pointer_grab_actor); | ||||
|       break; | ||||
|  | ||||
|     case CLUTTER_KEYBOARD_DEVICE: | ||||
|       grab_actor = &(device->keyboard_grab_actor); | ||||
|       break; | ||||
|  | ||||
|     default: | ||||
|       g_critical ("Only pointer and keyboard devices can grab an actor"); | ||||
|       return; | ||||
|     } | ||||
|  | ||||
|   if (*grab_actor != NULL) | ||||
|     { | ||||
|       g_signal_handlers_disconnect_by_func (*grab_actor, | ||||
|                                             G_CALLBACK (on_grab_actor_destroy), | ||||
|                                             device); | ||||
|     } | ||||
|  | ||||
|   *grab_actor = actor; | ||||
|  | ||||
|   g_signal_connect (*grab_actor, | ||||
|                     "destroy", | ||||
|                     G_CALLBACK (on_grab_actor_destroy), | ||||
|                     device); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_input_device_ungrab: | ||||
|  * @device: a #ClutterInputDevice | ||||
|  * | ||||
|  * Releases the grab on the @device, if one is in place. | ||||
|  * | ||||
|  * Since: 1.10 | ||||
|  */ | ||||
| void | ||||
| clutter_input_device_ungrab (ClutterInputDevice *device) | ||||
| { | ||||
|   ClutterActor **grab_actor; | ||||
|  | ||||
|   g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device)); | ||||
|  | ||||
|   switch (device->device_type) | ||||
|     { | ||||
|     case CLUTTER_POINTER_DEVICE: | ||||
|     case CLUTTER_TABLET_DEVICE: | ||||
|       grab_actor = &(device->pointer_grab_actor); | ||||
|       break; | ||||
|  | ||||
|     case CLUTTER_KEYBOARD_DEVICE: | ||||
|       grab_actor = &(device->keyboard_grab_actor); | ||||
|       break; | ||||
|  | ||||
|     default: | ||||
|       return; | ||||
|     } | ||||
|  | ||||
|   if (*grab_actor == NULL) | ||||
|     return; | ||||
|  | ||||
|   g_signal_handlers_disconnect_by_func (*grab_actor, | ||||
|                                         G_CALLBACK (on_grab_actor_destroy), | ||||
|                                         device); | ||||
|  | ||||
|   *grab_actor = NULL; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_input_device_get_grabbed_actor: | ||||
|  * @device: a #ClutterInputDevice | ||||
|  * | ||||
|  * Retrieves a pointer to the #ClutterActor currently grabbing all | ||||
|  * the events coming from @device. | ||||
|  * | ||||
|  * Return value: (transfer none): a #ClutterActor, or %NULL | ||||
|  * | ||||
|  * Since: 1.10 | ||||
|  */ | ||||
| ClutterActor * | ||||
| clutter_input_device_get_grabbed_actor (ClutterInputDevice *device) | ||||
| { | ||||
|   g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), NULL); | ||||
|  | ||||
|   switch (device->device_type) | ||||
|     { | ||||
|     case CLUTTER_POINTER_DEVICE: | ||||
|       return device->pointer_grab_actor; | ||||
|  | ||||
|     case CLUTTER_KEYBOARD_DEVICE: | ||||
|       return device->keyboard_grab_actor; | ||||
|  | ||||
|     default: | ||||
|       g_critical ("Only pointer and keyboard devices can grab an actor"); | ||||
|     } | ||||
|  | ||||
|   return NULL; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_ungrab_pointer: | ||||
|  * | ||||
|  * Removes an existing grab of the pointer. | ||||
|  * | ||||
|  * Since: 0.6 | ||||
|  */ | ||||
| void | ||||
| clutter_ungrab_pointer (void) | ||||
| { | ||||
|   clutter_grab_pointer (NULL); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_get_pointer_grab: | ||||
|  * | ||||
|  * Queries the current pointer grab of clutter. | ||||
|  * | ||||
|  * Return value: (transfer none): the actor currently holding the pointer grab, or NULL if there is no grab. | ||||
|  * | ||||
|  * Since: 0.6 | ||||
|  */ | ||||
| ClutterActor * | ||||
| clutter_get_pointer_grab (void) | ||||
| { | ||||
|   ClutterMainContext *context; | ||||
|   context = _clutter_context_get_default (); | ||||
|  | ||||
|   return context->pointer_grab_actor; | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * clutter_grab_keyboard: | ||||
|  * @actor: a #ClutterActor | ||||
|  * | ||||
|  * Grabs keyboard events, after the grab is done keyboard | ||||
|  * events (#ClutterActor::key-press-event and #ClutterActor::key-release-event) | ||||
|  * are delivered to this actor directly. The source set in the event will be | ||||
|  * the actor that would have received the event if the keyboard grab was not | ||||
|  * in effect. | ||||
|  * | ||||
|  * Like pointer grabs, keyboard grabs should only be used as a last | ||||
|  * resource. | ||||
|  * | ||||
|  * See also clutter_stage_set_key_focus() and clutter_actor_grab_key_focus() | ||||
|  * to perform a "soft" key grab and assign key focus to a specific actor. | ||||
|  * | ||||
|  * Since: 0.6 | ||||
|  */ | ||||
| void | ||||
| clutter_grab_keyboard (ClutterActor *actor) | ||||
| { | ||||
|   ClutterMainContext *context; | ||||
|  | ||||
|   g_return_if_fail (actor == NULL || CLUTTER_IS_ACTOR (actor)); | ||||
|  | ||||
|   context = _clutter_context_get_default (); | ||||
|  | ||||
|   if (context->keyboard_grab_actor == actor) | ||||
|     return; | ||||
|  | ||||
|   if (context->keyboard_grab_actor != NULL) | ||||
|     { | ||||
|       g_signal_handlers_disconnect_by_func (context->keyboard_grab_actor, | ||||
|                                             G_CALLBACK (on_grab_actor_destroy), | ||||
|                                             NULL); | ||||
|       context->keyboard_grab_actor = NULL; | ||||
|     } | ||||
|  | ||||
|   if (actor != NULL) | ||||
|     { | ||||
|       context->keyboard_grab_actor = actor; | ||||
|  | ||||
|       g_signal_connect (context->keyboard_grab_actor, "destroy", | ||||
|                         G_CALLBACK (on_grab_actor_destroy), | ||||
|                         NULL); | ||||
|     } | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_ungrab_keyboard: | ||||
|  * | ||||
|  * Removes an existing grab of the keyboard. | ||||
|  * | ||||
|  * Since: 0.6 | ||||
|  */ | ||||
| void | ||||
| clutter_ungrab_keyboard (void) | ||||
| { | ||||
|   clutter_grab_keyboard (NULL); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_get_keyboard_grab: | ||||
|  * | ||||
|  * Queries the current keyboard grab of clutter. | ||||
|  * | ||||
|  * Return value: (transfer none): the actor currently holding the keyboard grab, or NULL if there is no grab. | ||||
|  * | ||||
|  * Since: 0.6 | ||||
|  */ | ||||
| ClutterActor * | ||||
| clutter_get_keyboard_grab (void) | ||||
| { | ||||
|   ClutterMainContext *context; | ||||
|  | ||||
|   context = _clutter_context_get_default (); | ||||
|  | ||||
|   return context->keyboard_grab_actor; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_get_font_map: | ||||
|  * | ||||
|   | ||||
| @@ -146,19 +146,6 @@ guint                   clutter_threads_add_repaint_func_full   (ClutterRepaintF | ||||
| CLUTTER_EXPORT | ||||
| void                    clutter_threads_remove_repaint_func     (guint          handle_id); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void                    clutter_grab_pointer                    (ClutterActor  *actor); | ||||
| CLUTTER_EXPORT | ||||
| void                    clutter_ungrab_pointer                  (void); | ||||
| CLUTTER_EXPORT | ||||
| ClutterActor *          clutter_get_pointer_grab                (void); | ||||
| CLUTTER_EXPORT | ||||
| void                    clutter_grab_keyboard                   (ClutterActor  *actor); | ||||
| CLUTTER_EXPORT | ||||
| void                    clutter_ungrab_keyboard                 (void); | ||||
| CLUTTER_EXPORT | ||||
| ClutterActor *          clutter_get_keyboard_grab               (void); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| PangoFontMap *          clutter_get_font_map                    (void); | ||||
|  | ||||
|   | ||||
| @@ -12,17 +12,14 @@ BOOLEAN:OBJECT,FLOAT,FLOAT | ||||
| BOXED:UINT,UINT | ||||
| DOUBLE:VOID | ||||
| UINT:VOID | ||||
| VOID:BOOLEAN | ||||
| VOID:BOXED | ||||
| VOID:BOXED,FLAGS | ||||
| VOID:INT | ||||
| VOID:INT64,INT64,FLOAT,BOOLEAN | ||||
| VOID:INT,INT | ||||
| VOID:INT,POINTER | ||||
| VOID:FLOAT,FLOAT | ||||
| VOID:INT,INT,INT,INT | ||||
| VOID:OBJECT | ||||
| VOID:OBJECT,FLAGS | ||||
| VOID:OBJECT,FLAGS,BOOLEAN | ||||
| VOID:OBJECT,FLAGS,UINT | ||||
| VOID:OBJECT,FLOAT,FLOAT | ||||
| VOID:OBJECT,FLOAT,FLOAT,FLAGS | ||||
| @@ -30,12 +27,9 @@ VOID:OBJECT,OBJECT | ||||
| VOID:OBJECT,PARAM | ||||
| VOID:OBJECT,POINTER | ||||
| VOID:OBJECT,UINT | ||||
| VOID:POINTER | ||||
| VOID:STRING,BOOLEAN | ||||
| VOID:STRING,BOOLEAN,BOOLEAN | ||||
| VOID:STRING,INT | ||||
| VOID:UINT | ||||
| VOID:UINT,STRING,UINT | ||||
| VOID:UINT,UINT | ||||
| VOID:VOID | ||||
| VOID:STRING,INT,POINTER | ||||
|   | ||||
| @@ -26,10 +26,15 @@ | ||||
| #define __CLUTTER_H_INSIDE__ | ||||
|  | ||||
| #include "clutter-backend.h" | ||||
| #include "clutter-device-manager-private.h" | ||||
| #include "clutter-event-private.h" | ||||
| #include "clutter-input-pointer-a11y-private.h" | ||||
| #include "clutter-macros.h" | ||||
| #include "clutter-private.h" | ||||
| #include "clutter-stage-private.h" | ||||
| #include "clutter-stage-view.h" | ||||
| #include "cogl/clutter-stage-cogl.h" | ||||
| #include "x11/clutter-stage-x11.h" | ||||
| #include "clutter/x11/clutter-backend-x11.h" | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void clutter_set_custom_backend_func (ClutterBackend *(* func) (void)); | ||||
|   | ||||
| @@ -138,8 +138,6 @@ G_GNUC_INTERNAL | ||||
| ClutterPaintNode *      clutter_paint_node_get_last_child               (ClutterPaintNode      *node); | ||||
| G_GNUC_INTERNAL | ||||
| ClutterPaintNode *      clutter_paint_node_get_parent                   (ClutterPaintNode      *node); | ||||
| G_GNUC_INTERNAL | ||||
| CoglFramebuffer *       clutter_paint_node_get_framebuffer              (ClutterPaintNode      *node); | ||||
|  | ||||
| #define CLUTTER_TYPE_LAYER_NODE                 (_clutter_layer_node_get_type ()) | ||||
| #define CLUTTER_LAYER_NODE(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_LAYER_NODE, ClutterLayerNode)) | ||||
|   | ||||
| @@ -1194,6 +1194,15 @@ clutter_paint_node_get_root (ClutterPaintNode *node) | ||||
|   return iter; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_paint_node_get_framebuffer: | ||||
|  * @node: a #ClutterPaintNode | ||||
|  * | ||||
|  * Retrieves the #CoglFramebuffer that @node will draw | ||||
|  * into. | ||||
|  * | ||||
|  * Returns: (transfer none): a #CoglFramebuffer | ||||
|  */ | ||||
| CoglFramebuffer * | ||||
| clutter_paint_node_get_framebuffer (ClutterPaintNode *node) | ||||
| { | ||||
|   | ||||
| @@ -56,6 +56,9 @@ CLUTTER_EXPORT | ||||
| void                    clutter_paint_node_set_name                     (ClutterPaintNode      *node, | ||||
|                                                                          const char            *name); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| CoglFramebuffer *       clutter_paint_node_get_framebuffer              (ClutterPaintNode      *node); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void                    clutter_paint_node_add_child                    (ClutterPaintNode      *node, | ||||
|                                                                          ClutterPaintNode      *child); | ||||
|   | ||||
| @@ -579,8 +579,7 @@ clutter_pan_action_class_init (ClutterPanActionClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (klass), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   G_STRUCT_OFFSET (ClutterPanActionClass, pan_stopped), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__OBJECT, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 1, | ||||
|                   CLUTTER_TYPE_ACTOR); | ||||
| } | ||||
|   | ||||
| @@ -85,7 +85,6 @@ typedef struct _ClutterVertex4          ClutterVertex4; | ||||
| /* keep this for source compatibility with clutter */ | ||||
| #define P_(String) (String) | ||||
| #define N_(String) (String) | ||||
| #define _(String) (String) | ||||
|  | ||||
| /* This is a replacement for the nearbyint function which always rounds to the | ||||
|  * nearest integer. nearbyint is apparently a C99 function so it might not | ||||
| @@ -142,10 +141,6 @@ struct _ClutterMainContext | ||||
|   /* default FPS; this is only used if we cannot sync to vblank */ | ||||
|   guint frame_rate; | ||||
|  | ||||
|   /* actors with a grab on all devices */ | ||||
|   ClutterActor *pointer_grab_actor; | ||||
|   ClutterActor *keyboard_grab_actor; | ||||
|  | ||||
|   /* fb bit masks for col<->id mapping in picking */ | ||||
|   gint fb_r_mask; | ||||
|   gint fb_g_mask; | ||||
| @@ -186,7 +181,9 @@ typedef struct | ||||
| gboolean _clutter_threads_dispatch      (gpointer data); | ||||
| void     _clutter_threads_dispatch_free (gpointer data); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void                    _clutter_threads_acquire_lock                   (void); | ||||
| CLUTTER_EXPORT | ||||
| void                    _clutter_threads_release_lock                   (void); | ||||
|  | ||||
| ClutterMainContext *    _clutter_context_get_default                    (void); | ||||
| @@ -202,11 +199,7 @@ gboolean      _clutter_feature_init (GError **error); | ||||
| gboolean        _clutter_diagnostic_enabled     (void); | ||||
| void            _clutter_diagnostic_message     (const char *fmt, ...) G_GNUC_PRINTF (1, 2); | ||||
|  | ||||
| /* Picking code */ | ||||
| guint           _clutter_pixel_to_id            (guchar        pixel[4]); | ||||
| void            _clutter_id_to_color            (guint         id, | ||||
|                                                  ClutterColor *col); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_set_sync_to_vblank     (gboolean      sync_to_vblank); | ||||
|  | ||||
| /* use this function as the accumulator if you have a signal with | ||||
| @@ -295,6 +288,7 @@ gboolean        _clutter_util_matrix_decompose  (const ClutterMatrix *src, | ||||
|                                                  ClutterVertex       *translate_p, | ||||
|                                                  ClutterVertex4      *perspective_p); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| PangoDirection _clutter_pango_unichar_direction (gunichar ch); | ||||
|  | ||||
| PangoDirection _clutter_pango_find_base_dir     (const gchar *text, | ||||
|   | ||||
| @@ -134,8 +134,7 @@ clutter_stage_manager_class_init (ClutterStageManagerClass *klass) | ||||
|                   G_OBJECT_CLASS_TYPE (gobject_class), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   G_STRUCT_OFFSET (ClutterStageManagerClass, stage_added), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__OBJECT, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 1, | ||||
|                   CLUTTER_TYPE_STAGE); | ||||
|   /** | ||||
| @@ -153,8 +152,7 @@ clutter_stage_manager_class_init (ClutterStageManagerClass *klass) | ||||
|                   G_OBJECT_CLASS_TYPE (gobject_class), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   G_STRUCT_OFFSET (ClutterStageManagerClass, stage_removed), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__OBJECT, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 1, | ||||
|                   CLUTTER_TYPE_STAGE); | ||||
| } | ||||
|   | ||||
| @@ -41,8 +41,11 @@ void                _clutter_stage_paint_view            (ClutterStage | ||||
|                                                           const cairo_rectangle_int_t *clip); | ||||
|  | ||||
| void                _clutter_stage_emit_after_paint      (ClutterStage          *stage); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void                _clutter_stage_set_window            (ClutterStage          *stage, | ||||
|                                                           ClutterStageWindow    *stage_window); | ||||
| CLUTTER_EXPORT | ||||
| ClutterStageWindow *_clutter_stage_get_window            (ClutterStage          *stage); | ||||
| void                _clutter_stage_get_projection_matrix (ClutterStage          *stage, | ||||
|                                                           CoglMatrix            *projection); | ||||
| @@ -64,6 +67,7 @@ void                _clutter_stage_maybe_relayout        (ClutterActor | ||||
| gboolean            _clutter_stage_needs_update          (ClutterStage          *stage); | ||||
| gboolean            _clutter_stage_do_update             (ClutterStage          *stage); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void     _clutter_stage_queue_event                       (ClutterStage *stage, | ||||
|                                                            ClutterEvent *event, | ||||
|                                                            gboolean      copy_event); | ||||
| @@ -75,6 +79,15 @@ gint64    _clutter_stage_get_update_time                  (ClutterStage *stage); | ||||
| void     _clutter_stage_clear_update_time                 (ClutterStage *stage); | ||||
| gboolean _clutter_stage_has_full_redraw_queued            (ClutterStage *stage); | ||||
|  | ||||
| void clutter_stage_log_pick (ClutterStage       *stage, | ||||
|                              const ClutterPoint *vertices, | ||||
|                              ClutterActor       *actor); | ||||
|  | ||||
| void clutter_stage_push_pick_clip (ClutterStage       *stage, | ||||
|                                    const ClutterPoint *vertices); | ||||
|  | ||||
| void clutter_stage_pop_pick_clip (ClutterStage *stage); | ||||
|  | ||||
| ClutterActor *_clutter_stage_do_pick (ClutterStage    *stage, | ||||
|                                       gint             x, | ||||
|                                       gint             y, | ||||
| @@ -93,13 +106,6 @@ void                          _clutter_stage_queue_redraw_entry_invalidate (Clut | ||||
|  | ||||
| CoglFramebuffer *_clutter_stage_get_active_framebuffer (ClutterStage *stage); | ||||
|  | ||||
| gint32          _clutter_stage_acquire_pick_id          (ClutterStage *stage, | ||||
|                                                          ClutterActor *actor); | ||||
| void            _clutter_stage_release_pick_id          (ClutterStage *stage, | ||||
|                                                          gint32        pick_id); | ||||
| ClutterActor *  _clutter_stage_get_actor_by_pick_id     (ClutterStage *stage, | ||||
|                                                          gint32        pick_id); | ||||
|  | ||||
| void            _clutter_stage_add_pointer_drag_actor    (ClutterStage       *stage, | ||||
|                                                           ClutterInputDevice *device, | ||||
|                                                           ClutterActor       *actor); | ||||
| @@ -116,8 +122,11 @@ ClutterActor *  _clutter_stage_get_touch_drag_actor    (ClutterStage         *st | ||||
| void            _clutter_stage_remove_touch_drag_actor (ClutterStage         *stage, | ||||
|                                                         ClutterEventSequence *sequence); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| ClutterStageState       _clutter_stage_get_state        (ClutterStage      *stage); | ||||
| CLUTTER_EXPORT | ||||
| gboolean                _clutter_stage_is_activated     (ClutterStage      *stage); | ||||
| CLUTTER_EXPORT | ||||
| gboolean                _clutter_stage_update_state     (ClutterStage      *stage, | ||||
|                                                          ClutterStageState  unset_state, | ||||
|                                                          ClutterStageState  set_state); | ||||
|   | ||||
| @@ -275,24 +275,6 @@ _clutter_stage_window_redraw (ClutterStageWindow *window) | ||||
|     iface->redraw (window); | ||||
| } | ||||
|  | ||||
|  | ||||
| void | ||||
| _clutter_stage_window_get_dirty_pixel (ClutterStageWindow *window, | ||||
|                                        ClutterStageView   *view, | ||||
|                                        int *x, int *y) | ||||
| { | ||||
|   ClutterStageWindowInterface *iface; | ||||
|  | ||||
|   *x = 0; | ||||
|   *y = 0; | ||||
|  | ||||
|   g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (window)); | ||||
|  | ||||
|   iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window); | ||||
|   if (iface->get_dirty_pixel) | ||||
|     iface->get_dirty_pixel (window, view, x, y); | ||||
| } | ||||
|  | ||||
| gboolean | ||||
| _clutter_stage_window_can_clip_redraws (ClutterStageWindow *window) | ||||
| { | ||||
|   | ||||
| @@ -64,10 +64,6 @@ struct _ClutterStageWindowInterface | ||||
|  | ||||
|   void              (* redraw)                  (ClutterStageWindow *stage_window); | ||||
|  | ||||
|   void              (* get_dirty_pixel)         (ClutterStageWindow *stage_window, | ||||
|                                                  ClutterStageView   *view, | ||||
|                                                  int *x, int *y); | ||||
|  | ||||
|   gboolean          (* can_clip_redraws)        (ClutterStageWindow *stage_window); | ||||
|  | ||||
|   GList            *(* get_views)               (ClutterStageWindow *stage_window); | ||||
| @@ -92,6 +88,7 @@ void              _clutter_stage_window_hide                    (ClutterStageWin | ||||
| void              _clutter_stage_window_resize                  (ClutterStageWindow *window, | ||||
|                                                                  gint                width, | ||||
|                                                                  gint                height); | ||||
| CLUTTER_EXPORT | ||||
| void              _clutter_stage_window_get_geometry            (ClutterStageWindow *window, | ||||
|                                                                  cairo_rectangle_int_t *geometry); | ||||
| void              _clutter_stage_window_schedule_update         (ClutterStageWindow *window, | ||||
| @@ -111,10 +108,6 @@ void              _clutter_stage_window_set_accept_focus        (ClutterStageWin | ||||
|  | ||||
| void              _clutter_stage_window_redraw                  (ClutterStageWindow *window); | ||||
|  | ||||
| void              _clutter_stage_window_get_dirty_pixel         (ClutterStageWindow *window, | ||||
|                                                                  ClutterStageView   *view, | ||||
|                                                                  int *x, int *y); | ||||
|  | ||||
| gboolean          _clutter_stage_window_can_clip_redraws        (ClutterStageWindow *window); | ||||
|  | ||||
| GList *           _clutter_stage_window_get_views               (ClutterStageWindow *window); | ||||
|   | ||||
| @@ -105,6 +105,19 @@ struct _ClutterStageQueueRedrawEntry | ||||
|   ClutterPaintVolume clip; | ||||
| }; | ||||
|  | ||||
| typedef struct _PickRecord | ||||
| { | ||||
|   ClutterPoint vertex[4]; | ||||
|   ClutterActor *actor; | ||||
|   int clip_stack_top; | ||||
| } PickRecord; | ||||
|  | ||||
| typedef struct _PickClipRecord | ||||
| { | ||||
|   int prev; | ||||
|   ClutterPoint vertex[4]; | ||||
| } PickClipRecord; | ||||
|  | ||||
| struct _ClutterStagePrivate | ||||
| { | ||||
|   /* the stage implementation */ | ||||
| @@ -138,7 +151,11 @@ struct _ClutterStagePrivate | ||||
|   GTimer *fps_timer; | ||||
|   gint32 timer_n_frames; | ||||
|  | ||||
|   ClutterIDPool *pick_id_pool; | ||||
|   GArray *pick_stack; | ||||
|   GArray *pick_clip_stack; | ||||
|   int pick_clip_stack_top; | ||||
|   gboolean pick_stack_frozen; | ||||
|   ClutterPickMode cached_pick_mode; | ||||
|  | ||||
| #ifdef CLUTTER_ENABLE_DEBUG | ||||
|   gulong redraw_count; | ||||
| @@ -323,6 +340,211 @@ clutter_stage_get_preferred_height (ClutterActor *self, | ||||
|     *natural_height_p = geom.height; | ||||
| } | ||||
|  | ||||
| static void | ||||
| add_pick_stack_weak_refs (ClutterStage *stage) | ||||
| { | ||||
|   ClutterStagePrivate *priv = stage->priv; | ||||
|   int i; | ||||
|  | ||||
|   if (priv->pick_stack_frozen) | ||||
|     return; | ||||
|  | ||||
|   for (i = 0; i < priv->pick_stack->len; i++) | ||||
|     { | ||||
|       PickRecord *rec = &g_array_index (priv->pick_stack, PickRecord, i); | ||||
|  | ||||
|       if (rec->actor) | ||||
|         g_object_add_weak_pointer (G_OBJECT (rec->actor), | ||||
|                                    (gpointer) &rec->actor); | ||||
|     } | ||||
|  | ||||
|   priv->pick_stack_frozen = TRUE; | ||||
| } | ||||
|  | ||||
| static void | ||||
| remove_pick_stack_weak_refs (ClutterStage *stage) | ||||
| { | ||||
|   ClutterStagePrivate *priv = stage->priv; | ||||
|   int i; | ||||
|  | ||||
|   if (!priv->pick_stack_frozen) | ||||
|     return; | ||||
|  | ||||
|   for (i = 0; i < priv->pick_stack->len; i++) | ||||
|     { | ||||
|       PickRecord *rec = &g_array_index (priv->pick_stack, PickRecord, i); | ||||
|  | ||||
|       if (rec->actor) | ||||
|         g_object_remove_weak_pointer (G_OBJECT (rec->actor), | ||||
|                                       (gpointer) &rec->actor); | ||||
|     } | ||||
|  | ||||
|   priv->pick_stack_frozen = FALSE; | ||||
| } | ||||
|  | ||||
| static void | ||||
| _clutter_stage_clear_pick_stack (ClutterStage *stage) | ||||
| { | ||||
|   ClutterStagePrivate *priv = stage->priv; | ||||
|  | ||||
|   remove_pick_stack_weak_refs (stage); | ||||
|   g_array_set_size (priv->pick_stack, 0); | ||||
|   g_array_set_size (priv->pick_clip_stack, 0); | ||||
|   priv->pick_clip_stack_top = -1; | ||||
|   priv->cached_pick_mode = CLUTTER_PICK_NONE; | ||||
| } | ||||
|  | ||||
| void | ||||
| clutter_stage_log_pick (ClutterStage       *stage, | ||||
|                         const ClutterPoint *vertices, | ||||
|                         ClutterActor       *actor) | ||||
| { | ||||
|   ClutterStagePrivate *priv; | ||||
|   PickRecord rec; | ||||
|  | ||||
|   g_return_if_fail (CLUTTER_IS_STAGE (stage)); | ||||
|   g_return_if_fail (actor != NULL); | ||||
|  | ||||
|   priv = stage->priv; | ||||
|  | ||||
|   g_assert (!priv->pick_stack_frozen); | ||||
|  | ||||
|   memcpy (rec.vertex, vertices, 4 * sizeof (ClutterPoint)); | ||||
|   rec.actor = actor; | ||||
|   rec.clip_stack_top = priv->pick_clip_stack_top; | ||||
|  | ||||
|   g_array_append_val (priv->pick_stack, rec); | ||||
| } | ||||
|  | ||||
| void | ||||
| clutter_stage_push_pick_clip (ClutterStage       *stage, | ||||
|                               const ClutterPoint *vertices) | ||||
| { | ||||
|   ClutterStagePrivate *priv; | ||||
|   PickClipRecord clip; | ||||
|  | ||||
|   g_return_if_fail (CLUTTER_IS_STAGE (stage)); | ||||
|  | ||||
|   priv = stage->priv; | ||||
|  | ||||
|   g_assert (!priv->pick_stack_frozen); | ||||
|  | ||||
|   clip.prev = priv->pick_clip_stack_top; | ||||
|   memcpy (clip.vertex, vertices, 4 * sizeof (ClutterPoint)); | ||||
|  | ||||
|   g_array_append_val (priv->pick_clip_stack, clip); | ||||
|   priv->pick_clip_stack_top = priv->pick_clip_stack->len - 1; | ||||
| } | ||||
|  | ||||
| void | ||||
| clutter_stage_pop_pick_clip (ClutterStage *stage) | ||||
| { | ||||
|   ClutterStagePrivate *priv; | ||||
|   const PickClipRecord *top; | ||||
|  | ||||
|   g_return_if_fail (CLUTTER_IS_STAGE (stage)); | ||||
|  | ||||
|   priv = stage->priv; | ||||
|  | ||||
|   g_assert (!priv->pick_stack_frozen); | ||||
|   g_assert (priv->pick_clip_stack_top >= 0); | ||||
|  | ||||
|   /* Individual elements of pick_clip_stack are not freed. This is so they | ||||
|    * can be shared as part of a tree of different stacks used by different | ||||
|    * actors in the pick_stack. The whole pick_clip_stack does however get | ||||
|    * freed later in _clutter_stage_clear_pick_stack. | ||||
|    */ | ||||
|  | ||||
|   top = &g_array_index (priv->pick_clip_stack, | ||||
|                         PickClipRecord, | ||||
|                         priv->pick_clip_stack_top); | ||||
|  | ||||
|   priv->pick_clip_stack_top = top->prev; | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| is_quadrilateral_axis_aligned_rectangle (const ClutterPoint *vertices) | ||||
| { | ||||
|   int i; | ||||
|  | ||||
|   for (i = 0; i < 4; i++) | ||||
|     { | ||||
|       if (!G_APPROX_VALUE (vertices[i].x, | ||||
|                            vertices[(i + 1) % 4].x, | ||||
|                            FLT_EPSILON) && | ||||
|           !G_APPROX_VALUE (vertices[i].y, | ||||
|                            vertices[(i + 1) % 4].y, | ||||
|                            FLT_EPSILON)) | ||||
|         return FALSE; | ||||
|     } | ||||
|   return TRUE; | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| is_inside_axis_aligned_rectangle (const ClutterPoint *point, | ||||
|                                   const ClutterPoint *vertices) | ||||
| { | ||||
|   float min_x = FLT_MAX; | ||||
|   float max_x = FLT_MIN; | ||||
|   float min_y = FLT_MAX; | ||||
|   float max_y = FLT_MIN; | ||||
|   int i; | ||||
|  | ||||
|   for (i = 0; i < 3; i++) | ||||
|     { | ||||
|       min_x = MIN (min_x, vertices[i].x); | ||||
|       min_y = MIN (min_y, vertices[i].y); | ||||
|       max_x = MAX (max_x, vertices[i].x); | ||||
|       max_y = MAX (max_y, vertices[i].y); | ||||
|     } | ||||
|  | ||||
|   return (point->x >= min_x && | ||||
|           point->y >= min_y && | ||||
|           point->x < max_x && | ||||
|           point->y < max_y); | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| is_inside_input_region (const ClutterPoint *point, | ||||
|                         const ClutterPoint *vertices) | ||||
| { | ||||
|  | ||||
|   if (is_quadrilateral_axis_aligned_rectangle (vertices)) | ||||
|     return is_inside_axis_aligned_rectangle (point, vertices); | ||||
|   else | ||||
|     return clutter_point_inside_quadrilateral (point, vertices); | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| pick_record_contains_pixel (ClutterStage     *stage, | ||||
|                             const PickRecord *rec, | ||||
|                             int               x, | ||||
|                             int               y) | ||||
| { | ||||
|   const ClutterPoint point = CLUTTER_POINT_INIT (x, y); | ||||
|   ClutterStagePrivate *priv; | ||||
|   int clip_index; | ||||
|  | ||||
|   if (!is_inside_input_region (&point, rec->vertex)) | ||||
|       return FALSE; | ||||
|  | ||||
|   priv = stage->priv; | ||||
|   clip_index = rec->clip_stack_top; | ||||
|   while (clip_index >= 0) | ||||
|     { | ||||
|       const PickClipRecord *clip = &g_array_index (priv->pick_clip_stack, | ||||
|                                                    PickClipRecord, | ||||
|                                                    clip_index); | ||||
|  | ||||
|       if (!is_inside_input_region (&point, clip->vertex)) | ||||
|         return FALSE; | ||||
|  | ||||
|       clip_index = clip->prev; | ||||
|     } | ||||
|  | ||||
|   return TRUE; | ||||
| } | ||||
|  | ||||
| static inline void | ||||
| queue_full_redraw (ClutterStage *stage) | ||||
| { | ||||
| @@ -630,6 +852,12 @@ clutter_stage_do_paint_view (ClutterStage                *stage, | ||||
|   float viewport[4]; | ||||
|   cairo_rectangle_int_t geom; | ||||
|  | ||||
|   /* Any mode of painting/picking invalidates the pick cache, unless we're | ||||
|    * in the middle of building it. So we reset the cached flag but don't | ||||
|    * completely clear the pick stack. | ||||
|    */ | ||||
|   priv->cached_pick_mode = CLUTTER_PICK_NONE; | ||||
|  | ||||
|   _clutter_stage_window_get_geometry (priv->impl, &geom); | ||||
|  | ||||
|   viewport[0] = priv->viewport[0]; | ||||
| @@ -875,15 +1103,6 @@ _clutter_stage_queue_event (ClutterStage *stage, | ||||
|   if (copy_event) | ||||
|     event = clutter_event_copy (event); | ||||
|  | ||||
|   g_queue_push_tail (priv->event_queue, event); | ||||
|  | ||||
|   if (first_event) | ||||
|     { | ||||
|       ClutterMasterClock *master_clock = _clutter_master_clock_get_default (); | ||||
|       _clutter_master_clock_start_running (master_clock); | ||||
|       _clutter_stage_schedule_update (stage); | ||||
|     } | ||||
|  | ||||
|   /* if needed, update the state of the input device of the event. | ||||
|    * we do it here to avoid calling the same code from every backend | ||||
|    * event processing function | ||||
| @@ -904,6 +1123,28 @@ _clutter_stage_queue_event (ClutterStage *stage, | ||||
|       _clutter_input_device_set_state (device, event_state); | ||||
|       _clutter_input_device_set_time (device, event_time); | ||||
|     } | ||||
|  | ||||
|   if (first_event) | ||||
|     { | ||||
|       gboolean compressible = event->type == CLUTTER_MOTION || | ||||
|                               event->type == CLUTTER_TOUCH_UPDATE; | ||||
|  | ||||
|       if (!compressible) | ||||
|         { | ||||
|           _clutter_process_event (event); | ||||
|           clutter_event_free (event); | ||||
|           return; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   g_queue_push_tail (priv->event_queue, event); | ||||
|  | ||||
|   if (first_event) | ||||
|     { | ||||
|       ClutterMasterClock *master_clock = _clutter_master_clock_get_default (); | ||||
|       _clutter_master_clock_start_running (master_clock); | ||||
|       _clutter_stage_schedule_update (stage); | ||||
|     } | ||||
| } | ||||
|  | ||||
| gboolean | ||||
| @@ -1385,40 +1626,6 @@ clutter_stage_get_redraw_clip_bounds (ClutterStage          *stage, | ||||
|     } | ||||
| } | ||||
|  | ||||
| static void | ||||
| read_pixels_to_file (CoglFramebuffer *fb, | ||||
|                      char            *filename_stem, | ||||
|                      int              x, | ||||
|                      int              y, | ||||
|                      int              width, | ||||
|                      int              height) | ||||
| { | ||||
|   guint8 *data; | ||||
|   cairo_surface_t *surface; | ||||
|   static int read_count = 0; | ||||
|   char *filename = g_strdup_printf ("%s-%05d.png", | ||||
|                                     filename_stem, | ||||
|                                     read_count); | ||||
|  | ||||
|   data = g_malloc (4 * width * height); | ||||
|   cogl_framebuffer_read_pixels (fb, | ||||
|                                 x, y, width, height, | ||||
|                                 CLUTTER_CAIRO_FORMAT_ARGB32, | ||||
|                                 data); | ||||
|  | ||||
|   surface = cairo_image_surface_create_for_data (data, CAIRO_FORMAT_RGB24, | ||||
|                                                  width, height, | ||||
|                                                  width * 4); | ||||
|  | ||||
|   cairo_surface_write_to_png (surface, filename); | ||||
|   cairo_surface_destroy (surface); | ||||
|  | ||||
|   g_free (data); | ||||
|   g_free (filename); | ||||
|  | ||||
|   read_count++; | ||||
| } | ||||
|  | ||||
| static ClutterActor * | ||||
| _clutter_stage_do_pick_on_view (ClutterStage     *stage, | ||||
|                                 gint              x, | ||||
| @@ -1426,140 +1633,42 @@ _clutter_stage_do_pick_on_view (ClutterStage     *stage, | ||||
|                                 ClutterPickMode   mode, | ||||
|                                 ClutterStageView *view) | ||||
| { | ||||
|   ClutterActor *actor = CLUTTER_ACTOR (stage); | ||||
|   ClutterMainContext *context = _clutter_context_get_default (); | ||||
|   ClutterStagePrivate *priv = stage->priv; | ||||
|   CoglFramebuffer *fb = clutter_stage_view_get_framebuffer (view); | ||||
|   cairo_rectangle_int_t view_layout; | ||||
|   ClutterMainContext *context; | ||||
|   guchar pixel[4] = { 0xff, 0xff, 0xff, 0xff }; | ||||
|   CoglColor stage_pick_id; | ||||
|   gboolean dither_enabled_save; | ||||
|   ClutterActor *retval; | ||||
|   gint dirty_x; | ||||
|   gint dirty_y; | ||||
|   gint read_x; | ||||
|   gint read_y; | ||||
|   float fb_width, fb_height; | ||||
|   float fb_scale; | ||||
|   float viewport_offset_x; | ||||
|   float viewport_offset_y; | ||||
|   int i; | ||||
|  | ||||
|   priv = stage->priv; | ||||
|   g_assert (context->pick_mode == CLUTTER_PICK_NONE); | ||||
|  | ||||
|   context = _clutter_context_get_default (); | ||||
|   fb_scale = clutter_stage_view_get_scale (view); | ||||
|   clutter_stage_view_get_layout (view, &view_layout); | ||||
|  | ||||
|   fb_width = view_layout.width * fb_scale; | ||||
|   fb_height = view_layout.height * fb_scale; | ||||
|   cogl_push_framebuffer (fb); | ||||
|  | ||||
|   /* needed for when a context switch happens */ | ||||
|   _clutter_stage_maybe_setup_viewport (stage, view); | ||||
|  | ||||
|   /* FIXME: For some reason leaving the cogl clip stack empty causes the | ||||
|    * picking to not work at all, so setting it the whole framebuffer content | ||||
|    * for now. */ | ||||
|   cogl_framebuffer_push_scissor_clip (fb, 0, 0, | ||||
|                                       view_layout.width * fb_scale, | ||||
|                                       view_layout.height * fb_scale); | ||||
|  | ||||
|   _clutter_stage_window_get_dirty_pixel (priv->impl, view, &dirty_x, &dirty_y); | ||||
|  | ||||
|   if (G_LIKELY (!(clutter_pick_debug_flags & CLUTTER_DEBUG_DUMP_PICK_BUFFERS))) | ||||
|   if (mode != priv->cached_pick_mode) | ||||
|     { | ||||
|       CLUTTER_NOTE (PICK, "Pushing pick scissor clip x: %d, y: %d, 1x1", | ||||
|                     (int) (dirty_x * fb_scale), | ||||
|                     (int) (dirty_y * fb_scale)); | ||||
|       cogl_framebuffer_push_scissor_clip (fb, dirty_x * fb_scale, dirty_y * fb_scale, 1, 1); | ||||
|       _clutter_stage_clear_pick_stack (stage); | ||||
|  | ||||
|       cogl_push_framebuffer (fb); | ||||
|  | ||||
|       context->pick_mode = mode; | ||||
|       clutter_stage_do_paint_view (stage, view, NULL); | ||||
|       context->pick_mode = CLUTTER_PICK_NONE; | ||||
|       priv->cached_pick_mode = mode; | ||||
|  | ||||
|       cogl_pop_framebuffer (); | ||||
|  | ||||
|       add_pick_stack_weak_refs (stage); | ||||
|     } | ||||
|  | ||||
|   viewport_offset_x = x * fb_scale - dirty_x * fb_scale; | ||||
|   viewport_offset_y = y * fb_scale - dirty_y * fb_scale; | ||||
|   CLUTTER_NOTE (PICK, "Setting viewport to %f, %f, %f, %f", | ||||
|                 priv->viewport[0] * fb_scale - viewport_offset_x, | ||||
|                 priv->viewport[1] * fb_scale - viewport_offset_y, | ||||
|                 priv->viewport[2] * fb_scale, | ||||
|                 priv->viewport[3] * fb_scale); | ||||
|   cogl_framebuffer_set_viewport (fb, | ||||
|                                  priv->viewport[0] * fb_scale - viewport_offset_x, | ||||
|                                  priv->viewport[1] * fb_scale - viewport_offset_y, | ||||
|                                  priv->viewport[2] * fb_scale, | ||||
|                                  priv->viewport[3] * fb_scale); | ||||
|  | ||||
|   read_x = dirty_x * fb_scale; | ||||
|   read_y = dirty_y * fb_scale; | ||||
|  | ||||
|   CLUTTER_NOTE (PICK, "Performing pick at %i,%i on view %dx%d+%d+%d s: %f", | ||||
|                 x, y, | ||||
|                 view_layout.width, view_layout.height, | ||||
|                 view_layout.x, view_layout.y, fb_scale); | ||||
|  | ||||
|   cogl_color_init_from_4ub (&stage_pick_id, 255, 255, 255, 255); | ||||
|   cogl_framebuffer_clear (fb, COGL_BUFFER_BIT_COLOR | COGL_BUFFER_BIT_DEPTH, &stage_pick_id); | ||||
|  | ||||
|   /* Disable dithering (if any) when doing the painting in pick mode */ | ||||
|   dither_enabled_save = cogl_framebuffer_get_dither_enabled (fb); | ||||
|   cogl_framebuffer_set_dither_enabled (fb, FALSE); | ||||
|  | ||||
|   /* Render the entire scence in pick mode - just single colored silhouette's | ||||
|    * are drawn offscreen (as we never swap buffers) | ||||
|   */ | ||||
|   context->pick_mode = mode; | ||||
|  | ||||
|   clutter_stage_do_paint_view (stage, view, NULL); | ||||
|   context->pick_mode = CLUTTER_PICK_NONE; | ||||
|  | ||||
|   /* Read the color of the screen co-ords pixel. RGBA_8888_PRE is used | ||||
|      even though we don't care about the alpha component because under | ||||
|      GLES this is the only format that is guaranteed to work so Cogl | ||||
|      will end up having to do a conversion if any other format is | ||||
|      used. The format is requested as pre-multiplied because Cogl | ||||
|      assumes that all pixels in the framebuffer are premultiplied so | ||||
|      it avoids a conversion. */ | ||||
|   cogl_framebuffer_read_pixels (fb, | ||||
|                                 read_x, read_y, 1, 1, | ||||
|                                 COGL_PIXEL_FORMAT_RGBA_8888_PRE, | ||||
|                                 pixel); | ||||
|  | ||||
|   if (G_UNLIKELY (clutter_pick_debug_flags & CLUTTER_DEBUG_DUMP_PICK_BUFFERS)) | ||||
|   /* Search all "painted" pickable actors from front to back. A linear search | ||||
|    * is required, and also performs fine since there is typically only | ||||
|    * on the order of dozens of actors in the list (on screen) at a time. | ||||
|    */ | ||||
|   for (i = priv->pick_stack->len - 1; i >= 0; i--) | ||||
|     { | ||||
|       char *file_name = | ||||
|         g_strdup_printf ("pick-buffer-%s-view-x-%d", | ||||
|                          _clutter_actor_get_debug_name (actor), | ||||
|                          view_layout.x); | ||||
|       const PickRecord *rec = &g_array_index (priv->pick_stack, PickRecord, i); | ||||
|  | ||||
|       read_pixels_to_file (fb, file_name, 0, 0, fb_width, fb_height); | ||||
|  | ||||
|       g_free (file_name); | ||||
|       if (rec->actor && pick_record_contains_pixel (stage, rec, x, y)) | ||||
|         return rec->actor; | ||||
|     } | ||||
|  | ||||
|   /* Restore whether GL_DITHER was enabled */ | ||||
|   cogl_framebuffer_set_dither_enabled (fb, dither_enabled_save); | ||||
|  | ||||
|   if (G_LIKELY (!(clutter_pick_debug_flags & CLUTTER_DEBUG_DUMP_PICK_BUFFERS))) | ||||
|     cogl_framebuffer_pop_clip (fb); | ||||
|  | ||||
|   cogl_framebuffer_pop_clip (fb); | ||||
|  | ||||
|   _clutter_stage_dirty_viewport (stage); | ||||
|  | ||||
|   if (pixel[0] == 0xff && pixel[1] == 0xff && pixel[2] == 0xff) | ||||
|     retval = actor; | ||||
|   else | ||||
|     { | ||||
|       guint32 id_ = _clutter_pixel_to_id (pixel); | ||||
|  | ||||
|       retval = _clutter_stage_get_actor_by_pick_id (stage, id_); | ||||
|       CLUTTER_NOTE (PICK, "Picking actor %s with id %u (pixel: 0x%x%x%x%x", | ||||
|                     G_OBJECT_TYPE_NAME (retval), | ||||
|                     id_, | ||||
|                     pixel[0], pixel[1], pixel[2], pixel[3]); | ||||
|     } | ||||
|  | ||||
|   cogl_pop_framebuffer (); | ||||
|  | ||||
|   return retval; | ||||
|   return CLUTTER_ACTOR (stage); | ||||
| } | ||||
|  | ||||
| /** | ||||
| @@ -1854,7 +1963,9 @@ clutter_stage_finalize (GObject *object) | ||||
|  | ||||
|   g_array_free (priv->paint_volume_stack, TRUE); | ||||
|  | ||||
|   _clutter_id_pool_free (priv->pick_id_pool); | ||||
|   _clutter_stage_clear_pick_stack (stage); | ||||
|   g_array_free (priv->pick_clip_stack, TRUE); | ||||
|   g_array_free (priv->pick_stack, TRUE); | ||||
|  | ||||
|   if (priv->fps_timer != NULL) | ||||
|     g_timer_destroy (priv->fps_timer); | ||||
| @@ -2078,8 +2189,7 @@ clutter_stage_class_init (ClutterStageClass *klass) | ||||
| 		  G_TYPE_FROM_CLASS (gobject_class), | ||||
| 		  G_SIGNAL_RUN_LAST, | ||||
| 		  G_STRUCT_OFFSET (ClutterStageClass, activate), | ||||
| 		  NULL, NULL, | ||||
| 		  _clutter_marshal_VOID__VOID, | ||||
| 		  NULL, NULL, NULL, | ||||
| 		  G_TYPE_NONE, 0); | ||||
|   /** | ||||
|    * ClutterStage::deactivate: | ||||
| @@ -2095,8 +2205,7 @@ clutter_stage_class_init (ClutterStageClass *klass) | ||||
| 		  G_TYPE_FROM_CLASS (gobject_class), | ||||
| 		  G_SIGNAL_RUN_LAST, | ||||
| 		  G_STRUCT_OFFSET (ClutterStageClass, deactivate), | ||||
| 		  NULL, NULL, | ||||
| 		  _clutter_marshal_VOID__VOID, | ||||
| 		  NULL, NULL, NULL, | ||||
| 		  G_TYPE_NONE, 0); | ||||
|  | ||||
|   /** | ||||
| @@ -2164,8 +2273,7 @@ clutter_stage_class_init (ClutterStageClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (gobject_class), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   G_STRUCT_OFFSET (ClutterStageClass, paint_view), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__OBJECT, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 1, | ||||
|                   CLUTTER_TYPE_STAGE_VIEW); | ||||
|  | ||||
| @@ -2292,7 +2400,10 @@ clutter_stage_init (ClutterStage *self) | ||||
|   priv->paint_volume_stack = | ||||
|     g_array_new (FALSE, FALSE, sizeof (ClutterPaintVolume)); | ||||
|  | ||||
|   priv->pick_id_pool = _clutter_id_pool_new (256); | ||||
|   priv->pick_stack = g_array_new (FALSE, FALSE, sizeof (PickRecord)); | ||||
|   priv->pick_clip_stack = g_array_new (FALSE, FALSE, sizeof (PickClipRecord)); | ||||
|   priv->pick_clip_stack_top = -1; | ||||
|   priv->cached_pick_mode = CLUTTER_PICK_NONE; | ||||
| } | ||||
|  | ||||
| /** | ||||
| @@ -3970,6 +4081,12 @@ _clutter_stage_queue_actor_redraw (ClutterStage                 *stage, | ||||
|   CLUTTER_NOTE (CLIPPING, "stage_queue_actor_redraw (actor=%s, clip=%p): ", | ||||
|                 _clutter_actor_get_debug_name (actor), clip); | ||||
|  | ||||
|   /* Queuing a redraw or clip change invalidates the pick cache, unless we're | ||||
|    * in the middle of building it. So we reset the cached flag but don't | ||||
|    * completely clear the pick stack... | ||||
|    */ | ||||
|   priv->cached_pick_mode = CLUTTER_PICK_NONE; | ||||
|  | ||||
|   if (!priv->redraw_pending) | ||||
|     { | ||||
|       ClutterMasterClock *master_clock; | ||||
| @@ -4230,39 +4347,6 @@ _clutter_stage_get_active_framebuffer (ClutterStage *stage) | ||||
|   return stage->priv->active_framebuffer; | ||||
| } | ||||
|  | ||||
| gint32 | ||||
| _clutter_stage_acquire_pick_id (ClutterStage *stage, | ||||
|                                 ClutterActor *actor) | ||||
| { | ||||
|   ClutterStagePrivate *priv = stage->priv; | ||||
|  | ||||
|   g_assert (priv->pick_id_pool != NULL); | ||||
|  | ||||
|   return _clutter_id_pool_add (priv->pick_id_pool, actor); | ||||
| } | ||||
|  | ||||
| void | ||||
| _clutter_stage_release_pick_id (ClutterStage *stage, | ||||
|                                 gint32        pick_id) | ||||
| { | ||||
|   ClutterStagePrivate *priv = stage->priv; | ||||
|  | ||||
|   g_assert (priv->pick_id_pool != NULL); | ||||
|  | ||||
|   _clutter_id_pool_remove (priv->pick_id_pool, pick_id); | ||||
| } | ||||
|  | ||||
| ClutterActor * | ||||
| _clutter_stage_get_actor_by_pick_id (ClutterStage *stage, | ||||
|                                      gint32        pick_id) | ||||
| { | ||||
|   ClutterStagePrivate *priv = stage->priv; | ||||
|  | ||||
|   g_assert (priv->pick_id_pool != NULL); | ||||
|  | ||||
|   return _clutter_id_pool_lookup (priv->pick_id_pool, pick_id); | ||||
| } | ||||
|  | ||||
| void | ||||
| _clutter_stage_add_pointer_drag_actor (ClutterStage       *stage, | ||||
|                                        ClutterInputDevice *device, | ||||
|   | ||||
| @@ -122,8 +122,7 @@ clutter_tap_action_class_init (ClutterTapActionClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (klass), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   G_STRUCT_OFFSET (ClutterTapActionClass, tap), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__OBJECT, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 1, | ||||
|                   CLUTTER_TYPE_ACTOR); | ||||
| } | ||||
|   | ||||
| @@ -2260,7 +2260,10 @@ clutter_text_press (ClutterActor *actor, | ||||
|   priv->in_select_drag = TRUE; | ||||
|  | ||||
|   if (type == CLUTTER_BUTTON_PRESS) | ||||
|     clutter_grab_pointer (actor); | ||||
|     { | ||||
|       clutter_input_device_grab (clutter_event_get_device (event), | ||||
|                                  actor); | ||||
|     } | ||||
|   else | ||||
|     { | ||||
|       clutter_input_device_sequence_grab (clutter_event_get_device (event), | ||||
| @@ -2318,7 +2321,7 @@ clutter_text_release (ClutterActor *actor, | ||||
|         { | ||||
|           if (!priv->in_select_touch) | ||||
|             { | ||||
|               clutter_ungrab_pointer (); | ||||
|               clutter_input_device_ungrab (clutter_event_get_device (event)); | ||||
|               priv->in_select_drag = FALSE; | ||||
|  | ||||
|               return CLUTTER_EVENT_STOP; | ||||
| @@ -4340,8 +4343,7 @@ clutter_text_class_init (ClutterTextClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (gobject_class), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   G_STRUCT_OFFSET (ClutterTextClass, text_changed), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__VOID, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 0); | ||||
|  | ||||
|   /** | ||||
| @@ -4413,8 +4415,7 @@ clutter_text_class_init (ClutterTextClass *klass) | ||||
| 		  G_TYPE_FROM_CLASS (gobject_class), | ||||
| 		  G_SIGNAL_RUN_LAST | G_SIGNAL_DEPRECATED, | ||||
| 		  G_STRUCT_OFFSET (ClutterTextClass, cursor_event), | ||||
| 		  NULL, NULL, | ||||
| 		  _clutter_marshal_VOID__BOXED, | ||||
| 		  NULL, NULL, NULL, | ||||
| 		  G_TYPE_NONE, 1, | ||||
| 		  CLUTTER_TYPE_GEOMETRY | G_SIGNAL_TYPE_STATIC_SCOPE); | ||||
|  | ||||
| @@ -4432,8 +4433,7 @@ clutter_text_class_init (ClutterTextClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (gobject_class), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   G_STRUCT_OFFSET (ClutterTextClass, cursor_changed), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__VOID, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 0); | ||||
|  | ||||
|   /** | ||||
| @@ -4451,8 +4451,7 @@ clutter_text_class_init (ClutterTextClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (gobject_class), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   G_STRUCT_OFFSET (ClutterTextClass, activate), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__VOID, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 0); | ||||
|  | ||||
|   binding_pool = clutter_binding_pool_get_for_class (klass); | ||||
|   | ||||
| @@ -709,8 +709,7 @@ clutter_timeline_class_init (ClutterTimelineClass *klass) | ||||
| 		  G_TYPE_FROM_CLASS (object_class), | ||||
| 		  G_SIGNAL_RUN_LAST, | ||||
| 		  G_STRUCT_OFFSET (ClutterTimelineClass, new_frame), | ||||
| 		  NULL, NULL, | ||||
| 		  _clutter_marshal_VOID__INT, | ||||
| 		  NULL, NULL, NULL, | ||||
| 		  G_TYPE_NONE, | ||||
| 		  1, G_TYPE_INT); | ||||
|   /** | ||||
| @@ -733,8 +732,7 @@ clutter_timeline_class_init (ClutterTimelineClass *klass) | ||||
| 		  G_TYPE_FROM_CLASS (object_class), | ||||
| 		  G_SIGNAL_RUN_LAST, | ||||
| 		  G_STRUCT_OFFSET (ClutterTimelineClass, completed), | ||||
| 		  NULL, NULL, | ||||
| 		  _clutter_marshal_VOID__VOID, | ||||
| 		  NULL, NULL, NULL, | ||||
| 		  G_TYPE_NONE, 0); | ||||
|   /** | ||||
|    * ClutterTimeline::started: | ||||
| @@ -750,8 +748,7 @@ clutter_timeline_class_init (ClutterTimelineClass *klass) | ||||
| 		  G_TYPE_FROM_CLASS (object_class), | ||||
| 		  G_SIGNAL_RUN_LAST, | ||||
| 		  G_STRUCT_OFFSET (ClutterTimelineClass, started), | ||||
| 		  NULL, NULL, | ||||
| 		  _clutter_marshal_VOID__VOID, | ||||
| 		  NULL, NULL, NULL, | ||||
| 		  G_TYPE_NONE, 0); | ||||
|   /** | ||||
|    * ClutterTimeline::paused: | ||||
| @@ -764,8 +761,7 @@ clutter_timeline_class_init (ClutterTimelineClass *klass) | ||||
| 		  G_TYPE_FROM_CLASS (object_class), | ||||
| 		  G_SIGNAL_RUN_LAST, | ||||
| 		  G_STRUCT_OFFSET (ClutterTimelineClass, paused), | ||||
| 		  NULL, NULL, | ||||
| 		  _clutter_marshal_VOID__VOID, | ||||
| 		  NULL, NULL, NULL, | ||||
| 		  G_TYPE_NONE, 0); | ||||
|   /** | ||||
|    * ClutterTimeline::marker-reached: | ||||
| @@ -832,8 +828,7 @@ clutter_timeline_class_init (ClutterTimelineClass *klass) | ||||
| 		  G_TYPE_FROM_CLASS (object_class), | ||||
| 		  G_SIGNAL_RUN_LAST, | ||||
| 		  G_STRUCT_OFFSET (ClutterTimelineClass, stopped), | ||||
| 		  NULL, NULL, | ||||
| 		  _clutter_marshal_VOID__BOOLEAN, | ||||
| 		  NULL, NULL, NULL, | ||||
| 		  G_TYPE_NONE, 1, | ||||
|                   G_TYPE_BOOLEAN); | ||||
| } | ||||
|   | ||||
| @@ -200,6 +200,9 @@ float                   clutter_point_distance  (const ClutterPoint *a, | ||||
|                                                  const ClutterPoint *b, | ||||
|                                                  float              *x_distance, | ||||
|                                                  float              *y_distance); | ||||
| CLUTTER_EXPORT | ||||
| gboolean clutter_point_inside_quadrilateral     (const ClutterPoint *point, | ||||
|                                                  const ClutterPoint *vertices); | ||||
|  | ||||
| /** | ||||
|  * ClutterSize: | ||||
|   | ||||
| @@ -172,6 +172,7 @@ void clutter_virtual_input_device_notify_touch_up (ClutterVirtualInputDevice *vi | ||||
| CLUTTER_EXPORT | ||||
| ClutterDeviceManager * clutter_virtual_input_device_get_manager (ClutterVirtualInputDevice *virtual_device); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| int clutter_virtual_input_device_get_device_type (ClutterVirtualInputDevice *virtual_device); | ||||
|  | ||||
| #endif /* __CLUTTER_VIRTUAL_INPUT_DEVICE_H__ */ | ||||
|   | ||||
| @@ -103,7 +103,6 @@ | ||||
| #include "clutter-stage-manager.h" | ||||
| #include "clutter-stage-view.h" | ||||
| #include "clutter-tap-action.h" | ||||
| #include "clutter-test-utils.h" | ||||
| #include "clutter-texture.h" | ||||
| #include "clutter-text.h" | ||||
| #include "clutter-timeline.h" | ||||
|   | ||||
| @@ -1004,55 +1004,6 @@ clutter_stage_cogl_redraw (ClutterStageWindow *stage_window) | ||||
|   COGL_TRACE_END (ClutterStageCoglRedraw); | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_stage_cogl_get_dirty_pixel (ClutterStageWindow *stage_window, | ||||
|                                     ClutterStageView   *view, | ||||
|                                     int                *x, | ||||
|                                     int                *y) | ||||
| { | ||||
|   CoglFramebuffer *framebuffer = clutter_stage_view_get_framebuffer (view); | ||||
|   gboolean has_buffer_age = | ||||
|     cogl_is_onscreen (framebuffer) && | ||||
|     is_buffer_age_enabled (); | ||||
|   float fb_scale; | ||||
|   gboolean scale_is_fractional; | ||||
|  | ||||
|   fb_scale = clutter_stage_view_get_scale (view); | ||||
|   if (fb_scale != floorf (fb_scale)) | ||||
|     scale_is_fractional = TRUE; | ||||
|   else | ||||
|     scale_is_fractional = FALSE; | ||||
|  | ||||
|   /* | ||||
|    * Buffer damage is tracked in the framebuffer coordinate space | ||||
|    * using the damage history. When fractional scaling is used, a | ||||
|    * coordinate on the stage might not correspond to the exact position of any | ||||
|    * physical pixel, which causes issues when painting using the pick mode. | ||||
|    * | ||||
|    * For now, always use the (0, 0) pixel for picking when using fractional | ||||
|    * framebuffer scaling. | ||||
|    */ | ||||
|   if (!has_buffer_age || scale_is_fractional) | ||||
|     { | ||||
|       *x = 0; | ||||
|       *y = 0; | ||||
|     } | ||||
|   else | ||||
|     { | ||||
|       ClutterStageViewCogl *view_cogl = CLUTTER_STAGE_VIEW_COGL (view); | ||||
|       ClutterStageViewCoglPrivate *view_priv = | ||||
|         clutter_stage_view_cogl_get_instance_private (view_cogl); | ||||
|       cairo_rectangle_int_t view_layout; | ||||
|       cairo_rectangle_int_t *fb_damage; | ||||
|  | ||||
|       clutter_stage_view_get_layout (view, &view_layout); | ||||
|  | ||||
|       fb_damage = &view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index - 1)]; | ||||
|       *x = fb_damage->x / fb_scale; | ||||
|       *y = fb_damage->y / fb_scale; | ||||
|     } | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_stage_window_iface_init (ClutterStageWindowInterface *iface) | ||||
| { | ||||
| @@ -1070,7 +1021,6 @@ clutter_stage_window_iface_init (ClutterStageWindowInterface *iface) | ||||
|   iface->ignoring_redraw_clips = clutter_stage_cogl_ignoring_redraw_clips; | ||||
|   iface->get_redraw_clip_bounds = clutter_stage_cogl_get_redraw_clip_bounds; | ||||
|   iface->redraw = clutter_stage_cogl_redraw; | ||||
|   iface->get_dirty_pixel = clutter_stage_cogl_get_dirty_pixel; | ||||
| } | ||||
|  | ||||
| static void | ||||
|   | ||||
| @@ -567,8 +567,7 @@ clutter_animation_class_init (ClutterAnimationClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (klass), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   G_STRUCT_OFFSET (ClutterAnimationClass, started), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__VOID, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 0); | ||||
|  | ||||
|   /** | ||||
| @@ -589,8 +588,7 @@ clutter_animation_class_init (ClutterAnimationClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (klass), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   G_STRUCT_OFFSET (ClutterAnimationClass, completed), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__VOID, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 0); | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -258,8 +258,7 @@ clutter_behaviour_class_init (ClutterBehaviourClass *klass) | ||||
| 		  G_OBJECT_CLASS_TYPE (object_class), | ||||
| 		  G_SIGNAL_RUN_FIRST, | ||||
| 		  G_STRUCT_OFFSET (ClutterBehaviourClass, applied), | ||||
| 		  NULL, NULL, | ||||
| 		  _clutter_marshal_VOID__OBJECT, | ||||
| 		  NULL, NULL, NULL, | ||||
| 		  G_TYPE_NONE, 1, | ||||
| 		  CLUTTER_TYPE_ACTOR); | ||||
|   /** | ||||
| @@ -279,8 +278,7 @@ clutter_behaviour_class_init (ClutterBehaviourClass *klass) | ||||
| 		  G_OBJECT_CLASS_TYPE (object_class), | ||||
| 		  G_SIGNAL_RUN_FIRST, | ||||
| 		  G_STRUCT_OFFSET (ClutterBehaviourClass, removed), | ||||
| 		  NULL, NULL, | ||||
| 		  _clutter_marshal_VOID__OBJECT, | ||||
| 		  NULL, NULL, NULL, | ||||
| 		  G_TYPE_NONE, 1, | ||||
| 		  CLUTTER_TYPE_ACTOR); | ||||
| } | ||||
|   | ||||
| @@ -1423,8 +1423,7 @@ clutter_state_class_init (ClutterStateClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (gobject_class), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   G_STRUCT_OFFSET (ClutterStateClass, completed), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__VOID, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 0); | ||||
|  | ||||
|   /** | ||||
|   | ||||
| @@ -572,83 +572,6 @@ gen_texcoords_and_draw_cogl_rectangle (ClutterActor    *self, | ||||
|                                             0, 0, t_w, t_h); | ||||
| } | ||||
|  | ||||
| static CoglPipeline * | ||||
| create_pick_pipeline (ClutterActor *self) | ||||
| { | ||||
|   ClutterTexture *texture = CLUTTER_TEXTURE (self); | ||||
|   ClutterTexturePrivate *priv = texture->priv; | ||||
|   CoglPipeline *pick_pipeline = cogl_pipeline_copy (texture_template_pipeline); | ||||
|   GError *error = NULL; | ||||
|  | ||||
|   if (!cogl_pipeline_set_layer_combine (pick_pipeline, 0, | ||||
|                                         "RGBA = " | ||||
|                                         "  MODULATE (CONSTANT, TEXTURE[A])", | ||||
|                                         &error)) | ||||
|     { | ||||
|       if (!priv->seen_create_pick_pipeline_warning) | ||||
|         g_warning ("Error setting up texture combine for shaped " | ||||
|                    "texture picking: %s", error->message); | ||||
|       priv->seen_create_pick_pipeline_warning = TRUE; | ||||
|       g_error_free (error); | ||||
|       cogl_object_unref (pick_pipeline); | ||||
|       return NULL; | ||||
|     } | ||||
|  | ||||
|   cogl_pipeline_set_blend (pick_pipeline, | ||||
|                            "RGBA = ADD (SRC_COLOR[RGBA], 0)", | ||||
|                            NULL); | ||||
|  | ||||
|   cogl_pipeline_set_alpha_test_function (pick_pipeline, | ||||
|                                          COGL_PIPELINE_ALPHA_FUNC_EQUAL, | ||||
|                                          1.0); | ||||
|  | ||||
|   return pick_pipeline; | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_texture_pick (ClutterActor       *self, | ||||
|                       const ClutterColor *color) | ||||
| { | ||||
|   ClutterTexture *texture = CLUTTER_TEXTURE (self); | ||||
|   ClutterTexturePrivate *priv = texture->priv; | ||||
|   CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer (); | ||||
|  | ||||
|   if (!clutter_actor_should_pick_paint (self)) | ||||
|     return; | ||||
|  | ||||
|   if (G_LIKELY (priv->pick_with_alpha_supported) && priv->pick_with_alpha) | ||||
|     { | ||||
|       CoglColor pick_color; | ||||
|  | ||||
|       if (priv->pick_pipeline == NULL) | ||||
|         priv->pick_pipeline = create_pick_pipeline (self); | ||||
|  | ||||
|       if (priv->pick_pipeline == NULL) | ||||
|         { | ||||
|           priv->pick_with_alpha_supported = FALSE; | ||||
|           CLUTTER_ACTOR_CLASS (clutter_texture_parent_class)->pick (self, | ||||
|                                                                     color); | ||||
|           return; | ||||
|         } | ||||
|  | ||||
|       if (priv->fbo_handle != NULL) | ||||
|         update_fbo (self); | ||||
|  | ||||
|       cogl_color_init_from_4ub (&pick_color, | ||||
|                                 color->red, | ||||
|                                 color->green, | ||||
|                                 color->blue, | ||||
|                                 0xff); | ||||
|       cogl_pipeline_set_layer_combine_constant (priv->pick_pipeline, | ||||
|                                                 0, &pick_color); | ||||
|       cogl_pipeline_set_layer_texture (priv->pick_pipeline, 0, | ||||
|                                        clutter_texture_get_cogl_texture (texture)); | ||||
|       gen_texcoords_and_draw_cogl_rectangle (self, priv->pick_pipeline, framebuffer); | ||||
|     } | ||||
|   else | ||||
|     CLUTTER_ACTOR_CLASS (clutter_texture_parent_class)->pick (self, color); | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_texture_paint (ClutterActor *self) | ||||
| { | ||||
| @@ -767,12 +690,6 @@ clutter_texture_dispose (GObject *object) | ||||
|       priv->pipeline = NULL; | ||||
|     } | ||||
|  | ||||
|   if (priv->pick_pipeline != NULL) | ||||
|     { | ||||
|       cogl_object_unref (priv->pick_pipeline); | ||||
|       priv->pick_pipeline = NULL; | ||||
|     } | ||||
|  | ||||
|   G_OBJECT_CLASS (clutter_texture_parent_class)->dispose (object); | ||||
| } | ||||
|  | ||||
| @@ -944,7 +861,6 @@ clutter_texture_class_init (ClutterTextureClass *klass) | ||||
|   GParamSpec *pspec; | ||||
|  | ||||
|   actor_class->paint            = clutter_texture_paint; | ||||
|   actor_class->pick             = clutter_texture_pick; | ||||
|   actor_class->get_paint_volume = clutter_texture_get_paint_volume; | ||||
|   actor_class->realize          = clutter_texture_realize; | ||||
|   actor_class->unrealize        = clutter_texture_unrealize; | ||||
| @@ -1166,8 +1082,7 @@ clutter_texture_class_init (ClutterTextureClass *klass) | ||||
| 		  G_TYPE_FROM_CLASS (gobject_class), | ||||
| 		  G_SIGNAL_RUN_LAST, | ||||
| 		  G_STRUCT_OFFSET (ClutterTextureClass, pixbuf_change), | ||||
| 		  NULL, NULL, | ||||
| 		  _clutter_marshal_VOID__VOID, | ||||
| 		  NULL, NULL, NULL, | ||||
| 		  G_TYPE_NONE, | ||||
| 		  0); | ||||
|   /** | ||||
| @@ -1188,8 +1103,7 @@ clutter_texture_class_init (ClutterTextureClass *klass) | ||||
| 		  G_TYPE_FROM_CLASS (gobject_class), | ||||
| 		  G_SIGNAL_RUN_LAST, | ||||
| 		  G_STRUCT_OFFSET (ClutterTextureClass, load_finished), | ||||
| 		  NULL, NULL, | ||||
| 		  _clutter_marshal_VOID__BOXED, | ||||
| 		  NULL, NULL, NULL, | ||||
| 		  G_TYPE_NONE, | ||||
| 		  1, | ||||
|                   G_TYPE_ERROR); | ||||
| @@ -1263,11 +1177,9 @@ clutter_texture_init (ClutterTexture *self) | ||||
|   priv->repeat_y          = FALSE; | ||||
|   priv->sync_actor_size   = TRUE; | ||||
|   priv->fbo_handle        = NULL; | ||||
|   priv->pick_pipeline     = NULL; | ||||
|   priv->keep_aspect_ratio = FALSE; | ||||
|   priv->pick_with_alpha   = FALSE; | ||||
|   priv->pick_with_alpha_supported = TRUE; | ||||
|   priv->seen_create_pick_pipeline_warning = FALSE; | ||||
|  | ||||
|   if (G_UNLIKELY (texture_template_pipeline == NULL)) | ||||
|     { | ||||
| @@ -1565,7 +1477,7 @@ clutter_texture_set_from_data (ClutterTexture     *texture, | ||||
|  | ||||
|       g_set_error (&inner_error, CLUTTER_TEXTURE_ERROR, | ||||
|                    CLUTTER_TEXTURE_ERROR_BAD_FORMAT, | ||||
|                    _("Failed to load the image data")); | ||||
|                    "Failed to load the image data"); | ||||
|  | ||||
|       g_signal_emit (texture, texture_signals[LOAD_FINISHED], 0, inner_error); | ||||
|  | ||||
| @@ -1724,7 +1636,7 @@ clutter_texture_set_from_yuv_data (ClutterTexture     *texture, | ||||
|     { | ||||
|       g_set_error (error, CLUTTER_TEXTURE_ERROR, | ||||
|                    CLUTTER_TEXTURE_ERROR_NO_YUV, | ||||
|                    _("YUV textures are not supported")); | ||||
|                    "YUV textures are not supported"); | ||||
|       return FALSE; | ||||
|     } | ||||
|  | ||||
| @@ -1733,7 +1645,7 @@ clutter_texture_set_from_yuv_data (ClutterTexture     *texture, | ||||
|     { | ||||
|       g_set_error (error, CLUTTER_TEXTURE_ERROR, | ||||
| 		   CLUTTER_TEXTURE_ERROR_BAD_FORMAT, | ||||
| 		   _("YUV2 textures are not supported")); | ||||
| 		   "YUV2 textures are not supported"); | ||||
|       return FALSE; | ||||
|     } | ||||
|  | ||||
| @@ -1960,7 +1872,7 @@ clutter_texture_async_load (ClutterTexture *self, | ||||
|     { | ||||
|       g_set_error (error, CLUTTER_TEXTURE_ERROR, | ||||
| 		   CLUTTER_TEXTURE_ERROR_BAD_FORMAT, | ||||
|                    _("Failed to load the image data")); | ||||
|                    "Failed to load the image data"); | ||||
|       return FALSE; | ||||
|     } | ||||
|   else | ||||
| @@ -2057,7 +1969,7 @@ clutter_texture_set_from_file (ClutterTexture *texture, | ||||
|     { | ||||
|       g_set_error (&internal_error, CLUTTER_TEXTURE_ERROR, | ||||
|                    CLUTTER_TEXTURE_ERROR_BAD_FORMAT, | ||||
| 		   _("Failed to load the image data")); | ||||
| 		   "Failed to load the image data"); | ||||
|     } | ||||
|  | ||||
|   if (internal_error != NULL) | ||||
| @@ -2359,7 +2271,7 @@ clutter_texture_set_area_from_rgb_data (ClutterTexture     *texture, | ||||
|     { | ||||
|       g_set_error (error, CLUTTER_TEXTURE_ERROR, | ||||
| 		   CLUTTER_TEXTURE_ERROR_BAD_FORMAT, | ||||
| 		   _("Failed to load the image data")); | ||||
| 		   "Failed to load the image data"); | ||||
|       return FALSE; | ||||
|     } | ||||
|  | ||||
| @@ -3050,13 +2962,8 @@ clutter_texture_set_pick_with_alpha (ClutterTexture *texture, | ||||
|   if (priv->pick_with_alpha == pick_with_alpha) | ||||
|     return; | ||||
|  | ||||
|   if (!pick_with_alpha && priv->pick_pipeline != NULL) | ||||
|     { | ||||
|       cogl_object_unref (priv->pick_pipeline); | ||||
|       priv->pick_pipeline = NULL; | ||||
|     } | ||||
|   g_assert (!pick_with_alpha);  /* No longer supported */ | ||||
|  | ||||
|   /* NB: the pick pipeline is created lazily when we first pick */ | ||||
|   priv->pick_with_alpha = pick_with_alpha; | ||||
|  | ||||
|   /* NB: actors are expected to call clutter_actor_queue_redraw when | ||||
|   | ||||
| @@ -40,10 +40,6 @@ | ||||
| /* This is a Cogl based backend */ | ||||
| #include "cogl/clutter-stage-cogl.h" | ||||
|  | ||||
| #ifdef HAVE_EVDEV | ||||
| #include "evdev/clutter-device-manager-evdev.h" | ||||
| #endif | ||||
|  | ||||
| #include "clutter-debug.h" | ||||
| #include "clutter-private.h" | ||||
| #include "clutter-main.h" | ||||
|   | ||||
| @@ -1,108 +0,0 @@ | ||||
| /* | ||||
|  * Clutter. | ||||
|  * | ||||
|  * An OpenGL based 'interactive canvas' library. | ||||
|  * | ||||
|  * Copyright (C) 2010  Intel Corp. | ||||
|  * | ||||
|  * This library is free software; you can redistribute it and/or | ||||
|  * modify it under the terms of the GNU Lesser General Public | ||||
|  * License as published by the Free Software Foundation; either | ||||
|  * version 2 of the License, or (at your option) any later version. | ||||
|  * | ||||
|  * This library is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||
|  * Lesser General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU Lesser General Public | ||||
|  * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||||
|  * | ||||
|  * Author: Damien Lespiau <damien.lespiau@intel.com> | ||||
|  */ | ||||
|  | ||||
| #ifndef __CLUTTER_DEVICE_MANAGER_EVDEV_H__ | ||||
| #define __CLUTTER_DEVICE_MANAGER_EVDEV_H__ | ||||
|  | ||||
| #include <clutter/clutter-backend.h> | ||||
| #include <clutter/clutter-device-manager.h> | ||||
|  | ||||
| G_BEGIN_DECLS | ||||
|  | ||||
| #define CLUTTER_TYPE_DEVICE_MANAGER_EVDEV            (clutter_device_manager_evdev_get_type ()) | ||||
| #define CLUTTER_DEVICE_MANAGER_EVDEV(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_DEVICE_MANAGER_EVDEV, ClutterDeviceManagerEvdev)) | ||||
| #define CLUTTER_IS_DEVICE_MANAGER_EVDEV(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_DEVICE_MANAGER_EVDEV)) | ||||
| #define CLUTTER_DEVICE_MANAGER_EVDEV_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_DEVICE_MANAGER_EVDEV, ClutterDeviceManagerEvdevClass)) | ||||
| #define CLUTTER_IS_DEVICE_MANAGER_EVDEV_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_DEVICE_MANAGER_EVDEV)) | ||||
| #define CLUTTER_DEVICE_MANAGER_EVDEV_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_DEVICE_MANAGER_EVDEV, ClutterDeviceManagerEvdevClass)) | ||||
|  | ||||
| typedef struct _ClutterDeviceManagerEvdev         ClutterDeviceManagerEvdev; | ||||
| typedef struct _ClutterDeviceManagerEvdevClass    ClutterDeviceManagerEvdevClass; | ||||
| typedef struct _ClutterDeviceManagerEvdevPrivate  ClutterDeviceManagerEvdevPrivate; | ||||
|  | ||||
| typedef struct _ClutterSeatEvdev ClutterSeatEvdev; | ||||
|  | ||||
| struct _ClutterDeviceManagerEvdev | ||||
| { | ||||
|   ClutterDeviceManager parent_instance; | ||||
|  | ||||
|   ClutterDeviceManagerEvdevPrivate *priv; | ||||
| }; | ||||
|  | ||||
| struct _ClutterDeviceManagerEvdevClass | ||||
| { | ||||
|   ClutterDeviceManagerClass parent_class; | ||||
| }; | ||||
|  | ||||
| GType clutter_device_manager_evdev_get_type (void) G_GNUC_CONST; | ||||
|  | ||||
| void  _clutter_events_evdev_init            (ClutterBackend *backend); | ||||
| void  _clutter_events_evdev_uninit          (ClutterBackend *backend); | ||||
|  | ||||
| gint  _clutter_device_manager_evdev_acquire_device_id (ClutterDeviceManagerEvdev *manager_evdev); | ||||
|  | ||||
| void  _clutter_device_manager_evdev_release_device_id (ClutterDeviceManagerEvdev *manager_evdev, | ||||
|                                                        ClutterInputDevice        *device); | ||||
|  | ||||
| ClutterStage * _clutter_device_manager_evdev_get_stage (ClutterDeviceManagerEvdev *manager_evdev); | ||||
|  | ||||
| void _clutter_device_manager_evdev_constrain_pointer (ClutterDeviceManagerEvdev *manager_evdev, | ||||
|                                                       ClutterInputDevice        *core_pointer, | ||||
|                                                       uint64_t                   time_us, | ||||
|                                                       float                      x, | ||||
|                                                       float                      y, | ||||
|                                                       float                     *new_x, | ||||
|                                                       float                     *new_y); | ||||
|  | ||||
| void _clutter_device_manager_evdev_filter_relative_motion (ClutterDeviceManagerEvdev *manager_evdev, | ||||
|                                                            ClutterInputDevice        *device, | ||||
|                                                            float                      x, | ||||
|                                                            float                      y, | ||||
|                                                            float                     *dx, | ||||
|                                                            float                     *dy); | ||||
|  | ||||
| void _clutter_device_manager_evdev_dispatch (ClutterDeviceManagerEvdev *manager_evdev); | ||||
|  | ||||
| struct xkb_state * _clutter_device_manager_evdev_get_xkb_state (ClutterDeviceManagerEvdev *manager_evdev); | ||||
|  | ||||
| static inline guint64 | ||||
| us (guint64 us) | ||||
| { | ||||
|   return us; | ||||
| } | ||||
|  | ||||
| static inline guint64 | ||||
| ms2us (guint64 ms) | ||||
| { | ||||
|   return us (ms * 1000); | ||||
| } | ||||
|  | ||||
| static inline guint32 | ||||
| us2ms (guint64 us) | ||||
| { | ||||
|   return (guint32) (us / 1000); | ||||
| } | ||||
|  | ||||
| G_END_DECLS | ||||
|  | ||||
| #endif /* __CLUTTER_DEVICE_MANAGER_EVDEV_H__ */ | ||||
| @@ -1,181 +0,0 @@ | ||||
| /* | ||||
|  * Clutter. | ||||
|  * | ||||
|  * An OpenGL based 'interactive canvas' library. | ||||
|  * | ||||
|  * Copyright (C) 2012  Intel Corp. | ||||
|  * | ||||
|  * This library is free software; you can redistribute it and/or | ||||
|  * modify it under the terms of the GNU Lesser General Public | ||||
|  * License as published by the Free Software Foundation; either | ||||
|  * version 2 of the License, or (at your option) any later version. | ||||
|  * | ||||
|  * This library is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||
|  * Lesser General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU Lesser General Public | ||||
|  * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||||
|  * | ||||
|  * | ||||
|  */ | ||||
|  | ||||
| #ifndef __CLUTTER_EVDEV_H__ | ||||
| #define __CLUTTER_EVDEV_H__ | ||||
|  | ||||
| #include <glib.h> | ||||
| #include <glib-object.h> | ||||
| #include <xkbcommon/xkbcommon.h> | ||||
| #include <clutter/clutter.h> | ||||
| #include <libinput.h> | ||||
|  | ||||
| G_BEGIN_DECLS | ||||
|  | ||||
| #if !defined(CLUTTER_ENABLE_COMPOSITOR_API) && !defined(CLUTTER_COMPILATION) | ||||
| #error "You need to define CLUTTER_ENABLE_COMPOSITOR_API before including clutter-evdev.h" | ||||
| #endif | ||||
|  | ||||
| /** | ||||
|  * ClutterOpenDeviceCallback: | ||||
|  * @path: the device path | ||||
|  * @flags: flags to be passed to open | ||||
|  * | ||||
|  * This callback will be called when Clutter needs to access an input | ||||
|  * device. It should return an open file descriptor for the file at @path, | ||||
|  * or -1 if opening failed. | ||||
|  */ | ||||
| typedef int (*ClutterOpenDeviceCallback) (const char  *path, | ||||
| 					  int          flags, | ||||
| 					  gpointer     user_data, | ||||
| 					  GError     **error); | ||||
| typedef void (*ClutterCloseDeviceCallback) (int          fd, | ||||
| 					    gpointer     user_data); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void  clutter_evdev_set_device_callbacks (ClutterOpenDeviceCallback  open_callback, | ||||
|                                           ClutterCloseDeviceCallback close_callback, | ||||
|                                           gpointer                   user_data); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void  clutter_evdev_set_seat_id (const gchar *seat_id); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void  clutter_evdev_release_devices (void); | ||||
| CLUTTER_EXPORT | ||||
| void  clutter_evdev_reclaim_devices (void); | ||||
|  | ||||
| /** | ||||
|  * ClutterPointerConstrainCallback: | ||||
|  * @device: the core pointer device | ||||
|  * @time: the event time in milliseconds | ||||
|  * @x: (inout): the new X coordinate | ||||
|  * @y: (inout): the new Y coordinate | ||||
|  * @user_data: user data passed to this function | ||||
|  * | ||||
|  * This callback will be called for all pointer motion events, and should | ||||
|  * update (@x, @y) to constrain the pointer position appropriately. | ||||
|  * The subsequent motion event will use the updated values as the new coordinates. | ||||
|  * Note that the coordinates are not clamped to the stage size, and the callback | ||||
|  * must make sure that this happens before it returns. | ||||
|  * Also note that the event will be emitted even if the pointer is constrained | ||||
|  * to be in the same position. | ||||
|  * | ||||
|  * Since: 1.16 | ||||
|  */ | ||||
| typedef void (*ClutterPointerConstrainCallback) (ClutterInputDevice *device, | ||||
| 						 guint32             time, | ||||
| 						 float               prev_x, | ||||
| 						 float               prev_y, | ||||
| 						 float              *x, | ||||
| 						 float              *y, | ||||
| 						 gpointer            user_data); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void  clutter_evdev_set_pointer_constrain_callback (ClutterDeviceManager            *evdev, | ||||
| 						    ClutterPointerConstrainCallback  callback, | ||||
| 						    gpointer                         user_data, | ||||
| 						    GDestroyNotify                   user_data_notify); | ||||
|  | ||||
| typedef void (*ClutterRelativeMotionFilter) (ClutterInputDevice *device, | ||||
|                                              float               x, | ||||
|                                              float               y, | ||||
|                                              float              *dx, | ||||
|                                              float              *dy, | ||||
|                                              gpointer            user_data); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void clutter_evdev_set_relative_motion_filter (ClutterDeviceManager       *evdev, | ||||
|                                                ClutterRelativeMotionFilter filter, | ||||
|                                                gpointer                    user_data); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void               clutter_evdev_set_keyboard_map   (ClutterDeviceManager *evdev, | ||||
| 						     struct xkb_keymap    *keymap); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| struct xkb_keymap * clutter_evdev_get_keyboard_map (ClutterDeviceManager *evdev); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void clutter_evdev_set_keyboard_layout_index (ClutterDeviceManager *evdev, | ||||
|                                               xkb_layout_index_t    idx); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| xkb_layout_index_t clutter_evdev_get_keyboard_layout_index (ClutterDeviceManager *evdev); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void clutter_evdev_set_keyboard_numlock (ClutterDeviceManager *evdev, | ||||
|                                          gboolean              numlock_state); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void clutter_evdev_set_keyboard_repeat (ClutterDeviceManager *evdev, | ||||
|                                         gboolean              repeat, | ||||
|                                         guint32               delay, | ||||
|                                         guint32               interval); | ||||
|  | ||||
| typedef gboolean (* ClutterEvdevFilterFunc) (struct libinput_event *event, | ||||
|                                              gpointer               data); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void clutter_evdev_add_filter    (ClutterEvdevFilterFunc func, | ||||
|                                   gpointer               data, | ||||
|                                   GDestroyNotify         destroy_notify); | ||||
| CLUTTER_EXPORT | ||||
| void clutter_evdev_remove_filter (ClutterEvdevFilterFunc func, | ||||
|                                   gpointer               data); | ||||
| CLUTTER_EXPORT | ||||
| struct libinput_device * clutter_evdev_input_device_get_libinput_device (ClutterInputDevice *device); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| gint32 clutter_evdev_event_sequence_get_slot (const ClutterEventSequence *sequence); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void clutter_evdev_warp_pointer (ClutterInputDevice   *pointer_device, | ||||
|                                  guint32               time_, | ||||
|                                  int                   x, | ||||
|                                  int                   y); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| guint32 clutter_evdev_event_get_event_code (const ClutterEvent *event); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| guint64 clutter_evdev_event_get_time_usec (const ClutterEvent *event); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| gboolean clutter_evdev_event_get_relative_motion (const ClutterEvent *event, | ||||
|                                                   double             *dx, | ||||
|                                                   double             *dy, | ||||
|                                                   double             *dx_unaccel, | ||||
|                                                   double             *dy_unaccel); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void clutter_evdev_input_device_tool_set_pressure_curve (ClutterInputDeviceTool *tool, | ||||
|                                                          gdouble                 curve[4]); | ||||
| CLUTTER_EXPORT | ||||
| void clutter_evdev_input_device_tool_set_button_code    (ClutterInputDeviceTool *tool, | ||||
|                                                          guint                   button, | ||||
|                                                          guint                   evcode); | ||||
|  | ||||
| G_END_DECLS | ||||
|  | ||||
| #endif /* __CLUTTER_EVDEV_H__ */ | ||||
| @@ -1,191 +0,0 @@ | ||||
| /* Clutter. | ||||
|  * An OpenGL based 'interactive canvas' library. | ||||
|  * | ||||
|  * Copyright (C) 2015 Red Hat | ||||
|  * | ||||
|  * This library is free software; you can redistribute it and/or | ||||
|  * modify it under the terms of the GNU Lesser General Public | ||||
|  * License as published by the Free Software Foundation; either | ||||
|  * version 2 of the License, or (at your option) any later version. | ||||
|  * | ||||
|  * This library is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||
|  * Lesser General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU Lesser General Public | ||||
|  * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||||
|  * | ||||
|  * Authored by: | ||||
|  *      Carlos Garnacho <carlosg@gnome.org> | ||||
|  */ | ||||
|  | ||||
| #include "clutter-build-config.h" | ||||
|  | ||||
| #include "clutter/clutter-device-manager-private.h" | ||||
| #include "clutter/clutter-event-private.h" | ||||
| #include "clutter-input-device-evdev.h" | ||||
| #include "clutter-evdev.h" | ||||
|  | ||||
| typedef struct _ClutterEventEvdev ClutterEventEvdev; | ||||
|  | ||||
| struct _ClutterEventEvdev | ||||
| { | ||||
|   guint32 evcode; | ||||
|  | ||||
|   guint64 time_usec; | ||||
|  | ||||
|   gboolean has_relative_motion; | ||||
|   double dx; | ||||
|   double dy; | ||||
|   double dx_unaccel; | ||||
|   double dy_unaccel; | ||||
| }; | ||||
|  | ||||
| static ClutterEventEvdev * | ||||
| _clutter_event_evdev_new (void) | ||||
| { | ||||
|   return g_slice_new0 (ClutterEventEvdev); | ||||
| } | ||||
|  | ||||
| ClutterEventEvdev * | ||||
| _clutter_event_evdev_copy (ClutterEventEvdev *event_evdev) | ||||
| { | ||||
|   if (event_evdev != NULL) | ||||
|     return g_slice_dup (ClutterEventEvdev, event_evdev); | ||||
|  | ||||
|   return NULL; | ||||
| } | ||||
|  | ||||
| void | ||||
| _clutter_event_evdev_free (ClutterEventEvdev *event_evdev) | ||||
| { | ||||
|   if (event_evdev != NULL) | ||||
|     g_slice_free (ClutterEventEvdev, event_evdev); | ||||
| } | ||||
|  | ||||
| static ClutterEventEvdev * | ||||
| clutter_evdev_event_ensure_platform_data (ClutterEvent *event) | ||||
| { | ||||
|   ClutterEventEvdev *event_evdev = _clutter_event_get_platform_data (event); | ||||
|  | ||||
|   if (!event_evdev) | ||||
|     { | ||||
|       event_evdev = _clutter_event_evdev_new (); | ||||
|       _clutter_event_set_platform_data (event, event_evdev); | ||||
|     } | ||||
|  | ||||
|   return event_evdev; | ||||
| } | ||||
|  | ||||
| void | ||||
| _clutter_evdev_event_set_event_code (ClutterEvent *event, | ||||
|                                      guint32       evcode) | ||||
| { | ||||
|   ClutterEventEvdev *event_evdev; | ||||
|  | ||||
|   event_evdev = clutter_evdev_event_ensure_platform_data (event); | ||||
|   event_evdev->evcode = evcode; | ||||
| } | ||||
|  | ||||
| void | ||||
| _clutter_evdev_event_set_time_usec       (ClutterEvent *event, | ||||
|                                           guint64       time_usec) | ||||
| { | ||||
|   ClutterEventEvdev *event_evdev; | ||||
|  | ||||
|   event_evdev = clutter_evdev_event_ensure_platform_data (event); | ||||
|   event_evdev->time_usec = time_usec; | ||||
| } | ||||
|  | ||||
| void | ||||
| _clutter_evdev_event_set_relative_motion (ClutterEvent *event, | ||||
|                                           double        dx, | ||||
|                                           double        dy, | ||||
|                                           double        dx_unaccel, | ||||
|                                           double        dy_unaccel) | ||||
| { | ||||
|   ClutterEventEvdev *event_evdev; | ||||
|  | ||||
|   event_evdev = clutter_evdev_event_ensure_platform_data (event); | ||||
|   event_evdev->dx = dx; | ||||
|   event_evdev->dy = dy; | ||||
|   event_evdev->dx_unaccel = dx_unaccel; | ||||
|   event_evdev->dy_unaccel = dy_unaccel; | ||||
|   event_evdev->has_relative_motion = TRUE; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_evdev_event_get_event_code: | ||||
|  * @event: a #ClutterEvent | ||||
|  * | ||||
|  * Returns the event code of the original event. See linux/input.h for more | ||||
|  * information. | ||||
|  * | ||||
|  * Returns: The event code. | ||||
|  **/ | ||||
| guint32 | ||||
| clutter_evdev_event_get_event_code (const ClutterEvent *event) | ||||
| { | ||||
|   ClutterEventEvdev *event_evdev = _clutter_event_get_platform_data (event); | ||||
|  | ||||
|   if (event_evdev) | ||||
|     return event_evdev->evcode; | ||||
|  | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_evdev_event_get_time_usec: | ||||
|  * @event: a #ClutterEvent | ||||
|  * | ||||
|  * Returns the time in microsecond granularity, or 0 if unavailable. | ||||
|  * | ||||
|  * Returns: The time in microsecond granularity, or 0 if unavailable. | ||||
|  */ | ||||
| guint64 | ||||
| clutter_evdev_event_get_time_usec (const ClutterEvent *event) | ||||
| { | ||||
|   ClutterEventEvdev *event_evdev = _clutter_event_get_platform_data (event); | ||||
|  | ||||
|   if (event_evdev) | ||||
|     return event_evdev->time_usec; | ||||
|  | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_evdev_event_get_pointer_motion | ||||
|  * @event: a #ClutterEvent | ||||
|  * | ||||
|  * If available, the normal and unaccelerated motion deltas are written | ||||
|  * to the dx, dy, dx_unaccel and dy_unaccel and TRUE is returned. | ||||
|  * | ||||
|  * If unavailable, FALSE is returned. | ||||
|  * | ||||
|  * Returns: TRUE on success, otherwise FALSE. | ||||
|  **/ | ||||
| gboolean | ||||
| clutter_evdev_event_get_relative_motion (const ClutterEvent *event, | ||||
|                                          double             *dx, | ||||
|                                          double             *dy, | ||||
|                                          double             *dx_unaccel, | ||||
|                                          double             *dy_unaccel) | ||||
| { | ||||
|   ClutterEventEvdev *event_evdev = _clutter_event_get_platform_data (event); | ||||
|  | ||||
|   if (event_evdev && event_evdev->has_relative_motion) | ||||
|     { | ||||
|       if (dx) | ||||
|         *dx = event_evdev->dx; | ||||
|       if (dy) | ||||
|         *dy = event_evdev->dy; | ||||
|       if (dx_unaccel) | ||||
|         *dx_unaccel = event_evdev->dx_unaccel; | ||||
|       if (dy_unaccel) | ||||
|         *dy_unaccel = event_evdev->dy_unaccel; | ||||
|       return TRUE; | ||||
|     } | ||||
|   else | ||||
|     return FALSE; | ||||
| } | ||||
| @@ -1,157 +0,0 @@ | ||||
| /* | ||||
|  * Clutter. | ||||
|  * | ||||
|  * An OpenGL based 'interactive canvas' library. | ||||
|  * | ||||
|  * Copyright (C) 2010 Intel Corp. | ||||
|  * Copyright (C) 2014 Jonas Ådahl | ||||
|  * | ||||
|  * This library is free software; you can redistribute it and/or | ||||
|  * modify it under the terms of the GNU Lesser General Public | ||||
|  * License as published by the Free Software Foundation; either | ||||
|  * version 2 of the License, or (at your option) any later version. | ||||
|  * | ||||
|  * This library is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||
|  * Lesser General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU Lesser General Public | ||||
|  * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||||
|  * | ||||
|  * Author: Damien Lespiau <damien.lespiau@intel.com> | ||||
|  * Author: Jonas Ådahl <jadahl@gmail.com> | ||||
|  */ | ||||
|  | ||||
| #ifndef __CLUTTER_INPUT_DEVICE_EVDEV_H__ | ||||
| #define __CLUTTER_INPUT_DEVICE_EVDEV_H__ | ||||
|  | ||||
| #include <glib-object.h> | ||||
| #include <libinput.h> | ||||
|  | ||||
| #include "clutter/clutter-device-manager-private.h" | ||||
| #include "evdev/clutter-seat-evdev.h" | ||||
|  | ||||
| G_BEGIN_DECLS | ||||
|  | ||||
| #define CLUTTER_TYPE_INPUT_DEVICE_EVDEV _clutter_input_device_evdev_get_type() | ||||
|  | ||||
| #define CLUTTER_INPUT_DEVICE_EVDEV(obj) \ | ||||
|   (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ | ||||
|   CLUTTER_TYPE_INPUT_DEVICE_EVDEV, ClutterInputDeviceEvdev)) | ||||
|  | ||||
| #define CLUTTER_INPUT_DEVICE_EVDEV_CLASS(klass) \ | ||||
|   (G_TYPE_CHECK_CLASS_CAST ((klass), \ | ||||
|   CLUTTER_TYPE_INPUT_DEVICE_EVDEV, ClutterInputDeviceEvdevClass)) | ||||
|  | ||||
| #define CLUTTER_IS_INPUT_DEVICE_EVDEV(obj) \ | ||||
|   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ | ||||
|   CLUTTER_TYPE_INPUT_DEVICE_EVDEV)) | ||||
|  | ||||
| #define CLUTTER_IS_INPUT_DEVICE_EVDEV_CLASS(klass) \ | ||||
|   (G_TYPE_CHECK_CLASS_TYPE ((klass), \ | ||||
|   CLUTTER_TYPE_INPUT_DEVICE_EVDEV)) | ||||
|  | ||||
| #define CLUTTER_INPUT_DEVICE_EVDEV_GET_CLASS(obj) \ | ||||
|   (G_TYPE_INSTANCE_GET_CLASS ((obj), \ | ||||
|   CLUTTER_TYPE_INPUT_DEVICE_EVDEV, ClutterInputDeviceEvdevClass)) | ||||
|  | ||||
| typedef struct _ClutterInputDeviceEvdev ClutterInputDeviceEvdev; | ||||
| typedef struct _ClutterEventEvdev ClutterEventEvdev; | ||||
|  | ||||
| struct _ClutterInputDeviceEvdev | ||||
| { | ||||
|   ClutterInputDevice parent; | ||||
|  | ||||
|   struct libinput_device *libinput_device; | ||||
|   ClutterSeatEvdev *seat; | ||||
|   ClutterInputDeviceTool *last_tool; | ||||
|  | ||||
|   cairo_matrix_t device_matrix; | ||||
|   gdouble device_aspect_ratio; /* w:h */ | ||||
|   gdouble output_ratio;        /* w:h */ | ||||
|  | ||||
|   GHashTable *touches; | ||||
|  | ||||
|   /* Keyboard a11y */ | ||||
|   ClutterKeyboardA11yFlags a11y_flags; | ||||
|   GList *slow_keys_list; | ||||
|   guint debounce_timer; | ||||
|   guint16 debounce_key; | ||||
|   xkb_mod_mask_t stickykeys_depressed_mask; | ||||
|   xkb_mod_mask_t stickykeys_latched_mask; | ||||
|   xkb_mod_mask_t stickykeys_locked_mask; | ||||
|   guint toggle_slowkeys_timer; | ||||
|   guint16 shift_count; | ||||
|   guint32 last_shift_time; | ||||
|   gint mousekeys_btn; | ||||
|   gboolean mousekeys_btn_states[3]; | ||||
|   guint32 mousekeys_first_motion_time; /* ms */ | ||||
|   guint32 mousekeys_last_motion_time; /* ms */ | ||||
|   guint mousekeys_init_delay; | ||||
|   guint mousekeys_accel_time; | ||||
|   guint mousekeys_max_speed; | ||||
|   gdouble mousekeys_curve_factor; | ||||
|   guint move_mousekeys_timer; | ||||
|   guint16 last_mousekeys_key; | ||||
| }; | ||||
|  | ||||
| GType                     _clutter_input_device_evdev_get_type        (void) G_GNUC_CONST; | ||||
|  | ||||
| ClutterInputDevice *      _clutter_input_device_evdev_new             (ClutterDeviceManager    *manager, | ||||
|                                                                        ClutterSeatEvdev        *seat, | ||||
|                                                                        struct libinput_device  *libinput_device); | ||||
|  | ||||
| ClutterInputDevice *      _clutter_input_device_evdev_new_virtual     (ClutterDeviceManager    *manager, | ||||
|                                                                        ClutterSeatEvdev        *seat, | ||||
|                                                                        ClutterInputDeviceType   type, | ||||
|                                                                        ClutterInputMode         mode); | ||||
|  | ||||
| ClutterSeatEvdev *        _clutter_input_device_evdev_get_seat        (ClutterInputDeviceEvdev *device); | ||||
|  | ||||
| void                      _clutter_input_device_evdev_update_leds     (ClutterInputDeviceEvdev *device, | ||||
|                                                                        enum libinput_led        leds); | ||||
|  | ||||
| ClutterInputDeviceType    _clutter_input_device_evdev_determine_type  (struct libinput_device  *libinput_device); | ||||
|  | ||||
|  | ||||
| ClutterEventEvdev *       _clutter_event_evdev_copy                   (ClutterEventEvdev *event_evdev); | ||||
| void                      _clutter_event_evdev_free                   (ClutterEventEvdev *event_evdev); | ||||
|  | ||||
| void                      _clutter_evdev_event_set_event_code         (ClutterEvent      *event, | ||||
|                                                                        guint32            evcode); | ||||
|  | ||||
| void                      _clutter_evdev_event_set_time_usec       (ClutterEvent *event, | ||||
| 								    guint64       time_usec); | ||||
|  | ||||
| void  			  _clutter_evdev_event_set_relative_motion (ClutterEvent *event, | ||||
| 								    double        dx, | ||||
| 								    double        dy, | ||||
| 								    double        dx_unaccel, | ||||
| 								    double        dy_unaccel); | ||||
|  | ||||
| void                      clutter_input_device_evdev_translate_coordinates (ClutterInputDevice *device, | ||||
|                                                                             ClutterStage       *stage, | ||||
|                                                                             gfloat             *x, | ||||
|                                                                             gfloat             *y); | ||||
|  | ||||
| void                      clutter_input_device_evdev_apply_kbd_a11y_settings (ClutterInputDeviceEvdev *device, | ||||
|                                                                               ClutterKbdA11ySettings  *settings); | ||||
|  | ||||
| ClutterTouchState *       clutter_input_device_evdev_acquire_touch_state (ClutterInputDeviceEvdev *device, | ||||
|                                                                           int                      device_slot); | ||||
|  | ||||
| ClutterTouchState *       clutter_input_device_evdev_lookup_touch_state (ClutterInputDeviceEvdev *device, | ||||
|                                                                          int                      device_slot); | ||||
|  | ||||
| void                      clutter_input_device_evdev_release_touch_state (ClutterInputDeviceEvdev *device, | ||||
|                                                                           ClutterTouchState       *touch_state); | ||||
|  | ||||
| void                      clutter_input_device_evdev_release_touch_slots (ClutterInputDeviceEvdev *device_evdev, | ||||
|                                                                           uint64_t                 time_us); | ||||
|  | ||||
| void                      clutter_evdev_a11y_maybe_notify_toggle_keys  (ClutterInputDeviceEvdev *); | ||||
|  | ||||
| G_END_DECLS | ||||
|  | ||||
| #endif /* __CLUTTER_INPUT_DEVICE_EVDEV_H__ */ | ||||
| @@ -1,84 +0,0 @@ | ||||
| /* | ||||
|  * Clutter. | ||||
|  * | ||||
|  * An OpenGL based 'interactive canvas' library. | ||||
|  * | ||||
|  * Copyright © 2009, 2010, 2011  Intel Corp. | ||||
|  * | ||||
|  * This library is free software; you can redistribute it and/or | ||||
|  * modify it under the terms of the GNU Lesser General Public | ||||
|  * License as published by the Free Software Foundation; either | ||||
|  * version 2 of the License, or (at your option) any later version. | ||||
|  * | ||||
|  * This library is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||
|  * Lesser General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU Lesser General Public | ||||
|  * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||||
|  * | ||||
|  * Author: Carlos Garnacho <carlosg@gnome.org> | ||||
|  */ | ||||
|  | ||||
| #ifndef __CLUTTER_INPUT_DEVICE_EVDEV_TOOL_H__ | ||||
| #define __CLUTTER_INPUT_DEVICE_EVDEV_TOOL_H__ | ||||
|  | ||||
| #include <libinput.h> | ||||
|  | ||||
| #include <clutter/clutter-input-device-tool.h> | ||||
|  | ||||
| G_BEGIN_DECLS | ||||
|  | ||||
| #define CLUTTER_TYPE_INPUT_DEVICE_TOOL_EVDEV (clutter_input_device_tool_evdev_get_type ()) | ||||
|  | ||||
| #define CLUTTER_INPUT_DEVICE_TOOL_EVDEV(o) \ | ||||
|   (G_TYPE_CHECK_INSTANCE_CAST ((o), \ | ||||
|   CLUTTER_TYPE_INPUT_DEVICE_TOOL_EVDEV, ClutterInputDeviceToolEvdev)) | ||||
|  | ||||
| #define CLUTTER_IS_INPUT_DEVICE_TOOL_EVDEV(o) \ | ||||
|   (G_TYPE_CHECK_INSTANCE_TYPE ((o), \ | ||||
|   CLUTTER_TYPE_INPUT_DEVICE_TOOL_EVDEV)) | ||||
|  | ||||
| #define CLUTTER_INPUT_DEVICE_TOOL_EVDEV_CLASS(c) \ | ||||
|   (G_TYPE_CHECK_CLASS_CAST ((c), \ | ||||
|   CLUTTER_TYPE_INPUT_DEVICE_TOOL_EVDEV, ClutterInputDeviceToolEvdevClass)) | ||||
|  | ||||
| #define CLUTTER_IS_INPUT_DEVICE_TOOL_EVDEV_CLASS(c) \ | ||||
|   (G_TYPE_CHECK_CLASS_TYPE ((c), \ | ||||
|   CLUTTER_TYPE_INPUT_DEVICE_TOOL_EVDEV)) | ||||
|  | ||||
| #define CLUTTER_INPUT_DEVICE_TOOL_EVDEV_GET_CLASS(o) \ | ||||
|   (G_TYPE_INSTANCE_GET_CLASS ((o), \ | ||||
|   CLUTTER_TYPE_INPUT_DEVICE_TOOL_EVDEV, ClutterInputDeviceToolEvdevClass)) | ||||
|  | ||||
| typedef struct _ClutterInputDeviceToolEvdev ClutterInputDeviceToolEvdev; | ||||
| typedef struct _ClutterInputDeviceToolEvdevClass ClutterInputDeviceToolEvdevClass; | ||||
|  | ||||
| struct _ClutterInputDeviceToolEvdev | ||||
| { | ||||
|   ClutterInputDeviceTool parent_instance; | ||||
|   struct libinput_tablet_tool *tool; | ||||
|   GHashTable *button_map; | ||||
|   gdouble pressure_curve[4]; | ||||
| }; | ||||
|  | ||||
| struct _ClutterInputDeviceToolEvdevClass | ||||
| { | ||||
|   ClutterInputDeviceToolClass parent_class; | ||||
| }; | ||||
|  | ||||
| GType                    clutter_input_device_tool_evdev_get_type (void) G_GNUC_CONST; | ||||
|  | ||||
| ClutterInputDeviceTool * clutter_input_device_tool_evdev_new      (struct libinput_tablet_tool *tool, | ||||
|                                                                    guint64                      serial, | ||||
|                                                                    ClutterInputDeviceToolType   type); | ||||
|  | ||||
| gdouble                  clutter_input_device_tool_evdev_translate_pressure (ClutterInputDeviceTool *tool, | ||||
|                                                                              gdouble                 pressure); | ||||
| guint                    clutter_input_device_tool_evdev_get_button_code    (ClutterInputDeviceTool *tool, | ||||
|                                                                              guint                   button); | ||||
|  | ||||
| G_END_DECLS | ||||
|  | ||||
| #endif /* __CLUTTER_INPUT_DEVICE_EVDEV_TOOL_H__ */ | ||||
| @@ -1,163 +0,0 @@ | ||||
| /* | ||||
|  * Clutter. | ||||
|  * | ||||
|  * An OpenGL based 'interactive canvas' library. | ||||
|  * | ||||
|  * Copyright (C) 2010  Intel Corp. | ||||
|  * Copyright (C) 2014  Jonas Ådahl | ||||
|  * Copyright (C) 2016  Red Hat Inc. | ||||
|  * | ||||
|  * This library is free software; you can redistribute it and/or | ||||
|  * modify it under the terms of the GNU Lesser General Public | ||||
|  * License as published by the Free Software Foundation; either | ||||
|  * version 2 of the License, or (at your option) any later version. | ||||
|  * | ||||
|  * This library is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||
|  * Lesser General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU Lesser General Public | ||||
|  * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||||
|  * | ||||
|  * Author: Damien Lespiau <damien.lespiau@intel.com> | ||||
|  * Author: Jonas Ådahl <jadahl@gmail.com> | ||||
|  */ | ||||
|  | ||||
| #ifndef __CLUTTER_SEAT_EVDEV_H__ | ||||
| #define __CLUTTER_SEAT_EVDEV_H__ | ||||
|  | ||||
| #include <libinput.h> | ||||
| #include <linux/input.h> | ||||
|  | ||||
| #include "clutter-input-device.h" | ||||
| #include "clutter-device-manager-evdev.h" | ||||
| #include "clutter-xkb-utils.h" | ||||
|  | ||||
| typedef struct _ClutterTouchState ClutterTouchState; | ||||
|  | ||||
| struct _ClutterTouchState | ||||
| { | ||||
|   ClutterSeatEvdev *seat; | ||||
|  | ||||
|   int device_slot; | ||||
|   int seat_slot; | ||||
|   ClutterPoint coords; | ||||
| }; | ||||
|  | ||||
| struct _ClutterSeatEvdev | ||||
| { | ||||
|   struct libinput_seat *libinput_seat; | ||||
|   ClutterDeviceManagerEvdev *manager_evdev; | ||||
|  | ||||
|   GSList *devices; | ||||
|  | ||||
|   ClutterInputDevice *core_pointer; | ||||
|   ClutterInputDevice *core_keyboard; | ||||
|  | ||||
|   ClutterTouchState **touch_states; | ||||
|   int n_alloc_touch_states; | ||||
|  | ||||
|   struct xkb_state *xkb; | ||||
|   xkb_led_index_t caps_lock_led; | ||||
|   xkb_led_index_t num_lock_led; | ||||
|   xkb_led_index_t scroll_lock_led; | ||||
|   xkb_layout_index_t layout_idx; | ||||
|   uint32_t button_state; | ||||
|   int button_count[KEY_CNT]; | ||||
|  | ||||
|   /* keyboard repeat */ | ||||
|   gboolean repeat; | ||||
|   guint32 repeat_delay; | ||||
|   guint32 repeat_interval; | ||||
|   guint32 repeat_key; | ||||
|   guint32 repeat_count; | ||||
|   guint32 repeat_timer; | ||||
|   ClutterInputDevice *repeat_device; | ||||
|  | ||||
|   gfloat pointer_x; | ||||
|   gfloat pointer_y; | ||||
|  | ||||
|   /* Emulation of discrete scroll events out of smooth ones */ | ||||
|   gfloat accum_scroll_dx; | ||||
|   gfloat accum_scroll_dy; | ||||
| }; | ||||
|  | ||||
| void clutter_seat_evdev_notify_key (ClutterSeatEvdev   *seat, | ||||
|                                     ClutterInputDevice *device, | ||||
|                                     uint64_t            time_us, | ||||
|                                     uint32_t            key, | ||||
|                                     uint32_t            state, | ||||
|                                     gboolean            update_keys); | ||||
|  | ||||
| void clutter_seat_evdev_notify_relative_motion (ClutterSeatEvdev   *seat_evdev, | ||||
|                                                 ClutterInputDevice *input_device, | ||||
|                                                 uint64_t            time_us, | ||||
|                                                 float               dx, | ||||
|                                                 float               dy, | ||||
|                                                 float               dx_unaccel, | ||||
|                                                 float               dy_unaccel); | ||||
|  | ||||
| void clutter_seat_evdev_notify_absolute_motion (ClutterSeatEvdev   *seat_evdev, | ||||
|                                                 ClutterInputDevice *input_device, | ||||
|                                                 uint64_t            time_us, | ||||
|                                                 float               x, | ||||
|                                                 float               y, | ||||
|                                                 double             *axes); | ||||
|  | ||||
| void clutter_seat_evdev_notify_button (ClutterSeatEvdev   *seat, | ||||
|                                        ClutterInputDevice *input_device, | ||||
|                                        uint64_t            time_us, | ||||
|                                        uint32_t            button, | ||||
|                                        uint32_t            state); | ||||
|  | ||||
| void clutter_seat_evdev_notify_scroll_continuous (ClutterSeatEvdev         *seat, | ||||
|                                                   ClutterInputDevice       *input_device, | ||||
|                                                   uint64_t                  time_us, | ||||
|                                                   double                    dx, | ||||
|                                                   double                    dy, | ||||
|                                                   ClutterScrollSource       source, | ||||
|                                                   ClutterScrollFinishFlags  flags); | ||||
|  | ||||
| void clutter_seat_evdev_notify_discrete_scroll (ClutterSeatEvdev    *seat, | ||||
|                                                 ClutterInputDevice  *input_device, | ||||
|                                                 uint64_t             time_us, | ||||
|                                                 double               discrete_dx, | ||||
|                                                 double               discrete_dy, | ||||
|                                                 ClutterScrollSource  source); | ||||
|  | ||||
| void clutter_seat_evdev_notify_touch_event (ClutterSeatEvdev   *seat, | ||||
|                                             ClutterInputDevice *input_device, | ||||
|                                             ClutterEventType    evtype, | ||||
|                                             uint64_t            time_us, | ||||
|                                             int                 slot, | ||||
|                                             double              x, | ||||
|                                             double              y); | ||||
|  | ||||
| void clutter_seat_evdev_set_libinput_seat (ClutterSeatEvdev     *seat, | ||||
|                                            struct libinput_seat *libinput_seat); | ||||
|  | ||||
| void clutter_seat_evdev_sync_leds (ClutterSeatEvdev *seat); | ||||
|  | ||||
| ClutterInputDevice * clutter_seat_evdev_get_device (ClutterSeatEvdev *seat, | ||||
|                                                     gint              id); | ||||
|  | ||||
| ClutterTouchState * clutter_seat_evdev_acquire_touch_state (ClutterSeatEvdev *seat, | ||||
|                                                             int               device_slot); | ||||
|  | ||||
| void clutter_seat_evdev_release_touch_state (ClutterSeatEvdev  *seat, | ||||
|                                              ClutterTouchState *touch_state); | ||||
|  | ||||
| ClutterTouchState * clutter_seat_evdev_get_touch (ClutterSeatEvdev *seat, | ||||
|                                                   guint32           id); | ||||
|  | ||||
| void clutter_seat_evdev_set_stage (ClutterSeatEvdev *seat, | ||||
|                                    ClutterStage     *stage); | ||||
|  | ||||
| void clutter_seat_evdev_clear_repeat_timer (ClutterSeatEvdev *seat); | ||||
|  | ||||
| ClutterSeatEvdev * clutter_seat_evdev_new (ClutterDeviceManagerEvdev *manager_evdev); | ||||
|  | ||||
| void clutter_seat_evdev_free (ClutterSeatEvdev *seat); | ||||
|  | ||||
| #endif /* __CLUTTER_SEAT_EVDEV_H__ */ | ||||
| @@ -1,46 +0,0 @@ | ||||
| /* | ||||
|  * Clutter. | ||||
|  * | ||||
|  * An OpenGL based 'interactive canvas' library. | ||||
|  * | ||||
|  * Copyright (C) 2010  Intel Corporation. | ||||
|  * | ||||
|  * This library is free software; you can redistribute it and/or | ||||
|  * modify it under the terms of the GNU Lesser General Public | ||||
|  * License as published by the Free Software Foundation; either | ||||
|  * version 2 of the License, or (at your option) any later version. | ||||
|  * | ||||
|  * This library is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||
|  * Lesser General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU Lesser General Public | ||||
|  * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||||
|  | ||||
|  * Authors: | ||||
|  *  Damien Lespiau <damien.lespiau@intel.com> | ||||
|  */ | ||||
|  | ||||
| #ifndef __CLUTTER_XKB_UTILS_H__ | ||||
| #define __CLUTTER_XKB_UTILS_H__ | ||||
|  | ||||
| #include <xkbcommon/xkbcommon.h> | ||||
|  | ||||
| #include "clutter-stage.h" | ||||
| #include "clutter-event.h" | ||||
| #include "clutter-input-device.h" | ||||
|  | ||||
| ClutterEvent *    _clutter_key_event_new_from_evdev (ClutterInputDevice *device, | ||||
| 						     ClutterInputDevice *core_keyboard, | ||||
|                                                      ClutterStage       *stage, | ||||
|                                                      struct xkb_state   *xkb_state, | ||||
| 						     uint32_t            button_state, | ||||
|                                                      uint32_t            _time, | ||||
|                                                      uint32_t            key, | ||||
|                                                      uint32_t            state); | ||||
| void               _clutter_xkb_translate_state     (ClutterEvent       *event, | ||||
| 						     struct xkb_state   *xkb_state, | ||||
| 						     uint32_t            button_state); | ||||
|  | ||||
| #endif /* __CLUTTER_XKB_UTILS_H__ */ | ||||
| @@ -77,7 +77,6 @@ clutter_headers = [ | ||||
|   'clutter-stage-manager.h', | ||||
|   'clutter-stage-view.h', | ||||
|   'clutter-tap-action.h', | ||||
|   'clutter-test-utils.h', | ||||
|   'clutter-texture.h', | ||||
|   'clutter-text.h', | ||||
|   'clutter-text-buffer.h', | ||||
| @@ -168,7 +167,6 @@ clutter_sources = [ | ||||
|   'clutter-stage-view.c', | ||||
|   'clutter-stage-window.c', | ||||
|   'clutter-tap-action.c', | ||||
|   'clutter-test-utils.c', | ||||
|   'clutter-text.c', | ||||
|   'clutter-text-buffer.c', | ||||
|   'clutter-transition-group.c', | ||||
| @@ -191,7 +189,6 @@ clutter_private_headers = [ | ||||
|   'clutter-device-manager-private.h', | ||||
|   'clutter-easing.h', | ||||
|   'clutter-effect-private.h', | ||||
|   'clutter-event-translator.h', | ||||
|   'clutter-event-private.h', | ||||
|   'clutter-flatten-effect.h', | ||||
|   'clutter-gesture-action-private.h', | ||||
| @@ -215,7 +212,6 @@ clutter_private_headers = [ | ||||
|  | ||||
| clutter_nonintrospected_sources = [ | ||||
|   'clutter-easing.c', | ||||
|   'clutter-event-translator.c', | ||||
|   'clutter-id-pool.c', | ||||
| ] | ||||
|  | ||||
| @@ -273,21 +269,9 @@ clutter_backend_private_headers = [ | ||||
| if have_x11 | ||||
|   clutter_x11_sources = [ | ||||
|     'x11/clutter-backend-x11.c', | ||||
|     'x11/clutter-device-manager-xi2.c', | ||||
|     'x11/clutter-event-x11.c', | ||||
|     'x11/clutter-input-device-tool-xi2.c', | ||||
|     'x11/clutter-input-device-xi2.c', | ||||
|     'x11/clutter-keymap-x11.c', | ||||
|     'x11/clutter-stage-x11.c', | ||||
|     'x11/clutter-virtual-input-device-x11.c', | ||||
|   ] | ||||
|   clutter_backend_sources += clutter_x11_sources | ||||
|  | ||||
|   clutter_x11_nonintrospected_sources = [ | ||||
|     'x11/clutter-xkb-a11y-x11.c', | ||||
|   ] | ||||
|   clutter_backend_nonintrospected_sources += clutter_x11_nonintrospected_sources | ||||
|  | ||||
|   clutter_x11_headers = [ | ||||
|     'x11/clutter-x11.h', | ||||
|   ] | ||||
| @@ -295,14 +279,7 @@ if have_x11 | ||||
|  | ||||
|   clutter_x11_private_headers = [ | ||||
|     'x11/clutter-backend-x11.h', | ||||
|     'x11/clutter-device-manager-xi2.h', | ||||
|     'x11/clutter-input-device-tool-xi2.h', | ||||
|     'x11/clutter-input-device-xi2.h', | ||||
|     'x11/clutter-keymap-x11.h', | ||||
|     'x11/clutter-settings-x11.h', | ||||
|     'x11/clutter-stage-x11.h', | ||||
|     'x11/clutter-virtual-input-device-x11.h', | ||||
|     'x11/clutter-xkb-a11y-x11.h', | ||||
|   ] | ||||
|   clutter_backend_private_headers += clutter_x11_private_headers | ||||
|  | ||||
| @@ -318,28 +295,8 @@ endif | ||||
| if have_native_backend | ||||
|   clutter_native_nonintrospected_sources = [ | ||||
|     'egl/clutter-backend-eglnative.c', | ||||
|     'evdev/clutter-device-manager-evdev.c', | ||||
|     'evdev/clutter-event-evdev.c', | ||||
|     'evdev/clutter-input-device-evdev.c', | ||||
|     'evdev/clutter-input-device-tool-evdev.c', | ||||
|     'evdev/clutter-keymap-evdev.c', | ||||
|     'evdev/clutter-seat-evdev.c', | ||||
|     'evdev/clutter-virtual-input-device-evdev.c', | ||||
|     'evdev/clutter-xkb-utils.c', | ||||
|   ] | ||||
|   clutter_backend_nonintrospected_sources += clutter_native_nonintrospected_sources | ||||
|  | ||||
|   clutter_native_private_headers = [ | ||||
|     'evdev/clutter-evdev.h', | ||||
|     'evdev/clutter-device-manager-evdev.h', | ||||
|     'evdev/clutter-input-device-evdev.h', | ||||
|     'evdev/clutter-input-device-tool-evdev.h', | ||||
|     'evdev/clutter-keymap-evdev.h', | ||||
|     'evdev/clutter-seat-evdev.h', | ||||
|     'evdev/clutter-virtual-input-device-evdev.h', | ||||
|     'evdev/clutter-xkb-utils.h', | ||||
|   ] | ||||
|   clutter_backend_private_headers += clutter_native_private_headers | ||||
| endif | ||||
|  | ||||
| if have_wayland | ||||
|   | ||||
| @@ -34,9 +34,7 @@ | ||||
| #include <errno.h> | ||||
|  | ||||
| #include "clutter-backend-x11.h" | ||||
| #include "clutter-device-manager-xi2.h" | ||||
| #include "clutter-settings-x11.h" | ||||
| #include "clutter-stage-x11.h" | ||||
| #include "clutter-x11.h" | ||||
|  | ||||
| #include "xsettings/xsettings-common.h" | ||||
| @@ -54,7 +52,6 @@ | ||||
| #include "clutter-main.h" | ||||
| #include "clutter-private.h" | ||||
| #include "clutter-settings-private.h" | ||||
| #include "clutter-xkb-a11y-x11.h" | ||||
|  | ||||
| G_DEFINE_TYPE (ClutterBackendX11, clutter_backend_x11, CLUTTER_TYPE_BACKEND) | ||||
|  | ||||
| @@ -101,7 +98,6 @@ static const gchar *atom_names[] = { | ||||
| #define N_ATOM_NAMES G_N_ELEMENTS (atom_names) | ||||
|  | ||||
| /* various flags corresponding to pre init setup calls */ | ||||
| static gboolean _no_xevent_retrieval = FALSE; | ||||
| static gboolean clutter_enable_xinput = TRUE; | ||||
| static gboolean clutter_enable_argb = FALSE; | ||||
| static gboolean clutter_enable_stereo = FALSE; | ||||
| @@ -229,91 +225,6 @@ clutter_backend_x11_xsettings_notify (const char       *name, | ||||
|   g_object_thaw_notify (G_OBJECT (settings)); | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_backend_x11_create_device_manager (ClutterBackendX11 *backend_x11) | ||||
| { | ||||
|   ClutterEventTranslator *translator; | ||||
|   ClutterBackend *backend; | ||||
|  | ||||
|   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) | ||||
|     { | ||||
|       g_critical ("XI2 extension is missing."); | ||||
|       backend_x11->has_xinput = FALSE; | ||||
|       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 | ||||
| on_keymap_state_change (ClutterKeymapX11 *keymap_x11, | ||||
|                         gpointer          data) | ||||
| { | ||||
|   ClutterDeviceManager *device_manager = CLUTTER_DEVICE_MANAGER (data); | ||||
|   ClutterKbdA11ySettings kbd_a11y_settings; | ||||
|  | ||||
|   /* On keymaps state change, just reapply the current settings, it'll | ||||
|    * take care of enabling/disabling mousekeys based on NumLock state. | ||||
|    */ | ||||
|   clutter_device_manager_get_kbd_a11y_settings (device_manager, &kbd_a11y_settings); | ||||
|   clutter_device_manager_x11_apply_kbd_a11y_settings (device_manager, &kbd_a11y_settings); | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_backend_x11_create_keymap (ClutterBackendX11 *backend_x11) | ||||
| { | ||||
|   if (backend_x11->keymap == NULL) | ||||
|     { | ||||
|       ClutterEventTranslator *translator; | ||||
|       ClutterBackend *backend; | ||||
|  | ||||
|       backend_x11->keymap = | ||||
|         g_object_new (CLUTTER_TYPE_KEYMAP_X11, | ||||
|                       "backend", backend_x11, | ||||
|                       NULL); | ||||
|  | ||||
|       backend = CLUTTER_BACKEND (backend_x11); | ||||
|       translator = CLUTTER_EVENT_TRANSLATOR (backend_x11->keymap); | ||||
|       _clutter_backend_add_event_translator (backend, translator); | ||||
|  | ||||
|       g_signal_connect (backend_x11->keymap, | ||||
|                         "state-changed", | ||||
|                         G_CALLBACK (on_keymap_state_change), | ||||
|                         backend->device_manager); | ||||
|     } | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| clutter_backend_x11_pre_parse (ClutterBackend  *backend, | ||||
|                                GError         **error) | ||||
| @@ -461,45 +372,6 @@ clutter_backend_x11_post_parse (ClutterBackend  *backend, | ||||
|   return TRUE; | ||||
| } | ||||
|  | ||||
| void | ||||
| _clutter_backend_x11_events_init (ClutterBackend *backend) | ||||
| { | ||||
|   ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (backend); | ||||
|  | ||||
|   CLUTTER_NOTE (EVENT, "initialising the event loop"); | ||||
|  | ||||
|   /* the event source is optional */ | ||||
|   if (!_no_xevent_retrieval) | ||||
|     { | ||||
|       GSource *source; | ||||
|  | ||||
|       source = _clutter_x11_event_source_new (backend_x11); | ||||
|  | ||||
|       /* default priority for events | ||||
|        * | ||||
|        * XXX - at some point we'll have a common EventSource API that | ||||
|        * is created by the backend, and this code will most likely go | ||||
|        * into the default implementation of ClutterBackend | ||||
|        */ | ||||
|       g_source_set_priority (source, CLUTTER_PRIORITY_EVENTS); | ||||
|  | ||||
|       /* attach the source to the default context, and transfer the | ||||
|        * ownership to the GMainContext itself | ||||
|        */ | ||||
|       g_source_attach (source, NULL); | ||||
|       g_source_unref (source); | ||||
|  | ||||
|       backend_x11->event_source = source; | ||||
|     } | ||||
|  | ||||
|   clutter_backend_x11_create_device_manager (backend_x11); | ||||
|  | ||||
|   /* register keymap; unless we create a generic Keymap object, I'm | ||||
|    * afraid this will have to stay | ||||
|    */ | ||||
|   clutter_backend_x11_create_keymap (backend_x11); | ||||
| } | ||||
|  | ||||
| static const GOptionEntry entries[] = | ||||
| { | ||||
|   { | ||||
| @@ -619,7 +491,6 @@ clutter_backend_x11_translate_event (ClutterBackend *backend, | ||||
|                                      ClutterEvent   *event) | ||||
| { | ||||
|   ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (backend); | ||||
|   ClutterBackendClass *parent_class; | ||||
|   XEvent *xevent = native; | ||||
|  | ||||
|   /* X11 filter functions have a higher priority */ | ||||
| @@ -655,11 +526,7 @@ clutter_backend_x11_translate_event (ClutterBackend *backend, | ||||
|    */ | ||||
|   update_last_event_time (backend_x11, xevent); | ||||
|  | ||||
|   /* chain up to the parent implementation, which will handle | ||||
|    * event translators | ||||
|    */ | ||||
|   parent_class = CLUTTER_BACKEND_CLASS (clutter_backend_x11_parent_class); | ||||
|   return parent_class->translate_event (backend, native, event); | ||||
|   return FALSE; | ||||
| } | ||||
|  | ||||
| static CoglRenderer * | ||||
| @@ -779,50 +646,6 @@ clutter_backend_x11_get_display (ClutterBackend  *backend, | ||||
|   return display; | ||||
| } | ||||
|  | ||||
| static ClutterStageWindow * | ||||
| clutter_backend_x11_create_stage (ClutterBackend  *backend, | ||||
| 				  ClutterStage    *wrapper, | ||||
| 				  GError         **error) | ||||
| { | ||||
|   ClutterEventTranslator *translator; | ||||
|   ClutterStageWindow *stage; | ||||
|  | ||||
|   stage = g_object_new (CLUTTER_TYPE_STAGE_X11, | ||||
| 			"backend", backend, | ||||
| 			"wrapper", wrapper, | ||||
| 			NULL); | ||||
|  | ||||
|   /* the X11 stage does event translation */ | ||||
|   translator = CLUTTER_EVENT_TRANSLATOR (stage); | ||||
|   _clutter_backend_add_event_translator (backend, translator); | ||||
|  | ||||
|   CLUTTER_NOTE (BACKEND, "X11 stage created (display:%p, screen:%d, root:%u)", | ||||
|                 CLUTTER_BACKEND_X11 (backend)->xdpy, | ||||
|                 CLUTTER_BACKEND_X11 (backend)->xscreen_num, | ||||
|                 (unsigned int) CLUTTER_BACKEND_X11 (backend)->xwin_root); | ||||
|  | ||||
|   return stage; | ||||
| } | ||||
|  | ||||
| static PangoDirection | ||||
| clutter_backend_x11_get_keymap_direction (ClutterBackend *backend) | ||||
| { | ||||
|   ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (backend); | ||||
|  | ||||
|   if (G_UNLIKELY (backend_x11->keymap == NULL)) | ||||
|     return PANGO_DIRECTION_NEUTRAL; | ||||
|  | ||||
|   return _clutter_keymap_x11_get_direction (backend_x11->keymap); | ||||
| } | ||||
|  | ||||
| static ClutterKeymap * | ||||
| clutter_backend_x11_get_keymap (ClutterBackend *backend) | ||||
| { | ||||
|   ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (backend); | ||||
|  | ||||
|   return CLUTTER_KEYMAP (backend_x11->keymap); | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_backend_x11_class_init (ClutterBackendX11Class *klass) | ||||
| { | ||||
| @@ -832,8 +655,6 @@ clutter_backend_x11_class_init (ClutterBackendX11Class *klass) | ||||
|   gobject_class->dispose = clutter_backend_x11_dispose; | ||||
|   gobject_class->finalize = clutter_backend_x11_finalize; | ||||
|  | ||||
|   backend_class->create_stage = clutter_backend_x11_create_stage; | ||||
|  | ||||
|   backend_class->pre_parse = clutter_backend_x11_pre_parse; | ||||
|   backend_class->post_parse = clutter_backend_x11_post_parse; | ||||
|   backend_class->add_options = clutter_backend_x11_add_options; | ||||
| @@ -843,9 +664,6 @@ clutter_backend_x11_class_init (ClutterBackendX11Class *klass) | ||||
|  | ||||
|   backend_class->get_renderer = clutter_backend_x11_get_renderer; | ||||
|   backend_class->get_display = clutter_backend_x11_get_display; | ||||
|  | ||||
|   backend_class->get_keymap_direction = clutter_backend_x11_get_keymap_direction; | ||||
|   backend_class->get_keymap = clutter_backend_x11_get_keymap; | ||||
| } | ||||
|  | ||||
| static void | ||||
| @@ -956,58 +774,6 @@ clutter_x11_set_display (Display *xdpy) | ||||
|   _foreign_dpy= xdpy; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_x11_disable_event_retrieval: | ||||
|  * | ||||
|  * Disables the internal polling of X11 events in the main loop. | ||||
|  * | ||||
|  * Libraries or applications calling this function will be responsible of | ||||
|  * polling all X11 events. | ||||
|  * | ||||
|  * You also must call clutter_x11_handle_event() to let Clutter process | ||||
|  * events and maintain its internal state. | ||||
|  * | ||||
|  * This function can only be called before calling clutter_init(). | ||||
|  * | ||||
|  * Even with event handling disabled, Clutter will still select | ||||
|  * all the events required to maintain its internal state on the stage | ||||
|  * Window; compositors using Clutter and input regions to pass events | ||||
|  * through to application windows should not rely on an empty input | ||||
|  * region, and should instead clear it themselves explicitly using the | ||||
|  * XFixes extension. | ||||
|  * | ||||
|  * This function should not be normally used by applications. | ||||
|  * | ||||
|  * Since: 0.8 | ||||
|  */ | ||||
| void | ||||
| clutter_x11_disable_event_retrieval (void) | ||||
| { | ||||
|   if (_clutter_context_is_initialized ()) | ||||
|     { | ||||
|       g_warning ("%s() can only be used before calling clutter_init()", | ||||
|                  G_STRFUNC); | ||||
|       return; | ||||
|     } | ||||
|  | ||||
|   _no_xevent_retrieval = TRUE; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_x11_has_event_retrieval: | ||||
|  * | ||||
|  * Queries the X11 backend to check if event collection has been disabled. | ||||
|  * | ||||
|  * Return value: TRUE if event retrival has been disabled. FALSE otherwise. | ||||
|  * | ||||
|  * Since: 0.8 | ||||
|  */ | ||||
| gboolean | ||||
| clutter_x11_has_event_retrieval (void) | ||||
| { | ||||
|   return !_no_xevent_retrieval; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_x11_get_default_screen: | ||||
|  * | ||||
| @@ -1164,36 +930,6 @@ clutter_x11_remove_filter (ClutterX11FilterFunc func, | ||||
|     } | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_x11_has_xinput: | ||||
|  * | ||||
|  * Gets whether Clutter has XInput support. | ||||
|  * | ||||
|  * Return value: %TRUE if Clutter was compiled with XInput support | ||||
|  *   and XInput support is available at run time. | ||||
|  * | ||||
|  * Since: 0.8 | ||||
|  */ | ||||
| gboolean | ||||
| clutter_x11_has_xinput (void) | ||||
| { | ||||
|  ClutterBackend *backend = clutter_get_default_backend (); | ||||
|  | ||||
|   if (backend == NULL) | ||||
|     { | ||||
|       g_critical ("The Clutter backend has not been initialised"); | ||||
|       return FALSE; | ||||
|     } | ||||
|  | ||||
|   if (!CLUTTER_IS_BACKEND_X11 (backend)) | ||||
|     { | ||||
|       g_critical ("The Clutter backend is not a X11 backend."); | ||||
|       return FALSE; | ||||
|     } | ||||
|  | ||||
|   return CLUTTER_BACKEND_X11 (backend)->has_xinput; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_x11_has_composite_extension: | ||||
|  * | ||||
| @@ -1341,84 +1077,3 @@ clutter_x11_get_use_stereo_stage (void) | ||||
|   return clutter_enable_stereo; | ||||
| } | ||||
|  | ||||
| XVisualInfo * | ||||
| _clutter_backend_x11_get_visual_info (ClutterBackendX11 *backend_x11) | ||||
| { | ||||
|   return cogl_clutter_winsys_xlib_get_visual_info (); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_x11_get_visual_info: (skip) | ||||
|  * | ||||
|  * Retrieves the `XVisualInfo` used by the Clutter X11 backend. | ||||
|  * | ||||
|  * Return value: (transfer full): a `XVisualInfo`, or `None`. | ||||
|  *   The returned value should be freed using `XFree()` when done | ||||
|  * | ||||
|  * Since: 1.2 | ||||
|  */ | ||||
| XVisualInfo * | ||||
| clutter_x11_get_visual_info (void) | ||||
| { | ||||
|   ClutterBackendX11 *backend_x11; | ||||
|   ClutterBackend *backend; | ||||
|  | ||||
|   backend = clutter_get_default_backend (); | ||||
|   if (!CLUTTER_IS_BACKEND_X11 (backend)) | ||||
|     { | ||||
|       g_critical ("The Clutter backend is not a X11 backend."); | ||||
|       return NULL; | ||||
|     } | ||||
|  | ||||
|   backend_x11 = CLUTTER_BACKEND_X11 (backend); | ||||
|  | ||||
|   return _clutter_backend_x11_get_visual_info (backend_x11); | ||||
| } | ||||
|  | ||||
| gboolean | ||||
| _clutter_x11_input_device_translate_screen_coord (ClutterInputDevice *device, | ||||
|                                                   gint                stage_root_x, | ||||
|                                                   gint                stage_root_y, | ||||
|                                                   guint               index_, | ||||
|                                                   gdouble             value, | ||||
|                                                   gdouble            *axis_value) | ||||
| { | ||||
|   ClutterAxisInfo *info; | ||||
|   ClutterBackendX11 *backend_x11; | ||||
|   gdouble width, scale, offset; | ||||
|    | ||||
|   backend_x11 = CLUTTER_BACKEND_X11 (device->backend); | ||||
|  | ||||
|   if (device->axes == NULL || index_ >= device->axes->len) | ||||
|     return FALSE; | ||||
|  | ||||
|   info = &g_array_index (device->axes, ClutterAxisInfo, index_); | ||||
|   if (!(info->axis == CLUTTER_INPUT_AXIS_X || info->axis == CLUTTER_INPUT_AXIS_Y)) | ||||
|     return FALSE; | ||||
|  | ||||
|   width = info->max_value - info->min_value; | ||||
|  | ||||
|   if (info->axis == CLUTTER_INPUT_AXIS_X) | ||||
|     { | ||||
|       if (width > 0) | ||||
|         scale = backend_x11->xscreen_width / width; | ||||
|       else | ||||
|         scale = 1; | ||||
|  | ||||
|       offset = - stage_root_x; | ||||
|     } | ||||
|   else | ||||
|     { | ||||
|       if (width > 0) | ||||
|         scale = backend_x11->xscreen_height / width; | ||||
|       else | ||||
|         scale = 1; | ||||
|  | ||||
|       offset = - stage_root_y; | ||||
|     } | ||||
|  | ||||
|   if (axis_value) | ||||
|     *axis_value = offset + scale * (value - info->min_value); | ||||
|  | ||||
|   return TRUE; | ||||
| } | ||||
|   | ||||
| @@ -30,7 +30,6 @@ | ||||
| #include "clutter-x11.h" | ||||
|  | ||||
| #include "clutter-backend-private.h" | ||||
| #include "clutter-keymap-x11.h" | ||||
|  | ||||
| #include "xsettings/xsettings-client.h" | ||||
|  | ||||
| @@ -45,7 +44,6 @@ G_BEGIN_DECLS | ||||
|  | ||||
| typedef struct _ClutterBackendX11       ClutterBackendX11; | ||||
| typedef struct _ClutterBackendX11Class  ClutterBackendX11Class; | ||||
| typedef struct _ClutterEventX11         ClutterEventX11; | ||||
| typedef struct _ClutterX11EventFilter   ClutterX11EventFilter; | ||||
|  | ||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBackendX11, g_object_unref) | ||||
| @@ -57,16 +55,6 @@ struct _ClutterX11EventFilter | ||||
|  | ||||
| }; | ||||
|  | ||||
| struct _ClutterEventX11 | ||||
| { | ||||
|   /* additional fields for Key events */ | ||||
|   gint key_group; | ||||
|  | ||||
|   guint key_is_modifier : 1; | ||||
|   guint num_lock_set    : 1; | ||||
|   guint caps_lock_set   : 1; | ||||
| }; | ||||
|  | ||||
| struct _ClutterBackendX11 | ||||
| { | ||||
|   ClutterBackend parent_instance; | ||||
| @@ -82,7 +70,6 @@ struct _ClutterBackendX11 | ||||
|   Window   xwin_root; | ||||
|  | ||||
|   /* event source */ | ||||
|   GSource *event_source; | ||||
|   GSList  *event_filters; | ||||
|  | ||||
|   /* props */ | ||||
| @@ -100,16 +87,9 @@ struct _ClutterBackendX11 | ||||
|   Time last_event_time; | ||||
|  | ||||
|   ClutterDeviceManager *device_manager; | ||||
|   gboolean has_xinput; | ||||
|   int xi_minor; | ||||
|  | ||||
|   XSettingsClient *xsettings; | ||||
|   Window xsettings_xwin; | ||||
|  | ||||
|   ClutterKeymapX11 *keymap; | ||||
|   gboolean use_xkb; | ||||
|   gboolean have_xkb_autorepeat; | ||||
|   guint keymap_serial; | ||||
| }; | ||||
|  | ||||
| struct _ClutterBackendX11Class | ||||
| @@ -122,26 +102,9 @@ GType clutter_backend_x11_get_type (void) G_GNUC_CONST; | ||||
|  | ||||
| ClutterBackend *clutter_backend_x11_new (void); | ||||
|  | ||||
| void            _clutter_backend_x11_events_init        (ClutterBackend *backend); | ||||
|  | ||||
| GSource *       _clutter_x11_event_source_new   (ClutterBackendX11 *backend_x11); | ||||
|  | ||||
| /* Private to glx/eglx backends */ | ||||
| XVisualInfo *   _clutter_backend_x11_get_visual_info (ClutterBackendX11 *backend_x11); | ||||
|  | ||||
| void            _clutter_x11_select_events (Window xwin); | ||||
|  | ||||
| ClutterEventX11 *       _clutter_event_x11_new          (void); | ||||
| ClutterEventX11 *       _clutter_event_x11_copy         (ClutterEventX11 *event_x11); | ||||
| void                    _clutter_event_x11_free         (ClutterEventX11 *event_x11); | ||||
|  | ||||
| gboolean        _clutter_x11_input_device_translate_screen_coord (ClutterInputDevice *device, | ||||
|                                                                   gint                stage_root_x, | ||||
|                                                                   gint                stage_root_y, | ||||
|                                                                   guint               index_, | ||||
|                                                                   gdouble             value, | ||||
|                                                                   gdouble            *axis_value); | ||||
|  | ||||
| G_END_DECLS | ||||
|  | ||||
| #endif /* __CLUTTER_BACKEND_X11_H__ */ | ||||
|   | ||||
| @@ -1,73 +0,0 @@ | ||||
| /* | ||||
|  * Clutter. | ||||
|  * | ||||
|  * An OpenGL based 'interactive canvas' library. | ||||
|  * | ||||
|  * Copyright © 2011  Intel Corp. | ||||
|  * | ||||
|  * This library is free software; you can redistribute it and/or | ||||
|  * modify it under the terms of the GNU Lesser General Public | ||||
|  * License as published by the Free Software Foundation; either | ||||
|  * version 2 of the License, or (at your option) any later version. | ||||
|  * | ||||
|  * This library is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||
|  * Lesser General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU Lesser General Public | ||||
|  * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||||
|  * | ||||
|  * Author: Emmanuele Bassi <ebassi@linux.intel.com> | ||||
|  */ | ||||
|  | ||||
| #ifndef __CLUTTER_DEVICE_MANAGER_XI2_H__ | ||||
| #define __CLUTTER_DEVICE_MANAGER_XI2_H__ | ||||
|  | ||||
| #include <clutter/clutter-device-manager.h> | ||||
|  | ||||
| #ifdef HAVE_LIBWACOM | ||||
| #include <libwacom/libwacom.h> | ||||
| #endif | ||||
|  | ||||
| G_BEGIN_DECLS | ||||
|  | ||||
| #define CLUTTER_TYPE_DEVICE_MANAGER_XI2            (_clutter_device_manager_xi2_get_type ()) | ||||
| #define CLUTTER_DEVICE_MANAGER_XI2(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_DEVICE_MANAGER_XI2, ClutterDeviceManagerXI2)) | ||||
| #define CLUTTER_IS_DEVICE_MANAGER_XI2(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_DEVICE_MANAGER_XI2)) | ||||
| #define CLUTTER_DEVICE_MANAGER_XI2_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_DEVICE_MANAGER_XI2, ClutterDeviceManagerXI2Class)) | ||||
| #define CLUTTER_IS_DEVICE_MANAGER_XI2_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_DEVICE_MANAGER_XI2)) | ||||
| #define CLUTTER_DEVICE_MANAGER_XI2_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_DEVICE_MANAGER_XI2, ClutterDeviceManagerXI2Class)) | ||||
|  | ||||
| typedef struct _ClutterDeviceManagerXI2         ClutterDeviceManagerXI2; | ||||
| typedef struct _ClutterDeviceManagerXI2Class    ClutterDeviceManagerXI2Class; | ||||
|  | ||||
| struct _ClutterDeviceManagerXI2 | ||||
| { | ||||
|   ClutterDeviceManager parent_instance; | ||||
|  | ||||
|   GHashTable *devices_by_id; | ||||
|   GHashTable *tools_by_serial; | ||||
|  | ||||
|   GSList *all_devices; | ||||
|  | ||||
|   GList *master_devices; | ||||
|   GList *slave_devices; | ||||
|  | ||||
|   int opcode; | ||||
|  | ||||
| #ifdef HAVE_LIBWACOM | ||||
|   WacomDeviceDatabase *wacom_db; | ||||
| #endif | ||||
| }; | ||||
|  | ||||
| struct _ClutterDeviceManagerXI2Class | ||||
| { | ||||
|   ClutterDeviceManagerClass parent_class; | ||||
| }; | ||||
|  | ||||
| GType _clutter_device_manager_xi2_get_type (void) G_GNUC_CONST; | ||||
|  | ||||
| G_END_DECLS | ||||
|  | ||||
| #endif /* __CLUTTER_DEVICE_MANAGER_XI2_H__ */ | ||||
| @@ -1,384 +0,0 @@ | ||||
| /* Clutter. | ||||
|  * An OpenGL based 'interactive canvas' library. | ||||
|  * | ||||
|  * Copyright (C) 2006, 2007, 2008  OpenedHand Ltd | ||||
|  * Copyright (C) 2009, 2010  Intel Corp. | ||||
|  * | ||||
|  * This library is free software; you can redistribute it and/or | ||||
|  * modify it under the terms of the GNU Lesser General Public | ||||
|  * License as published by the Free Software Foundation; either | ||||
|  * version 2 of the License, or (at your option) any later version. | ||||
|  * | ||||
|  * This library is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||
|  * Lesser General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU Lesser General Public | ||||
|  * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||||
|  * | ||||
|  * | ||||
|  * | ||||
|  * Authored by: | ||||
|  *      Matthew Allum <mallum@openedhand.com> | ||||
|  *      Emmanuele Bassi <ebassi@linux.intel.com> | ||||
|  */ | ||||
|  | ||||
| #include "clutter-build-config.h" | ||||
|  | ||||
| #include "clutter-backend-x11.h" | ||||
| #include "clutter-x11.h" | ||||
|  | ||||
| #include "clutter-backend-private.h" | ||||
| #include "clutter-debug.h" | ||||
| #include "clutter-event-private.h" | ||||
| #include "clutter-main.h" | ||||
| #include "clutter-private.h" | ||||
| #include "clutter-stage-private.h" | ||||
|  | ||||
| #include <string.h> | ||||
|  | ||||
| #include <glib.h> | ||||
|  | ||||
| #if 0 | ||||
| /* XEMBED protocol support for toolkit embedding */ | ||||
| #define XEMBED_MAPPED                   (1 << 0) | ||||
| #define MAX_SUPPORTED_XEMBED_VERSION    1 | ||||
|  | ||||
| #define XEMBED_EMBEDDED_NOTIFY          0 | ||||
| #define XEMBED_WINDOW_ACTIVATE          1 | ||||
| #define XEMBED_WINDOW_DEACTIVATE        2 | ||||
| #define XEMBED_REQUEST_FOCUS            3 | ||||
| #define XEMBED_FOCUS_IN                 4 | ||||
| #define XEMBED_FOCUS_OUT                5 | ||||
| #define XEMBED_FOCUS_NEXT               6 | ||||
| #define XEMBED_FOCUS_PREV               7 | ||||
| /* 8-9 were used for XEMBED_GRAB_KEY/XEMBED_UNGRAB_KEY */ | ||||
| #define XEMBED_MODALITY_ON              10 | ||||
| #define XEMBED_MODALITY_OFF             11 | ||||
| #define XEMBED_REGISTER_ACCELERATOR     12 | ||||
| #define XEMBED_UNREGISTER_ACCELERATOR   13 | ||||
| #define XEMBED_ACTIVATE_ACCELERATOR     14 | ||||
|  | ||||
| static Window ParentEmbedderWin = None; | ||||
| #endif | ||||
|  | ||||
| typedef struct _ClutterEventSource      ClutterEventSource; | ||||
|  | ||||
| struct _ClutterEventSource | ||||
| { | ||||
|   GSource source; | ||||
|  | ||||
|   ClutterBackendX11 *backend; | ||||
|  | ||||
|   GPollFD event_poll_fd; | ||||
| }; | ||||
|  | ||||
| ClutterEventX11 * | ||||
| _clutter_event_x11_new (void) | ||||
| { | ||||
|   return g_slice_new0 (ClutterEventX11); | ||||
| } | ||||
|  | ||||
| ClutterEventX11 * | ||||
| _clutter_event_x11_copy (ClutterEventX11 *event_x11) | ||||
| { | ||||
|   if (event_x11 != NULL) | ||||
|     return g_slice_dup (ClutterEventX11, event_x11); | ||||
|  | ||||
|   return NULL; | ||||
| } | ||||
|  | ||||
| void | ||||
| _clutter_event_x11_free (ClutterEventX11 *event_x11) | ||||
| { | ||||
|   if (event_x11 != NULL) | ||||
|     g_slice_free (ClutterEventX11, event_x11); | ||||
| } | ||||
|  | ||||
| static gboolean clutter_event_prepare  (GSource     *source, | ||||
|                                         gint        *timeout); | ||||
| static gboolean clutter_event_check    (GSource     *source); | ||||
| static gboolean clutter_event_dispatch (GSource     *source, | ||||
|                                         GSourceFunc  callback, | ||||
|                                         gpointer     user_data); | ||||
|  | ||||
| static GSourceFuncs event_funcs = { | ||||
|   clutter_event_prepare, | ||||
|   clutter_event_check, | ||||
|   clutter_event_dispatch, | ||||
|   NULL | ||||
| }; | ||||
|  | ||||
| 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; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_x11_handle_event: | ||||
|  * @xevent: pointer to XEvent structure | ||||
|  * | ||||
|  * This function processes a single X event; it can be used to hook | ||||
|  * into external X11 event processing (for example, a GDK filter | ||||
|  * function). | ||||
|  * | ||||
|  * If clutter_x11_disable_event_retrieval() has been called, you must | ||||
|  * let this function process events to update Clutter's internal state. | ||||
|  * | ||||
|  * Return value: #ClutterX11FilterReturn. %CLUTTER_X11_FILTER_REMOVE | ||||
|  *  indicates that Clutter has internally handled the event and the | ||||
|  *  caller should do no further processing. %CLUTTER_X11_FILTER_CONTINUE | ||||
|  *  indicates that Clutter is either not interested in the event, | ||||
|  *  or has used the event to update internal state without taking | ||||
|  *  any exclusive action. %CLUTTER_X11_FILTER_TRANSLATE will not | ||||
|  *  occur. | ||||
|  * | ||||
|  * Since: 0.8 | ||||
|  */ | ||||
| ClutterX11FilterReturn | ||||
| clutter_x11_handle_event (XEvent *xevent) | ||||
| { | ||||
|   ClutterX11FilterReturn result; | ||||
|   ClutterBackend *backend; | ||||
|   ClutterEvent *event; | ||||
|   gint spin = 1; | ||||
|   ClutterBackendX11 *backend_x11; | ||||
|   Display *xdisplay; | ||||
|   gboolean allocated_event; | ||||
|  | ||||
|   /* The return values here are someone approximate; we return | ||||
|    * CLUTTER_X11_FILTER_REMOVE if a clutter event is | ||||
|    * generated for the event. This mostly, but not entirely, | ||||
|    * corresponds to whether other event processing should be | ||||
|    * excluded. As long as the stage window is not shared with another | ||||
|    * toolkit it should be safe, and never return | ||||
|    * %CLUTTER_X11_FILTER_REMOVE when more processing is needed. | ||||
|    */ | ||||
|  | ||||
|   result = CLUTTER_X11_FILTER_CONTINUE; | ||||
|  | ||||
|   _clutter_threads_acquire_lock (); | ||||
|  | ||||
|   backend = clutter_get_default_backend (); | ||||
|  | ||||
|   event = clutter_event_new (CLUTTER_NOTHING); | ||||
|  | ||||
|   backend_x11 = CLUTTER_BACKEND_X11 (backend); | ||||
|   xdisplay = backend_x11->xdpy; | ||||
|  | ||||
|   allocated_event = XGetEventData (xdisplay, &xevent->xcookie); | ||||
|  | ||||
|   if (_clutter_backend_translate_event (backend, xevent, event)) | ||||
|     { | ||||
|       _clutter_event_push (event, FALSE); | ||||
|  | ||||
|       result = CLUTTER_X11_FILTER_REMOVE; | ||||
|     } | ||||
|   else | ||||
|     { | ||||
|       clutter_event_free (event); | ||||
|       goto out; | ||||
|     } | ||||
|  | ||||
|   /* | ||||
|    * Motion events can generate synthetic enter and leave events, so if we | ||||
|    * are processing a motion event, we need to spin the event loop at least | ||||
|    * two extra times to pump the enter/leave events through (otherwise they | ||||
|    * just get pushed down the queue and never processed). | ||||
|    */ | ||||
|   if (event->type == CLUTTER_MOTION) | ||||
|     spin += 2; | ||||
|  | ||||
|   while (spin > 0 && (event = clutter_event_get ())) | ||||
|     { | ||||
|       /* forward the event into clutter for emission etc. */ | ||||
|       _clutter_stage_queue_event (event->any.stage, event, FALSE); | ||||
|       --spin; | ||||
|     } | ||||
|  | ||||
| out: | ||||
|   if (allocated_event) | ||||
|     XFreeEventData (xdisplay, &xevent->xcookie); | ||||
|  | ||||
|   _clutter_threads_release_lock (); | ||||
|  | ||||
|   return result; | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| clutter_event_prepare (GSource *source, | ||||
|                        gint    *timeout) | ||||
| { | ||||
|   ClutterBackendX11 *backend = ((ClutterEventSource *) source)->backend; | ||||
|   gboolean retval; | ||||
|  | ||||
|   _clutter_threads_acquire_lock (); | ||||
|  | ||||
|   *timeout = -1; | ||||
|   retval = (clutter_events_pending () || XPending (backend->xdpy)); | ||||
|  | ||||
|   _clutter_threads_release_lock (); | ||||
|  | ||||
|   return retval; | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| clutter_event_check (GSource *source) | ||||
| { | ||||
|   ClutterEventSource *event_source = (ClutterEventSource *) source; | ||||
|   ClutterBackendX11 *backend = event_source->backend; | ||||
|   gboolean retval; | ||||
|  | ||||
|   _clutter_threads_acquire_lock (); | ||||
|  | ||||
|   if (event_source->event_poll_fd.revents & G_IO_IN) | ||||
|     retval = (clutter_events_pending () || XPending (backend->xdpy)); | ||||
|   else | ||||
|     retval = FALSE; | ||||
|  | ||||
|   _clutter_threads_release_lock (); | ||||
|  | ||||
|   return retval; | ||||
| } | ||||
|  | ||||
| static void | ||||
| events_queue (ClutterBackendX11 *backend_x11) | ||||
| { | ||||
|   ClutterBackend *backend = CLUTTER_BACKEND (backend_x11); | ||||
|   Display *xdisplay = backend_x11->xdpy; | ||||
|   ClutterEvent *event; | ||||
|   XEvent xevent; | ||||
|  | ||||
|   while (!clutter_events_pending () && XPending (xdisplay)) | ||||
|     { | ||||
|       XNextEvent (xdisplay, &xevent); | ||||
|  | ||||
|       event = clutter_event_new (CLUTTER_NOTHING); | ||||
|  | ||||
|       XGetEventData (xdisplay, &xevent.xcookie); | ||||
|  | ||||
|       if (_clutter_backend_translate_event (backend, &xevent, event)) | ||||
|         _clutter_event_push (event, FALSE); | ||||
|       else | ||||
|         clutter_event_free (event); | ||||
|  | ||||
|       XFreeEventData (xdisplay, &xevent.xcookie); | ||||
|     } | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| clutter_event_dispatch (GSource     *source, | ||||
|                         GSourceFunc  callback, | ||||
|                         gpointer     user_data) | ||||
| { | ||||
|   ClutterBackendX11 *backend = ((ClutterEventSource *) source)->backend; | ||||
|   ClutterEvent *event; | ||||
|  | ||||
|   _clutter_threads_acquire_lock (); | ||||
|  | ||||
|   /*  Grab the event(s), translate and figure out double click. | ||||
|    *  The push onto queue (stack) if valid. | ||||
|   */ | ||||
|   events_queue (backend); | ||||
|  | ||||
|   /* Pop an event off the queue if any */ | ||||
|   event = clutter_event_get (); | ||||
|   if (event != NULL) | ||||
|     { | ||||
|       /* forward the event into clutter for emission etc. */ | ||||
|       _clutter_stage_queue_event (event->any.stage, event, FALSE); | ||||
|     } | ||||
|  | ||||
|   _clutter_threads_release_lock (); | ||||
|  | ||||
|   return TRUE; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_x11_get_current_event_time: (skip) | ||||
|  * | ||||
|  * Retrieves the timestamp of the last X11 event processed by | ||||
|  * Clutter. This might be different from the timestamp returned | ||||
|  * by clutter_get_current_event_time(), as Clutter may synthesize | ||||
|  * or throttle events. | ||||
|  * | ||||
|  * Return value: a timestamp, in milliseconds | ||||
|  * | ||||
|  * Since: 1.0 | ||||
|  */ | ||||
| Time | ||||
| clutter_x11_get_current_event_time (void) | ||||
| { | ||||
|   ClutterBackend *backend = clutter_get_default_backend (); | ||||
|  | ||||
|   return CLUTTER_BACKEND_X11 (backend)->last_event_time; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_x11_event_get_key_group: | ||||
|  * @event: a #ClutterEvent of type %CLUTTER_KEY_PRESS or %CLUTTER_KEY_RELEASE | ||||
|  * | ||||
|  * Retrieves the group for the modifiers set in @event | ||||
|  * | ||||
|  * Return value: the group id | ||||
|  * | ||||
|  * Since: 1.4 | ||||
|  */ | ||||
| gint | ||||
| clutter_x11_event_get_key_group (const ClutterEvent *event) | ||||
| { | ||||
|   ClutterEventX11 *event_x11; | ||||
|  | ||||
|   g_return_val_if_fail (event != NULL, 0); | ||||
|   g_return_val_if_fail (event->type == CLUTTER_KEY_PRESS || | ||||
|                         event->type == CLUTTER_KEY_RELEASE, 0); | ||||
|  | ||||
|   event_x11 = _clutter_event_get_platform_data (event); | ||||
|   if (event_x11 == NULL) | ||||
|     return 0; | ||||
|  | ||||
|   return event_x11->key_group; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_x11_event_sequence_get_touch_detail: | ||||
|  * @sequence: a #ClutterEventSequence | ||||
|  * | ||||
|  * Retrieves the touch detail froma #ClutterEventSequence. | ||||
|  * | ||||
|  * Return value: the touch detail | ||||
|  * | ||||
|  * Since: 1.12 | ||||
|  */ | ||||
| guint | ||||
| clutter_x11_event_sequence_get_touch_detail (const ClutterEventSequence *sequence) | ||||
| { | ||||
|   g_return_val_if_fail (sequence != NULL, 0); | ||||
|  | ||||
|   return GPOINTER_TO_UINT (sequence); | ||||
| } | ||||
| @@ -1,74 +0,0 @@ | ||||
| /* | ||||
|  * Clutter. | ||||
|  * | ||||
|  * An OpenGL based 'interactive canvas' library. | ||||
|  * | ||||
|  * Copyright © 2016 Red Hat | ||||
|  * | ||||
|  * This library is free software; you can redistribute it and/or | ||||
|  * modify it under the terms of the GNU Lesser General Public | ||||
|  * License as published by the Free Software Foundation; either | ||||
|  * version 2 of the License, or (at your option) any later version. | ||||
|  * | ||||
|  * This library is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||
|  * Lesser General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU Lesser General Public | ||||
|  * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||||
|  * | ||||
|  * Author: Carlos Garnacho <carlosg@gnome.org> | ||||
|  */ | ||||
|  | ||||
| #ifndef __CLUTTER_INPUT_DEVICE_XI2_TOOL_H__ | ||||
| #define __CLUTTER_INPUT_DEVICE_XI2_TOOL_H__ | ||||
|  | ||||
| #include <clutter/clutter-input-device-tool.h> | ||||
|  | ||||
| G_BEGIN_DECLS | ||||
|  | ||||
| #define CLUTTER_TYPE_INPUT_DEVICE_TOOL_XI2 (clutter_input_device_tool_xi2_get_type ()) | ||||
|  | ||||
| #define CLUTTER_INPUT_DEVICE_TOOL_XI2(o) \ | ||||
|   (G_TYPE_CHECK_INSTANCE_CAST ((o), \ | ||||
|   CLUTTER_TYPE_INPUT_DEVICE_TOOL_XI2, ClutterInputDeviceToolXI2)) | ||||
|  | ||||
| #define CLUTTER_IS_INPUT_DEVICE_TOOL_XI2(o) \ | ||||
|   (G_TYPE_CHECK_INSTANCE_TYPE ((o), \ | ||||
|   CLUTTER_TYPE_INPUT_DEVICE_TOOL_XI2)) | ||||
|  | ||||
| #define CLUTTER_INPUT_DEVICE_TOOL_XI2_CLASS(c) \ | ||||
|   (G_TYPE_CHECK_CLASS_CAST ((c), \ | ||||
|   CLUTTER_TYPE_INPUT_DEVICE_TOOL_XI2, ClutterInputDeviceToolXI2Class)) | ||||
|  | ||||
| #define CLUTTER_IS_INPUT_DEVICE_TOOL_XI2_CLASS(c) \ | ||||
|   (G_TYPE_CHECK_CLASS_TYPE ((c), \ | ||||
|   CLUTTER_TYPE_INPUT_DEVICE_TOOL_XI2)) | ||||
|  | ||||
| #define CLUTTER_INPUT_DEVICE_TOOL_XI2_GET_CLASS(o) \ | ||||
|   (G_TYPE_INSTANCE_GET_CLASS ((o), \ | ||||
|   CLUTTER_TYPE_INPUT_DEVICE_TOOL_XI2, ClutterInputDeviceToolXI2Class)) | ||||
|  | ||||
| typedef struct _ClutterInputDeviceToolXI2 ClutterInputDeviceToolXI2; | ||||
| typedef struct _ClutterInputDeviceToolXI2Class ClutterInputDeviceToolXI2Class; | ||||
|  | ||||
| struct _ClutterInputDeviceToolXI2 | ||||
| { | ||||
|   ClutterInputDeviceTool parent_instance; | ||||
|   struct libinput_tablet_tool *tool; | ||||
| }; | ||||
|  | ||||
| struct _ClutterInputDeviceToolXI2Class | ||||
| { | ||||
|   ClutterInputDeviceToolClass parent_class; | ||||
| }; | ||||
|  | ||||
| GType                    clutter_input_device_tool_xi2_get_type  (void) G_GNUC_CONST; | ||||
|  | ||||
| ClutterInputDeviceTool * clutter_input_device_tool_xi2_new       (guint                        serial, | ||||
|                                                                   ClutterInputDeviceToolType   type); | ||||
|  | ||||
| G_END_DECLS | ||||
|  | ||||
| #endif /* __CLUTTER_INPUT_DEVICE_XI2_TOOL_H__ */ | ||||
| @@ -1,72 +0,0 @@ | ||||
| /* | ||||
|  * Clutter. | ||||
|  * | ||||
|  * An OpenGL based 'interactive canvas' library. | ||||
|  * | ||||
|  * Copyright © 2011  Intel Corp. | ||||
|  * | ||||
|  * This library is free software; you can redistribute it and/or | ||||
|  * modify it under the terms of the GNU Lesser General Public | ||||
|  * License as published by the Free Software Foundation; either | ||||
|  * version 2 of the License, or (at your option) any later version. | ||||
|  * | ||||
|  * This library is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||
|  * Lesser General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU Lesser General Public | ||||
|  * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||||
|  * | ||||
|  * Author: Emmanuele Bassi <ebassi@linux.intel.com> | ||||
|  */ | ||||
|  | ||||
| #ifndef __CLUTTER_INPUT_DEVICE_XI2_H__ | ||||
| #define __CLUTTER_INPUT_DEVICE_XI2_H__ | ||||
|  | ||||
| #include <clutter/clutter-input-device.h> | ||||
| #include <X11/extensions/XInput2.h> | ||||
|  | ||||
| #ifdef HAVE_LIBWACOM | ||||
| #include <libwacom/libwacom.h> | ||||
| #endif | ||||
|  | ||||
| G_BEGIN_DECLS | ||||
|  | ||||
| #define CLUTTER_TYPE_INPUT_DEVICE_XI2           (_clutter_input_device_xi2_get_type ()) | ||||
| #define CLUTTER_INPUT_DEVICE_XI2(obj)           (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_INPUT_DEVICE_XI2, ClutterInputDeviceXI2)) | ||||
| #define CLUTTER_IS_INPUT_DEVICE_XI2(obj)        (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_INPUT_DEVICE_XI2)) | ||||
|  | ||||
| typedef struct _ClutterInputDeviceXI2           ClutterInputDeviceXI2; | ||||
|  | ||||
| GType _clutter_input_device_xi2_get_type (void) G_GNUC_CONST; | ||||
|  | ||||
| void  _clutter_input_device_xi2_translate_state (ClutterEvent    *event, | ||||
| 						 XIModifierState *modifiers_state, | ||||
| 						 XIButtonState   *buttons_state, | ||||
| 						 XIGroupState    *group_state); | ||||
| void  clutter_input_device_xi2_update_tool      (ClutterInputDevice     *device, | ||||
|                                                  ClutterInputDeviceTool *tool); | ||||
| ClutterInputDeviceTool * clutter_input_device_xi2_get_current_tool (ClutterInputDevice *device); | ||||
| gboolean clutter_input_device_xi2_get_pointer_location (ClutterInputDevice *device, | ||||
|                                                         float              *x, | ||||
|                                                         float              *y); | ||||
|  | ||||
| #ifdef HAVE_LIBWACOM | ||||
| void clutter_input_device_xi2_ensure_wacom_info (ClutterInputDevice  *device, | ||||
|                                                  WacomDeviceDatabase *wacom_db); | ||||
|  | ||||
| guint clutter_input_device_xi2_get_pad_group_mode (ClutterInputDevice *device, | ||||
|                                                    guint               group); | ||||
|  | ||||
| void clutter_input_device_xi2_update_pad_state (ClutterInputDevice *device, | ||||
|                                                 guint               button, | ||||
|                                                 guint               state, | ||||
|                                                 guint              *group, | ||||
|                                                 guint              *mode); | ||||
|  | ||||
| #endif | ||||
|  | ||||
| G_END_DECLS | ||||
|  | ||||
| #endif /* __CLUTTER_INPUT_DEVICE_XI2_H__ */ | ||||
| @@ -1,68 +0,0 @@ | ||||
| /* | ||||
|  * Clutter. | ||||
|  * | ||||
|  * An OpenGL based 'interactive canvas' library. | ||||
|  * | ||||
|  * Copyright (C) 2009  Intel Corp. | ||||
|  * | ||||
|  * This library is free software; you can redistribute it and/or | ||||
|  * modify it under the terms of the GNU Lesser General Public | ||||
|  * License as published by the Free Software Foundation; either | ||||
|  * version 2 of the License, or (at your option) any later version. | ||||
|  * | ||||
|  * This library is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||
|  * Lesser General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU Lesser General Public | ||||
|  * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||||
|  * | ||||
|  * Author: Emmanuele Bassi <ebassi@linux.intel.com> | ||||
|  */ | ||||
|  | ||||
| #ifndef __CLUTTER_KEYMAP_X11_H__ | ||||
| #define __CLUTTER_KEYMAP_X11_H__ | ||||
|  | ||||
| #include <glib-object.h> | ||||
| #include <pango/pango.h> | ||||
| #include <clutter/clutter-event.h> | ||||
|  | ||||
| G_BEGIN_DECLS | ||||
|  | ||||
| #define CLUTTER_TYPE_KEYMAP_X11         (_clutter_keymap_x11_get_type ()) | ||||
| #define CLUTTER_KEYMAP_X11(obj)         (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_KEYMAP_X11, ClutterKeymapX11)) | ||||
| #define CLUTTER_IS_KEYMAP_X11(obj)      (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_KEYMAP_X11)) | ||||
|  | ||||
| typedef struct _ClutterKeymapX11        ClutterKeymapX11; | ||||
|  | ||||
| GType _clutter_keymap_x11_get_type (void) G_GNUC_CONST; | ||||
|  | ||||
| gint     _clutter_keymap_x11_get_key_group       (ClutterKeymapX11    *keymap, | ||||
|                                                   ClutterModifierType  state); | ||||
| gboolean _clutter_keymap_x11_get_num_lock_state  (ClutterKeymapX11    *keymap); | ||||
| gboolean _clutter_keymap_x11_get_caps_lock_state (ClutterKeymapX11    *keymap); | ||||
| gint     _clutter_keymap_x11_translate_key_state (ClutterKeymapX11    *keymap, | ||||
|                                                   guint                hardware_keycode, | ||||
|                                                   ClutterModifierType *modifier_state_p, | ||||
|                                                   ClutterModifierType *mods_p); | ||||
| gboolean _clutter_keymap_x11_get_is_modifier     (ClutterKeymapX11    *keymap, | ||||
|                                                   gint                 keycode); | ||||
|  | ||||
| PangoDirection _clutter_keymap_x11_get_direction (ClutterKeymapX11    *keymap); | ||||
|  | ||||
| gboolean clutter_keymap_x11_keycode_for_keyval (ClutterKeymapX11 *keymap_x11, | ||||
|                                                 guint             keyval, | ||||
|                                                 guint            *keycode_out, | ||||
|                                                 guint            *level_out); | ||||
| void     clutter_keymap_x11_latch_modifiers (ClutterKeymapX11 *keymap_x11, | ||||
|                                              uint32_t          level, | ||||
|                                              gboolean          enable); | ||||
| gboolean clutter_keymap_x11_reserve_keycode (ClutterKeymapX11 *keymap_x11, | ||||
|                                              guint             keyval, | ||||
|                                              guint            *keycode_out); | ||||
| void     clutter_keymap_x11_release_keycode_if_needed (ClutterKeymapX11 *keymap_x11, | ||||
|                                                        guint             keycode); | ||||
| G_END_DECLS | ||||
|  | ||||
| #endif /* __CLUTTER_KEYMAP_X11_H__ */ | ||||
| @@ -1,96 +0,0 @@ | ||||
| /* Clutter. | ||||
|  * An OpenGL based 'interactive canvas' library. | ||||
|  * Authored By Matthew Allum  <mallum@openedhand.com> | ||||
|  * Copyright (C) 2006-2007 OpenedHand | ||||
|  * | ||||
|  * This library is free software; you can redistribute it and/or | ||||
|  * modify it under the terms of the GNU Lesser General Public | ||||
|  * License as published by the Free Software Foundation; either | ||||
|  * version 2 of the License, or (at your option) any later version. | ||||
|  * | ||||
|  * This library is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||
|  * Lesser General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU Lesser General Public | ||||
|  * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||||
|  * | ||||
|  * | ||||
|  */ | ||||
|  | ||||
| #ifndef __CLUTTER_STAGE_X11_H__ | ||||
| #define __CLUTTER_STAGE_X11_H__ | ||||
|  | ||||
| #include <clutter/clutter-group.h> | ||||
| #include <clutter/clutter-stage.h> | ||||
| #include <X11/Xlib.h> | ||||
| #include <X11/Xatom.h> | ||||
|  | ||||
| #include "clutter-backend-x11.h" | ||||
| #include "cogl/clutter-stage-cogl.h" | ||||
|  | ||||
| G_BEGIN_DECLS | ||||
|  | ||||
| #define CLUTTER_TYPE_STAGE_X11                  (_clutter_stage_x11_get_type ()) | ||||
| #define CLUTTER_STAGE_X11(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_STAGE_X11, ClutterStageX11)) | ||||
| #define CLUTTER_IS_STAGE_X11(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_STAGE_X11)) | ||||
| #define CLUTTER_STAGE_X11_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_STAGE_X11, ClutterStageX11Class)) | ||||
| #define CLUTTER_IS_STAGE_X11_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_STAGE_X11)) | ||||
| #define CLUTTER_STAGE_X11_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_STAGE_X11, ClutterStageX11Class)) | ||||
|  | ||||
| typedef struct _ClutterStageX11         ClutterStageX11; | ||||
| typedef struct _ClutterStageX11Class    ClutterStageX11Class; | ||||
|  | ||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterStageX11, g_object_unref) | ||||
|  | ||||
| typedef enum | ||||
| { | ||||
|   STAGE_X11_WITHDRAWN = 1 << 1 | ||||
| } ClutterStageX11State; | ||||
|  | ||||
| struct _ClutterStageX11 | ||||
| { | ||||
|   ClutterStageCogl parent_instance; | ||||
|  | ||||
|   CoglOnscreen *onscreen; | ||||
|   Window xwin; | ||||
|   gint xwin_width; | ||||
|   gint xwin_height; /* FIXME target_width / height */ | ||||
|  | ||||
|   ClutterStageView *legacy_view; | ||||
|   GList *legacy_views; | ||||
|  | ||||
|   CoglFrameClosure *frame_closure; | ||||
|  | ||||
|   gchar *title; | ||||
|  | ||||
|   guint clipped_redraws_cool_off; | ||||
|  | ||||
|   ClutterStageX11State wm_state; | ||||
|  | ||||
|   guint is_foreign_xwin       : 1; | ||||
|   guint is_cursor_visible     : 1; | ||||
|   guint viewport_initialized  : 1; | ||||
|   guint accept_focus          : 1; | ||||
| }; | ||||
|  | ||||
| struct _ClutterStageX11Class | ||||
| { | ||||
|   ClutterStageCoglClass parent_class; | ||||
| }; | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| GType _clutter_stage_x11_get_type (void) G_GNUC_CONST; | ||||
|  | ||||
| void  _clutter_stage_x11_events_device_changed (ClutterStageX11 *stage_x11, | ||||
|                                                 ClutterInputDevice *device, | ||||
|                                                 ClutterDeviceManager *device_manager); | ||||
|  | ||||
| /* Private to subclasses */ | ||||
| void            _clutter_stage_x11_set_user_time                (ClutterStageX11 *stage_x11, | ||||
|                                                                  guint32          user_time); | ||||
|  | ||||
| G_END_DECLS | ||||
|  | ||||
| #endif /* __CLUTTER_STAGE_H__ */ | ||||
| @@ -1,219 +0,0 @@ | ||||
| /* | ||||
|  * Clutter. | ||||
|  * | ||||
|  * An OpenGL based 'interactive canvas' library. | ||||
|  * | ||||
|  * Copyright (C) 2016  Red Hat Inc. | ||||
|  * | ||||
|  * This library is free software; you can redistribute it and/or | ||||
|  * modify it under the terms of the GNU Lesser General Public | ||||
|  * License as published by the Free Software Foundation; either | ||||
|  * version 2 of the License, or (at your option) any later version. | ||||
|  * | ||||
|  * This library is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||
|  * Lesser General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU Lesser General Public | ||||
|  * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||||
|  * | ||||
|  * Author: Jonas Ådahl <jadahl@gmail.com> | ||||
|  */ | ||||
|  | ||||
| #include "clutter-build-config.h" | ||||
|  | ||||
| #include <glib-object.h> | ||||
|  | ||||
| #include "clutter-x11.h" | ||||
| #include "X11/extensions/XTest.h" | ||||
|  | ||||
| #include "clutter-virtual-input-device.h" | ||||
| #include "x11/clutter-virtual-input-device-x11.h" | ||||
| #include "x11/clutter-backend-x11.h" | ||||
| #include "x11/clutter-keymap-x11.h" | ||||
|  | ||||
| struct _ClutterVirtualInputDeviceX11 | ||||
| { | ||||
|   ClutterVirtualInputDevice parent; | ||||
| }; | ||||
|  | ||||
| G_DEFINE_TYPE (ClutterVirtualInputDeviceX11, | ||||
|                clutter_virtual_input_device_x11, | ||||
|                CLUTTER_TYPE_VIRTUAL_INPUT_DEVICE) | ||||
|  | ||||
| static void | ||||
| clutter_virtual_input_device_x11_notify_relative_motion (ClutterVirtualInputDevice *virtual_device, | ||||
|                                                          uint64_t                   time_us, | ||||
|                                                          double                     dx, | ||||
|                                                          double                     dy) | ||||
| { | ||||
|   XTestFakeRelativeMotionEvent (clutter_x11_get_default_display (), | ||||
|                                 (int) dx, | ||||
|                                 (int) dy, | ||||
|                                 0); | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_virtual_input_device_x11_notify_absolute_motion (ClutterVirtualInputDevice *virtual_device, | ||||
|                                                          uint64_t                   time_us, | ||||
|                                                          double                     x, | ||||
|                                                          double                     y) | ||||
| { | ||||
|   XTestFakeMotionEvent (clutter_x11_get_default_display (), | ||||
|                         clutter_x11_get_default_screen (), | ||||
|                         (int) x, | ||||
|                         (int) y, | ||||
|                         0); | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_virtual_input_device_x11_notify_button (ClutterVirtualInputDevice *virtual_device, | ||||
|                                                 uint64_t                   time_us, | ||||
|                                                 uint32_t                   button, | ||||
|                                                 ClutterButtonState         button_state) | ||||
| { | ||||
|   XTestFakeButtonEvent (clutter_x11_get_default_display (), | ||||
|                         button, button_state == CLUTTER_BUTTON_STATE_PRESSED, 0); | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_virtual_input_device_x11_notify_discrete_scroll (ClutterVirtualInputDevice *virtual_device, | ||||
|                                                          uint64_t                   time_us, | ||||
|                                                          ClutterScrollDirection     direction, | ||||
|                                                          ClutterScrollSource        scroll_source) | ||||
| { | ||||
|   Display *xdisplay = clutter_x11_get_default_display (); | ||||
|   int button; | ||||
|  | ||||
|   switch (direction) | ||||
|     { | ||||
|     case CLUTTER_SCROLL_UP: | ||||
|       button = 4; | ||||
|       break; | ||||
|     case CLUTTER_SCROLL_DOWN: | ||||
|       button = 5; | ||||
|       break; | ||||
|     case CLUTTER_SCROLL_LEFT: | ||||
|       button = 6; | ||||
|       break; | ||||
|     case CLUTTER_SCROLL_RIGHT: | ||||
|       button = 7; | ||||
|       break; | ||||
|     default: | ||||
|       g_warn_if_reached (); | ||||
|       return; | ||||
|     } | ||||
|  | ||||
|   XTestFakeButtonEvent (xdisplay, button, True, 0); | ||||
|   XTestFakeButtonEvent (xdisplay, button, False, 0); | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_virtual_input_device_x11_notify_scroll_continuous (ClutterVirtualInputDevice *virtual_device, | ||||
|                                                            uint64_t                   time_us, | ||||
|                                                            double                     dx, | ||||
|                                                            double                     dy, | ||||
|                                                            ClutterScrollSource        scroll_source, | ||||
|                                                            ClutterScrollFinishFlags   finish_flags) | ||||
| { | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_virtual_input_device_x11_notify_key (ClutterVirtualInputDevice *virtual_device, | ||||
|                                              uint64_t                   time_us, | ||||
|                                              uint32_t                   key, | ||||
|                                              ClutterKeyState            key_state) | ||||
| { | ||||
|   XTestFakeKeyEvent (clutter_x11_get_default_display (), | ||||
|                      key, key_state == CLUTTER_KEY_STATE_PRESSED, 0); | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_virtual_input_device_x11_notify_keyval (ClutterVirtualInputDevice *virtual_device, | ||||
| 						uint64_t                   time_us, | ||||
| 						uint32_t                   keyval, | ||||
| 						ClutterKeyState            key_state) | ||||
| { | ||||
|   ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (clutter_get_default_backend ()); | ||||
|   ClutterKeymapX11 *keymap = backend_x11->keymap; | ||||
|   uint32_t keycode, level; | ||||
|  | ||||
|   if (!clutter_keymap_x11_keycode_for_keyval (keymap, keyval, &keycode, &level)) | ||||
|     { | ||||
|       level = 0; | ||||
|  | ||||
|       if (!clutter_keymap_x11_reserve_keycode (keymap, keyval, &keycode)) | ||||
|         { | ||||
|           g_warning ("No keycode found for keyval %x in current group", keyval); | ||||
|           return; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   if (!_clutter_keymap_x11_get_is_modifier (keymap, keycode) && | ||||
|       key_state == CLUTTER_KEY_STATE_PRESSED) | ||||
|     clutter_keymap_x11_latch_modifiers (keymap, level, TRUE); | ||||
|  | ||||
|   XTestFakeKeyEvent (clutter_x11_get_default_display (), | ||||
|                      (KeyCode) keycode, | ||||
|                      key_state == CLUTTER_KEY_STATE_PRESSED, 0); | ||||
|  | ||||
|  | ||||
|   if (key_state == CLUTTER_KEY_STATE_RELEASED) | ||||
|     { | ||||
|       if (!_clutter_keymap_x11_get_is_modifier (keymap, keycode)) | ||||
|         clutter_keymap_x11_latch_modifiers (keymap, level, FALSE); | ||||
|       clutter_keymap_x11_release_keycode_if_needed (keymap, keycode); | ||||
|     } | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_virtual_input_device_x11_notify_touch_down (ClutterVirtualInputDevice *virtual_device, | ||||
|                                                     uint64_t                   time_us, | ||||
|                                                     int                        device_slot, | ||||
|                                                     double                     x, | ||||
|                                                     double                     y) | ||||
| { | ||||
|   g_warning ("Virtual touch motion not implemented under X11"); | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_virtual_input_device_x11_notify_touch_motion (ClutterVirtualInputDevice *virtual_device, | ||||
|                                                       uint64_t                   time_us, | ||||
|                                                       int                        device_slot, | ||||
|                                                       double                     x, | ||||
|                                                       double                     y) | ||||
| { | ||||
|   g_warning ("Virtual touch motion not implemented under X11"); | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_virtual_input_device_x11_notify_touch_up (ClutterVirtualInputDevice *virtual_device, | ||||
|                                                   uint64_t                   time_us, | ||||
|                                                   int                        device_slot) | ||||
| { | ||||
|   g_warning ("Virtual touch motion not implemented under X11"); | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_virtual_input_device_x11_init (ClutterVirtualInputDeviceX11 *virtual_device_x11) | ||||
| { | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_virtual_input_device_x11_class_init (ClutterVirtualInputDeviceX11Class *klass) | ||||
| { | ||||
|   ClutterVirtualInputDeviceClass *virtual_input_device_class = | ||||
|     CLUTTER_VIRTUAL_INPUT_DEVICE_CLASS (klass); | ||||
|  | ||||
|   virtual_input_device_class->notify_relative_motion = clutter_virtual_input_device_x11_notify_relative_motion; | ||||
|   virtual_input_device_class->notify_absolute_motion = clutter_virtual_input_device_x11_notify_absolute_motion; | ||||
|   virtual_input_device_class->notify_button = clutter_virtual_input_device_x11_notify_button; | ||||
|   virtual_input_device_class->notify_discrete_scroll = clutter_virtual_input_device_x11_notify_discrete_scroll; | ||||
|   virtual_input_device_class->notify_scroll_continuous = clutter_virtual_input_device_x11_notify_scroll_continuous; | ||||
|   virtual_input_device_class->notify_key = clutter_virtual_input_device_x11_notify_key; | ||||
|   virtual_input_device_class->notify_keyval = clutter_virtual_input_device_x11_notify_keyval; | ||||
|   virtual_input_device_class->notify_touch_down = clutter_virtual_input_device_x11_notify_touch_down; | ||||
|   virtual_input_device_class->notify_touch_motion = clutter_virtual_input_device_x11_notify_touch_motion; | ||||
|   virtual_input_device_class->notify_touch_up = clutter_virtual_input_device_x11_notify_touch_up; | ||||
| } | ||||
| @@ -100,16 +100,8 @@ int      clutter_x11_get_default_screen  (void); | ||||
| CLUTTER_EXPORT | ||||
| Window   clutter_x11_get_root_window     (void); | ||||
| CLUTTER_EXPORT | ||||
| XVisualInfo *clutter_x11_get_visual_info (void); | ||||
| CLUTTER_EXPORT | ||||
| void     clutter_x11_set_display         (Display * xdpy); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| Window       clutter_x11_get_stage_window  (ClutterStage *stage); | ||||
| CLUTTER_EXPORT | ||||
| gboolean     clutter_x11_set_stage_foreign (ClutterStage *stage, | ||||
|                                             Window        xwindow); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void         clutter_x11_add_filter    (ClutterX11FilterFunc func, | ||||
|                                         gpointer             data); | ||||
| @@ -117,20 +109,6 @@ CLUTTER_EXPORT | ||||
| void         clutter_x11_remove_filter (ClutterX11FilterFunc func, | ||||
|                                         gpointer             data); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| ClutterX11FilterReturn clutter_x11_handle_event (XEvent *xevent); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void     clutter_x11_disable_event_retrieval (void); | ||||
| CLUTTER_EXPORT | ||||
| gboolean clutter_x11_has_event_retrieval (void); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| ClutterStage *clutter_x11_get_stage_from_window (Window win); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| gboolean clutter_x11_has_xinput (void); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| gboolean clutter_x11_has_composite_extension (void); | ||||
|  | ||||
| @@ -144,15 +122,6 @@ void     clutter_x11_set_use_stereo_stage (gboolean use_stereo); | ||||
| CLUTTER_EXPORT | ||||
| gboolean clutter_x11_get_use_stereo_stage (void); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| Time clutter_x11_get_current_event_time (void); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| gint clutter_x11_event_get_key_group (const ClutterEvent *event); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| guint clutter_x11_event_sequence_get_touch_detail (const ClutterEventSequence *sequence); | ||||
|  | ||||
| G_END_DECLS | ||||
|  | ||||
| #endif /* __CLUTTER_X11_H__ */ | ||||
|   | ||||
| @@ -71,14 +71,6 @@ if have_x11 | ||||
|   ] | ||||
| endif | ||||
|  | ||||
| if have_native_backend | ||||
|   clutter_pkg_private_deps += [ | ||||
|     libudev_dep, | ||||
|     libinput_dep, | ||||
|     xkbcommon_dep, | ||||
|   ] | ||||
| endif | ||||
|  | ||||
| if have_libwacom | ||||
|   clutter_pkg_private_deps += [ | ||||
|     libwacom_dep, | ||||
| @@ -94,6 +86,3 @@ clutter_deps = [ | ||||
|  | ||||
| subdir('clutter') | ||||
|  | ||||
| if have_clutter_tests | ||||
|   subdir('tests') | ||||
| endif | ||||
|   | ||||
| @@ -1,84 +0,0 @@ | ||||
| #define CLUTTER_DISABLE_DEPRECATION_WARNINGS | ||||
| #include <clutter/clutter.h> | ||||
| #include <string.h> | ||||
|  | ||||
| static CoglHandle | ||||
| make_texture (void) | ||||
| { | ||||
|   guint32 *data = g_malloc (100 * 100 * 4); | ||||
|   int x; | ||||
|   int y; | ||||
|  | ||||
|   for (y = 0; y < 100; y ++) | ||||
|     for (x = 0; x < 100; x++) | ||||
|       { | ||||
|         if (x < 50 && y < 50) | ||||
|           data[y * 100 + x] = 0xff00ff00; | ||||
|         else | ||||
|           data[y * 100 + x] = 0xff00ffff; | ||||
|       } | ||||
|   return cogl_texture_new_from_data (100, | ||||
|                                      100, | ||||
|                                      COGL_TEXTURE_NONE, | ||||
|                                      COGL_PIXEL_FORMAT_ARGB_8888, | ||||
|                                      COGL_PIXEL_FORMAT_ARGB_8888, | ||||
|                                      400, | ||||
|                                      (guchar *)data); | ||||
| } | ||||
|  | ||||
| static void | ||||
| texture_pick_with_alpha (void) | ||||
| { | ||||
|   ClutterTexture *tex = CLUTTER_TEXTURE (clutter_texture_new ()); | ||||
|   ClutterStage *stage = CLUTTER_STAGE (clutter_test_get_stage ()); | ||||
|   ClutterActor *actor; | ||||
|  | ||||
|   clutter_texture_set_cogl_texture (tex, make_texture ()); | ||||
|  | ||||
|   clutter_actor_add_child (CLUTTER_ACTOR (stage), CLUTTER_ACTOR (tex)); | ||||
|  | ||||
|   clutter_actor_show (CLUTTER_ACTOR (stage)); | ||||
|  | ||||
|   if (g_test_verbose ()) | ||||
|     { | ||||
|       g_print ("\nstage = %p\n", stage); | ||||
|       g_print ("texture = %p\n\n", tex); | ||||
|     } | ||||
|  | ||||
|   clutter_texture_set_pick_with_alpha (tex, TRUE); | ||||
|   if (g_test_verbose ()) | ||||
|     g_print ("Testing with pick-with-alpha enabled:\n"); | ||||
|  | ||||
|   /* This should fall through and hit the stage: */ | ||||
|   actor = clutter_stage_get_actor_at_pos (stage, CLUTTER_PICK_ALL, 10, 10); | ||||
|   if (g_test_verbose ()) | ||||
|     g_print ("actor @ (10, 10) = %p\n", actor); | ||||
|   g_assert (actor == CLUTTER_ACTOR (stage)); | ||||
|  | ||||
|   /* The rest should hit the texture */ | ||||
|   actor = clutter_stage_get_actor_at_pos (stage, CLUTTER_PICK_ALL, 90, 10); | ||||
|   if (g_test_verbose ()) | ||||
|     g_print ("actor @ (90, 10) = %p\n", actor); | ||||
|   g_assert (actor == CLUTTER_ACTOR (tex)); | ||||
|   actor = clutter_stage_get_actor_at_pos (stage, CLUTTER_PICK_ALL, 90, 90); | ||||
|   if (g_test_verbose ()) | ||||
|     g_print ("actor @ (90, 90) = %p\n", actor); | ||||
|   g_assert (actor == CLUTTER_ACTOR (tex)); | ||||
|   actor = clutter_stage_get_actor_at_pos (stage, CLUTTER_PICK_ALL, 10, 90); | ||||
|   if (g_test_verbose ()) | ||||
|     g_print ("actor @ (10, 90) = %p\n", actor); | ||||
|   g_assert (actor == CLUTTER_ACTOR (tex)); | ||||
|  | ||||
|   clutter_texture_set_pick_with_alpha (tex, FALSE); | ||||
|   if (g_test_verbose ()) | ||||
|     g_print ("Testing with pick-with-alpha disabled:\n"); | ||||
|  | ||||
|   actor = clutter_stage_get_actor_at_pos (stage, CLUTTER_PICK_ALL, 10, 10); | ||||
|   if (g_test_verbose ()) | ||||
|     g_print ("actor @ (10, 10) = %p\n", actor); | ||||
|   g_assert (actor == CLUTTER_ACTOR (tex)); | ||||
| } | ||||
|  | ||||
| CLUTTER_TEST_SUITE ( | ||||
|   CLUTTER_TEST_UNIT ("/texture/pick-with-alpha", texture_pick_with_alpha) | ||||
| ) | ||||
| @@ -1,169 +0,0 @@ | ||||
| #ifndef __gl2_h_ | ||||
| #define __gl2_h_ | ||||
|  | ||||
| /* $Revision: 16803 $ on $Date:: 2012-02-02 09:49:18 -0800 #$ */ | ||||
|  | ||||
| #include <GLES2/gl2platform.h> | ||||
| #include <cogl/cogl-gles2-types.h> | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif | ||||
|  | ||||
| /* | ||||
|  * This document is licensed under the SGI Free Software B License Version | ||||
|  * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . | ||||
|  */ | ||||
|  | ||||
| /*------------------------------------------------------------------------- | ||||
|  * GL core functions. | ||||
|  *-----------------------------------------------------------------------*/ | ||||
|  | ||||
| GL_APICALL void         GL_APIENTRY glActiveTexture (GLenum texture); | ||||
| GL_APICALL void         GL_APIENTRY glAttachShader (GLuint program, GLuint shader); | ||||
| GL_APICALL void         GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar* name); | ||||
| GL_APICALL void         GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer); | ||||
| GL_APICALL void         GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer); | ||||
| GL_APICALL void         GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer); | ||||
| GL_APICALL void         GL_APIENTRY glBindTexture (GLenum target, GLuint texture); | ||||
| GL_APICALL void         GL_APIENTRY glBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); | ||||
| GL_APICALL void         GL_APIENTRY glBlendEquation ( GLenum mode ); | ||||
| GL_APICALL void         GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha); | ||||
| GL_APICALL void         GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor); | ||||
| GL_APICALL void         GL_APIENTRY glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); | ||||
| GL_APICALL void         GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage); | ||||
| GL_APICALL void         GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data); | ||||
| GL_APICALL GLenum       GL_APIENTRY glCheckFramebufferStatus (GLenum target); | ||||
| GL_APICALL void         GL_APIENTRY glClear (GLbitfield mask); | ||||
| GL_APICALL void         GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); | ||||
| GL_APICALL void         GL_APIENTRY glClearDepthf (GLclampf depth); | ||||
| GL_APICALL void         GL_APIENTRY glClearStencil (GLint s); | ||||
| GL_APICALL void         GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); | ||||
| GL_APICALL void         GL_APIENTRY glCompileShader (GLuint shader); | ||||
| GL_APICALL void         GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data); | ||||
| GL_APICALL void         GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data); | ||||
| GL_APICALL void         GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); | ||||
| GL_APICALL void         GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); | ||||
| GL_APICALL GLuint       GL_APIENTRY glCreateProgram (void); | ||||
| GL_APICALL GLuint       GL_APIENTRY glCreateShader (GLenum type); | ||||
| GL_APICALL void         GL_APIENTRY glCullFace (GLenum mode); | ||||
| GL_APICALL void         GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint* buffers); | ||||
| GL_APICALL void         GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint* framebuffers); | ||||
| GL_APICALL void         GL_APIENTRY glDeleteProgram (GLuint program); | ||||
| GL_APICALL void         GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint* renderbuffers); | ||||
| GL_APICALL void         GL_APIENTRY glDeleteShader (GLuint shader); | ||||
| GL_APICALL void         GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint* textures); | ||||
| GL_APICALL void         GL_APIENTRY glDepthFunc (GLenum func); | ||||
| GL_APICALL void         GL_APIENTRY glDepthMask (GLboolean flag); | ||||
| GL_APICALL void         GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar); | ||||
| GL_APICALL void         GL_APIENTRY glDetachShader (GLuint program, GLuint shader); | ||||
| GL_APICALL void         GL_APIENTRY glDisable (GLenum cap); | ||||
| GL_APICALL void         GL_APIENTRY glDisableVertexAttribArray (GLuint index); | ||||
| GL_APICALL void         GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count); | ||||
| GL_APICALL void         GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices); | ||||
| GL_APICALL void         GL_APIENTRY glEnable (GLenum cap); | ||||
| GL_APICALL void         GL_APIENTRY glEnableVertexAttribArray (GLuint index); | ||||
| GL_APICALL void         GL_APIENTRY glFinish (void); | ||||
| GL_APICALL void         GL_APIENTRY glFlush (void); | ||||
| GL_APICALL void         GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); | ||||
| GL_APICALL void         GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); | ||||
| GL_APICALL void         GL_APIENTRY glFrontFace (GLenum mode); | ||||
| GL_APICALL void         GL_APIENTRY glGenBuffers (GLsizei n, GLuint* buffers); | ||||
| GL_APICALL void         GL_APIENTRY glGenerateMipmap (GLenum target); | ||||
| GL_APICALL void         GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint* framebuffers); | ||||
| GL_APICALL void         GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint* renderbuffers); | ||||
| GL_APICALL void         GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures); | ||||
| GL_APICALL void         GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); | ||||
| GL_APICALL void         GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); | ||||
| GL_APICALL void         GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders); | ||||
| GL_APICALL int          GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name); | ||||
| GL_APICALL void         GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params); | ||||
| GL_APICALL void         GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params); | ||||
| GL_APICALL GLenum       GL_APIENTRY glGetError (void); | ||||
| GL_APICALL void         GL_APIENTRY glGetFloatv (GLenum pname, GLfloat* params); | ||||
| GL_APICALL void         GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params); | ||||
| GL_APICALL void         GL_APIENTRY glGetIntegerv (GLenum pname, GLint* params); | ||||
| GL_APICALL void         GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint* params); | ||||
| GL_APICALL void         GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog); | ||||
| GL_APICALL void         GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params); | ||||
| GL_APICALL void         GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint* params); | ||||
| GL_APICALL void         GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog); | ||||
| GL_APICALL void         GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision); | ||||
| GL_APICALL void         GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source); | ||||
| GL_APICALL const GLubyte* GL_APIENTRY glGetString (GLenum name); | ||||
| GL_APICALL void         GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params); | ||||
| GL_APICALL void         GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params); | ||||
| GL_APICALL void         GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat* params); | ||||
| GL_APICALL void         GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint* params); | ||||
| GL_APICALL int          GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name); | ||||
| GL_APICALL void         GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params); | ||||
| GL_APICALL void         GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params); | ||||
| GL_APICALL void         GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid** pointer); | ||||
| GL_APICALL void         GL_APIENTRY glHint (GLenum target, GLenum mode); | ||||
| GL_APICALL GLboolean    GL_APIENTRY glIsBuffer (GLuint buffer); | ||||
| GL_APICALL GLboolean    GL_APIENTRY glIsEnabled (GLenum cap); | ||||
| GL_APICALL GLboolean    GL_APIENTRY glIsFramebuffer (GLuint framebuffer); | ||||
| GL_APICALL GLboolean    GL_APIENTRY glIsProgram (GLuint program); | ||||
| GL_APICALL GLboolean    GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer); | ||||
| GL_APICALL GLboolean    GL_APIENTRY glIsShader (GLuint shader); | ||||
| GL_APICALL GLboolean    GL_APIENTRY glIsTexture (GLuint texture); | ||||
| GL_APICALL void         GL_APIENTRY glLineWidth (GLfloat width); | ||||
| GL_APICALL void         GL_APIENTRY glLinkProgram (GLuint program); | ||||
| GL_APICALL void         GL_APIENTRY glPixelStorei (GLenum pname, GLint param); | ||||
| GL_APICALL void         GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units); | ||||
| GL_APICALL void         GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels); | ||||
| GL_APICALL void         GL_APIENTRY glReleaseShaderCompiler (void); | ||||
| GL_APICALL void         GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); | ||||
| GL_APICALL void         GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert); | ||||
| GL_APICALL void         GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); | ||||
| GL_APICALL void         GL_APIENTRY glShaderBinary (GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length); | ||||
| GL_APICALL void         GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length); | ||||
| GL_APICALL void         GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask); | ||||
| GL_APICALL void         GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask); | ||||
| GL_APICALL void         GL_APIENTRY glStencilMask (GLuint mask); | ||||
| GL_APICALL void         GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask); | ||||
| GL_APICALL void         GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); | ||||
| GL_APICALL void         GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass); | ||||
| GL_APICALL void         GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels); | ||||
| GL_APICALL void         GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param); | ||||
| GL_APICALL void         GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat* params); | ||||
| GL_APICALL void         GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param); | ||||
| GL_APICALL void         GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint* params); | ||||
| GL_APICALL void         GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels); | ||||
| GL_APICALL void         GL_APIENTRY glUniform1f (GLint location, GLfloat x); | ||||
| GL_APICALL void         GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat* v); | ||||
| GL_APICALL void         GL_APIENTRY glUniform1i (GLint location, GLint x); | ||||
| GL_APICALL void         GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint* v); | ||||
| GL_APICALL void         GL_APIENTRY glUniform2f (GLint location, GLfloat x, GLfloat y); | ||||
| GL_APICALL void         GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat* v); | ||||
| GL_APICALL void         GL_APIENTRY glUniform2i (GLint location, GLint x, GLint y); | ||||
| GL_APICALL void         GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint* v); | ||||
| GL_APICALL void         GL_APIENTRY glUniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z); | ||||
| GL_APICALL void         GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat* v); | ||||
| GL_APICALL void         GL_APIENTRY glUniform3i (GLint location, GLint x, GLint y, GLint z); | ||||
| GL_APICALL void         GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint* v); | ||||
| GL_APICALL void         GL_APIENTRY glUniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); | ||||
| GL_APICALL void         GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat* v); | ||||
| GL_APICALL void         GL_APIENTRY glUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w); | ||||
| GL_APICALL void         GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint* v); | ||||
| GL_APICALL void         GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); | ||||
| GL_APICALL void         GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); | ||||
| GL_APICALL void         GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); | ||||
| GL_APICALL void         GL_APIENTRY glUseProgram (GLuint program); | ||||
| GL_APICALL void         GL_APIENTRY glValidateProgram (GLuint program); | ||||
| GL_APICALL void         GL_APIENTRY glVertexAttrib1f (GLuint indx, GLfloat x); | ||||
| GL_APICALL void         GL_APIENTRY glVertexAttrib1fv (GLuint indx, const GLfloat* values); | ||||
| GL_APICALL void         GL_APIENTRY glVertexAttrib2f (GLuint indx, GLfloat x, GLfloat y); | ||||
| GL_APICALL void         GL_APIENTRY glVertexAttrib2fv (GLuint indx, const GLfloat* values); | ||||
| GL_APICALL void         GL_APIENTRY glVertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z); | ||||
| GL_APICALL void         GL_APIENTRY glVertexAttrib3fv (GLuint indx, const GLfloat* values); | ||||
| GL_APICALL void         GL_APIENTRY glVertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w); | ||||
| GL_APICALL void         GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloat* values); | ||||
| GL_APICALL void         GL_APIENTRY glVertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr); | ||||
| GL_APICALL void         GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif | ||||
|  | ||||
| #endif /* __gl2_h_ */ | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,28 +0,0 @@ | ||||
| #ifndef __gl2platform_h_ | ||||
| #define __gl2platform_h_ | ||||
|  | ||||
| /* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */ | ||||
|  | ||||
| /* | ||||
|  * This document is licensed under the SGI Free Software B License Version | ||||
|  * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . | ||||
|  */ | ||||
|  | ||||
| /* Platform-specific types and definitions for OpenGL ES 2.X  gl2.h | ||||
|  * | ||||
|  * Adopters may modify khrplatform.h and this file to suit their platform. | ||||
|  * You are encouraged to submit all modifications to the Khronos group so that | ||||
|  * they can be included in future versions of this file.  Please submit changes | ||||
|  * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) | ||||
|  * by filing a bug against product "OpenGL-ES" component "Registry". | ||||
|  */ | ||||
|  | ||||
| #ifndef GL_APICALL | ||||
| #define GL_APICALL | ||||
| #endif | ||||
|  | ||||
| #ifndef GL_APIENTRY | ||||
| #define GL_APIENTRY | ||||
| #endif | ||||
|  | ||||
| #endif /* __gl2platform_h_ */ | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,4 +0,0 @@ | ||||
| { | ||||
| local: | ||||
|   *; | ||||
| }; | ||||
| @@ -1,45 +0,0 @@ | ||||
| cogl_gles2_public_headers = [ | ||||
|   'GLES2/gl2.h', | ||||
|   'GLES2/gl2ext.h', | ||||
|   'GLES2/gl2platform.h', | ||||
| ] | ||||
|  | ||||
| cogl_gles2_sources = [ | ||||
|   'cogl-gles2-api.c', | ||||
| ] | ||||
|  | ||||
| libmutter_cogl_gles2_map = 'libmutter-cogl-gles2.map' | ||||
| libmutter_cogl_gles2_link_args = [ | ||||
|   '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), | ||||
|       libmutter_cogl_gles2_map), | ||||
| ] | ||||
| libmutter_cogl_gles2 = shared_library('mutter-cogl-gles2-' + libmutter_api_version, | ||||
|   sources: [cogl_gles2_sources, cogl_gles2_public_headers], | ||||
|   version: '0.0.0', | ||||
|   soversion: 0, | ||||
|   c_args: cogl_c_args, | ||||
|   include_directories: [cogl_includepath, cogl_path_includepath], | ||||
|   link_depends: libmutter_cogl_gles2_map, | ||||
|   link_args: libmutter_cogl_gles2_link_args, | ||||
|   dependencies: libmutter_cogl_dep, | ||||
|   install_rpath: pkglibdir, | ||||
|   install_dir: pkglibdir, | ||||
|   install: true, | ||||
| ) | ||||
|  | ||||
| cogl_gles2_includesubdir = join_paths(cogl_includesubdir, 'cogl-gles2/GLES2') | ||||
| install_headers(cogl_gles2_public_headers, | ||||
|   subdir: cogl_gles2_includesubdir) | ||||
|  | ||||
| pkg.generate(libmutter_cogl_gles2, | ||||
|   name: 'CoglGles2', | ||||
|   filebase: 'mutter-cogl-gles2-' + libmutter_api_version, | ||||
|   description: 'A cogl GLES2 helper library for mutter', | ||||
|   subdirs: join_paths(pkgname, 'cogl'), | ||||
|   requires: [cogl_pkg_deps, libmutter_cogl_name], | ||||
|   version: meson.project_version(), | ||||
|   variables: [ | ||||
|     'apiversion=' + libmutter_api_version, | ||||
|   ], | ||||
|   install_dir: pcdir, | ||||
| ) | ||||
| @@ -1,13 +0,0 @@ | ||||
| prefix=@prefix@ | ||||
| exec_prefix=@exec_prefix@ | ||||
| apiversion=@LIBMUTTER_API_VERSION@ | ||||
| libdir=@libdir@/mutter-${apiversion} | ||||
| includedir=@includedir@/mutter-${apiversion} | ||||
| requires=@COGL_PKG_REQUIRES@ mutter-cogl-${apiversion} | ||||
|  | ||||
| Name: Cogl | ||||
| Description: An object oriented GL/GLES Abstraction/Utility Layer | ||||
| Version: @MUTTER_VERSION@ | ||||
| Libs: -L${libdir} -lmutter-cogl-gles2-${apiversion} | ||||
| Cflags: -I${includedir}/cogl | ||||
| Requires: ${requires} | ||||
| @@ -212,9 +212,6 @@ struct _CoglContext | ||||
|   CoglList onscreen_dirty_queue; | ||||
|   CoglClosure *onscreen_dispatch_idle; | ||||
|  | ||||
|   CoglGLES2Context *current_gles2_context; | ||||
|   GQueue gles2_context_stack; | ||||
|  | ||||
|   /* This becomes TRUE the first time the context is bound to an | ||||
|    * onscreen buffer. This is used by cogl-framebuffer-gl to determine | ||||
|    * when to initialise the glDrawBuffer state */ | ||||
| @@ -234,8 +231,6 @@ struct _CoglContext | ||||
|   CoglIndices      *rectangle_short_indices; | ||||
|   int               rectangle_short_indices_len; | ||||
|  | ||||
|   gboolean          in_begin_gl_block; | ||||
|  | ||||
|   CoglPipeline     *texture_download_pipeline; | ||||
|   CoglPipeline     *blit_texture_pipeline; | ||||
|  | ||||
|   | ||||
| @@ -288,8 +288,6 @@ cogl_context_new (CoglDisplay *display, | ||||
|   _cogl_list_init (&context->onscreen_events_queue); | ||||
|   _cogl_list_init (&context->onscreen_dirty_queue); | ||||
|  | ||||
|   g_queue_init (&context->gles2_context_stack); | ||||
|  | ||||
|   context->journal_flush_attributes_array = | ||||
|     g_array_new (TRUE, FALSE, sizeof (CoglAttribute *)); | ||||
|   context->journal_clip_bounds = NULL; | ||||
| @@ -349,8 +347,6 @@ cogl_context_new (CoglDisplay *display, | ||||
|   context->current_path = NULL; | ||||
|   context->stencil_pipeline = cogl_pipeline_new (context); | ||||
|  | ||||
|   context->in_begin_gl_block = FALSE; | ||||
|  | ||||
|   context->quad_buffer_indices_byte = NULL; | ||||
|   context->quad_buffer_indices = NULL; | ||||
|   context->quad_buffer_indices_len = 0; | ||||
| @@ -454,8 +450,6 @@ _cogl_context_free (CoglContext *context) | ||||
|   if (context->swap_callback_closures) | ||||
|     g_hash_table_destroy (context->swap_callback_closures); | ||||
|  | ||||
|   g_warn_if_fail (context->gles2_context_stack.length == 0); | ||||
|  | ||||
|   if (context->journal_flush_attributes_array) | ||||
|     g_array_free (context->journal_flush_attributes_array, TRUE); | ||||
|   if (context->journal_clip_bounds) | ||||
|   | ||||
| @@ -202,8 +202,6 @@ cogl_is_context (void *object); | ||||
|  * @COGL_FEATURE_ID_BUFFER_AGE: Available if the age of #CoglOnscreen back | ||||
|  *    buffers are tracked and so cogl_onscreen_get_buffer_age() can be | ||||
|  *    expected to return age values other than 0. | ||||
|  * @COGL_FEATURE_ID_GLES2_CONTEXT: Whether creating new GLES2 contexts is | ||||
|  *    suported. | ||||
|  * @COGL_FEATURE_ID_DEPTH_TEXTURE: Whether #CoglFramebuffer support rendering | ||||
|  *     the depth buffer to a texture. | ||||
|  * @COGL_FEATURE_ID_PRESENTATION_TIME: Whether frame presentation | ||||
| @@ -227,7 +225,6 @@ typedef enum _CoglFeatureID | ||||
|   COGL_FEATURE_ID_MAP_BUFFER_FOR_WRITE, | ||||
|   COGL_FEATURE_ID_MIRRORED_REPEAT, | ||||
|   COGL_FEATURE_ID_SWAP_BUFFERS_EVENT, | ||||
|   COGL_FEATURE_ID_GLES2_CONTEXT, | ||||
|   COGL_FEATURE_ID_DEPTH_TEXTURE, | ||||
|   COGL_FEATURE_ID_PRESENTATION_TIME, | ||||
|   COGL_FEATURE_ID_FENCE, | ||||
|   | ||||
| @@ -1,201 +0,0 @@ | ||||
| /* | ||||
|  * Cogl | ||||
|  * | ||||
|  * A Low Level GPU Graphics and Utilities API | ||||
|  * | ||||
|  * Copyright (C) 2011 Collabora Ltd. | ||||
|  * Copyright (C) 2012 Intel Corporation. | ||||
|  * | ||||
|  * Permission is hereby granted, free of charge, to any person | ||||
|  * obtaining a copy of this software and associated documentation | ||||
|  * files (the "Software"), to deal in the Software without | ||||
|  * restriction, including without limitation the rights to use, copy, | ||||
|  * modify, merge, publish, distribute, sublicense, and/or sell copies | ||||
|  * of the Software, and to permit persons to whom the Software is | ||||
|  * furnished to do so, subject to the following conditions: | ||||
|  * | ||||
|  * The above copyright notice and this permission notice shall be | ||||
|  * included in all copies or substantial portions of the Software. | ||||
|  * | ||||
|  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||||
|  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||||
|  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||||
|  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS | ||||
|  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | ||||
|  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||||
|  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||||
|  * SOFTWARE. | ||||
|  * | ||||
|  * Authors: | ||||
|  *  Tomeu Vizoso <tomeu.vizoso@collabora.com> | ||||
|  *  Robert Bragg <robert@linux.intel.com> | ||||
|  * | ||||
|  */ | ||||
|  | ||||
| #ifndef __COGL_GLES2_CONTEXT_PRIVATE_H | ||||
| #define __COGL_GLES2_CONTEXT_PRIVATE_H | ||||
|  | ||||
| #include <glib.h> | ||||
|  | ||||
| #include "cogl-object-private.h" | ||||
| #include "cogl-framebuffer-private.h" | ||||
| #include "cogl-list.h" | ||||
|  | ||||
| typedef struct _CoglGLES2Offscreen | ||||
| { | ||||
|   CoglList link; | ||||
|   CoglOffscreen *original_offscreen; | ||||
|   CoglGLFramebuffer gl_framebuffer; | ||||
| } CoglGLES2Offscreen; | ||||
|  | ||||
| typedef struct | ||||
| { | ||||
|   /* GL's ID for the shader */ | ||||
|   GLuint object_id; | ||||
|   /* Shader type */ | ||||
|   GLenum type; | ||||
|  | ||||
|   /* Number of references to this shader. The shader will have one | ||||
|    * reference when it is created. This reference will be removed when | ||||
|    * glDeleteShader is called. An additional reference will be taken | ||||
|    * whenever the shader is attached to a program. This is necessary | ||||
|    * to correctly detect when a shader is destroyed because | ||||
|    * glDeleteShader doesn't actually delete the object if it is | ||||
|    * attached to a program */ | ||||
|   int ref_count; | ||||
|  | ||||
|   /* Set once this object has had glDeleteShader called on it. We need | ||||
|    * to keep track of this so we don't deref the data twice if the | ||||
|    * application calls glDeleteShader multiple times */ | ||||
|   gboolean deleted; | ||||
| } CoglGLES2ShaderData; | ||||
|  | ||||
| typedef enum | ||||
| { | ||||
|   COGL_GLES2_FLIP_STATE_UNKNOWN, | ||||
|   COGL_GLES2_FLIP_STATE_NORMAL, | ||||
|   COGL_GLES2_FLIP_STATE_FLIPPED | ||||
| } CoglGLES2FlipState; | ||||
|  | ||||
| typedef struct | ||||
| { | ||||
|   /* GL's ID for the program */ | ||||
|   GLuint object_id; | ||||
|  | ||||
|   /* List of shaders attached to this program */ | ||||
|   GList *attached_shaders; | ||||
|  | ||||
|   /* Reference count. There can be up to two references. One of these | ||||
|    * will exist between glCreateProgram and glDeleteShader, the other | ||||
|    * will exist while the program is made current. This is necessary | ||||
|    * to correctly detect when the program is deleted because | ||||
|    * glDeleteShader will delay the deletion if the program is | ||||
|    * current */ | ||||
|   int ref_count; | ||||
|  | ||||
|   /* Set once this object has had glDeleteProgram called on it. We need | ||||
|    * to keep track of this so we don't deref the data twice if the | ||||
|    * application calls glDeleteProgram multiple times */ | ||||
|   gboolean deleted; | ||||
|  | ||||
|   GLuint flip_vector_location; | ||||
|  | ||||
|   /* A cache of what value we've put in the flip vector uniform so | ||||
|    * that we don't flush unless it's changed */ | ||||
|   CoglGLES2FlipState flip_vector_state; | ||||
|  | ||||
|   CoglGLES2Context *context; | ||||
| } CoglGLES2ProgramData; | ||||
|  | ||||
| /* State tracked for each texture unit */ | ||||
| typedef struct | ||||
| { | ||||
|   /* The currently bound texture for the GL_TEXTURE_2D */ | ||||
|   GLuint current_texture_2d; | ||||
| } CoglGLES2TextureUnitData; | ||||
|  | ||||
| /* State tracked for each texture object */ | ||||
| typedef struct | ||||
| { | ||||
|   /* GL's ID for this object */ | ||||
|   GLuint object_id; | ||||
|  | ||||
|   GLenum target; | ||||
|  | ||||
|   /* The details for texture when it has a 2D target */ | ||||
|   int width, height; | ||||
|   GLenum format; | ||||
| } CoglGLES2TextureObjectData; | ||||
|  | ||||
| struct _CoglGLES2Context | ||||
| { | ||||
|   CoglObject _parent; | ||||
|  | ||||
|   CoglContext *context; | ||||
|  | ||||
|   /* This is set to FALSE until the first time the GLES2 context is | ||||
|    * bound to something. We need to keep track of this so we can set | ||||
|    * the viewport and scissor the first time it is bound. */ | ||||
|   gboolean has_been_bound; | ||||
|  | ||||
|   CoglFramebuffer *read_buffer; | ||||
|   CoglGLES2Offscreen *gles2_read_buffer; | ||||
|   CoglFramebuffer *write_buffer; | ||||
|   CoglGLES2Offscreen *gles2_write_buffer; | ||||
|  | ||||
|   GLuint current_fbo_handle; | ||||
|  | ||||
|   CoglList foreign_offscreens; | ||||
|  | ||||
|   CoglGLES2Vtable *vtable; | ||||
|  | ||||
|   /* Hash table mapping GL's IDs for shaders and objects to ShaderData | ||||
|    * and ProgramData so that we can maintain extra data for these | ||||
|    * objects. Although technically the IDs will end up global across | ||||
|    * all GLES2 contexts because they will all be in the same share | ||||
|    * list, we don't really want to expose this outside of the Cogl API | ||||
|    * so we will assume it is undefined behaviour if an application | ||||
|    * relies on this. */ | ||||
|   GHashTable *shader_map; | ||||
|   GHashTable *program_map; | ||||
|  | ||||
|   /* Currently in use program. We need to keep track of this so that | ||||
|    * we can keep a reference to the data for the program while it is | ||||
|    * current */ | ||||
|   CoglGLES2ProgramData *current_program; | ||||
|  | ||||
|   /* Whether the currently bound framebuffer needs flipping. This is | ||||
|    * used to check for changes so that we can dirty the following | ||||
|    * state flags */ | ||||
|   CoglGLES2FlipState current_flip_state; | ||||
|  | ||||
|   /* The following state is tracked separately from the GL context | ||||
|    * because we need to modify it depending on whether we are flipping | ||||
|    * the geometry. */ | ||||
|   gboolean viewport_dirty; | ||||
|   int viewport[4]; | ||||
|   gboolean scissor_dirty; | ||||
|   int scissor[4]; | ||||
|   gboolean front_face_dirty; | ||||
|   GLenum front_face; | ||||
|  | ||||
|   /* We need to keep track of the pack alignment so we can flip the | ||||
|    * results of glReadPixels read from a CoglOffscreen */ | ||||
|   int pack_alignment; | ||||
|  | ||||
|   /* A hash table of CoglGLES2TextureObjects indexed by the texture | ||||
|    * object ID so that we can track some state */ | ||||
|   GHashTable *texture_object_map; | ||||
|  | ||||
|   /* Array of CoglGLES2TextureUnits to keep track of state for each | ||||
|    * texture unit */ | ||||
|   GArray *texture_units; | ||||
|  | ||||
|   /* The currently active texture unit indexed from 0 (not from | ||||
|    * GL_TEXTURE0) */ | ||||
|   int current_texture_unit; | ||||
|  | ||||
|   void *winsys; | ||||
| }; | ||||
|  | ||||
| #endif /* __COGL_GLES2_CONTEXT_PRIVATE_H */ | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,475 +0,0 @@ | ||||
| #ifndef __COGL_GLES2_TYPES_H_ | ||||
| #define __COGL_GLES2_TYPES_H_ | ||||
|  | ||||
| /* $Revision: 16803 $ on $Date:: 2012-02-02 09:49:18 -0800 #$ */ | ||||
|  | ||||
| #include <stdint.h> | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif | ||||
|  | ||||
| /* | ||||
|  * This document is licensed under the SGI Free Software B License Version | ||||
|  * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . | ||||
|  */ | ||||
|  | ||||
| /*------------------------------------------------------------------------- | ||||
|  * Data type definitions | ||||
|  *-----------------------------------------------------------------------*/ | ||||
|  | ||||
| typedef void             GLvoid; | ||||
| typedef char             GLchar; | ||||
| typedef unsigned int     GLenum; | ||||
| typedef unsigned char    GLboolean; | ||||
| typedef unsigned int     GLbitfield; | ||||
| typedef int8_t           GLbyte; | ||||
| typedef short            GLshort; | ||||
| typedef int              GLint; | ||||
| typedef int              GLsizei; | ||||
| typedef uint8_t          GLubyte; | ||||
| typedef unsigned short   GLushort; | ||||
| typedef unsigned int     GLuint; | ||||
| typedef float            GLfloat; | ||||
| typedef float            GLclampf; | ||||
| typedef int32_t          GLfixed; | ||||
|  | ||||
| /* GL types for handling large vertex buffer objects */ | ||||
| typedef signed long int  GLintptr; | ||||
| typedef long             GLsizeiptr; | ||||
|  | ||||
| /* OpenGL ES core versions */ | ||||
| #define GL_ES_VERSION_2_0                 1 | ||||
|  | ||||
| /* ClearBufferMask */ | ||||
| #define GL_DEPTH_BUFFER_BIT               0x00000100 | ||||
| #define GL_STENCIL_BUFFER_BIT             0x00000400 | ||||
| #define GL_COLOR_BUFFER_BIT               0x00004000 | ||||
|  | ||||
| /* Boolean */ | ||||
| #define GL_FALSE                          0 | ||||
| #define GL_TRUE                           1 | ||||
|  | ||||
| /* BeginMode */ | ||||
| #define GL_POINTS                         0x0000 | ||||
| #define GL_LINES                          0x0001 | ||||
| #define GL_LINE_LOOP                      0x0002 | ||||
| #define GL_LINE_STRIP                     0x0003 | ||||
| #define GL_TRIANGLES                      0x0004 | ||||
| #define GL_TRIANGLE_STRIP                 0x0005 | ||||
| #define GL_TRIANGLE_FAN                   0x0006 | ||||
|  | ||||
| /* AlphaFunction (not supported in ES20) */ | ||||
| /*      GL_NEVER */ | ||||
| /*      GL_LESS */ | ||||
| /*      GL_EQUAL */ | ||||
| /*      GL_LEQUAL */ | ||||
| /*      GL_GREATER */ | ||||
| /*      GL_NOTEQUAL */ | ||||
| /*      GL_GEQUAL */ | ||||
| /*      GL_ALWAYS */ | ||||
|  | ||||
| /* BlendingFactorDest */ | ||||
| #define GL_ZERO                           0 | ||||
| #define GL_ONE                            1 | ||||
| #define GL_SRC_COLOR                      0x0300 | ||||
| #define GL_ONE_MINUS_SRC_COLOR            0x0301 | ||||
| #define GL_SRC_ALPHA                      0x0302 | ||||
| #define GL_ONE_MINUS_SRC_ALPHA            0x0303 | ||||
| #define GL_DST_ALPHA                      0x0304 | ||||
| #define GL_ONE_MINUS_DST_ALPHA            0x0305 | ||||
|  | ||||
| /* BlendingFactorSrc */ | ||||
| /*      GL_ZERO */ | ||||
| /*      GL_ONE */ | ||||
| #define GL_DST_COLOR                      0x0306 | ||||
| #define GL_ONE_MINUS_DST_COLOR            0x0307 | ||||
| #define GL_SRC_ALPHA_SATURATE             0x0308 | ||||
| /*      GL_SRC_ALPHA */ | ||||
| /*      GL_ONE_MINUS_SRC_ALPHA */ | ||||
| /*      GL_DST_ALPHA */ | ||||
| /*      GL_ONE_MINUS_DST_ALPHA */ | ||||
|  | ||||
| /* BlendEquationSeparate */ | ||||
| #define GL_FUNC_ADD                       0x8006 | ||||
| #define GL_BLEND_EQUATION                 0x8009 | ||||
| #define GL_BLEND_EQUATION_RGB             0x8009    /* same as BLEND_EQUATION */ | ||||
| #define GL_BLEND_EQUATION_ALPHA           0x883D | ||||
|  | ||||
| /* BlendSubtract */ | ||||
| #define GL_FUNC_SUBTRACT                  0x800A | ||||
| #define GL_FUNC_REVERSE_SUBTRACT          0x800B | ||||
|  | ||||
| /* Separate Blend Functions */ | ||||
| #define GL_BLEND_DST_RGB                  0x80C8 | ||||
| #define GL_BLEND_SRC_RGB                  0x80C9 | ||||
| #define GL_BLEND_DST_ALPHA                0x80CA | ||||
| #define GL_BLEND_SRC_ALPHA                0x80CB | ||||
| #define GL_CONSTANT_COLOR                 0x8001 | ||||
| #define GL_ONE_MINUS_CONSTANT_COLOR       0x8002 | ||||
| #define GL_CONSTANT_ALPHA                 0x8003 | ||||
| #define GL_ONE_MINUS_CONSTANT_ALPHA       0x8004 | ||||
| #define GL_BLEND_COLOR                    0x8005 | ||||
|  | ||||
| /* Buffer Objects */ | ||||
| #define GL_ARRAY_BUFFER                   0x8892 | ||||
| #define GL_ELEMENT_ARRAY_BUFFER           0x8893 | ||||
| #define GL_ARRAY_BUFFER_BINDING           0x8894 | ||||
| #define GL_ELEMENT_ARRAY_BUFFER_BINDING   0x8895 | ||||
|  | ||||
| #define GL_STREAM_DRAW                    0x88E0 | ||||
| #define GL_STATIC_DRAW                    0x88E4 | ||||
| #define GL_DYNAMIC_DRAW                   0x88E8 | ||||
|  | ||||
| #define GL_BUFFER_SIZE                    0x8764 | ||||
| #define GL_BUFFER_USAGE                   0x8765 | ||||
|  | ||||
| #define GL_CURRENT_VERTEX_ATTRIB          0x8626 | ||||
|  | ||||
| /* CullFaceMode */ | ||||
| #define GL_FRONT                          0x0404 | ||||
| #define GL_BACK                           0x0405 | ||||
| #define GL_FRONT_AND_BACK                 0x0408 | ||||
|  | ||||
| /* DepthFunction */ | ||||
| /*      GL_NEVER */ | ||||
| /*      GL_LESS */ | ||||
| /*      GL_EQUAL */ | ||||
| /*      GL_LEQUAL */ | ||||
| /*      GL_GREATER */ | ||||
| /*      GL_NOTEQUAL */ | ||||
| /*      GL_GEQUAL */ | ||||
| /*      GL_ALWAYS */ | ||||
|  | ||||
| /* EnableCap */ | ||||
| #define GL_TEXTURE_2D                     0x0DE1 | ||||
| #define GL_CULL_FACE                      0x0B44 | ||||
| #define GL_BLEND                          0x0BE2 | ||||
| #define GL_DITHER                         0x0BD0 | ||||
| #define GL_STENCIL_TEST                   0x0B90 | ||||
| #define GL_DEPTH_TEST                     0x0B71 | ||||
| #define GL_SCISSOR_TEST                   0x0C11 | ||||
| #define GL_POLYGON_OFFSET_FILL            0x8037 | ||||
| #define GL_SAMPLE_ALPHA_TO_COVERAGE       0x809E | ||||
| #define GL_SAMPLE_COVERAGE                0x80A0 | ||||
| #define GL_TEXTURE_EXTERNAL_OES           0x8D65 | ||||
|  | ||||
| /* ErrorCode */ | ||||
| #define GL_NO_ERROR                       0 | ||||
| #define GL_INVALID_ENUM                   0x0500 | ||||
| #define GL_INVALID_VALUE                  0x0501 | ||||
| #define GL_INVALID_OPERATION              0x0502 | ||||
| #define GL_OUT_OF_MEMORY                  0x0505 | ||||
|  | ||||
| /* FrontFaceDirection */ | ||||
| #define GL_CW                             0x0900 | ||||
| #define GL_CCW                            0x0901 | ||||
|  | ||||
| /* GetPName */ | ||||
| #define GL_LINE_WIDTH                     0x0B21 | ||||
| #define GL_ALIASED_POINT_SIZE_RANGE       0x846D | ||||
| #define GL_ALIASED_LINE_WIDTH_RANGE       0x846E | ||||
| #define GL_CULL_FACE_MODE                 0x0B45 | ||||
| #define GL_FRONT_FACE                     0x0B46 | ||||
| #define GL_DEPTH_RANGE                    0x0B70 | ||||
| #define GL_DEPTH_WRITEMASK                0x0B72 | ||||
| #define GL_DEPTH_CLEAR_VALUE              0x0B73 | ||||
| #define GL_DEPTH_FUNC                     0x0B74 | ||||
| #define GL_STENCIL_CLEAR_VALUE            0x0B91 | ||||
| #define GL_STENCIL_FUNC                   0x0B92 | ||||
| #define GL_STENCIL_FAIL                   0x0B94 | ||||
| #define GL_STENCIL_PASS_DEPTH_FAIL        0x0B95 | ||||
| #define GL_STENCIL_PASS_DEPTH_PASS        0x0B96 | ||||
| #define GL_STENCIL_REF                    0x0B97 | ||||
| #define GL_STENCIL_VALUE_MASK             0x0B93 | ||||
| #define GL_STENCIL_WRITEMASK              0x0B98 | ||||
| #define GL_STENCIL_BACK_FUNC              0x8800 | ||||
| #define GL_STENCIL_BACK_FAIL              0x8801 | ||||
| #define GL_STENCIL_BACK_PASS_DEPTH_FAIL   0x8802 | ||||
| #define GL_STENCIL_BACK_PASS_DEPTH_PASS   0x8803 | ||||
| #define GL_STENCIL_BACK_REF               0x8CA3 | ||||
| #define GL_STENCIL_BACK_VALUE_MASK        0x8CA4 | ||||
| #define GL_STENCIL_BACK_WRITEMASK         0x8CA5 | ||||
| #define GL_VIEWPORT                       0x0BA2 | ||||
| #define GL_SCISSOR_BOX                    0x0C10 | ||||
| /*      GL_SCISSOR_TEST */ | ||||
| #define GL_COLOR_CLEAR_VALUE              0x0C22 | ||||
| #define GL_COLOR_WRITEMASK                0x0C23 | ||||
| #define GL_UNPACK_ALIGNMENT               0x0CF5 | ||||
| #define GL_PACK_ALIGNMENT                 0x0D05 | ||||
| #define GL_MAX_TEXTURE_SIZE               0x0D33 | ||||
| #define GL_MAX_VIEWPORT_DIMS              0x0D3A | ||||
| #define GL_SUBPIXEL_BITS                  0x0D50 | ||||
| #define GL_RED_BITS                       0x0D52 | ||||
| #define GL_GREEN_BITS                     0x0D53 | ||||
| #define GL_BLUE_BITS                      0x0D54 | ||||
| #define GL_ALPHA_BITS                     0x0D55 | ||||
| #define GL_DEPTH_BITS                     0x0D56 | ||||
| #define GL_STENCIL_BITS                   0x0D57 | ||||
| #define GL_POLYGON_OFFSET_UNITS           0x2A00 | ||||
| /*      GL_POLYGON_OFFSET_FILL */ | ||||
| #define GL_POLYGON_OFFSET_FACTOR          0x8038 | ||||
| #define GL_TEXTURE_BINDING_2D             0x8069 | ||||
| #define GL_SAMPLE_BUFFERS                 0x80A8 | ||||
| #define GL_SAMPLES                        0x80A9 | ||||
| #define GL_SAMPLE_COVERAGE_VALUE          0x80AA | ||||
| #define GL_SAMPLE_COVERAGE_INVERT         0x80AB | ||||
|  | ||||
| /* GetTextureParameter */ | ||||
| /*      GL_TEXTURE_MAG_FILTER */ | ||||
| /*      GL_TEXTURE_MIN_FILTER */ | ||||
| /*      GL_TEXTURE_WRAP_S */ | ||||
| /*      GL_TEXTURE_WRAP_T */ | ||||
|  | ||||
| #define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 | ||||
| #define GL_COMPRESSED_TEXTURE_FORMATS     0x86A3 | ||||
|  | ||||
| /* HintMode */ | ||||
| #define GL_DONT_CARE                      0x1100 | ||||
| #define GL_FASTEST                        0x1101 | ||||
| #define GL_NICEST                         0x1102 | ||||
|  | ||||
| /* HintTarget */ | ||||
| #define GL_GENERATE_MIPMAP_HINT            0x8192 | ||||
|  | ||||
| /* DataType */ | ||||
| #define GL_BYTE                           0x1400 | ||||
| #define GL_UNSIGNED_BYTE                  0x1401 | ||||
| #define GL_SHORT                          0x1402 | ||||
| #define GL_UNSIGNED_SHORT                 0x1403 | ||||
| #define GL_INT                            0x1404 | ||||
| #define GL_UNSIGNED_INT                   0x1405 | ||||
| #define GL_FLOAT                          0x1406 | ||||
| #define GL_FIXED                          0x140C | ||||
|  | ||||
| /* PixelFormat */ | ||||
| #define GL_DEPTH_COMPONENT                0x1902 | ||||
| #define GL_ALPHA                          0x1906 | ||||
| #define GL_RGB                            0x1907 | ||||
| #define GL_RGBA                           0x1908 | ||||
| #define GL_LUMINANCE                      0x1909 | ||||
| #define GL_LUMINANCE_ALPHA                0x190A | ||||
|  | ||||
| /* PixelType */ | ||||
| /*      GL_UNSIGNED_BYTE */ | ||||
| #define GL_UNSIGNED_SHORT_4_4_4_4         0x8033 | ||||
| #define GL_UNSIGNED_SHORT_5_5_5_1         0x8034 | ||||
| #define GL_UNSIGNED_SHORT_5_6_5           0x8363 | ||||
|  | ||||
| /* Shaders */ | ||||
| #define GL_FRAGMENT_SHADER                  0x8B30 | ||||
| #define GL_VERTEX_SHADER                    0x8B31 | ||||
| #define GL_MAX_VERTEX_ATTRIBS               0x8869 | ||||
| #define GL_MAX_VERTEX_UNIFORM_VECTORS       0x8DFB | ||||
| #define GL_MAX_VARYING_VECTORS              0x8DFC | ||||
| #define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D | ||||
| #define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS   0x8B4C | ||||
| #define GL_MAX_TEXTURE_IMAGE_UNITS          0x8872 | ||||
| #define GL_MAX_FRAGMENT_UNIFORM_VECTORS     0x8DFD | ||||
| #define GL_SHADER_TYPE                      0x8B4F | ||||
| #define GL_DELETE_STATUS                    0x8B80 | ||||
| #define GL_LINK_STATUS                      0x8B82 | ||||
| #define GL_VALIDATE_STATUS                  0x8B83 | ||||
| #define GL_ATTACHED_SHADERS                 0x8B85 | ||||
| #define GL_ACTIVE_UNIFORMS                  0x8B86 | ||||
| #define GL_ACTIVE_UNIFORM_MAX_LENGTH        0x8B87 | ||||
| #define GL_ACTIVE_ATTRIBUTES                0x8B89 | ||||
| #define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH      0x8B8A | ||||
| #define GL_SHADING_LANGUAGE_VERSION         0x8B8C | ||||
| #define GL_CURRENT_PROGRAM                  0x8B8D | ||||
|  | ||||
| /* StencilFunction */ | ||||
| #define GL_NEVER                          0x0200 | ||||
| #define GL_LESS                           0x0201 | ||||
| #define GL_EQUAL                          0x0202 | ||||
| #define GL_LEQUAL                         0x0203 | ||||
| #define GL_GREATER                        0x0204 | ||||
| #define GL_NOTEQUAL                       0x0205 | ||||
| #define GL_GEQUAL                         0x0206 | ||||
| #define GL_ALWAYS                         0x0207 | ||||
|  | ||||
| /* StencilOp */ | ||||
| /*      GL_ZERO */ | ||||
| #define GL_KEEP                           0x1E00 | ||||
| #define GL_REPLACE                        0x1E01 | ||||
| #define GL_INCR                           0x1E02 | ||||
| #define GL_DECR                           0x1E03 | ||||
| #define GL_INVERT                         0x150A | ||||
| #define GL_INCR_WRAP                      0x8507 | ||||
| #define GL_DECR_WRAP                      0x8508 | ||||
|  | ||||
| /* StringName */ | ||||
| #define GL_VENDOR                         0x1F00 | ||||
| #define GL_RENDERER                       0x1F01 | ||||
| #define GL_VERSION                        0x1F02 | ||||
| #define GL_EXTENSIONS                     0x1F03 | ||||
|  | ||||
| /* TextureMagFilter */ | ||||
| #define GL_NEAREST                        0x2600 | ||||
| #define GL_LINEAR                         0x2601 | ||||
|  | ||||
| /* TextureMinFilter */ | ||||
| /*      GL_NEAREST */ | ||||
| /*      GL_LINEAR */ | ||||
| #define GL_NEAREST_MIPMAP_NEAREST         0x2700 | ||||
| #define GL_LINEAR_MIPMAP_NEAREST          0x2701 | ||||
| #define GL_NEAREST_MIPMAP_LINEAR          0x2702 | ||||
| #define GL_LINEAR_MIPMAP_LINEAR           0x2703 | ||||
|  | ||||
| /* TextureParameterName */ | ||||
| #define GL_TEXTURE_MAG_FILTER             0x2800 | ||||
| #define GL_TEXTURE_MIN_FILTER             0x2801 | ||||
| #define GL_TEXTURE_WRAP_S                 0x2802 | ||||
| #define GL_TEXTURE_WRAP_T                 0x2803 | ||||
|  | ||||
| /* TextureTarget */ | ||||
| /*      GL_TEXTURE_2D */ | ||||
| #define GL_TEXTURE                        0x1702 | ||||
|  | ||||
| #define GL_TEXTURE_CUBE_MAP               0x8513 | ||||
| #define GL_TEXTURE_BINDING_CUBE_MAP       0x8514 | ||||
| #define GL_TEXTURE_CUBE_MAP_POSITIVE_X    0x8515 | ||||
| #define GL_TEXTURE_CUBE_MAP_NEGATIVE_X    0x8516 | ||||
| #define GL_TEXTURE_CUBE_MAP_POSITIVE_Y    0x8517 | ||||
| #define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y    0x8518 | ||||
| #define GL_TEXTURE_CUBE_MAP_POSITIVE_Z    0x8519 | ||||
| #define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z    0x851A | ||||
| #define GL_MAX_CUBE_MAP_TEXTURE_SIZE      0x851C | ||||
|  | ||||
| /* TextureUnit */ | ||||
| #define GL_TEXTURE0                       0x84C0 | ||||
| #define GL_TEXTURE1                       0x84C1 | ||||
| #define GL_TEXTURE2                       0x84C2 | ||||
| #define GL_TEXTURE3                       0x84C3 | ||||
| #define GL_TEXTURE4                       0x84C4 | ||||
| #define GL_TEXTURE5                       0x84C5 | ||||
| #define GL_TEXTURE6                       0x84C6 | ||||
| #define GL_TEXTURE7                       0x84C7 | ||||
| #define GL_TEXTURE8                       0x84C8 | ||||
| #define GL_TEXTURE9                       0x84C9 | ||||
| #define GL_TEXTURE10                      0x84CA | ||||
| #define GL_TEXTURE11                      0x84CB | ||||
| #define GL_TEXTURE12                      0x84CC | ||||
| #define GL_TEXTURE13                      0x84CD | ||||
| #define GL_TEXTURE14                      0x84CE | ||||
| #define GL_TEXTURE15                      0x84CF | ||||
| #define GL_TEXTURE16                      0x84D0 | ||||
| #define GL_TEXTURE17                      0x84D1 | ||||
| #define GL_TEXTURE18                      0x84D2 | ||||
| #define GL_TEXTURE19                      0x84D3 | ||||
| #define GL_TEXTURE20                      0x84D4 | ||||
| #define GL_TEXTURE21                      0x84D5 | ||||
| #define GL_TEXTURE22                      0x84D6 | ||||
| #define GL_TEXTURE23                      0x84D7 | ||||
| #define GL_TEXTURE24                      0x84D8 | ||||
| #define GL_TEXTURE25                      0x84D9 | ||||
| #define GL_TEXTURE26                      0x84DA | ||||
| #define GL_TEXTURE27                      0x84DB | ||||
| #define GL_TEXTURE28                      0x84DC | ||||
| #define GL_TEXTURE29                      0x84DD | ||||
| #define GL_TEXTURE30                      0x84DE | ||||
| #define GL_TEXTURE31                      0x84DF | ||||
| #define GL_ACTIVE_TEXTURE                 0x84E0 | ||||
|  | ||||
| /* TextureWrapMode */ | ||||
| #define GL_REPEAT                         0x2901 | ||||
| #define GL_CLAMP_TO_EDGE                  0x812F | ||||
| #define GL_MIRRORED_REPEAT                0x8370 | ||||
|  | ||||
| /* Uniform Types */ | ||||
| #define GL_FLOAT_VEC2                     0x8B50 | ||||
| #define GL_FLOAT_VEC3                     0x8B51 | ||||
| #define GL_FLOAT_VEC4                     0x8B52 | ||||
| #define GL_INT_VEC2                       0x8B53 | ||||
| #define GL_INT_VEC3                       0x8B54 | ||||
| #define GL_INT_VEC4                       0x8B55 | ||||
| #define GL_BOOL                           0x8B56 | ||||
| #define GL_BOOL_VEC2                      0x8B57 | ||||
| #define GL_BOOL_VEC3                      0x8B58 | ||||
| #define GL_BOOL_VEC4                      0x8B59 | ||||
| #define GL_FLOAT_MAT2                     0x8B5A | ||||
| #define GL_FLOAT_MAT3                     0x8B5B | ||||
| #define GL_FLOAT_MAT4                     0x8B5C | ||||
| #define GL_SAMPLER_2D                     0x8B5E | ||||
| #define GL_SAMPLER_CUBE                   0x8B60 | ||||
|  | ||||
| /* Vertex Arrays */ | ||||
| #define GL_VERTEX_ATTRIB_ARRAY_ENABLED        0x8622 | ||||
| #define GL_VERTEX_ATTRIB_ARRAY_SIZE           0x8623 | ||||
| #define GL_VERTEX_ATTRIB_ARRAY_STRIDE         0x8624 | ||||
| #define GL_VERTEX_ATTRIB_ARRAY_TYPE           0x8625 | ||||
| #define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED     0x886A | ||||
| #define GL_VERTEX_ATTRIB_ARRAY_POINTER        0x8645 | ||||
| #define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F | ||||
|  | ||||
| /* Read Format */ | ||||
| #define GL_IMPLEMENTATION_COLOR_READ_TYPE   0x8B9A | ||||
| #define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B | ||||
|  | ||||
| /* Shader Source */ | ||||
| #define GL_COMPILE_STATUS                 0x8B81 | ||||
| #define GL_INFO_LOG_LENGTH                0x8B84 | ||||
| #define GL_SHADER_SOURCE_LENGTH           0x8B88 | ||||
| #define GL_SHADER_COMPILER                0x8DFA | ||||
|  | ||||
| /* Shader Binary */ | ||||
| #define GL_SHADER_BINARY_FORMATS          0x8DF8 | ||||
| #define GL_NUM_SHADER_BINARY_FORMATS      0x8DF9 | ||||
|  | ||||
| /* Shader Precision-Specified Types */ | ||||
| #define GL_LOW_FLOAT                      0x8DF0 | ||||
| #define GL_MEDIUM_FLOAT                   0x8DF1 | ||||
| #define GL_HIGH_FLOAT                     0x8DF2 | ||||
| #define GL_LOW_INT                        0x8DF3 | ||||
| #define GL_MEDIUM_INT                     0x8DF4 | ||||
| #define GL_HIGH_INT                       0x8DF5 | ||||
|  | ||||
| /* Framebuffer Object. */ | ||||
| #define GL_FRAMEBUFFER                    0x8D40 | ||||
| #define GL_RENDERBUFFER                   0x8D41 | ||||
|  | ||||
| #define GL_RGBA4                          0x8056 | ||||
| #define GL_RGB5_A1                        0x8057 | ||||
| #define GL_RGB565                         0x8D62 | ||||
| #define GL_DEPTH_COMPONENT16              0x81A5 | ||||
| #define GL_STENCIL_INDEX8                 0x8D48 | ||||
|  | ||||
| #define GL_RENDERBUFFER_WIDTH             0x8D42 | ||||
| #define GL_RENDERBUFFER_HEIGHT            0x8D43 | ||||
| #define GL_RENDERBUFFER_INTERNAL_FORMAT   0x8D44 | ||||
| #define GL_RENDERBUFFER_RED_SIZE          0x8D50 | ||||
| #define GL_RENDERBUFFER_GREEN_SIZE        0x8D51 | ||||
| #define GL_RENDERBUFFER_BLUE_SIZE         0x8D52 | ||||
| #define GL_RENDERBUFFER_ALPHA_SIZE        0x8D53 | ||||
| #define GL_RENDERBUFFER_DEPTH_SIZE        0x8D54 | ||||
| #define GL_RENDERBUFFER_STENCIL_SIZE      0x8D55 | ||||
|  | ||||
| #define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE           0x8CD0 | ||||
| #define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME           0x8CD1 | ||||
| #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL         0x8CD2 | ||||
| #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 | ||||
|  | ||||
| #define GL_COLOR_ATTACHMENT0              0x8CE0 | ||||
| #define GL_DEPTH_ATTACHMENT               0x8D00 | ||||
| #define GL_STENCIL_ATTACHMENT             0x8D20 | ||||
|  | ||||
| #define GL_NONE                           0 | ||||
|  | ||||
| #define GL_FRAMEBUFFER_COMPLETE                      0x8CD5 | ||||
| #define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT         0x8CD6 | ||||
| #define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 | ||||
| #define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS         0x8CD9 | ||||
| #define GL_FRAMEBUFFER_UNSUPPORTED                   0x8CDD | ||||
|  | ||||
| #define GL_FRAMEBUFFER_BINDING            0x8CA6 | ||||
| #define GL_RENDERBUFFER_BINDING           0x8CA7 | ||||
| #define GL_MAX_RENDERBUFFER_SIZE          0x84E8 | ||||
|  | ||||
| #define GL_INVALID_FRAMEBUFFER_OPERATION  0x0506 | ||||
|  | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif | ||||
|  | ||||
| #endif /* __COGL_GLES2_TYPES_H_ */ | ||||
| @@ -1,416 +0,0 @@ | ||||
| /* | ||||
|  * Cogl | ||||
|  * | ||||
|  * A Low Level GPU Graphics and Utilities API | ||||
|  * | ||||
|  * Copyright (C) 2011 Collabora Ltd. | ||||
|  * Copyright (C) 2012 Intel Corporation. | ||||
|  * | ||||
|  * Permission is hereby granted, free of charge, to any person | ||||
|  * obtaining a copy of this software and associated documentation | ||||
|  * files (the "Software"), to deal in the Software without | ||||
|  * restriction, including without limitation the rights to use, copy, | ||||
|  * modify, merge, publish, distribute, sublicense, and/or sell copies | ||||
|  * of the Software, and to permit persons to whom the Software is | ||||
|  * furnished to do so, subject to the following conditions: | ||||
|  * | ||||
|  * The above copyright notice and this permission notice shall be | ||||
|  * included in all copies or substantial portions of the Software. | ||||
|  * | ||||
|  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||||
|  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||||
|  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||||
|  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS | ||||
|  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | ||||
|  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||||
|  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||||
|  * SOFTWARE. | ||||
|  * | ||||
|  * Authors: | ||||
|  *  Tomeu Vizoso <tomeu.vizoso@collabora.com> | ||||
|  *  Robert Bragg <robert@linux.intel.com> | ||||
|  * | ||||
|  */ | ||||
|  | ||||
| #ifndef __COGL_GLES2_H__ | ||||
| #define __COGL_GLES2_H__ | ||||
|  | ||||
| /* NB: cogl-gles2.h is a top-level header that can be included directly | ||||
|  * but we want to be careful not to define __COGL_H_INSIDE__ when this | ||||
|  * is included internally while building Cogl itself since | ||||
|  * __COGL_H_INSIDE__ is used in headers to guard public vs private | ||||
|  * api definitions | ||||
|  */ | ||||
| #ifndef COGL_COMPILATION | ||||
|  | ||||
| /* Note: When building Cogl .gir we explicitly define | ||||
|  * __COGL_H_INSIDE__ */ | ||||
| #ifndef __COGL_H_INSIDE__ | ||||
| #define __COGL_H_INSIDE__ | ||||
| #define __COGL_MUST_UNDEF_COGL_H_INSIDE_COGL_GLES2__ | ||||
| #endif | ||||
|  | ||||
| #endif /* COGL_COMPILATION */ | ||||
|  | ||||
| #include <cogl/cogl-defines.h> | ||||
| #include <cogl/cogl-context.h> | ||||
| #include <cogl/cogl-framebuffer.h> | ||||
| #include <cogl/cogl-texture.h> | ||||
| #include <cogl/cogl-texture-2d.h> | ||||
|  | ||||
| /* CoglGLES2Vtable depends on GLES 2.0 typedefs being available but we | ||||
|  * want to be careful that the public api doesn't expose arbitrary | ||||
|  * system GL headers as part of the Cogl API so although when building | ||||
|  * internally we consistently refer to the system headers to avoid | ||||
|  * conflicts we only expose the minimal set of GLES 2.0 types and enums | ||||
|  * publicly. | ||||
|  */ | ||||
| #if defined(COGL_COMPILATION) || defined(COGL_ENABLE_MUTTER_API) | ||||
| #include "cogl-gl-header.h" | ||||
| #else | ||||
| #include <cogl/cogl-gles2-types.h> | ||||
| #endif | ||||
|  | ||||
| G_BEGIN_DECLS | ||||
|  | ||||
| /** | ||||
|  * SECTION:cogl-gles2 | ||||
|  * @short_description: A portable api to access OpenGLES 2.0 | ||||
|  * | ||||
|  * Cogl provides portable access to the OpenGLES api through a single | ||||
|  * library that is able to smooth over inconsistencies between the | ||||
|  * different vendor drivers for OpenGLES in a single place. | ||||
|  * | ||||
|  * The api is designed to allow Cogl to transparently implement the | ||||
|  * api on top of other drivers, such as OpenGL, D3D or on Cogl's own | ||||
|  * drawing api so even if your platform doesn't come with an | ||||
|  * OpenGLES 2.0 api Cogl may still be able to expose the api to your | ||||
|  * application. | ||||
|  * | ||||
|  * Since Cogl is a library and not an api specification it is possible | ||||
|  * to add OpenGLES 2.0 api features to Cogl which can immidiately | ||||
|  * benefit developers regardless of what platform they are running on. | ||||
|  * | ||||
|  * With this api it's possible to re-use existing OpenGLES 2.0 code | ||||
|  * within applications that are rendering with the Cogl API and also | ||||
|  * it's possible for applications that render using OpenGLES 2.0 to | ||||
|  * incorporate content rendered with Cogl. | ||||
|  * | ||||
|  * Applications can check for OpenGLES 2.0 api support by checking for | ||||
|  * %COGL_FEATURE_ID_GLES2_CONTEXT support with cogl_has_feature(). | ||||
|  * | ||||
|  * Since: 1.12 | ||||
|  * Stability: unstable | ||||
|  */ | ||||
|  | ||||
| /** | ||||
|  * CoglGLES2Context: | ||||
|  * | ||||
|  * Represents an OpenGLES 2.0 api context used as a sandbox for | ||||
|  * OpenGLES 2.0 state. This is comparable to an EGLContext for those | ||||
|  * who have used OpenGLES 2.0 with EGL before. | ||||
|  * | ||||
|  * Since: 1.12 | ||||
|  * Stability: unstable | ||||
|  */ | ||||
| typedef struct _CoglGLES2Context CoglGLES2Context; | ||||
|  | ||||
| /** | ||||
|  * CoglGLES2Vtable: | ||||
|  * | ||||
|  * Provides function pointers for the full OpenGLES 2.0 api. The | ||||
|  * api must be accessed this way and not by directly calling | ||||
|  * symbols of any system OpenGLES 2.0 api. | ||||
|  * | ||||
|  * Since: 1.12 | ||||
|  * Stability: unstable | ||||
|  */ | ||||
| typedef struct _CoglGLES2Vtable CoglGLES2Vtable; | ||||
|  | ||||
| struct _CoglGLES2Vtable | ||||
| { | ||||
|   /*< private >*/ | ||||
| #define COGL_EXT_BEGIN(name, \ | ||||
|                        min_gl_major, min_gl_minor, \ | ||||
|                        gles_availability, \ | ||||
|                        extension_suffixes, extension_names) | ||||
|  | ||||
| #define COGL_EXT_FUNCTION(ret, name, args) \ | ||||
|   ret (* name) args; | ||||
|  | ||||
| #define COGL_EXT_END() | ||||
|  | ||||
| #include <cogl/gl-prototypes/cogl-gles2-functions.h> | ||||
|  | ||||
| #include <glib-object.h> | ||||
|  | ||||
| #undef COGL_EXT_BEGIN | ||||
| #undef COGL_EXT_FUNCTION | ||||
| #undef COGL_EXT_END | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * cogl_gles2_context_get_gtype: | ||||
|  * | ||||
|  * Returns: a #GType that can be used with the GLib type system. | ||||
|  */ | ||||
| GType cogl_gles2_context_get_gtype (void); | ||||
|  | ||||
| uint32_t | ||||
| _cogl_gles2_context_error_quark (void); | ||||
|  | ||||
| /** | ||||
|  * COGL_GLES2_CONTEXT_ERROR: | ||||
|  * | ||||
|  * An error domain for runtime exceptions relating to the | ||||
|  * cogl_gles2_context api. | ||||
|  * | ||||
|  * Since: 2.0 | ||||
|  * Stability: unstable | ||||
|  */ | ||||
| #define COGL_GLES2_CONTEXT_ERROR (_cogl_gles2_context_error_quark ()) | ||||
|  | ||||
| /** | ||||
|  * CoglGLES2ContextError: | ||||
|  * @COGL_GLES2_CONTEXT_ERROR_UNSUPPORTED: Creating GLES2 contexts | ||||
|  *    isn't supported. Applications should use cogl_has_feature() to | ||||
|  *    check for the %COGL_FEATURE_ID_GLES2_CONTEXT. | ||||
|  * @COGL_GLES2_CONTEXT_ERROR_DRIVER: An underlying driver error | ||||
|  *    occured. | ||||
|  * | ||||
|  * Error codes that relate to the cogl_gles2_context api. | ||||
|  */ | ||||
| typedef enum /*< prefix=COGL_GLES2_CONTEXT_ERROR >*/ | ||||
| { | ||||
|   COGL_GLES2_CONTEXT_ERROR_UNSUPPORTED, | ||||
|   COGL_GLES2_CONTEXT_ERROR_DRIVER | ||||
| } CoglGLES2ContextError; | ||||
|  | ||||
| /** | ||||
|  * cogl_gles2_context_new: | ||||
|  * @ctx: A #CoglContext | ||||
|  * @error: A pointer to a #GError for returning exceptions | ||||
|  * | ||||
|  * Allocates a new OpenGLES 2.0 context that can be used to render to | ||||
|  * #CoglOffscreen framebuffers (Rendering to #CoglOnscreen | ||||
|  * framebuffers is not currently supported). | ||||
|  * | ||||
|  * To actually access the OpenGLES 2.0 api itself you need to use | ||||
|  * cogl_gles2_context_get_vtable(). You should not try to directly link | ||||
|  * to and use the symbols provided by the a system OpenGLES 2.0 | ||||
|  * driver. | ||||
|  * | ||||
|  * Once you have allocated an OpenGLES 2.0 context you can make it | ||||
|  * current using cogl_push_gles2_context(). For those familiar with | ||||
|  * using the EGL api, this serves a similar purpose to eglMakeCurrent. | ||||
|  * | ||||
|  * <note>Before using this api applications can check for OpenGLES 2.0 | ||||
|  * api support by checking for %COGL_FEATURE_ID_GLES2_CONTEXT support | ||||
|  * with cogl_has_feature(). This function will return %FALSE and | ||||
|  * return an %COGL_GLES2_CONTEXT_ERROR_UNSUPPORTED error if the | ||||
|  * feature isn't available.</note> | ||||
|  * | ||||
|  * Since: 2.0 | ||||
|  * Return value: A newly allocated #CoglGLES2Context or %NULL if there | ||||
|  *               was an error and @error will be updated in that case. | ||||
|  * Stability: unstable | ||||
|  */ | ||||
| CoglGLES2Context * | ||||
| cogl_gles2_context_new (CoglContext *ctx, GError **error); | ||||
|  | ||||
| /** | ||||
|  * cogl_gles2_context_get_vtable: | ||||
|  * @gles2_ctx: A #CoglGLES2Context allocated with | ||||
|  *             cogl_gles2_context_new() | ||||
|  * | ||||
|  * Queries the OpenGLES 2.0 api function pointers that should be | ||||
|  * used for rendering with the given @gles2_ctx. | ||||
|  * | ||||
|  * <note>You should not try to directly link to and use the symbols | ||||
|  * provided by any system OpenGLES 2.0 driver.</note> | ||||
|  * | ||||
|  * Since: 2.0 | ||||
|  * Return value: A pointer to a #CoglGLES2Vtable providing pointers | ||||
|  *               to functions for the full OpenGLES 2.0 api. | ||||
|  * Stability: unstable | ||||
|  */ | ||||
| const CoglGLES2Vtable * | ||||
| cogl_gles2_context_get_vtable (CoglGLES2Context *gles2_ctx); | ||||
|  | ||||
| /** | ||||
|  * cogl_push_gles2_context: | ||||
|  * @ctx: A #CoglContext | ||||
|  * @gles2_ctx: A #CoglGLES2Context allocated with | ||||
|  *             cogl_gles2_context_new() | ||||
|  * @read_buffer: A #CoglFramebuffer to access to read operations | ||||
|  *               such as glReadPixels. (must be a #CoglOffscreen | ||||
|  *               framebuffer currently) | ||||
|  * @write_buffer: A #CoglFramebuffer to access for drawing operations | ||||
|  *                such as glDrawArrays. (must be a #CoglOffscreen | ||||
|  *               framebuffer currently) | ||||
|  * @error: A pointer to a #GError for returning exceptions | ||||
|  * | ||||
|  * Pushes the given @gles2_ctx onto a stack associated with @ctx so | ||||
|  * that the OpenGLES 2.0 api can be used instead of the Cogl | ||||
|  * rendering apis to read and write to the specified framebuffers. | ||||
|  * | ||||
|  * Usage of the api available through a #CoglGLES2Vtable is only | ||||
|  * allowed between cogl_push_gles2_context() and | ||||
|  * cogl_pop_gles2_context() calls. | ||||
|  * | ||||
|  * If there is a runtime problem with switching over to the given | ||||
|  * @gles2_ctx then this function will return %FALSE and return | ||||
|  * an error through @error. | ||||
|  * | ||||
|  * Since: 2.0 | ||||
|  * Return value: %TRUE if operation was successfull or %FALSE | ||||
|  *               otherwise and @error will be updated. | ||||
|  * Stability: unstable | ||||
|  */ | ||||
| gboolean | ||||
| cogl_push_gles2_context (CoglContext *ctx, | ||||
|                          CoglGLES2Context *gles2_ctx, | ||||
|                          CoglFramebuffer *read_buffer, | ||||
|                          CoglFramebuffer *write_buffer, | ||||
|                          GError **error); | ||||
|  | ||||
| /** | ||||
|  * cogl_pop_gles2_context: | ||||
|  * @ctx: A #CoglContext | ||||
|  * | ||||
|  * Restores the previously active #CoglGLES2Context if there | ||||
|  * were nested calls to cogl_push_gles2_context() or otherwise | ||||
|  * restores the ability to render with the Cogl api instead | ||||
|  * of OpenGLES 2.0. | ||||
|  * | ||||
|  * The behaviour is undefined if calls to cogl_pop_gles2_context() | ||||
|  * are not balenced with the number of corresponding calls to | ||||
|  * cogl_push_gles2_context(). | ||||
|  * | ||||
|  * Since: 2.0 | ||||
|  * Stability: unstable | ||||
|  */ | ||||
| void | ||||
| cogl_pop_gles2_context (CoglContext *ctx); | ||||
|  | ||||
| /** | ||||
|  * cogl_gles2_get_current_vtable: | ||||
|  * | ||||
|  * Returns the OpenGL ES 2.0 api vtable for the currently pushed | ||||
|  * #CoglGLES2Context (last pushed with cogl_push_gles2_context()) or | ||||
|  * %NULL if no #CoglGLES2Context has been pushed. | ||||
|  * | ||||
|  * Return value: The #CoglGLES2Vtable for the currently pushed | ||||
|  *               #CoglGLES2Context or %NULL if none has been pushed. | ||||
|  * Since: 2.0 | ||||
|  * Stability: unstable | ||||
|  */ | ||||
| CoglGLES2Vtable * | ||||
| cogl_gles2_get_current_vtable (void); | ||||
|  | ||||
| /** | ||||
|  * cogl_gles2_texture_2d_new_from_handle: | ||||
|  * @ctx: A #CoglContext | ||||
|  * @gles2_ctx: A #CoglGLES2Context allocated with | ||||
|  *             cogl_gles2_context_new() | ||||
|  * @handle: An OpenGL ES 2.0 texture handle created with | ||||
|  *          glGenTextures() | ||||
|  * @width: Width of the texture to allocate | ||||
|  * @height: Height of the texture to allocate | ||||
|  * @format: The format of the texture | ||||
|  * | ||||
|  * Creates a #CoglTexture2D from an OpenGL ES 2.0 texture handle that | ||||
|  * was created within the given @gles2_ctx via glGenTextures(). The | ||||
|  * texture needs to have been associated with the GL_TEXTURE_2D target. | ||||
|  * | ||||
|  * <note>This interface is only intended for sharing textures to read | ||||
|  * from.  The behaviour is undefined if the texture is modified using | ||||
|  * the Cogl api.</note> | ||||
|  * | ||||
|  * <note>Applications should only pass this function handles that were | ||||
|  * created via a #CoglGLES2Vtable or via libcogl-gles2 and not pass | ||||
|  * handles created directly using the system's native libGLESv2 | ||||
|  * api.</note> | ||||
|  * | ||||
|  * Since: 2.0 | ||||
|  * Stability: unstable | ||||
|  */ | ||||
| CoglTexture2D * | ||||
| cogl_gles2_texture_2d_new_from_handle (CoglContext *ctx, | ||||
|                                        CoglGLES2Context *gles2_ctx, | ||||
|                                        unsigned int handle, | ||||
|                                        int width, | ||||
|                                        int height, | ||||
|                                        CoglPixelFormat format); | ||||
|  | ||||
| /** | ||||
|  * cogl_gles2_texture_get_handle: | ||||
|  * @texture: A #CoglTexture | ||||
|  * @handle: A return location for an OpenGL ES 2.0 texture handle | ||||
|  * @target: A return location for an OpenGL ES 2.0 texture target | ||||
|  * | ||||
|  * Gets an OpenGL ES 2.0 texture handle for a #CoglTexture that can | ||||
|  * then be referenced by a #CoglGLES2Context. As well as returning | ||||
|  * a texture handle the texture's target (such as GL_TEXTURE_2D) is | ||||
|  * also returned. | ||||
|  * | ||||
|  * If the #CoglTexture can not be shared with a #CoglGLES2Context then | ||||
|  * this function will return %FALSE. | ||||
|  * | ||||
|  * This api does not affect the lifetime of the CoglTexture and you | ||||
|  * must take care not to reference the returned handle after the | ||||
|  * original texture has been freed. | ||||
|  * | ||||
|  * <note>This interface is only intended for sharing textures to read | ||||
|  * from.  The behaviour is undefined if the texture is modified by a | ||||
|  * GLES2 context.</note> | ||||
|  * | ||||
|  * <note>This function will only return %TRUE for low-level | ||||
|  * #CoglTexture<!-- -->s such as #CoglTexture2D but not for high level | ||||
|  * meta textures such as #CoglTexture2DSliced</note> | ||||
|  * | ||||
|  * <note>The handle returned should not be passed directly to a system | ||||
|  * OpenGL ES 2.0 library, the handle is only intended to be used via | ||||
|  * a #CoglGLES2Vtable or via libcogl-gles2.</note> | ||||
|  * | ||||
|  * Return value: %TRUE if a handle and target could be returned | ||||
|  *               otherwise %FALSE is returned. | ||||
|  * Since: 2.0 | ||||
|  * Stability: unstable | ||||
|  */ | ||||
| gboolean | ||||
| cogl_gles2_texture_get_handle (CoglTexture *texture, | ||||
|                                unsigned int *handle, | ||||
|                                unsigned int *target); | ||||
|  | ||||
| /** | ||||
|  * cogl_is_gles2_context: | ||||
|  * @object: A #CoglObject pointer | ||||
|  * | ||||
|  * Gets whether the given object references a #CoglGLES2Context. | ||||
|  * | ||||
|  * Return value: %TRUE if the object references a #CoglGLES2Context | ||||
|  *   and %FALSE otherwise. | ||||
|  * Since: 2.0 | ||||
|  * Stability: unstable | ||||
|  */ | ||||
| gboolean | ||||
| cogl_is_gles2_context (void *object); | ||||
|  | ||||
| G_END_DECLS | ||||
|  | ||||
| /* The gobject introspection scanner seems to parse public headers in | ||||
|  * isolation which means we need to be extra careful about how we | ||||
|  * define and undefine __COGL_H_INSIDE__ used to detect when internal | ||||
|  * headers are incorrectly included by developers. In the gobject | ||||
|  * introspection case we have to manually define __COGL_H_INSIDE__ as | ||||
|  * a commandline argument for the scanner which means we must be | ||||
|  * careful not to undefine it in a header... | ||||
|  */ | ||||
| #ifdef __COGL_MUST_UNDEF_COGL_H_INSIDE_COGL_GLES2__ | ||||
| #undef __COGL_H_INSIDE__ | ||||
| #undef __COGL_MUST_UNDEF_COGL_H_INSIDE_COGL_GLES2__ | ||||
| #endif | ||||
|  | ||||
| #endif /* __COGL_GLES2_H__ */ | ||||
|  | ||||
| @@ -76,9 +76,6 @@ typedef enum | ||||
|   COGL_PRIVATE_FEATURE_GL_PROGRAMMABLE, | ||||
|   COGL_PRIVATE_FEATURE_GL_EMBEDDED, | ||||
|   COGL_PRIVATE_FEATURE_GL_WEB, | ||||
|   /* This is currently only implemented for GLX, but isn't actually | ||||
|    * that winsys dependent */ | ||||
|   COGL_PRIVATE_FEATURE_THREADED_SWAP_WAIT, | ||||
|  | ||||
|   COGL_N_PRIVATE_FEATURES | ||||
| } CoglPrivateFeature; | ||||
|   | ||||
| @@ -71,7 +71,6 @@ struct _CoglRenderer | ||||
|   Display *foreign_xdpy; | ||||
|   gboolean xlib_enable_event_retrieval; | ||||
|   gboolean xlib_want_reset_on_video_memory_purge; | ||||
|   gboolean xlib_enable_threaded_swap_wait; | ||||
| #endif | ||||
|  | ||||
|   CoglDriver driver; | ||||
| @@ -84,11 +83,6 @@ struct _CoglRenderer | ||||
|   void *winsys; | ||||
| }; | ||||
|  | ||||
| /* Mask of constraints that effect driver selection. All of the other | ||||
|  * constraints effect only the winsys selection */ | ||||
| #define COGL_RENDERER_DRIVER_CONSTRAINTS \ | ||||
|   COGL_RENDERER_CONSTRAINT_SUPPORTS_COGL_GLES2 | ||||
|  | ||||
| typedef CoglFilterReturn (* CoglNativeFilterFunc) (void *native_event, | ||||
|                                                    void *data); | ||||
|  | ||||
|   | ||||
| @@ -76,7 +76,6 @@ typedef struct _CoglDriverDescription | ||||
| { | ||||
|   CoglDriver id; | ||||
|   const char *name; | ||||
|   CoglRendererConstraint constraints; | ||||
|   /* It would be nice to make this a pointer and then use a compound | ||||
|    * literal from C99 to initialise it but we probably can't get away | ||||
|    * with using C99 here. Instead we'll just use a fixed-size array. | ||||
| @@ -94,7 +93,6 @@ static CoglDriverDescription _cogl_drivers[] = | ||||
|   { | ||||
|     COGL_DRIVER_GL, | ||||
|     "gl", | ||||
|     0, | ||||
|     { COGL_PRIVATE_FEATURE_ANY_GL, | ||||
|       COGL_PRIVATE_FEATURE_GL_FIXED, | ||||
|       COGL_PRIVATE_FEATURE_GL_PROGRAMMABLE, | ||||
| @@ -106,7 +104,6 @@ static CoglDriverDescription _cogl_drivers[] = | ||||
|   { | ||||
|     COGL_DRIVER_GL3, | ||||
|     "gl3", | ||||
|     0, | ||||
|     { COGL_PRIVATE_FEATURE_ANY_GL, | ||||
|       COGL_PRIVATE_FEATURE_GL_PROGRAMMABLE, | ||||
|       -1 }, | ||||
| @@ -119,7 +116,6 @@ static CoglDriverDescription _cogl_drivers[] = | ||||
|   { | ||||
|     COGL_DRIVER_GLES2, | ||||
|     "gles2", | ||||
|     COGL_RENDERER_CONSTRAINT_SUPPORTS_COGL_GLES2, | ||||
|     { COGL_PRIVATE_FEATURE_ANY_GL, | ||||
|       COGL_PRIVATE_FEATURE_GL_EMBEDDED, | ||||
|       COGL_PRIVATE_FEATURE_GL_PROGRAMMABLE, | ||||
| @@ -132,7 +128,6 @@ static CoglDriverDescription _cogl_drivers[] = | ||||
|   { | ||||
|     COGL_DRIVER_NOP, | ||||
|     "nop", | ||||
|     0, /* constraints satisfied */ | ||||
|     { -1 }, | ||||
|     &_cogl_driver_nop, | ||||
|     NULL, /* texture driver */ | ||||
| @@ -267,17 +262,6 @@ cogl_xlib_renderer_request_reset_on_video_memory_purge (CoglRenderer *renderer, | ||||
|  | ||||
|   renderer->xlib_want_reset_on_video_memory_purge = enable; | ||||
| } | ||||
|  | ||||
| void | ||||
| cogl_xlib_renderer_set_threaded_swap_wait_enabled (CoglRenderer *renderer, | ||||
| 						   gboolean enable) | ||||
| { | ||||
|   g_return_if_fail (cogl_is_renderer (renderer)); | ||||
|   /* NB: Renderers are considered immutable once connected */ | ||||
|   g_return_if_fail (!renderer->connected); | ||||
|  | ||||
|   renderer->xlib_enable_threaded_swap_wait = enable; | ||||
| } | ||||
| #endif /* COGL_HAS_XLIB_SUPPORT */ | ||||
|  | ||||
| gboolean | ||||
| @@ -398,31 +382,15 @@ driver_id_to_name (CoglDriver id) | ||||
|  | ||||
| typedef struct _SatisfyConstraintsState | ||||
| { | ||||
|   GList *constraints; | ||||
|   const CoglDriverDescription *driver_description; | ||||
| } SatisfyConstraintsState; | ||||
|  | ||||
| /* XXX this is still uglier than it needs to be */ | ||||
| static gboolean | ||||
| satisfy_constraints (CoglDriverDescription *description, | ||||
|                      void *user_data) | ||||
| { | ||||
|   SatisfyConstraintsState *state = user_data; | ||||
|   GList *l; | ||||
|  | ||||
|   for (l = state->constraints; l; l = l->next) | ||||
|     { | ||||
|       CoglRendererConstraint constraint = GPOINTER_TO_UINT (l->data); | ||||
|  | ||||
|       /* Most of the constraints only affect the winsys selection so | ||||
|        * we'll filter them out */ | ||||
|       if (!(constraint & COGL_RENDERER_DRIVER_CONSTRAINTS)) | ||||
|         continue; | ||||
|  | ||||
|       /* If the driver doesn't satisfy any constraint then continue | ||||
|        * to the next driver description */ | ||||
|       if (!(constraint & description->constraints)) | ||||
|         return TRUE; | ||||
|     } | ||||
|  | ||||
|   state->driver_description = description; | ||||
|  | ||||
| @@ -493,7 +461,6 @@ _cogl_renderer_choose_driver (CoglRenderer *renderer, | ||||
|     } | ||||
|  | ||||
|   state.driver_description = NULL; | ||||
|   state.constraints = renderer->constraints; | ||||
|  | ||||
|   foreach_driver_description (driver_override, | ||||
|                               satisfy_constraints, | ||||
|   | ||||
| @@ -261,10 +261,6 @@ cogl_renderer_connect (CoglRenderer *renderer, GError **error); | ||||
|  * @COGL_RENDERER_CONSTRAINT_USES_XLIB: Require the renderer to be X11 | ||||
|  *                                      based and use Xlib | ||||
|  * @COGL_RENDERER_CONSTRAINT_USES_EGL: Require the renderer to be EGL based | ||||
|  * @COGL_RENDERER_CONSTRAINT_SUPPORTS_COGL_GLES2: Require that the | ||||
|  *    renderer supports creating a #CoglGLES2Context via | ||||
|  *    cogl_gles2_context_new(). This can be used to integrate GLES 2.0 | ||||
|  *    code into Cogl based applications. | ||||
|  * | ||||
|  * These constraint flags are hard-coded features of the different renderer | ||||
|  * backends. Sometimes a platform may support multiple rendering options which | ||||
| @@ -286,7 +282,6 @@ typedef enum | ||||
|   COGL_RENDERER_CONSTRAINT_USES_X11 = (1 << 0), | ||||
|   COGL_RENDERER_CONSTRAINT_USES_XLIB = (1 << 1), | ||||
|   COGL_RENDERER_CONSTRAINT_USES_EGL = (1 << 2), | ||||
|   COGL_RENDERER_CONSTRAINT_SUPPORTS_COGL_GLES2 = (1 << 3) | ||||
| } CoglRendererConstraint; | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -167,36 +167,6 @@ void | ||||
| cogl_xlib_renderer_set_event_retrieval_enabled (CoglRenderer *renderer, | ||||
|                                                 gboolean enable); | ||||
|  | ||||
| /** | ||||
|  * cogl_xlib_renderer_set_threaded_swap_wait_enabled: (skip) | ||||
|  * @renderer: a #CoglRenderer | ||||
|  * @enable: The new value | ||||
|  * | ||||
|  * Sets whether Cogl is allowed to use a separate threaded to wait for the | ||||
|  * completion of glXSwapBuffers() and call the frame callback for the | ||||
|  * corresponding #CoglOnscreen. This is a way of emulating the | ||||
|  * INTEL_swap_event extension, and will only ever be used if | ||||
|  * INTEL_swap_event is not present; it will also only be used for | ||||
|  * specific white-listed drivers that are known to work correctly with | ||||
|  * multiple contexts sharing state between threads. | ||||
|  * | ||||
|  * The advantage of enabling this is that it will allow your main loop | ||||
|  * to do other work while waiting for the system to be ready to draw | ||||
|  * the next frame, instead of blocking in glXSwapBuffers(). A disadvantage | ||||
|  * is that the driver will be prevented from buffering up multiple frames | ||||
|  * even if it thinks that it would be advantageous. In general, this | ||||
|  * will work best for something like a system compositor that is doing | ||||
|  * simple drawing but handling lots of other complex tasks. | ||||
|  *  | ||||
|  * If you enable this, you must call XInitThreads() before any other | ||||
|  * X11 calls in your program. (See the documentation for XInitThreads()) | ||||
|  * | ||||
|  * Stability: unstable | ||||
|  */ | ||||
| void | ||||
| cogl_xlib_renderer_set_threaded_swap_wait_enabled (CoglRenderer *renderer, | ||||
| 						   gboolean enable); | ||||
|  | ||||
| /** | ||||
|  * cogl_xlib_renderer_get_display: (skip) | ||||
|  */ | ||||
|   | ||||
| @@ -347,82 +347,6 @@ cogl_read_pixels (int x, | ||||
|   cogl_object_unref (bitmap); | ||||
| } | ||||
|  | ||||
| void | ||||
| cogl_begin_gl (void) | ||||
| { | ||||
|   CoglPipeline *pipeline; | ||||
|  | ||||
|   _COGL_GET_CONTEXT (ctx, NO_RETVAL); | ||||
|  | ||||
|   if (ctx->in_begin_gl_block) | ||||
|     { | ||||
|       static gboolean shown = FALSE; | ||||
|       if (!shown) | ||||
|         g_warning ("You should not nest cogl_begin_gl/cogl_end_gl blocks"); | ||||
|       shown = TRUE; | ||||
|       return; | ||||
|     } | ||||
|   ctx->in_begin_gl_block = TRUE; | ||||
|  | ||||
|   /* Flush all batched primitives */ | ||||
|   cogl_flush (); | ||||
|  | ||||
|   /* Flush framebuffer state, including clip state, modelview and | ||||
|    * projection matrix state | ||||
|    * | ||||
|    * NB: _cogl_framebuffer_flush_state may disrupt various state (such | ||||
|    * as the pipeline state) when flushing the clip stack, so should | ||||
|    * always be done first when preparing to draw. */ | ||||
|   _cogl_framebuffer_flush_state (cogl_get_draw_framebuffer (), | ||||
|                                  _cogl_get_read_framebuffer (), | ||||
|                                  COGL_FRAMEBUFFER_STATE_ALL); | ||||
|  | ||||
|   /* Setup the state for the current pipeline */ | ||||
|  | ||||
|   /* We considered flushing a specific, minimal pipeline here to try and | ||||
|    * simplify the GL state, but decided to avoid special cases and second | ||||
|    * guessing what would be actually helpful. | ||||
|    * | ||||
|    * A user should instead call cogl_set_source_color4ub() before | ||||
|    * cogl_begin_gl() to simplify the state flushed. | ||||
|    * | ||||
|    * XXX: note defining n_tex_coord_attribs using | ||||
|    * cogl_pipeline_get_n_layers is a hack, but the problem is that | ||||
|    * n_tex_coord_attribs is usually defined when drawing a primitive | ||||
|    * which isn't happening here. | ||||
|    * | ||||
|    * Maybe it would be more useful if this code did flush the | ||||
|    * opaque_color_pipeline and then call into cogl-pipeline-opengl.c to then | ||||
|    * restore all state for the material's backend back to default OpenGL | ||||
|    * values. | ||||
|    */ | ||||
|   pipeline = cogl_get_source (); | ||||
|   _cogl_pipeline_flush_gl_state (ctx, | ||||
|                                  pipeline, | ||||
|                                  cogl_get_draw_framebuffer (), | ||||
|                                  FALSE, | ||||
|                                  FALSE); | ||||
|  | ||||
|   /* Disable any cached vertex arrays */ | ||||
|   _cogl_gl_disable_all_attributes (ctx); | ||||
| } | ||||
|  | ||||
| void | ||||
| cogl_end_gl (void) | ||||
| { | ||||
|   _COGL_GET_CONTEXT (ctx, NO_RETVAL); | ||||
|  | ||||
|   if (!ctx->in_begin_gl_block) | ||||
|     { | ||||
|       static gboolean shown = FALSE; | ||||
|       if (!shown) | ||||
|         g_warning ("cogl_end_gl is being called before cogl_begin_gl"); | ||||
|       shown = TRUE; | ||||
|       return; | ||||
|     } | ||||
|   ctx->in_begin_gl_block = FALSE; | ||||
| } | ||||
|  | ||||
| void | ||||
| cogl_push_matrix (void) | ||||
| { | ||||
|   | ||||
| @@ -38,8 +38,6 @@ cogl_attribute_set_buffer | ||||
| cogl_attribute_set_normalized | ||||
| cogl_attribute_type_get_type | ||||
|  | ||||
| cogl_begin_gl | ||||
|  | ||||
| cogl_bitmap_error_get_type | ||||
| cogl_bitmap_get_buffer | ||||
| cogl_bitmap_get_format | ||||
| @@ -198,8 +196,6 @@ cogl_display_set_onscreen_template | ||||
|  | ||||
| cogl_double_to_fixed | ||||
|  | ||||
| cogl_end_gl | ||||
|  | ||||
| cogl_euler_copy | ||||
| cogl_euler_equal | ||||
| cogl_euler_free | ||||
| @@ -334,15 +330,6 @@ cogl_get_static_identity_quaternion | ||||
| cogl_get_static_zero_quaternion | ||||
| cogl_get_viewport | ||||
|  | ||||
| #ifdef COGL_HAS_GTYPE_SUPPORT | ||||
| cogl_gles2_context_get_gtype | ||||
| #endif | ||||
| cogl_gles2_context_get_vtable | ||||
| cogl_gles2_context_new | ||||
| cogl_gles2_get_current_vtable | ||||
| cogl_gles2_texture_get_handle | ||||
| cogl_gles2_texture_2d_new_from_handle | ||||
|  | ||||
| #ifdef COGL_HAS_GLIB_SUPPORT | ||||
| cogl_glib_renderer_source_new | ||||
| cogl_glib_source_new | ||||
| @@ -381,7 +368,6 @@ cogl_is_bitmap | ||||
| cogl_is_buffer | ||||
| cogl_is_context | ||||
| cogl_is_frame_info | ||||
| cogl_is_gles2_context | ||||
| cogl_is_index_buffer | ||||
| #if 0 | ||||
| /* not implemented! */ | ||||
| @@ -690,7 +676,6 @@ cogl_polygon | ||||
| cogl_pop_draw_buffer | ||||
| #endif | ||||
| cogl_pop_framebuffer | ||||
| cogl_pop_gles2_context | ||||
| cogl_pop_matrix | ||||
| cogl_pop_source | ||||
|  | ||||
| @@ -752,7 +737,6 @@ cogl_push_draw_buffer | ||||
| #endif | ||||
|  | ||||
| cogl_push_framebuffer | ||||
| cogl_push_gles2_context | ||||
| cogl_push_matrix | ||||
| cogl_push_source | ||||
|  | ||||
|   | ||||
| @@ -766,97 +766,6 @@ cogl_set_source_texture (CoglTexture *texture); | ||||
| void | ||||
| cogl_flush (void); | ||||
|  | ||||
| /** | ||||
|  * cogl_begin_gl: | ||||
|  * | ||||
|  * We do not advise nor reliably support the interleaving of raw GL drawing and | ||||
|  * Cogl drawing functions, but if you insist, cogl_begin_gl() and cogl_end_gl() | ||||
|  * provide a simple mechanism that may at least give you a fighting chance of | ||||
|  * succeeding. | ||||
|  * | ||||
|  * Note: this doesn't help you modify the behaviour of Cogl drawing functions | ||||
|  * through the modification of GL state; that will never be reliably supported, | ||||
|  * but if you are trying to do something like: | ||||
|  * | ||||
|  * |[ | ||||
|  * { | ||||
|  *    - setup some OpenGL state. | ||||
|  *    - draw using OpenGL (e.g. glDrawArrays() ) | ||||
|  *    - reset modified OpenGL state. | ||||
|  *    - continue using Cogl to draw | ||||
|  * } | ||||
|  * ]| | ||||
|  * | ||||
|  * You should surround blocks of drawing using raw GL with cogl_begin_gl() | ||||
|  * and cogl_end_gl(): | ||||
|  * | ||||
|  * |[ | ||||
|  * { | ||||
|  *    cogl_begin_gl (); | ||||
|  *    - setup some OpenGL state. | ||||
|  *    - draw using OpenGL (e.g. glDrawArrays() ) | ||||
|  *    - reset modified OpenGL state. | ||||
|  *    cogl_end_gl (); | ||||
|  *    - continue using Cogl to draw | ||||
|  * } | ||||
|  * ]| | ||||
|  * | ||||
|  * Don't ever try and do: | ||||
|  * | ||||
|  * |[ | ||||
|  * { | ||||
|  *    - setup some OpenGL state. | ||||
|  *    - use Cogl to draw | ||||
|  *    - reset modified OpenGL state. | ||||
|  * } | ||||
|  * ]| | ||||
|  * | ||||
|  * When the internals of Cogl evolves, this is very liable to break. | ||||
|  * | ||||
|  * This function will flush all batched primitives, and subsequently flush | ||||
|  * all internal Cogl state to OpenGL as if it were going to draw something | ||||
|  * itself. | ||||
|  * | ||||
|  * The result is that the OpenGL modelview matrix will be setup; the state | ||||
|  * corresponding to the current source material will be set up and other world | ||||
|  * state such as backface culling, depth and fogging enabledness will be sent | ||||
|  * to OpenGL. | ||||
|  * | ||||
|  * <note>No special material state is flushed, so if you want Cogl to setup a | ||||
|  * simplified material state it is your responsibility to set a simple source | ||||
|  * material before calling cogl_begin_gl(). E.g. by calling | ||||
|  * cogl_set_source_color4ub().</note> | ||||
|  * | ||||
|  * <note>It is your responsibility to restore any OpenGL state that you modify | ||||
|  * to how it was after calling cogl_begin_gl() if you don't do this then the | ||||
|  * result of further Cogl calls is undefined.</note> | ||||
|  * | ||||
|  * <note>You can not nest begin/end blocks.</note> | ||||
|  * | ||||
|  * Again we would like to stress, we do not advise the use of this API and if | ||||
|  * possible we would prefer to improve Cogl than have developers require raw | ||||
|  * OpenGL. | ||||
|  * | ||||
|  * Since: 1.0 | ||||
|  * Deprecated: 1.16: Use the #CoglGLES2Context api instead | ||||
|  */ | ||||
| COGL_DEPRECATED_FOR (CoglGLES2Context_API) | ||||
| void | ||||
| cogl_begin_gl (void); | ||||
|  | ||||
| /** | ||||
|  * cogl_end_gl: | ||||
|  * | ||||
|  * This is the counterpart to cogl_begin_gl() used to delimit blocks of drawing | ||||
|  * code using raw OpenGL. Please refer to cogl_begin_gl() for full details. | ||||
|  * | ||||
|  * Since: 1.0 | ||||
|  * Deprecated: 1.16: Use the #CoglGLES2Context api instead | ||||
|  */ | ||||
| COGL_DEPRECATED_FOR (CoglGLES2Context_API) | ||||
| void | ||||
| cogl_end_gl (void); | ||||
|  | ||||
| G_END_DECLS | ||||
|  | ||||
| #endif /* __COGL_1_CONTEXT_H__ */ | ||||
|   | ||||
| @@ -47,7 +47,4 @@ _cogl_gl_flush_attributes_state (CoglFramebuffer *framebuffer, | ||||
|                                  CoglAttribute **attributes, | ||||
|                                  int n_attributes); | ||||
|  | ||||
| void | ||||
| _cogl_gl_disable_all_attributes (CoglContext *ctx); | ||||
|  | ||||
| #endif /* _COGL_ATTRIBUTE_GL_PRIVATE_H_ */ | ||||
|   | ||||
| @@ -523,16 +523,3 @@ _cogl_gl_flush_attributes_state (CoglFramebuffer *framebuffer, | ||||
|   if (copy) | ||||
|     cogl_object_unref (copy); | ||||
| } | ||||
|  | ||||
| void | ||||
| _cogl_gl_disable_all_attributes (CoglContext *ctx) | ||||
| { | ||||
|   _cogl_bitmask_clear_all (&ctx->enable_builtin_attributes_tmp); | ||||
|   _cogl_bitmask_clear_all (&ctx->enable_texcoord_attributes_tmp); | ||||
|   _cogl_bitmask_clear_all (&ctx->enable_custom_attributes_tmp); | ||||
|  | ||||
|   /* XXX: we can pass a NULL source pipeline here because we know a | ||||
|    * source pipeline only needs to be referenced when enabling | ||||
|    * attributes. */ | ||||
|   apply_attribute_enable_updates (ctx, NULL); | ||||
| } | ||||
|   | ||||
| @@ -106,8 +106,6 @@ cogl_nonintrospected_headers = [ | ||||
|   'cogl-display.h', | ||||
|   'cogl-context.h', | ||||
|   'cogl-snippet.h', | ||||
|   'cogl-gles2.h', | ||||
|   'cogl-gles2-types.h', | ||||
|   'cogl-index-buffer.h', | ||||
|   'cogl-attribute-buffer.h', | ||||
|   'cogl-indices.h', | ||||
| @@ -362,8 +360,6 @@ cogl_sources = [ | ||||
|   'cogl-memory-stack.c', | ||||
|   'cogl-magazine-private.h', | ||||
|   'cogl-magazine.c', | ||||
|   'cogl-gles2-context-private.h', | ||||
|   'cogl-gles2-context.c', | ||||
|   'cogl-closure-list-private.h', | ||||
|   'cogl-closure-list.c', | ||||
|   'cogl-fence.c', | ||||
|   | ||||
| @@ -41,9 +41,9 @@ | ||||
| #include "cogl-swap-chain-private.h" | ||||
| #include "cogl-renderer-private.h" | ||||
| #include "cogl-onscreen-template-private.h" | ||||
| #include "cogl-gles2-context-private.h" | ||||
| #include "cogl-egl.h" | ||||
| #include "cogl-private.h" | ||||
| #include "cogl-trace.h" | ||||
| #include "winsys/cogl-winsys-egl-private.h" | ||||
| #include "winsys/cogl-winsys-private.h" | ||||
|  | ||||
| @@ -110,40 +110,6 @@ static const CoglFeatureData winsys_feature_data[] = | ||||
| #include "winsys/cogl-winsys-egl-feature-functions.h" | ||||
|   }; | ||||
|  | ||||
| static const char * | ||||
| get_error_string (void) | ||||
| { | ||||
|   switch (eglGetError()){ | ||||
|   case EGL_BAD_DISPLAY: | ||||
|     return "Invalid display"; | ||||
|   case EGL_NOT_INITIALIZED: | ||||
|     return "Display not initialized"; | ||||
|   case EGL_BAD_ALLOC: | ||||
|     return "Not enough resources to allocate context"; | ||||
|   case EGL_BAD_ATTRIBUTE: | ||||
|     return "Invalid attribute"; | ||||
|   case EGL_BAD_CONFIG: | ||||
|     return "Invalid config"; | ||||
|   case EGL_BAD_CONTEXT: | ||||
|     return "Invalid context"; | ||||
|   case EGL_BAD_CURRENT_SURFACE: | ||||
|      return "Invalid current surface"; | ||||
|   case EGL_BAD_MATCH: | ||||
|      return "Bad match"; | ||||
|   case EGL_BAD_NATIVE_PIXMAP: | ||||
|      return "Invalid native pixmap"; | ||||
|   case EGL_BAD_NATIVE_WINDOW: | ||||
|      return "Invalid native window"; | ||||
|   case EGL_BAD_PARAMETER: | ||||
|      return "Invalid parameter"; | ||||
|   case EGL_BAD_SURFACE: | ||||
|      return "Invalid surface"; | ||||
|   default: | ||||
|     g_assert_not_reached (); | ||||
|     return NULL; | ||||
|   } | ||||
| } | ||||
|  | ||||
| static GCallback | ||||
| _cogl_winsys_renderer_get_proc_address (CoglRenderer *renderer, | ||||
|                                         const char *name, | ||||
| @@ -556,14 +522,6 @@ _cogl_winsys_context_init (CoglContext *context, GError **error) | ||||
|       COGL_FLAGS_SET (context->features, COGL_FEATURE_ID_BUFFER_AGE, TRUE); | ||||
|     } | ||||
|  | ||||
|   /* NB: We currently only support creating standalone GLES2 contexts | ||||
|    * for offscreen rendering and so we need a dummy (non-visible) | ||||
|    * surface to be able to bind those contexts */ | ||||
|   if (egl_display->dummy_surface != EGL_NO_SURFACE && | ||||
|       context->driver == COGL_DRIVER_GLES2) | ||||
|     COGL_FLAGS_SET (context->features, | ||||
|                     COGL_FEATURE_ID_GLES2_CONTEXT, TRUE); | ||||
|  | ||||
|   if (egl_renderer->platform_vtable->context_init && | ||||
|       !egl_renderer->platform_vtable->context_init (context, error)) | ||||
|     return FALSE; | ||||
| @@ -583,54 +541,6 @@ _cogl_winsys_context_deinit (CoglContext *context) | ||||
|   g_free (context->winsys); | ||||
| } | ||||
|  | ||||
| typedef struct _CoglGLES2ContextEGL | ||||
| { | ||||
|   EGLContext egl_context; | ||||
|   EGLSurface dummy_surface; | ||||
| } CoglGLES2ContextEGL; | ||||
|  | ||||
| static void * | ||||
| _cogl_winsys_context_create_gles2_context (CoglContext *ctx, GError **error) | ||||
| { | ||||
|   CoglRendererEGL *egl_renderer = ctx->display->renderer->winsys; | ||||
|   CoglDisplayEGL *egl_display = ctx->display->winsys; | ||||
|   EGLint attribs[3]; | ||||
|   EGLContext egl_context; | ||||
|  | ||||
|   attribs[0] = EGL_CONTEXT_CLIENT_VERSION; | ||||
|   attribs[1] = 2; | ||||
|   attribs[2] = EGL_NONE; | ||||
|  | ||||
|   egl_context = eglCreateContext (egl_renderer->edpy, | ||||
|                                   egl_display->egl_config, | ||||
|                                   egl_display->egl_context, | ||||
|                                   attribs); | ||||
|   if (egl_context == EGL_NO_CONTEXT) | ||||
|     { | ||||
|       g_set_error (error, COGL_WINSYS_ERROR, | ||||
|                    COGL_WINSYS_ERROR_CREATE_GLES2_CONTEXT, | ||||
|                    "%s", get_error_string ()); | ||||
|       return NULL; | ||||
|     } | ||||
|  | ||||
|   return (void *)egl_context; | ||||
| } | ||||
|  | ||||
| static void | ||||
| _cogl_winsys_destroy_gles2_context (CoglGLES2Context *gles2_ctx) | ||||
| { | ||||
|   CoglContext *context = gles2_ctx->context; | ||||
|   CoglDisplay *display = context->display; | ||||
|   CoglDisplayEGL *egl_display = display->winsys; | ||||
|   CoglRenderer *renderer = display->renderer; | ||||
|   CoglRendererEGL *egl_renderer = renderer->winsys; | ||||
|   EGLContext egl_context = gles2_ctx->winsys; | ||||
|  | ||||
|   g_return_if_fail (egl_display->current_context != egl_context); | ||||
|  | ||||
|   eglDestroyContext (egl_renderer->edpy, egl_context); | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| _cogl_winsys_onscreen_init (CoglOnscreen *onscreen, | ||||
|                             GError **error) | ||||
| @@ -844,6 +754,9 @@ _cogl_winsys_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen, | ||||
|   CoglRendererEGL *egl_renderer = renderer->winsys; | ||||
|   CoglOnscreenEGL *egl_onscreen = onscreen->winsys; | ||||
|  | ||||
|   COGL_TRACE_BEGIN_SCOPED (CoglOnscreenEGLSwapBuffersWithDamage, | ||||
|                            "Onscreen (eglSwapBuffers)"); | ||||
|  | ||||
|   /* The specification for EGL (at least in 1.4) says that the surface | ||||
|      needs to be bound to the current context for the swap to work | ||||
|      although it may change in future. Mesa explicitly checks for this | ||||
| @@ -878,58 +791,6 @@ _cogl_winsys_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen, | ||||
|     eglSwapBuffers (egl_renderer->edpy, egl_onscreen->egl_surface); | ||||
| } | ||||
|  | ||||
| static void | ||||
| _cogl_winsys_save_context (CoglContext *ctx) | ||||
| { | ||||
|   CoglContextEGL *egl_context = ctx->winsys; | ||||
|   CoglDisplayEGL *egl_display = ctx->display->winsys; | ||||
|  | ||||
|   egl_context->saved_draw_surface = egl_display->current_draw_surface; | ||||
|   egl_context->saved_read_surface = egl_display->current_read_surface; | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| _cogl_winsys_set_gles2_context (CoglGLES2Context *gles2_ctx, GError **error) | ||||
| { | ||||
|   CoglContext *ctx = gles2_ctx->context; | ||||
|   CoglDisplayEGL *egl_display = ctx->display->winsys; | ||||
|   gboolean status; | ||||
|  | ||||
|   if (gles2_ctx->write_buffer && | ||||
|       cogl_is_onscreen (gles2_ctx->write_buffer)) | ||||
|     status = | ||||
|       bind_onscreen_with_context (COGL_ONSCREEN (gles2_ctx->write_buffer), | ||||
|                                   gles2_ctx->winsys); | ||||
|   else | ||||
|     status = _cogl_winsys_egl_make_current (ctx->display, | ||||
|                                             egl_display->dummy_surface, | ||||
|                                             egl_display->dummy_surface, | ||||
|                                             gles2_ctx->winsys); | ||||
|  | ||||
|   if (!status) | ||||
|     { | ||||
|       g_set_error (error, | ||||
|                    COGL_WINSYS_ERROR, | ||||
|                    COGL_WINSYS_ERROR_MAKE_CURRENT, | ||||
|                    "Failed to make gles2 context current"); | ||||
|       return FALSE; | ||||
|     } | ||||
|  | ||||
|   return TRUE; | ||||
| } | ||||
|  | ||||
| static void | ||||
| _cogl_winsys_restore_context (CoglContext *ctx) | ||||
| { | ||||
|   CoglContextEGL *egl_context = ctx->winsys; | ||||
|   CoglDisplayEGL *egl_display = ctx->display->winsys; | ||||
|  | ||||
|   _cogl_winsys_egl_make_current (ctx->display, | ||||
|                                  egl_context->saved_draw_surface, | ||||
|                                  egl_context->saved_read_surface, | ||||
|                                  egl_display->egl_context); | ||||
| } | ||||
|  | ||||
| #if defined(EGL_KHR_fence_sync) || defined(EGL_KHR_reusable_sync) | ||||
| static void * | ||||
| _cogl_winsys_fence_add (CoglContext *context) | ||||
| @@ -971,8 +832,7 @@ _cogl_winsys_fence_destroy (CoglContext *context, void *fence) | ||||
|  | ||||
| static CoglWinsysVtable _cogl_winsys_vtable = | ||||
|   { | ||||
|     .constraints = COGL_RENDERER_CONSTRAINT_USES_EGL | | ||||
|       COGL_RENDERER_CONSTRAINT_SUPPORTS_COGL_GLES2, | ||||
|     .constraints = COGL_RENDERER_CONSTRAINT_USES_EGL, | ||||
|  | ||||
|     /* This winsys is only used as a base for the EGL-platform | ||||
|        winsys's so it does not have an ID or a name */ | ||||
| @@ -984,9 +844,6 @@ static CoglWinsysVtable _cogl_winsys_vtable = | ||||
|     .display_destroy = _cogl_winsys_display_destroy, | ||||
|     .context_init = _cogl_winsys_context_init, | ||||
|     .context_deinit = _cogl_winsys_context_deinit, | ||||
|     .context_create_gles2_context = | ||||
|       _cogl_winsys_context_create_gles2_context, | ||||
|     .destroy_gles2_context = _cogl_winsys_destroy_gles2_context, | ||||
|     .onscreen_init = _cogl_winsys_onscreen_init, | ||||
|     .onscreen_deinit = _cogl_winsys_onscreen_deinit, | ||||
|     .onscreen_bind = _cogl_winsys_onscreen_bind, | ||||
| @@ -995,11 +852,6 @@ static CoglWinsysVtable _cogl_winsys_vtable = | ||||
|     .onscreen_swap_region = _cogl_winsys_onscreen_swap_region, | ||||
|     .onscreen_get_buffer_age = _cogl_winsys_onscreen_get_buffer_age, | ||||
|  | ||||
|     /* CoglGLES2Context related methods */ | ||||
|     .save_context = _cogl_winsys_save_context, | ||||
|     .set_gles2_context = _cogl_winsys_set_gles2_context, | ||||
|     .restore_context = _cogl_winsys_restore_context, | ||||
|  | ||||
| #if defined(EGL_KHR_fence_sync) || defined(EGL_KHR_reusable_sync) | ||||
|     .fence_add = _cogl_winsys_fence_add, | ||||
|     .fence_is_complete = _cogl_winsys_fence_is_complete, | ||||
|   | ||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user