fix a lot of issues with giant tooltips, also disable mouse input.
authordiscomfitor <discomfitor@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 27 Jul 2011 06:43:51 +0000 (06:43 +0000)
committerMike McCormack <mj.mccormack@samsung.com>
Wed, 23 Nov 2011 00:54:34 +0000 (09:54 +0900)
THANK YOU JEFFDAMETH FOR BEING SO AWESOME

git-svn-id: https://svn.enlightenment.org/svn/e/trunk/elementary@61791 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/els_tooltip.c

index 33f059e..561b679 100644 (file)
@@ -105,14 +105,16 @@ _elm_tooltip_show(Elm_Tooltip *tt)
    if (tt->free_size)
      {
         tt->tt_win = elm_win_add(NULL, "tooltip", ELM_WIN_BASIC);
-        elm_win_transparent_set(tt->tt_win, EINA_TRUE);
-        elm_win_override_set(tt->tt_win, EINA_TRUE);
         elm_win_borderless_set(tt->tt_win, EINA_TRUE);
-        elm_object_focus_allow_set(tt->tt_win, EINA_FALSE);
+        elm_win_override_set(tt->tt_win, EINA_TRUE);
         tt->tt_evas = evas_object_evas_get(tt->tt_win);
         tt->tooltip = edje_object_add(tt->tt_evas);
+        evas_object_pass_events_set(tt->tooltip, EINA_TRUE);
         evas_object_move(tt->tooltip, 0, 0);
         elm_win_resize_object_add(tt->tt_win, tt->tooltip);
+#ifdef HAVE_ELEMENTARY_X
+        ecore_x_window_shape_input_rectangle_set(elm_win_xwindow_get(tt->tt_win), 0, 0, 0, 0);
+#endif
         evas_object_show(tt->tt_win);
      }
    else
@@ -213,10 +215,13 @@ _elm_tooltip_hide_anim_cb(void *data)
 static void
 _elm_tooltip_hide_anim_start(Elm_Tooltip *tt)
 {
+   double extra = 0;
    if (tt->hide_timer) return;
+   /* hide slightly faster when in window mode to look less stupid */
+   if ((tt->hide_timeout > 0) && tt->tt_win) extra = 0.1;
    edje_object_signal_emit(tt->tooltip, "elm,action,hide", "elm");
    tt->hide_timer = ecore_timer_add
-     (tt->hide_timeout, _elm_tooltip_hide_anim_cb, tt);
+     (tt->hide_timeout - extra, _elm_tooltip_hide_anim_cb, tt);
 }
 
 static void
@@ -253,7 +258,7 @@ _elm_tooltip_reconfigure(Elm_Tooltip *tt)
              ERR("Could not apply the theme to the tooltip! style=%s", style);
              if (tt->tt_win) evas_object_del(tt->tt_win);
              else evas_object_del(tt->tooltip);
-
+elm_win_transparent_set(tt->tt_win, EINA_TRUE);
              tt->tt_win = NULL;
              tt->tt_evas = NULL;
              tt->tooltip = NULL;
@@ -268,6 +273,13 @@ _elm_tooltip_reconfigure(Elm_Tooltip *tt)
         tt->pad.bx = 0;
         tt->pad.by = 0;
         tt->hide_timeout = 0.0;
+        if (tt->tt_win)
+          {  /* FIXME: hardcoded here is bad */
+             if (!strcmp(style, "transparent"))
+               elm_win_transparent_set(tt->tt_win, EINA_TRUE);
+             else
+               elm_win_transparent_set(tt->tt_win, EINA_FALSE);
+          }
 
         str = edje_object_data_get(tt->tooltip, "pad_x");
         if (str) tt->pad.x = atoi(str);
@@ -345,15 +357,25 @@ _elm_tooltip_reconfigure(Elm_Tooltip *tt)
    if (!cw)
 #endif
      evas_output_size_get(tt->tt_evas ?: tt->evas, &cw, &ch);
-   evas_pointer_canvas_xy_get(tt->evas, &px, &py);
 
    evas_object_geometry_get(tt->eventarea, &ox, &oy, &ow, &oh);
 
-   inside_eventarea = ((px >= ox) && (py >= oy) &&
-                       (px <= ox + ow) && (py <= oy + oh));
+   if (tt->tt_win)
+     {
+        int x, y;
 #ifdef HAVE_ELEMENTARY_X
-   if (tt->tt_win) ecore_x_pointer_xy_get(xwin, &px, &py);
+        ecore_x_pointer_xy_get(xwin, &px, &py);
 #endif
+        elm_win_screen_position_get(elm_object_top_widget_get(tt->owner), &x, &y);
+        ox += x;
+        oy += y;
+     }
+
+   else
+     evas_pointer_canvas_xy_get(tt->evas, &px, &py);
+
+   inside_eventarea = ((px >= ox) && (py >= oy) &&
+                       (px <= ox + ow) && (py <= oy + oh));
    if (inside_eventarea)
      {
         tx = px;
@@ -444,10 +466,8 @@ _elm_tooltip_obj_mouse_in_cb(void *data, Evas *e  __UNUSED__, Evas_Object *obj _
 }
 
 static void
-_elm_tooltip_obj_mouse_out_cb(void *data, Evas *e  __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info  __UNUSED__)
+_elm_tooltip_obj_mouse_out_cb(Elm_Tooltip *tt, Evas *e  __UNUSED__, Evas_Object *obj __UNUSED__, Evas_Event_Mouse_Out *event __UNUSED__)
 {
-   Elm_Tooltip *tt = data;
-
    if (tt->visible_lock) return;
 
    if (!tt->tooltip)
@@ -474,7 +494,7 @@ _elm_tooltip_unset(Elm_Tooltip *tt)
            _elm_tooltip_obj_mouse_in_cb, tt);
         evas_object_event_callback_del_full
           (tt->eventarea, EVAS_CALLBACK_MOUSE_OUT,
-           _elm_tooltip_obj_mouse_out_cb, tt);
+           (Evas_Object_Event_Cb)_elm_tooltip_obj_mouse_out_cb, tt);
         evas_object_event_callback_del_full
           (tt->eventarea, EVAS_CALLBACK_FREE, _elm_tooltip_obj_free_cb, tt);
 
@@ -648,9 +668,9 @@ elm_object_sub_tooltip_content_cb_set(Evas_Object *eventarea, Evas_Object *owner
         evas_object_event_callback_add(eventarea, EVAS_CALLBACK_MOUSE_IN,
            _elm_tooltip_obj_mouse_in_cb, tt);
         evas_object_event_callback_add(eventarea, EVAS_CALLBACK_MOUSE_OUT,
-           _elm_tooltip_obj_mouse_out_cb, tt);
+           (Evas_Object_Event_Cb)_elm_tooltip_obj_mouse_out_cb, tt);
         evas_object_event_callback_add(eventarea, EVAS_CALLBACK_FREE,
-            _elm_tooltip_obj_free_cb, tt);
+           _elm_tooltip_obj_free_cb, tt);
 
         if (owner != eventarea)
           evas_object_event_callback_add