modify systemutil file
authorminkyu kim <imetjade.kim@samsung.com>
Mon, 15 Apr 2013 10:55:26 +0000 (19:55 +0900)
committerminkyu kim <imetjade.kim@samsung.com>
Mon, 15 Apr 2013 10:55:26 +0000 (19:55 +0900)
Change-Id: I1e6c6518dfa9dd5b292fd8059c32e3df2ee51836

src/ui/FUi_SystemUtilImpl.cpp

index e02ac3c..0d8eb8a 100644 (file)
@@ -173,15 +173,15 @@ _SystemUtilImpl::~_SystemUtilImpl(void)
 }
 
 result
-_SystemUtilImpl::GenerateKeyEvent(Tizen::Ui::KeyEventType KeyEvent, Tizen::Ui::_KeyCode keyCode)
+_SystemUtilImpl::GenerateKeyEvent(Tizen::Ui::KeyEventType keyEvent, Tizen::Ui::_KeyCode keyCode)
 {
        result r = E_SUCCESS;
 
        Display* pDisplay = (Display*)ecore_x_display_get();
-       SysTryReturnResult(NID_UI, pDisplay != null, E_SYSTEM, "[E_SYSTEM] pDisplay is invalid. something wrong!");
+       SysTryReturnResult(NID_UI, pDisplay != null, E_OPERATION_FAILED, "[E_OPERATION_FAILED] pDisplay is invalid. something wrong!");
 
        std::unique_ptr<Display, _DisplayDeleter> pDpy(XOpenDisplay(NULL));
-       SysTryReturnResult(NID_UI, pDpy.get() != null, E_SYSTEM, "[E_SYSTEM] pDpy is invalid. something wrong!");
+       SysTryReturnResult(NID_UI, pDpy.get() != null, E_OPERATION_FAILED, "[E_OPERATION_FAILED] pDpy is invalid. something wrong!");
 
        int key = -1;
 
@@ -201,7 +201,7 @@ _SystemUtilImpl::GenerateKeyEvent(Tizen::Ui::KeyEventType KeyEvent, Tizen::Ui::_
                return E_INVALID_ARG;
        }
 
-       switch (KeyEvent)
+       switch (keyEvent)
        {
        case KEY_EVENT_TYPE_PRESSED:
                XTestFakeKeyEvent(pDisplay, key, true, CurrentTime);
@@ -232,10 +232,10 @@ _SystemUtilImpl::GenerateTouchEvent(TouchEventType touchEvent, const Tizen::Grap
        result r = E_SUCCESS;
 
        Display* pDisplay = (Display*)ecore_x_display_get();
-       SysTryReturnResult(NID_UI, pDisplay != null, E_SYSTEM, "[E_SYSTEM] pDisplay is invalid. something wrong!");
+       SysTryReturnResult(NID_UI, pDisplay != null, E_OPERATION_FAILED, "[E_OPERATION_FAILED] pDisplay is invalid. something wrong!");
 
        std::unique_ptr<Display, _DisplayDeleter> pDpy(XOpenDisplay(NULL));
-       SysTryReturnResult(NID_UI, pDpy.get() != null, E_SYSTEM, "[E_SYSTEM] pDpy is invalid. something wrong!");
+       SysTryReturnResult(NID_UI, pDpy.get() != null, E_OPERATION_FAILED, "[E_OPERATION_FAILED] pDpy is invalid. something wrong!");
 
        int width = DisplayWidth(pDpy.get(), DefaultScreen(pDpy.get()));
        int height = DisplayHeight(pDpy.get(), DefaultScreen(pDpy.get()));
@@ -280,23 +280,27 @@ _SystemUtilImpl::CaptureScreenN(void)
        result r = E_SUCCESS;
 
        std::unique_ptr<Display, _DisplayDeleter> pDpy(XOpenDisplay(NULL));
-       SysTryReturn(NID_UI, pDpy, null, E_SYSTEM, "[E_SYSTEM] pDpy is invalid. something wrong!");
+       SysTryReturn(NID_UI, pDpy.get(), null, E_OPERATION_FAILED, "[E_OPERATION_FAILED] pDpy is invalid. something wrong!");
 
        int width = DisplayWidth(pDpy.get(), DefaultScreen(pDpy.get()));
        int height = DisplayHeight(pDpy.get(), DefaultScreen(pDpy.get()));
 
        void* pDump = utilx_create_screen_shot(pDpy.get(), width, height);
-       SysTryReturn(NID_UI, pDump, null, E_SYSTEM, "[E_SYSTEM] pDump is invalid. something wrong!");
+       if (pDump == null)
+       {
+               SysLog(NID_UI, "pDump is invalid. Check if screen is off");
+               return null;
+       }
 
        std::unique_ptr<ByteBuffer> pBuffer(new (std::nothrow) ByteBuffer());
-       SysTryReturn(NID_UI, pBuffer != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failure.");
+       SysTryReturn(NID_UI, pBuffer != null, null, E_OPERATION_FAILED, "[E_OPERATION_FAILED] Memory allocation failure.");
 
        r = pBuffer->Construct(static_cast<byte*>(pDump), 0, width*height*4, width*height*4);
        SysTryReturn(NID_UI, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
 
        Tizen::Graphics::Dimension dim(width, height);
        std::unique_ptr<Tizen::Graphics::Bitmap> pBitmap(new (std::nothrow) Bitmap());
-       SysTryReturn(NID_UI, pBitmap != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failure.");
+       SysTryReturn(NID_UI, pBitmap != null, null, E_OPERATION_FAILED, "[E_OPERATION_FAILED] Memory allocation failure.");
 
        r = pBitmap->Construct(*pBuffer, dim, BITMAP_PIXEL_FORMAT_ARGB8888);
        SysTryReturn(NID_UI, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
@@ -322,7 +326,7 @@ _SystemUtilImpl::SendKeyStopMessage(void)
                Ecore_X_Window xWindow = *_keygrab_win;
 
                r = ecore_x_client_message8_send(xWindow, type, msg_data, sizeof(msg_data));
-               SysTryReturn(NID_UI, r == true, E_SYSTEM, E_SYSTEM, "ecore_x_client_message8_send failed.");
+               SysTryReturn(NID_UI, r == true, E_OPERATION_FAILED, E_OPERATION_FAILED, "ecore_x_client_message8_send failed.");
        }
 
        return E_SUCCESS;