[EFL] Drop evas object cursor support
authorryuan.choi@gmail.com <ryuan.choi@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 6 Sep 2014 11:17:23 +0000 (11:17 +0000)
committerryuan.choi@gmail.com <ryuan.choi@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 6 Sep 2014 11:17:23 +0000 (11:17 +0000)
https://bugs.webkit.org/show_bug.cgi?id=136324

Reviewed by Gyuyoung Kim.

Removed evas object cursor because there are some bugs.
ewebkit will only support ecore_x_cursor because ewebkit is available with X, now.

Source/WebCore:

* platform/efl/DefaultTheme/CMakeLists.txt: Removed cursor related code.
* platform/efl/DefaultTheme/default.edc: Ditto.
* platform/efl/DefaultTheme/widget/cursor/cursor.edc: Removed.
* platform/efl/EflScreenUtilities.cpp:
(WebCore::getEcoreCursor):
(WebCore::applyCursorFromEcoreX): Renamed applyFallbackCursor.
(WebCore::createCustomCursor): Added to make custom cursor.
(WebCore::applyFallbackCursor): Deleted.
* platform/efl/EflScreenUtilities.h:

Source/WebKit2:

* UIProcess/API/efl/EwkView.cpp:
(EwkViewEventHandler<EVAS_CALLBACK_MOUSE_IN>::handleEvent):
(EwkView::EwkView):
(EwkView::updateCursor): Simplifies not to use evas object cursor.
(EwkView::setCursor): Ditto.
* UIProcess/API/efl/EwkView.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@173354 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/efl/DefaultTheme/CMakeLists.txt
Source/WebCore/platform/efl/DefaultTheme/default.edc
Source/WebCore/platform/efl/DefaultTheme/widget/cursor/cursor.edc [deleted file]
Source/WebCore/platform/efl/EflScreenUtilities.cpp
Source/WebCore/platform/efl/EflScreenUtilities.h
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/efl/EwkView.cpp
Source/WebKit2/UIProcess/API/efl/EwkView.h

index b8e7a25191623b2cba75c3208d82a8cd1b51aeef..4cd14cbc2ddf1f57cde06506c4c69ed79556b05f 100644 (file)
@@ -1,3 +1,23 @@
+2014-09-06  Ryuan Choi  <ryuan.choi@gmail.com>
+
+        [EFL] Drop evas object cursor support
+        https://bugs.webkit.org/show_bug.cgi?id=136324
+
+        Reviewed by Gyuyoung Kim.
+
+        Removed evas object cursor because there are some bugs.
+        ewebkit will only support ecore_x_cursor because ewebkit is available with X, now.
+
+        * platform/efl/DefaultTheme/CMakeLists.txt: Removed cursor related code.
+        * platform/efl/DefaultTheme/default.edc: Ditto.
+        * platform/efl/DefaultTheme/widget/cursor/cursor.edc: Removed.
+        * platform/efl/EflScreenUtilities.cpp:
+        (WebCore::getEcoreCursor):
+        (WebCore::applyCursorFromEcoreX): Renamed applyFallbackCursor.
+        (WebCore::createCustomCursor): Added to make custom cursor.
+        (WebCore::applyFallbackCursor): Deleted.
+        * platform/efl/EflScreenUtilities.h:
+
 2014-09-05  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r173340 and r173342.
index 01f33df6dd28ae618aa5382591441455e65e3eb6..1d3d51d9697e908501164855eff6fbbeb7d0a35d 100644 (file)
@@ -37,7 +37,6 @@ macro(GENERATE_THEME _target_name _name _option)
             widget/combo/combo_press.png
             widget/combo/combo_press_transparent.png
             widget/combo/icon.png
-            widget/cursor/cursor.edc
             widget/entry/entry.edc
             widget/entry/img_focused.png
             widget/entry/img_hovered.png
@@ -83,31 +82,6 @@ macro(GENERATE_THEME _target_name _name _option)
             widget/spinner/sp_up_default.png
             widget/spinner/sp_up_hover.png
             widget/spinner/sp_up_pressed.png
-            ${Resources_DIR}/aliasCursor.png
-            ${Resources_DIR}/cellCursor.png
-            ${Resources_DIR}/contextMenuCursor.png
-            ${Resources_DIR}/copyCursor.png
-            ${Resources_DIR}/eastResizeCursor.png
-            ${Resources_DIR}/eastWestResizeCursor.png
-            ${Resources_DIR}/helpCursor.png
-            ${Resources_DIR}/linkCursor.png
-            ${Resources_DIR}/moveCursor.png
-            ${Resources_DIR}/noDropCursor.png
-            ${Resources_DIR}/noneCursor.png
-            ${Resources_DIR}/northEastResizeCursor.png
-            ${Resources_DIR}/northEastSouthWestResizeCursor.png
-            ${Resources_DIR}/northResizeCursor.png
-            ${Resources_DIR}/northSouthResizeCursor.png
-            ${Resources_DIR}/northWestResizeCursor.png
-            ${Resources_DIR}/northWestSouthEastResizeCursor.png
-            ${Resources_DIR}/panIcon.png
-            ${Resources_DIR}/progressCursor.png
-            ${Resources_DIR}/southEastResizeCursor.png
-            ${Resources_DIR}/southResizeCursor.png
-            ${Resources_DIR}/southWestResizeCursor.png
-            ${Resources_DIR}/verticalTextCursor.png
-            ${Resources_DIR}/waitCursor.png
-            ${Resources_DIR}/westResizeCursor.png
         WORKING_DIRECTORY ${DefaultTheme_DIR}
         VERBATIM
     )
@@ -119,9 +93,9 @@ endmacro()
 
 set(DefaultTheme_DEFINITION "")
 
-GENERATE_THEME(DefaultTheme "default.edj" "-DCURSOR_IMAGE_DIR=${Resources_DIR} ${DefaultTheme_DEFINITION}")
+GENERATE_THEME(DefaultTheme "default.edj" "${DefaultTheme_DEFINITION}")
 install(FILES "${THEME_BINARY_DIR}/default.edj" DESTINATION ${DATA_INSTALL_DIR}/themes)
 
 if (ENABLE_API_TESTS)
-    GENERATE_THEME(BigButtonTheme "big_button_theme.edj" "-DBIG_BUTTON_THEME_FOR_TESTING -DCURSOR_IMAGE_DIR=${Resources_DIR}")
+    GENERATE_THEME(BigButtonTheme "big_button_theme.edj" "-DBIG_BUTTON_THEME_FOR_TESTING")
 endif ()
index f92cdbbcd6cfd2cd3c4cb09f6d3bf08b6ace7aef..2651278288e2706448358e60370037517ce99667 100644 (file)
@@ -45,7 +45,6 @@ collections {
 #include "widget/button/button.edc"
 #include "widget/check/check.edc"
 #include "widget/combo/combo.edc"
-#include "widget/cursor/cursor.edc"
 #include "widget/entry/entry.edc"
 #include "widget/progressbar/progressbar.edc"
 #include "widget/radio/radio.edc"
diff --git a/Source/WebCore/platform/efl/DefaultTheme/widget/cursor/cursor.edc b/Source/WebCore/platform/efl/DefaultTheme/widget/cursor/cursor.edc
deleted file mode 100644 (file)
index 09ee32d..0000000
+++ /dev/null
@@ -1,551 +0,0 @@
-/*
- * Copyright (C) 2013 Samsung Electronics. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifdef CURSOR_IMAGE_DIR
-   group {
-      name: "cursor/hand";
-
-      images {
-         image: CURSOR_IMAGE_DIR"/linkCursor.png" COMP;
-      }
-      parts {
-         part {
-            name: "hand";
-            type: IMAGE;
-            description {
-               min: 20 20;
-               max: 20 20;
-               image {
-                  normal: CURSOR_IMAGE_DIR"/linkCursor.png";
-               }
-            }
-         }
-     }
-   }
-
-   group {
-      name: "cursor/wait";
-
-      images {
-         image: CURSOR_IMAGE_DIR"/waitCursor.png" COMP;
-      }
-      parts {
-         part {
-            name: "wait";
-            type: IMAGE;
-            description {
-               min: 16 16;
-               max: 16 16;
-               image {
-                  normal: CURSOR_IMAGE_DIR"/waitCursor.png";
-               }
-            }
-         }
-     }
-   }
-
-   group {
-      name: "cursor/help";
-
-      images {
-         image: CURSOR_IMAGE_DIR"/helpCursor.png" COMP;
-      }
-      parts {
-         part {
-            name: "help";
-            type: IMAGE;
-            description {
-               min: 18 18;
-               max: 18 18;
-               image {
-                  normal: CURSOR_IMAGE_DIR"/helpCursor.png";
-               }
-            }
-         }
-     }
-   }
-
-   group {
-      name: "cursor/east_resize";
-
-      images {
-         image: CURSOR_IMAGE_DIR"/eastResizeCursor.png" COMP;
-      }
-      parts {
-         part {
-            name: "eastResize";
-            type: IMAGE;
-            description {
-               min: 16 16;
-               max: 16 16;
-               image {
-                  normal: CURSOR_IMAGE_DIR"/eastResizeCursor.png";
-               }
-            }
-         }
-     }
-   }
-
-   group {
-      name: "cursor/north_resize";
-
-      images {
-         image: CURSOR_IMAGE_DIR"/northResizeCursor.png" COMP;
-      }
-      parts {
-         part {
-            name: "northResize";
-            type: IMAGE;
-            description {
-               min: 16 16;
-               max: 16 16;
-               image {
-                  normal: CURSOR_IMAGE_DIR"/northResizeCursor.png";
-               }
-            }
-         }
-     }
-   }
-
-   group {
-      name: "cursor/north_east_resize";
-
-      images {
-         image: CURSOR_IMAGE_DIR"/northEastResizeCursor.png" COMP;
-      }
-      parts {
-         part {
-            name: "northEastResize";
-            type: IMAGE;
-            description {
-               min: 16 16;
-               max: 16 16;
-               image {
-                  normal: CURSOR_IMAGE_DIR"/northEastResizeCursor.png";
-               }
-            }
-         }
-     }
-   }
-
-   group {
-      name: "cursor/north_west_resize";
-
-      images {
-         image: CURSOR_IMAGE_DIR"/northWestResizeCursor.png" COMP;
-      }
-      parts {
-         part {
-            name: "northWestResize";
-            type: IMAGE;
-            description {
-               min: 16 16;
-               max: 16 16;
-               image {
-                  normal: CURSOR_IMAGE_DIR"/northWestResizeCursor.png";
-               }
-            }
-         }
-     }
-   }
-
-   group {
-      name: "cursor/south_resize";
-
-      images {
-         image: CURSOR_IMAGE_DIR"/southResizeCursor.png" COMP;
-      }
-      parts {
-         part {
-            name: "southResize";
-            type: IMAGE;
-            description {
-               min: 16 16;
-               max: 16 16;
-               image {
-                  normal: CURSOR_IMAGE_DIR"/southResizeCursor.png";
-               }
-            }
-         }
-     }
-   }
-
-   group {
-      name: "cursor/south_east_resize";
-
-      images {
-         image: CURSOR_IMAGE_DIR"/southEastResizeCursor.png" COMP;
-      }
-      parts {
-         part {
-            name: "southEastResize";
-            type: IMAGE;
-            description {
-               min: 16 16;
-               max: 16 16;
-               image {
-                  normal: CURSOR_IMAGE_DIR"/southEastResizeCursor.png";
-               }
-            }
-         }
-     }
-   }
-
-   group {
-      name: "cursor/south_west_resize";
-
-      images {
-         image: CURSOR_IMAGE_DIR"/southWestResizeCursor.png" COMP;
-      }
-      parts {
-         part {
-            name: "southWestResize";
-            type: IMAGE;
-            description {
-               min: 16 16;
-               max: 16 16;
-               image {
-                  normal: CURSOR_IMAGE_DIR"/southWestResizeCursor.png";
-               }
-            }
-         }
-     }
-   }
-
-   group {
-      name: "cursor/west_resize";
-
-      images {
-         image: CURSOR_IMAGE_DIR"/westResizeCursor.png" COMP;
-      }
-      parts {
-         part {
-            name: "westResize";
-            type: IMAGE;
-            description {
-               min: 16 16;
-               max: 16 16;
-               image {
-                  normal: CURSOR_IMAGE_DIR"/westResizeCursor.png";
-               }
-            }
-         }
-     }
-   }
-
-   group {
-      name: "cursor/north_south_resize";
-
-      images {
-         image: CURSOR_IMAGE_DIR"/northSouthResizeCursor.png" COMP;
-      }
-      parts {
-         part {
-            name: "northSouthResize";
-            type: IMAGE;
-            description {
-               min: 16 16;
-               max: 16 16;
-               image {
-                  normal: CURSOR_IMAGE_DIR"/northSouthResizeCursor.png";
-               }
-            }
-         }
-     }
-   }
-
-   group {
-      name: "cursor/east_west_resize";
-
-      images {
-         image: CURSOR_IMAGE_DIR"/eastWestResizeCursor.png" COMP;
-      }
-      parts {
-         part {
-            name: "eastWestResize";
-            type: IMAGE;
-            description {
-               min: 16 16;
-               max: 16 16;
-               image {
-                  normal: CURSOR_IMAGE_DIR"/eastWestResizeCursor.png";
-               }
-            }
-         }
-     }
-   }
-
-   group {
-      name: "cursor/north_east_south_west_resize";
-
-      images {
-         image: CURSOR_IMAGE_DIR"/northEastSouthWestResizeCursor.png" COMP;
-      }
-      parts {
-         part {
-            name: "northEastSouthWestResize";
-            type: IMAGE;
-            description {
-               min: 16 16;
-               max: 16 16;
-               image {
-                  normal: CURSOR_IMAGE_DIR"/northEastSouthWestResizeCursor.png";
-               }
-            }
-         }
-     }
-   }
-
-   group {
-      name: "cursor/north_west_south_east_resize";
-
-      images {
-         image: CURSOR_IMAGE_DIR"/northWestSouthEastResizeCursor.png" COMP;
-      }
-      parts {
-         part {
-            name: "northWestSouthEastResize";
-            type: IMAGE;
-            description {
-               min: 16 16;
-               max: 16 16;
-               image {
-                  normal: CURSOR_IMAGE_DIR"/northWestSouthEastResizeCursor.png";
-               }
-            }
-         }
-     }
-   }
-
-   group {
-      name: "cursor/middle_panning";
-
-      images {
-         image: CURSOR_IMAGE_DIR"/panIcon.png" COMP;
-      }
-      parts {
-         part {
-            name: "panIcon";
-            type: IMAGE;
-            description {
-               min: 16 16;
-               max: 16 16;
-               image {
-                  normal: CURSOR_IMAGE_DIR"/panIcon.png";
-               }
-            }
-         }
-     }
-   }
-
-   group {
-      name: "cursor/move";
-
-      images {
-         image: CURSOR_IMAGE_DIR"/moveCursor.png" COMP;
-      }
-      parts {
-         part {
-            name: "move";
-            type: IMAGE;
-            description {
-               min: 16 16;
-               max: 16 16;
-               image {
-                  normal: CURSOR_IMAGE_DIR"/moveCursor.png";
-               }
-            }
-         }
-     }
-   }
-
-   group {
-      name: "cursor/vertical_text";
-
-      images {
-         image: CURSOR_IMAGE_DIR"/verticalTextCursor.png" COMP;
-      }
-      parts {
-         part {
-            name: "verticalText";
-            type: IMAGE;
-            description {
-               min: 16 16;
-               max: 16 16;
-               image {
-                  normal: CURSOR_IMAGE_DIR"/verticalTextCursor.png";
-               }
-            }
-         }
-     }
-   }
-
-   group {
-      name: "cursor/cell";
-
-      images {
-         image: CURSOR_IMAGE_DIR"/cellCursor.png" COMP;
-      }
-      parts {
-         part {
-            name: "cell";
-            type: IMAGE;
-            description {
-               min: 18 18;
-               max: 18 18;
-               image {
-                  normal: CURSOR_IMAGE_DIR"/cellCursor.png";
-               }
-            }
-         }
-     }
-   }
-
-   group {
-      name: "cursor/context_menu";
-
-      images {
-         image: CURSOR_IMAGE_DIR"/contextMenuCursor.png" COMP;
-      }
-      parts {
-         part {
-            name: "contextMenu";
-            type: IMAGE;
-            description {
-               min: 19 27;
-               max: 19 27;
-               image {
-                  normal: CURSOR_IMAGE_DIR"/contextMenuCursor.png";
-               }
-            }
-         }
-     }
-   }
-
-   group {
-      name: "cursor/alias";
-
-      images {
-         image: CURSOR_IMAGE_DIR"/aliasCursor.png" COMP;
-      }
-      parts {
-         part {
-            name: "alias";
-            type: IMAGE;
-            description {
-               min: 16 21;
-               max: 16 21;
-               image {
-                  normal: CURSOR_IMAGE_DIR"/aliasCursor.png";
-               }
-            }
-         }
-     }
-   }
-
-   group {
-      name: "cursor/progress";
-
-      images {
-         image: CURSOR_IMAGE_DIR"/progressCursor.png" COMP;
-      }
-      parts {
-         part {
-            name: "progress";
-            type: IMAGE;
-            description {
-               min: 25 37;
-               max: 25 37;
-               image {
-                  normal: CURSOR_IMAGE_DIR"/progressCursor.png";
-               }
-            }
-         }
-     }
-   }
-
-   group {
-      name: "cursor/no_drop";
-
-      images {
-         image: CURSOR_IMAGE_DIR"/noDropCursor.png" COMP;
-      }
-      parts {
-         part {
-            name: "noDrop";
-            type: IMAGE;
-            description {
-               min: 25 36;
-               max: 25 36;
-               image {
-                  normal: CURSOR_IMAGE_DIR"/noDropCursor.png";
-               }
-            }
-         }
-     }
-   }
-
-   group {
-      name: "cursor/copy";
-
-      images {
-         image: CURSOR_IMAGE_DIR"/copyCursor.png" COMP;
-      }
-      parts {
-         part {
-            name: "copy";
-            type: IMAGE;
-            description {
-               min: 25 37;
-               max: 25 37;
-               image {
-                  normal: CURSOR_IMAGE_DIR"/copyCursor.png";
-               }
-            }
-         }
-     }
-   }
-
-   group {
-      name: "cursor/none";
-
-      images {
-         image: CURSOR_IMAGE_DIR"/noneCursor.png" COMP;
-      }
-      parts {
-         part {
-            name: "none";
-            type: IMAGE;
-            description {
-               min: 16 16;
-               max: 16 16;
-               image {
-                  normal: CURSOR_IMAGE_DIR"/noneCursor.png";
-               }
-            }
-         }
-     }
-   }
-#endif
index cee14b747b2a5c959bb795f7ce4e5634adc77c2a..f61bb86f1aff49535b9e07aab71601393271f0c9 100644 (file)
 #include "config.h"
 #include "EflScreenUtilities.h"
 
+#include "Image.h"
+#include "IntPoint.h"
+#include "IntSize.h"
+#include "RefPtrCairo.h"
+#include <cairo.h>
+
 #ifdef HAVE_ECORE_X
 #include <Ecore_Evas.h>
 #include <Ecore_X.h>
@@ -101,14 +107,10 @@ int getEcoreCursor(const String& cursorString)
 
     return cursorStringMap.cursor(cursorString);
 }
-#endif
 
-void applyFallbackCursor(Ecore_Evas* ecoreEvas, const char* cursorString)
+void applyCursorFromEcoreX(Ecore_X_Window window, const char* cursorString)
 {
-#ifdef HAVE_ECORE_X
-    Ecore_X_Window window = getEcoreXWindow(ecoreEvas);
-    if (!window)
-        return;
+    ASSERT(!window);
 
     int shape = getEcoreCursor(cursorString);
     if (shape < ECORE_X_CURSOR_X || shape > ECORE_X_CURSOR_XTERM) {
@@ -119,7 +121,17 @@ void applyFallbackCursor(Ecore_Evas* ecoreEvas, const char* cursorString)
 
     Ecore_X_Cursor cursor = ecore_x_cursor_shape_get(shape);
     ecore_x_window_cursor_set(window, cursor);
-#endif
+}
+
+Ecore_X_Cursor createCustomCursor(Ecore_X_Window window, Image* image, const IntSize& cursorSize, const IntPoint& hotSpot)
+{
+    RefPtr<cairo_surface_t> surface = image->nativeImageForCurrentFrame();
+    if (!surface)
+        return 0;
+
+    unsigned char* buffer = cairo_image_surface_get_data(surface.get());
+
+    return ecore_x_cursor_new(window, (int*)(buffer), cursorSize.width(), cursorSize.height(), hotSpot.x(), hotSpot.y());
 }
 
 Ecore_X_Window getEcoreXWindow(Ecore_Evas* ecoreEvas)
@@ -134,5 +146,6 @@ Ecore_X_Window getEcoreXWindow(Ecore_Evas* ecoreEvas)
 
     return 0;
 }
+#endif
 
 } // namespace WebCore
index cf52c5b69bd547f656b816a0e75055ebcc3f8a59..3c49a16d1694114a49e335ac5338c40c9f0c8143 100644 (file)
 #ifndef EflScreenUtilities_h
 #define EflScreenUtilities_h
 
-#include <wtf/text/WTFString.h>
+#ifdef HAVE_ECORE_X
+#include <Ecore_X.h>
+#endif
 
 namespace WebCore {
 
-void applyFallbackCursor(Ecore_Evas*, const char*);
+#ifdef HAVE_ECORE_X
+class Image;
+class IntSize;
+class IntPoint;
+
+void applyCursorFromEcoreX(Ecore_X_Window, const char*);
+Ecore_X_Cursor createCustomCursor(Ecore_X_Window, Image*, const IntSize& cursorSize, const IntPoint& hotSpot);
 
 Ecore_X_Window getEcoreXWindow(Ecore_Evas*);
+#endif
 
 } // namespace WebCore
 
index 861a668eb654334580cb01a98af84193b3538b68..8c379ed4d8fcdd1335fae2e542fb4fa1af769469 100644 (file)
@@ -1,3 +1,20 @@
+2014-09-06  Ryuan Choi  <ryuan.choi@gmail.com>
+
+        [EFL] Drop evas object cursor support
+        https://bugs.webkit.org/show_bug.cgi?id=136324
+
+        Reviewed by Gyuyoung Kim.
+
+        Removed evas object cursor because there are some bugs.
+        ewebkit will only support ecore_x_cursor because ewebkit is available with X, now.
+
+        * UIProcess/API/efl/EwkView.cpp:
+        (EwkViewEventHandler<EVAS_CALLBACK_MOUSE_IN>::handleEvent):
+        (EwkView::EwkView):
+        (EwkView::updateCursor): Simplifies not to use evas object cursor.
+        (EwkView::setCursor): Ditto.
+        * UIProcess/API/efl/EwkView.h:
+
 2014-09-05  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r173340 and r173342.
index b81ed1e1fe398d375057f3c1cb7c44580a4c8b4a..106f72ae65b383f085f86cf87e84d8fa906e72a1 100755 (executable)
@@ -64,7 +64,6 @@
 #include "ewk_settings_private.h"
 #include "ewk_window_features_private.h"
 #include <Ecore_Evas.h>
-#include <Ecore_X.h>
 #include <Edje.h>
 #include <Evas_GL.h>
 #include <WebCore/CairoUtilitiesEfl.h>
@@ -217,11 +216,17 @@ void EwkViewEventHandler<EVAS_CALLBACK_MOUSE_WHEEL>::handleEvent(void* data, Eva
 }
 
 template <>
-void EwkViewEventHandler<EVAS_CALLBACK_MOUSE_IN>::handleEvent(void*, Evas*, Evas_Object*, void*)
+void EwkViewEventHandler<EVAS_CALLBACK_MOUSE_IN>::handleEvent(void* data, Evas* evas, Evas_Object*, void*)
 {
-    // FIXME: self->updateCursor(); was removed in order to fix crash caused by invalid cursor image.
-    // new cursor implementation should be added for curso image restoration previously used for.
-    notImplemented();
+#ifdef HAVE_ECORE_X
+    Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
+    EwkView* self = toEwkView(smartData);
+
+    Ecore_Evas* ecoreEvas = ecore_evas_ecore_evas_get(evas);
+    Ecore_X_Window window = getEcoreXWindow(ecoreEvas);
+
+    self->updateCursor(window);
+#endif
 }
 
 template <>
@@ -280,7 +285,9 @@ EwkView::EwkView(WKViewRef view, Evas_Object* evasObject)
     , m_vibrationClient(std::make_unique<VibrationClientEfl>(this))
 #endif
     , m_backForwardList(std::make_unique<EwkBackForwardList>(WKPageGetBackForwardList(wkPage())))
-    , m_useCustomCursor(false)
+#ifdef HAVE_ECORE_X
+    , m_customCursor(ECORE_X_CURSOR_X)
+#endif
     , m_userAgent(WKEinaSharedString(AdoptWK, WKPageCopyUserAgent(wkPage())))
     , m_applicationNameForUserAgent(WKEinaSharedString(AdoptWK, WKPageCopyApplicationNameForUserAgent(wkPage())))
     , m_mouseEventsEnabled(false)
@@ -404,36 +411,11 @@ WKPageRef EwkView::wkPage() const
     return WKViewGetPage(wkView());
 }
 
-void EwkView::updateCursor()
-{
-    Ewk_View_Smart_Data* sd = smartData();
-    Ecore_Evas* ecoreEvas = ecore_evas_ecore_evas_get(sd->base.evas);
-    // FIXME : ecore_evas_object_cursor_set doesn't guarantee deletion of cursor image previously set.
-    // Therefore, this patch deletes old cursor image before setting new image explicitly.
-    ecore_evas_object_cursor_set(ecoreEvas, 0, 0, 0, 0);
-
-    if (m_useCustomCursor) {
-        Image* cursorImage = static_cast<Image*>(m_cursorIdentifier.image);
-        if (!cursorImage)
-            return;
-
-        EflUniquePtr<Evas_Object> cursorObject = EflUniquePtr<Evas_Object>(cursorImage->getEvasObject(sd->base.evas));
-        if (!cursorObject)
-            return;
-
-        IntSize cursorSize = IntSize(cursorImage->size());
-        // Resize cursor.
-        evas_object_resize(cursorObject.get(), cursorSize.width(), cursorSize.height());
-
-        // Get cursor hot spot.
-        IntPoint hotSpot;
-        cursorImage->getHotSpot(hotSpot);
-
 #ifdef HAVE_ECORE_X
-        ecore_x_window_cursor_set(getEcoreXWindow(ecoreEvas), 0);
-#endif
-        // ecore_evas takes care of freeing the cursor object.
-        ecore_evas_object_cursor_set(ecoreEvas, cursorObject.release(), EVAS_LAYER_MAX, hotSpot.x(), hotSpot.y());
+void EwkView::updateCursor(Ecore_X_Window window)
+{
+    if (m_customCursor) {
+        ecore_x_window_cursor_set(window, m_customCursor);
         return;
     }
 
@@ -441,66 +423,50 @@ void EwkView::updateCursor()
     if (!group)
         return;
 
-    EflUniquePtr<Evas_Object> cursorObject = EflUniquePtr<Evas_Object>(edje_object_add(sd->base.evas));
-
-    if (!m_theme || !edje_object_file_set(cursorObject.get(), m_theme, group)) {
-#ifdef HAVE_ECORE_X
-        WebCore::applyFallbackCursor(ecoreEvas, group);
+    applyCursorFromEcoreX(window, group);
+}
 #endif
-        return;
-    }
 
-    // Set cursor size.
-    Evas_Coord width, height;
-    edje_object_size_min_get(cursorObject.get(), &width, &height);
-    if (width <= 0 || height <= 0)
-        edje_object_size_min_calc(cursorObject.get(), &width, &height);
-    if (width <= 0 || height <= 0) {
-        width = defaultCursorSize;
-        height = defaultCursorSize;
-    }
-    evas_object_resize(cursorObject.get(), width, height);
+void EwkView::setCursor(const Cursor& cursor)
+{
+#ifdef HAVE_ECORE_X
+    Ecore_Evas* ecoreEvas = ecore_evas_ecore_evas_get(smartData()->base.evas);
+    Ecore_X_Window window = getEcoreXWindow(ecoreEvas);
 
-    // Get cursor hot spot.
-    const char* data;
-    int hotspotX = 0;
-    data = edje_object_data_get(cursorObject.get(), "hot.x");
-    if (data)
-        hotspotX = atoi(data);
+    if (Image* cursorImage = cursor.image()) {
+        // Custom cursor.
+        if (cursorImage == m_cursorIdentifier.image)
+            return;
 
-    int hotspotY = 0;
-    data = edje_object_data_get(cursorObject.get(), "hot.y");
-    if (data)
-        hotspotY = atoi(data);
+        IntPoint hotSpot;
+        cursorImage->getHotSpot(hotSpot);
 
-#ifdef HAVE_ECORE_X
-    ecore_x_window_cursor_set(getEcoreXWindow(ecoreEvas), 0);
-#endif
+        Ecore_X_Cursor customCursor = createCustomCursor(window, cursorImage, IntSize(cursorImage->size()), hotSpot);
+        if (!customCursor)
+            return;
 
-    // ecore_evas takes care of freeing the cursor object.
-    ecore_evas_object_cursor_set(ecoreEvas, cursorObject.release(), EVAS_LAYER_MAX, hotspotX, hotspotY);
-}
+        if (m_customCursor)
+            ecore_x_cursor_free(m_customCursor);
 
-void EwkView::setCursor(const Cursor& cursor)
-{
-    if (cursor.image()) {
-        // Custom cursor.
-        if (cursor.image() == m_cursorIdentifier.image)
-            return;
+        m_cursorIdentifier.image = cursorImage;
+        m_customCursor = customCursor;
 
-        m_cursorIdentifier.image = cursor.image();
-        m_useCustomCursor = true;
     } else {
+        if (m_customCursor) {
+            ecore_x_cursor_free(m_customCursor);
+            m_customCursor = ECORE_X_CURSOR_X;
+        }
+
         // Standard cursor.
         const char* group = cursor.platformCursor();
         if (!group || group == m_cursorIdentifier.group)
             return;
 
         m_cursorIdentifier.group = group;
-        m_useCustomCursor = false;
     }
 
-    updateCursor();
+    updateCursor(window);
+#endif
 }
 
 void EwkView::setDeviceScaleFactor(float scale)
index a07b35341c0bfb6097b2aefec05876416921c8f7..b1b32fc875afa67974ffb72388480eb35fecc4a8 100644 (file)
 #include "ewk_touch.h"
 #endif
 
+#ifdef HAVE_ECORE_X
+#include <Ecore_X.h>
+#endif
+
 typedef struct _cairo_surface cairo_surface_t;
 
 namespace WebKit {
@@ -129,7 +133,9 @@ public:
     void doneWithTouchEvent(WKTouchEventRef, bool);
 #endif
 
-    void updateCursor();
+#ifdef HAVE_ECORE_X
+    void updateCursor(Ecore_X_Window);
+#endif
     void setCursor(const WebCore::Cursor& cursor);
 
     void scheduleUpdateDisplay();
@@ -261,6 +267,11 @@ private:
 #endif
     std::unique_ptr<EwkBackForwardList> m_backForwardList;
     RefPtr<EwkWindowFeatures> m_windowFeatures;
+
+#ifdef HAVE_ECORE_X
+    Ecore_X_Cursor m_customCursor;
+#endif
+
     union CursorIdentifier {
         CursorIdentifier()
             : image(nullptr)
@@ -269,7 +280,6 @@ private:
         WebCore::Image* image;
         const char* group;
     } m_cursorIdentifier;
-    bool m_useCustomCursor;
 
     WKEinaSharedString m_url;
     mutable WKEinaSharedString m_title;