From: Sangjin Kim Date: Mon, 24 Jun 2013 09:54:43 +0000 (+0900) Subject: Update sdk version to tizen_2.2 X-Git-Tag: 2.2.1_release~20 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a207b6f5f5453bd6827ed37eab061a5cf3e53230;p=sdk%2Femulator%2Fqemu.git Update sdk version to tizen_2.2 Change-Id: I1809eee8d9850266ff6811ed982db676235214c8 Signed-off-by: Sangjin Kim --- diff --git a/Makefile.target b/Makefile.target index 437199188c..7a9b9939ed 100755 --- a/Makefile.target +++ b/Makefile.target @@ -327,7 +327,9 @@ CHECK_GL_LDFLAGS = CHECK_GL_TARGET = ifdef CONFIG_LINUX CHECK_GL_OBJS += gloffscreen_xcomposite.o -CHECK_GL_LDFLAGS += -lGL -lXcomposite -lXext -lglib-2.0 +#CHECK_GL_LDFLAGS += -lGL -lXcomposite -lXext -lglib-2.0 +# Fix linking error on Ubuntu 13.04 +CHECK_GL_LDFLAGS += -lGL -lXcomposite -lX11 -lXext -lglib-2.0 CHECK_GL_TARGET = check-gl endif ifdef CONFIG_WIN32 diff --git a/configure b/configure index d04beb4c7f..1015d9dac6 100755 --- a/configure +++ b/configure @@ -543,6 +543,8 @@ Haiku) if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then audio_possible_drivers="$audio_possible_drivers fmod" fi +# fix linking error on Ubuntu 13.04 + libs_qga="-lrt $libs_qga" ;; esac @@ -2216,6 +2218,22 @@ else exit 1 fi +########################################## +# pixman support probe + +if test "$shm" = no; then + if $pkg_config pixman-1 > /dev/null 2>&1; then + pixman_cflags=`$pkg_config --cflags pixman-1 2>/dev/null` + pixman_libs=`$pkg_config --libs pixman-1 2>/dev/null` + QEMU_CFLAGS="$pixman_cflags $QEMU_CFLAGS" + LIBS="$pixman_libs $LIBS" + else + echo "Error: pixman-1 check failed" + echo "Make sure to have the pixman-1 libs and headers installed" + exit 1 + fi +fi + ########################################## # libcap probe @@ -2748,7 +2766,10 @@ fi cat > $TMPC < #include +/* Fix linking error on Ubuntu 13.04 int main(void) { return clock_gettime(CLOCK_REALTIME, NULL); } +*/ +int main(void) { return timer_gettime(CLOCK_REALTIME, NULL); } EOF if compile_prog "" "" ; then diff --git a/hw/pci-hotplug.c b/hw/pci-hotplug.c index 73badc15ad..33d1baceee 100644 --- a/hw/pci-hotplug.c +++ b/hw/pci-hotplug.c @@ -246,7 +246,11 @@ static PCIDevice *qemu_pci_hot_add_keyboard(Monitor *mon, } #endif /* CONFIG_MARU */ +#ifdef CONFIG_MARU +PCIDevice *pci_device_hot_add(Monitor *mon, const QDict *qdict) +#else void pci_device_hot_add(Monitor *mon, const QDict *qdict) +#endif { PCIDevice *dev = NULL; const char *pci_addr = qdict_get_str(qdict, "pci_addr"); @@ -284,6 +288,9 @@ void pci_device_hot_add(Monitor *mon, const QDict *qdict) PCI_FUNC(dev->devfn)); } else monitor_printf(mon, "failed to add %s\n", opts); +#ifdef CONFIG_MARU + return dev; +#endif } #endif diff --git a/package/changelog b/package/changelog index fb518c60f8..f996f8d642 100644 --- a/package/changelog +++ b/package/changelog @@ -1,3 +1,7 @@ +* 2.2.0 +- tizen_2.2 source update +== Sangjin Kim 2013-06-24 + * 1.5.38 - modified process of using virtio keyboard queue and added key release event when context menu is activated == Sungmin Ha 2013-05-14 diff --git a/package/pkginfo.manifest b/package/pkginfo.manifest index 1c22f7c028..b14c1a4687 100644 --- a/package/pkginfo.manifest +++ b/package/pkginfo.manifest @@ -1,4 +1,4 @@ -Version: 1.5.38 +Version: 2.2.0 Maintainer: Yeong-Kyoon Lee Source: emulator @@ -43,7 +43,7 @@ Description: Tizen x86 Emulator Package: emulator-qemu-x86 OS: windows-32, windows-64 Build-host-os: windows-32 -Build-dependency: SDL-1.2.14 [ windows-32 ], apache-ant-1.8.3-bin [ windows-32 ], gtk-bundle_2.16.6 [ windows-32 ], directx-dev [ windows-32 ], libcurl-4 [ windows-32 ], emulator-lib [ windows-32 ] +Build-dependency: SDL-1.2.14 [ windows-32 ], apache-ant-1.8.3-bin [ windows-32 ], gtk-bundle_2.16.6 [ windows-32 ], directx-dev [ windows-32 ], libcurl-4 [ windows-32 ], pixman-0.30.0 [ windows-32 ], emulator-lib [ windows-32 ] Install-dependency: emulator-kernel-x86 [ windows-32 ], vgabios [ windows-32 ] Description: Tizen x86 Emulator diff --git a/qemu-sockets.c b/qemu-sockets.c index 361d890da3..34cbbde01a 100644 --- a/qemu-sockets.c +++ b/qemu-sockets.c @@ -242,6 +242,14 @@ int inet_connect_opts(QemuOpts *opts, bool *in_progress, Error **errp) if (qemu_opt_get_bool(opts, "ipv6", 0)) ai.ai_family = PF_INET6; +#ifdef CONFIG_MARU + // for lookup loopback interface... + if (addr[0] == '\0') { + ai.ai_flags = 0; + addr = NULL; + } +#endif + /* lookup */ if (0 != (rc = getaddrinfo(addr, port, &ai, &res))) { fprintf(stderr,"getaddrinfo(%s,%s): %s\n", addr, port, diff --git a/sysemu.h b/sysemu.h index 92107114f9..3a23fb97dc 100644 --- a/sysemu.h +++ b/sysemu.h @@ -161,7 +161,11 @@ extern const char *prom_envs[MAX_PROM_ENVS]; extern unsigned int nb_prom_envs; /* pci-hotplug */ +#ifdef CONFIG_MARU +PCIDevice *pci_device_hot_add(Monitor *mon, const QDict *qdict); +#else void pci_device_hot_add(Monitor *mon, const QDict *qdict); +#endif int pci_drive_hot_add(Monitor *mon, const QDict *qdict, DriveInfo *dinfo, int type); void do_pci_device_hot_remove(Monitor *mon, const QDict *qdict); diff --git a/tizen/src/Makefile.tizen b/tizen/src/Makefile.tizen index e374992410..0dd0b14b9d 100755 --- a/tizen/src/Makefile.tizen +++ b/tizen/src/Makefile.tizen @@ -104,7 +104,7 @@ endif # maru display obj-y += maru_display.o maru_shm.o ifndef CONFIG_DARWIN -obj-y += maru_sdl.o SDL_rotozoom.o maru_finger.o +obj-y += maru_sdl.o maru_finger.o endif # sdb diff --git a/tizen/src/guest_server.c b/tizen/src/guest_server.c index 5840ed4b04..1649d182ad 100644 --- a/tizen/src/guest_server.c +++ b/tizen/src/guest_server.c @@ -223,8 +223,8 @@ static void* run_guest_server(void* args) if (atoi(ret) == 0) { /* umount sdcard */ - mloop_evcmd_usbdisk(NULL); - + //mloop_evcmd_usbdisk(NULL); + mloop_evcmd_sdcard(NULL); } else if (atoi(ret) == 1) { /* mount sdcard */ char sdcard_path[256]; @@ -238,7 +238,9 @@ static void* run_guest_server(void* args) strcat(sdcard_path, ret); INFO("%s\n", sdcard_path); - mloop_evcmd_usbdisk(sdcard_path); + //mloop_evcmd_usbdisk(sdcard_path); + mloop_evcmd_sdcard(sdcard_path); + free(vms_path); } else { ERR("!!! unknown command : %s\n", ret); diff --git a/tizen/src/hw/gloffscreen.h b/tizen/src/hw/gloffscreen.h index 11547c71be..f317619baa 100644 --- a/tizen/src/hw/gloffscreen.h +++ b/tizen/src/hw/gloffscreen.h @@ -86,7 +86,7 @@ extern void glo_surface_update_context(GloSurface *surface, GloContext *context, /* Link the pixmap/pbuffer associated with surface as texture. * ctxt is the target context for the texture operation */ -extern void glo_surface_as_texture(GloContext *ctxt, GloSurface *surface); +extern void glo_surface_as_texture(GloContext *ctxt, GloSurface *surface, int surface_type); /* Create a surface with given width and height, */ extern GloSurface *glo_surface_create(int width, int height, GloContext *context); diff --git a/tizen/src/hw/gloffscreen_agl.c b/tizen/src/hw/gloffscreen_agl.c index 2070bade76..5ae68c58fd 100644 --- a/tizen/src/hw/gloffscreen_agl.c +++ b/tizen/src/hw/gloffscreen_agl.c @@ -57,7 +57,7 @@ struct _GloSurface extern void glo_surface_getcontents_readpixels(int formatFlags, int stride, int bpp, int width, int height, - void *data); + void *data, int noflip); @@ -316,7 +316,7 @@ void glo_surface_getcontents(GloSurface *surface, int stride, int bpp, { aglSwapBuffers(surface->context->context); aglSetInteger(surface->context->context, AGL_SWAP_INTERVAL, &swap_interval); - glo_surface_getcontents_readpixels(surface->context->formatFlags, stride, bpp, surface->width, surface->height, data); + glo_surface_getcontents_readpixels(surface->context->formatFlags, stride, bpp, surface->width, surface->height, data, 0); } } @@ -335,7 +335,7 @@ void glo_surface_get_size(GloSurface *surface, int *width, int *height) } /* Bind the surface as texture */ -void glo_surface_as_texture(GloContext *ctxt, GloSurface *surface) +void glo_surface_as_texture(GloContext *ctxt, GloSurface *surface, int surface_type) { #if 0 //Not QUit sure about this function; diff --git a/tizen/src/hw/gloffscreen_common.c b/tizen/src/hw/gloffscreen_common.c index bd1285421c..c8fd382c9b 100644 --- a/tizen/src/hw/gloffscreen_common.c +++ b/tizen/src/hw/gloffscreen_common.c @@ -102,7 +102,7 @@ void g_free(void *ptr); // --------------------------------------------------- extern void glo_surface_getcontents_readpixels(int formatFlags, int stride, - int bpp, int width, int height, void *data); + int bpp, int width, int height, void *data, int noflip); // --------------------------------------------------- @@ -370,7 +370,7 @@ void glo_geometry_get_from_glx(const int* attrib_list, int* width, int* height) } void glo_surface_getcontents_readpixels(int formatFlags, int stride, int bpp, - int width, int height, void *data) { + int width, int height, void *data, int noflip) { int glFormat, glType, rl, pa; static int once; @@ -418,12 +418,14 @@ void glo_surface_getcontents_readpixels(int formatFlags, int stride, int bpp, glReadPixels(0, 0, width, height, glFormat, glType, data); - for(irow = 0; irow < height/2; irow++) { - memcpy(tmp, b, stride); - memcpy(b, c, stride); - memcpy(c, tmp, stride); - b += stride; - c -= stride; + if (noflip == 0) { + for(irow = 0; irow < height/2; irow++) { + memcpy(tmp, b, stride); + memcpy(b, c, stride); + memcpy(c, tmp, stride); + b += stride; + c -= stride; + } } g_free(tmp); diff --git a/tizen/src/hw/gloffscreen_glx.c b/tizen/src/hw/gloffscreen_glx.c index f649a0ff3e..a2ec3b2cc0 100644 --- a/tizen/src/hw/gloffscreen_glx.c +++ b/tizen/src/hw/gloffscreen_glx.c @@ -71,7 +71,7 @@ struct _GloSurface { }; extern void glo_surface_getcontents_readpixels(int formatFlags, int stride, - int bpp, int width, int height, void *data); + int bpp, int width, int height, void *data, int noflip); static void glo_test_readback_methods(void); /* ------------------------------------------------------------------------ */ @@ -371,7 +371,7 @@ void glo_surface_getcontents(GloSurface *surface, int stride, int bpp, void *dat // Compatible / fallback method. glo_surface_getcontents_readpixels(surface->context->formatFlags, stride, bpp, surface->width, - surface->height, data); + surface->height, data, 0); } // while(0) { diff --git a/tizen/src/hw/gloffscreen_wgl.c b/tizen/src/hw/gloffscreen_wgl.c index 10ceb48dd5..610a911f7e 100644 --- a/tizen/src/hw/gloffscreen_wgl.c +++ b/tizen/src/hw/gloffscreen_wgl.c @@ -43,6 +43,12 @@ #include "gl_mangled.h" #endif +enum { + SURFACE_WINDOW, + SURFACE_PIXMAP, + SURFACE_PBUFFER +}; + /* In Windows, you must create a window *before* you can create a pbuffer or * get a context. So we create a hidden Window on startup (see glo_init/GloMain). * @@ -98,7 +104,7 @@ PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB; extern const char *glo_glXQueryExtensionsString(void); extern void glo_surface_getcontents_readpixels(int formatFlags, int stride, - int bpp, int width, int height, void *data); + int bpp, int width, int height, void *data, int noflip); /* ------------------------------------------------------------------------ */ @@ -946,7 +952,7 @@ void glo_surface_getcontents(GloSurface *surface, int stride, int bpp, void *dat // Compatible / fallback method. glo_surface_getcontents_readpixels(surface->context->formatFlags, stride, bpp, surface->width, - surface->height, data); + surface->height, data, 0); } /* Return the width and height of the given surface */ @@ -958,35 +964,37 @@ void glo_surface_get_size(GloSurface *surface, int *width, int *height) { } /* Bind the surface as texture */ -void glo_surface_as_texture(GloContext *ctxt, GloSurface *surface) +void glo_surface_as_texture(GloContext *ctxt, GloSurface *surface, int surface_type) { -#if 0 int glFormat, glType; - glo_surface_updatecontents(surface); - /*XXX: change the fixed target: GL_TEXTURE_2D*/ - glo_flags_get_readpixel_type(surface->context->formatFlags, &glFormat, &glType); - fprintf(stderr, "surface_as_texture:teximage:width=%d,height=%d,glFormat=0x%x,glType=0x%x.\n", surface->width, surface->height, glFormat, glType); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, surface->width, surface->height, 0, glFormat, glType, surface->image->data); -#else - if(!Render_texture_support) - { - //fprintf(stderr, "Render to texture not supported on this machine, just return!\n"); - return ; - } + int bpp = 4; + int stride = surface->width * bpp; + char *data; + HGLRC oldCtx; + HDC oldDC; - if (!wglBindTexImageARB) - { - fprintf (stderr, "wglBindTexImageEXT not supported! Can't emulate glEGLImageTargetTexture2DOES!\n"); + data = malloc(surface->width * surface->height * bpp); + if (!data) return; - } - if ( !wglBindTexImageARB(surface->hPBuffer, WGL_FRONT_LEFT_ARB) ) - { - fprintf(stderr, "wglBindTexImageARBr error=%d.\n", glGetError()); - } + /* Read pixels from Speficied context */ + oldCtx = wglGetCurrentContext(); + oldDC = wglGetCurrentDC(); + glo_surface_makecurrent(surface); + glo_surface_updatecontents(surface); + glo_flags_get_readpixel_type(surface->context->formatFlags, &glFormat, &glType); + // Make sure we do not flip pbuffer surfaces on Windows + glo_surface_getcontents_readpixels(surface->context->formatFlags, + stride, bpp *8, surface->width, + surface->height, data, (surface_type == SURFACE_PBUFFER)); -#endif + /* Restore previous context for setting texture */ + wglMakeCurrent(oldDC, oldCtx); + + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, surface->width, surface->height, 0, glFormat, glType, data); + free(data); } + void glo_surface_release_texture(GloSurface *surface) { if(!Render_texture_support) diff --git a/tizen/src/hw/gloffscreen_xcomposite.c b/tizen/src/hw/gloffscreen_xcomposite.c index 7c043318a7..14123e9724 100644 --- a/tizen/src/hw/gloffscreen_xcomposite.c +++ b/tizen/src/hw/gloffscreen_xcomposite.c @@ -44,6 +44,12 @@ #include "gl_mangled.h" #endif +enum{ + SURFACE_WINDOW, + SURFACE_PIXMAP, + SURFACE_PBUFFER, +}; + void *g_malloc(size_t size); void *g_realloc(void *ptr, size_t size); void g_free(void *ptr); @@ -77,7 +83,7 @@ struct _GloSurface { }; extern void glo_surface_getcontents_readpixels(int formatFlags, int stride, - int bpp, int width, int height, void *data); + int bpp, int width, int height, void *data, int noflip); static void glo_test_readback_methods(void); /* ------------------------------------------------------------------------ */ @@ -471,7 +477,7 @@ void glo_surface_getcontents(GloSurface *surface, int stride, int bpp, void *dat // Compatible / fallback method. glo_surface_getcontents_readpixels(surface->context->formatFlags, stride, bpp, surface->width, - surface->height, data); + surface->height, data, 0); } /* Return the width and height of the given surface */ @@ -483,7 +489,7 @@ void glo_surface_get_size(GloSurface *surface, int *width, int *height) { } /* Bind the surface as texture */ -void glo_surface_as_texture(GloContext *ctxt, GloSurface *surface) +void glo_surface_as_texture(GloContext *ctxt, GloSurface *surface, int surface_type) { #if 0 void (*ptr_func_glXBindTexImageEXT) (Display *dpy, GLXDrawable draw, int buffer, int *attrib_list); @@ -504,10 +510,12 @@ void glo_surface_as_texture(GloContext *ctxt, GloSurface *surface) glo_surface_updatecontents(surface); /*XXX: changet the fixed target: GL_TEXTURE_2D*/ glo_flags_get_readpixel_type(surface->context->formatFlags, &glFormat, &glType); - fprintf(stderr, "surface_as_texture:teximage:width=%d,height=%d, glFormat=0x%x, glType=0x%x.\n", surface->width, surface->height, glFormat, glType); +/* fprintf(stderr, "surface_as_texture:teximage:width=%d,height=%d, glFormat=0x%x, glType=0x%x.\n", surface->width, surface->height, glFormat, glType);*/ /* glTexImage2D use different RGB order than the contexts in the pixmap surface */ /* glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, surface->width, surface->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, surface->image->data);*/ + if(surface_type == SURFACE_PBUFFER) + { if ((glFormat == GL_RGBA || glFormat == GL_BGRA) && glType == GL_UNSIGNED_BYTE) { GLubyte *b = (GLubyte *)surface->image->data; int stride = surface->width * 4; @@ -524,6 +532,8 @@ void glo_surface_as_texture(GloContext *ctxt, GloSurface *surface) } g_free(tmp); } + } + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, surface->width, surface->height, 0, glFormat, glType, surface->image->data); #endif } diff --git a/tizen/src/hw/maru_camera_win32_pci.c b/tizen/src/hw/maru_camera_win32_pci.c index f2a044501a..8b78926727 100644 --- a/tizen/src/hw/maru_camera_win32_pci.c +++ b/tizen/src/hw/maru_camera_win32_pci.c @@ -2645,73 +2645,71 @@ void rgb24_to_yuv420(const unsigned char *src, unsigned char *dest, uint32_t width, uint32_t height, uint32_t yvu) { uint32_t x, y; - unsigned char *udest, *vdest; - uint32_t bytesperline = width * 3; + uint32_t halfWidth; + uint8_t *yplane, *uplane, *vplane; + uint8_t *yline, *uline, *vline; + const uint8_t *rgbIndex; - /* Y */ - for (y = 0; y < height; y++) { - for (x = 0; x < width; x++) { - RGB2Y(src[2], src[1], src[0], *dest++); - src += 3; - } - src += bytesperline - 3 * width; - } - src -= height * bytesperline; + halfWidth = width >> 1; + yplane = dest; - /* U + V */ if (yvu) { - vdest = dest; - udest = dest + width * height / 4; + vplane = dest + width * height; + uplane = vplane + ((width * height) >> 2); } else { - udest = dest; - vdest = dest + width * height / 4; + uplane = dest + width * height; + vplane = uplane + ((width * height) >> 2); } - for (y = 0; y < height / 2; y++) { - for (x = 0; x < width / 2; x++) { - uint32_t avg_src[3]; - - avg_src[0] = (src[0] + src[3] + src[bytesperline] + - src[bytesperline + 3]) / 4; - avg_src[1] = (src[1] + src[4] + src[bytesperline + 1] + - src[bytesperline + 4]) / 4; - avg_src[2] = (src[2] + src[5] + src[bytesperline + 2] + - src[bytesperline + 5]) / 4; - RGB2UV(avg_src[2], avg_src[1], avg_src[0], *udest++, *vdest++); - src += 6; + for (y = 0; y < height; y++) { + yline = yplane + (y * width); + uline = uplane + ((y >> 1) * halfWidth); + vline = vplane + ((y >> 1) * halfWidth); + + rgbIndex = src + (width * (height - 1 - y) * 3); + for (x = 0; x < (int)width; x+=2) { + RGB2Y(rgbIndex[2], rgbIndex[1], rgbIndex[0], *yline++); + rgbIndex += 3; + RGB2Y(rgbIndex[2], rgbIndex[1], rgbIndex[0], *yline++); + RGB2UV(rgbIndex[2], rgbIndex[1], rgbIndex[0], *uline++, *vline++); + rgbIndex += 3; } - src += 2 * bytesperline - 3 * width; } } void rgb24_to_yuyv(unsigned char *src, unsigned char *dest, uint32_t width, uint32_t height) { - uint32_t i = 0; - - for (i = 0; i < (width * height * 3); i = i + 6) { - /* y */ - *dest++ = CLIP(0.299 * (src[i + 2] - 128) + - 0.587 * (src[i + 1] - 128) + - 0.114 * (src[i] - 128) + 128); - /* u */ - *dest++ = CLIP(((-0.147 * (src[i + 2] - 128) - - 0.289 * (src[i + 1] - 128) + - 0.436 * (src[i] - 128) + 128) + - (-0.147 * (src[i + 5] - 128) - - 0.289 * (src[i + 4] - 128) + - 0.436 * (src[i + 3] - 128) + 128)) / 2); - /* y1 */ - *dest++ = CLIP(0.299 * (src[i + 5] - 128) + - 0.587 * (src[i + 4] - 128) + - 0.114 * (src[i + 3] - 128) + 128); - /* v */ - *dest++ = CLIP(((0.615 * (src[i + 2] - 128) - - 0.515 * (src[i + 1] - 128) - - 0.100 * (src[i] - 128) + 128) + - (0.615 * (src[i + 5] - 128) - - 0.515 * (src[i + 4] - 128) - - 0.100 * (src[i + 3] - 128) + 128)) / 2); + uint32_t i, j; + uint8_t *ptr; + + for (i = 0; i < height; i++) { + ptr = src + (width * (height - 1 - i) * 3); + for (j = 0; j < width; j += 2) { + /* y */ + *dest++ = CLIP(0.299 * (ptr[2] - 128) + + 0.587 * (ptr[1] - 128) + + 0.114 * (ptr[0] - 128) + 128); + /* u */ + *dest++ = CLIP(((-0.147 * (ptr[2] - 128) - + 0.289 * (ptr[1] - 128) + + 0.436 * (ptr[0] - 128) + 128) + + (-0.147 * (ptr[5] - 128) - + 0.289 * (ptr[4] - 128) + + 0.436 * (ptr[3] - 128) + 128)) / 2); + /* y1 */ + *dest++ = CLIP(0.299 * (ptr[5] - 128) + + 0.587 * (ptr[4] - 128) + + 0.114 * (ptr[3] - 128) + 128); + /* v */ + *dest++ = CLIP(((0.615 * (ptr[2] - 128) - + 0.515 * (ptr[1] - 128) - + 0.100 * (ptr[0] - 128) + 128) + + (0.615 * (ptr[5] - 128) - + 0.515 * (ptr[4] - 128) - + 0.100 * (ptr[3] - 128) + 128)) / 2); + ptr += 6; + } } } diff --git a/tizen/src/hw/maru_virtio_keyboard.c b/tizen/src/hw/maru_virtio_keyboard.c index 9c36770935..98d017badb 100644 --- a/tizen/src/hw/maru_virtio_keyboard.c +++ b/tizen/src/hw/maru_virtio_keyboard.c @@ -58,7 +58,6 @@ void virtio_keyboard_notify(void *opaque) { VirtIOKeyboard *vkbd = (VirtIOKeyboard *)opaque; EmulKbdEvent *kbdevt; - int index = 0; int written_cnt = 0; if (!vkbd) { diff --git a/tizen/src/hw/opengl_exec.c b/tizen/src/hw/opengl_exec.c index cca917d2ba..831eac7e76 100644 --- a/tizen/src/hw/opengl_exec.c +++ b/tizen/src/hw/opengl_exec.c @@ -2044,7 +2044,7 @@ int do_function_call(ProcessState *process, int func_number, unsigned long *args /* If this pixmap is linked as texture previously */ if (link_drawable(process, client_drawable)) glo_surface_as_texture(process->current_state->context, - qsurface->surface); + qsurface->surface, qsurface->type); ret.i = client_drawable; @@ -2088,7 +2088,7 @@ int do_function_call(ProcessState *process, int func_number, unsigned long *args } } else - glo_surface_as_texture(process->current_state->context, qsurface->surface); + glo_surface_as_texture(process->current_state->context, qsurface->surface, qsurface->type); break; } @@ -2104,7 +2104,7 @@ int do_function_call(ProcessState *process, int func_number, unsigned long *args add_pixmap_texture_mapping(process->current_state, process->current_state->bindTexture2D, client_drawable); - glo_surface_as_texture(process->current_state->context, qsurface->surface); + glo_surface_as_texture(process->current_state->context, qsurface->surface, qsurface->type); ret.i = 1; } else @@ -2216,8 +2216,8 @@ int do_function_call(ProcessState *process, int func_number, unsigned long *args if ( qsurface ) { - glo_surface_as_texture(process->current_state->context, qsurface->surface); - fprintf(stderr, "edwin:bindtexture: drawable=0x%x,qsurface=%p.\n", drawable, qsurface); + glo_surface_as_texture(process->current_state->context, qsurface->surface, qsurface->type); + /*fprintf(stderr, "edwin:bindtexture: drawable=0x%x,qsurface=%p.\n", drawable, qsurface);*/ } } diff --git a/tizen/src/maru_sdl.c b/tizen/src/maru_sdl.c index 9bb3f8d4d5..cd9d69efa1 100644 --- a/tizen/src/maru_sdl.c +++ b/tizen/src/maru_sdl.c @@ -4,6 +4,7 @@ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved. * * Contact: + * Jinhyung Jo * GiWoong Kim * SeokYeon Hwang * YeongKyoon Lee @@ -30,11 +31,14 @@ #include #include +#include #include "console.h" #include "maru_sdl.h" #include "emul_state.h" +/* #include "SDL_gfx/SDL_rotozoom.h" #include "maru_sdl_rotozoom.h" +*/ #include "maru_finger.h" #include "hw/maru_pm.h" #include "hw/maru_brightness.h" @@ -52,7 +56,8 @@ DisplaySurface* qemu_display_surface = NULL; static SDL_Surface *surface_screen; static SDL_Surface *surface_qemu; -static SDL_Surface *processing_screen; +static SDL_Surface *scaled_screen; +static SDL_Surface *rotated_screen; static double current_scale_factor = 1.0; static double current_screen_degree; @@ -81,6 +86,102 @@ static int sdl_thread_initialized; #define SDL_FLAGS (SDL_HWSURFACE | SDL_ASYNCBLIT | SDL_HWACCEL | SDL_NOFRAME) #define SDL_BPP 32 +/* Image processing functions using the pixman library */ +static SDL_Surface *maru_do_pixman_scale(SDL_Surface *rz_src, + SDL_Surface *rz_dst, + int angle) +{ + pixman_image_t *src = NULL; + pixman_image_t *dst = NULL; + double sx = 0; + double sy = 0; + pixman_transform_t matrix; + struct pixman_f_transform matrix_f; + + SDL_LockSurface(rz_src); + SDL_LockSurface(rz_dst); + + src = pixman_image_create_bits(PIXMAN_a8r8g8b8, + rz_src->w, rz_src->h, rz_src->pixels, rz_src->w * 4); + dst = pixman_image_create_bits(PIXMAN_a8r8g8b8, + rz_dst->w, rz_dst->h, rz_dst->pixels, rz_dst->w * 4); + + sx = (double)rz_src->w / (double)rz_dst->w; + sy = (double)rz_src->h / (double)rz_dst->h; + pixman_f_transform_init_identity(&matrix_f); + pixman_f_transform_scale(&matrix_f, NULL, sx, sy); + pixman_transform_from_pixman_f_transform(&matrix, &matrix_f); + pixman_image_set_transform(src, &matrix); + pixman_image_set_filter(src, PIXMAN_FILTER_BILINEAR, NULL, 0); + pixman_image_composite(PIXMAN_OP_SRC, src, NULL, dst, + 0, 0, 0, 0, 0, 0, + rz_dst->w, rz_dst->h); + + pixman_image_unref(src); + pixman_image_unref(dst); + + SDL_UnlockSurface(rz_src); + SDL_UnlockSurface(rz_dst); + + return rz_dst; +} + +static SDL_Surface *maru_do_pixman_rotate(SDL_Surface *rz_src, + SDL_Surface *rz_dst, + int angle) +{ + pixman_image_t *src = NULL; + pixman_image_t *dst = NULL; + pixman_transform_t matrix; + struct pixman_f_transform matrix_f; + + SDL_LockSurface(rz_src); + SDL_LockSurface(rz_dst); + + src = pixman_image_create_bits(PIXMAN_a8r8g8b8, + rz_src->w, rz_src->h, rz_src->pixels, rz_src->w * 4); + dst = pixman_image_create_bits(PIXMAN_a8r8g8b8, + rz_dst->w, rz_dst->h, rz_dst->pixels, rz_dst->w * 4); + + pixman_f_transform_init_identity(&matrix_f); + switch(angle) { + case 0: + pixman_f_transform_rotate(&matrix_f, NULL, 1.0, 0.0); + pixman_f_transform_translate(&matrix_f, NULL, 0.0, 0.0); + break; + case 90: + pixman_f_transform_rotate(&matrix_f, NULL, 0.0, 1.0); + pixman_f_transform_translate(&matrix_f, NULL, (double)rz_dst->h, 0.0); + break; + case 180: + pixman_f_transform_rotate(&matrix_f, NULL, -1.0, 0.0); + pixman_f_transform_translate(&matrix_f, NULL, + (double)rz_dst->w, (double)rz_dst->h); + break; + case 270: + pixman_f_transform_rotate(&matrix_f, NULL, 0.0, -1.0); + pixman_f_transform_translate(&matrix_f, NULL, 0.0, (double)rz_dst->w); + break; + default: + fprintf(stdout, "not supported angle factor (angle=%d)\n", angle); + break; + } + pixman_transform_from_pixman_f_transform(&matrix, &matrix_f); + pixman_image_set_transform(src, &matrix); + pixman_image_set_filter(src, PIXMAN_FILTER_BILINEAR, NULL, 0); + pixman_image_composite(PIXMAN_OP_SRC, src, NULL, dst, + 0, 0, 0, 0, 0, 0, + rz_dst->w, rz_dst->h); + + pixman_image_unref(src); + pixman_image_unref(dst); + + SDL_UnlockSurface(rz_src); + SDL_UnlockSurface(rz_dst); + + return rz_dst; +} + void qemu_ds_sdl_update(DisplayState *ds, int x, int y, int w, int h) { /* call sdl update */ @@ -221,14 +322,16 @@ void qemu_ds_sdl_refresh(DisplayState *ds) //extern int capability_check_gl; static void _sdl_init(void) { - int w, h, temp; + int w, h, rwidth, rheight, temp; INFO("Set up a video mode with the specified width, height and bits-per-pixel\n"); //get current setting information and calculate screen size + rwidth = get_emul_lcd_width(); + rheight = get_emul_lcd_height(); current_scale_factor = get_emul_win_scale(); - w = current_screen_width = get_emul_lcd_width() * current_scale_factor; - h = current_screen_height = get_emul_lcd_height() * current_scale_factor; + w = current_screen_width = rwidth * current_scale_factor; + h = current_screen_height = rheight * current_scale_factor; short rotaton_type = get_emul_rotation(); if (rotaton_type == ROTATION_PORTRAIT) { @@ -238,6 +341,9 @@ static void _sdl_init(void) temp = w; w = h; h = temp; + temp = rwidth; + rwidth = rheight; + rheight = temp; } else if (rotaton_type == ROTATION_REVERSE_PORTRAIT) { current_screen_degree = 180.0; } else if (rotaton_type == ROTATION_REVERSE_LANDSCAPE) { @@ -245,6 +351,9 @@ static void _sdl_init(void) temp = w; w = h; h = temp; + temp = rwidth; + rwidth = rheight; + rheight = temp; } #if 0 @@ -274,8 +383,14 @@ static void _sdl_init(void) #endif /* create buffer for image processing */ - SDL_FreeSurface(processing_screen); - processing_screen = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, get_emul_sdl_bpp(), + SDL_FreeSurface(scaled_screen); + scaled_screen = SDL_CreateRGBSurface(SDL_SWSURFACE, + w, h, get_emul_sdl_bpp(), + surface_qemu->format->Rmask, surface_qemu->format->Gmask, + surface_qemu->format->Bmask, surface_qemu->format->Amask); + SDL_FreeSurface(rotated_screen); + rotated_screen = SDL_CreateRGBSurface(SDL_SWSURFACE, + rwidth, rheight, get_emul_sdl_bpp(), surface_qemu->format->Rmask, surface_qemu->format->Gmask, surface_qemu->format->Bmask, surface_qemu->format->Amask); @@ -365,7 +480,8 @@ static void qemu_update(void) sdl_alteration = 0; _sdl_init(); } else if (sdl_alteration == -1) { - SDL_FreeSurface(processing_screen); + SDL_FreeSurface(scaled_screen); + SDL_FreeSurface(rotated_screen); SDL_FreeSurface(surface_qemu); surface_qemu = NULL; SDL_Quit(); @@ -434,40 +550,23 @@ static void qemu_update(void) else { //sdl surface #endif - if (current_scale_factor < 0.5) - { - /* image processing via sdl_gfx for rich interpolating */ - - // workaround - // set color key 'magenta' - surface_qemu->format->colorkey = 0xFF00FF; - - SDL_Surface *temp_surface = NULL; - - temp_surface = rotozoomSurface( - surface_qemu, current_screen_degree, current_scale_factor, 1); - SDL_BlitSurface(temp_surface, NULL, surface_screen, NULL); - - SDL_FreeSurface(temp_surface); - } - else if (current_scale_factor < 1.0) + if (current_scale_factor != 1.0) { - /* image processing with simple algorithm for uniformly interpolation */ - processing_screen = maru_rotozoom( - surface_qemu, processing_screen, - (int)current_screen_degree, TRUE); - - SDL_BlitSurface(processing_screen, NULL, surface_screen, NULL); + rotated_screen = maru_do_pixman_rotate( + surface_qemu, rotated_screen, + (int)current_screen_degree); + scaled_screen = maru_do_pixman_scale( + rotated_screen, scaled_screen, + (int)current_screen_degree); + SDL_BlitSurface(scaled_screen, NULL, surface_screen, NULL); } else /* current_scale_factor == 1.0 */ { if (current_screen_degree != 0.0) { - /* image processing */ - processing_screen = maru_rotozoom( - surface_qemu, processing_screen, - (int)current_screen_degree, FALSE); - - SDL_BlitSurface(processing_screen, NULL, surface_screen, NULL); + rotated_screen = maru_do_pixman_rotate( + surface_qemu, rotated_screen, + (int)current_screen_degree); + SDL_BlitSurface(rotated_screen, NULL, surface_screen, NULL); } else { /* as-is */ SDL_BlitSurface(surface_qemu, NULL, surface_screen, NULL); diff --git a/tizen/src/mloop_event.c b/tizen/src/mloop_event.c index d4a61eb7b3..1e6b37744c 100644 --- a/tizen/src/mloop_event.c +++ b/tizen/src/mloop_event.c @@ -85,6 +85,8 @@ struct mloop_evpack { #define MLOOP_EVTYPE_KBD_ADD 8 #define MLOOP_EVTYPE_KBD_DEL 9 #define MLOOP_EVTYPE_RAMDUMP 10 +#define MLOOP_EVTYPE_SDCARD_ATTACH 11 +#define MLOOP_EVTYPE_SDCARD_DETACH 12 static struct mloop_evsock mloop = {-1, 0, 0}; @@ -205,6 +207,9 @@ static int mloop_evsock_send(struct mloop_evsock *ev, struct mloop_evpack *p) static USBDevice *usbkbd = NULL; static USBDevice *usbdisk = NULL; static PCIDevice *hostkbd = NULL; +#ifdef TARGET_I386 +static PCIDevice *virtio_sdcard = NULL; +#endif static void mloop_evhandle_usb_add(char *name) { @@ -372,6 +377,71 @@ static void mloop_evhandle_kbd_del(char *name) WARN("There is no %s device.\n", name); } } + +static void mloop_evhandle_sdcard_attach(char *name) +{ + char opts[PATH_MAX]; + + INFO("mloop_evhandle_sdcard_attach\n"); + + if (name == NULL) { + ERR("Packet data is NULL.\n"); + return; + } + + if (virtio_sdcard) { + ERR("sdcard is already attached.\n"); + return; + } + + QDict *qdict = qdict_new(); + + qdict_put(qdict, "pci_addr", qstring_from_str("auto")); + qdict_put(qdict, "type", qstring_from_str("storage")); + snprintf(opts, sizeof(opts), "file=%s,if=virtio", name); + qdict_put(qdict, "opts", qstring_from_str(opts)); + + virtio_sdcard = pci_device_hot_add(cur_mon, qdict); + + INFO("hot add virtio storage device with [%s]\n", opts); + INFO("virtio-sdcard device: domain %d, bus %d, slot %d, function %d\n", + pci_find_domain(virtio_sdcard->bus), pci_bus_num(virtio_sdcard->bus), + PCI_SLOT(virtio_sdcard->devfn), PCI_FUNC(virtio_sdcard->devfn)); + + QDECREF(qdict); +} + +static void mloop_evhandle_sdcard_detach(char *name) +{ + INFO("mloop_evhandle_sdcard_detach\n"); + + if (name == NULL) { + ERR("packet data is NULL.\n"); + return; + } + + if (!virtio_sdcard) { + ERR("sdcard is not attached yet.\n"); + return; + } + + QDict *qdict = qdict_new(); + int slot = 0; + char slotbuf[4] = {0,}; + + slot = PCI_SLOT(virtio_sdcard->devfn); + snprintf(slotbuf, sizeof(slotbuf), "%x", slot); + INFO("virtio-sdcard slot [%d].\n", slot); + qdict_put(qdict, "pci_addr", qstring_from_str(slotbuf)); + + do_pci_device_hot_remove(cur_mon, qdict); + + virtio_sdcard = NULL; + + INFO("hot remove virtio storage device.\n"); + + QDECREF(qdict); +} #endif @@ -470,6 +540,14 @@ static void mloop_evcb_recv(struct mloop_evsock *ev) case MLOOP_EVTYPE_RAMDUMP: mloop_evhandle_ramdump(&pack); break; +#ifdef TARGET_I386 + case MLOOP_EVTYPE_SDCARD_ATTACH: + mloop_evhandle_sdcard_attach(pack.data); + break; + case MLOOP_EVTYPE_SDCARD_DETACH: + mloop_evhandle_sdcard_detach(pack.data); + break; +#endif default: break; } @@ -550,6 +628,28 @@ void mloop_evcmd_usbdisk(char *img) mloop_evsock_send(&mloop, &pack); } +void mloop_evcmd_sdcard(char *img) +{ + struct mloop_evpack pack; + + if (img) { + if (strlen(img) > PACKET_LEN-5) { + // Need log + ERR("The length of disk image path is greater than " + "lenth of maximum packet.\n"); + return; + } + + pack.type = MLOOP_EVTYPE_SDCARD_ATTACH; + pack.size = 5 + sprintf(pack.data, "%s", img); + } else { + pack.type = MLOOP_EVTYPE_SDCARD_DETACH; + pack.size = 5; + } + + mloop_evsock_send(&mloop, &pack); +} + int mloop_evcmd_get_usbkbd_status(void) { return (usbkbd && usbkbd->attached ? 1 : 0); diff --git a/tizen/src/mloop_event.h b/tizen/src/mloop_event.h index ddfbc25ec3..1023f02985 100644 --- a/tizen/src/mloop_event.h +++ b/tizen/src/mloop_event.h @@ -56,6 +56,8 @@ void mloop_evcmd_touch(void); void mloop_evcmd_keyboard(void *data); void mloop_evcmd_ramdump(void); +void mloop_evcmd_sdcard(char* img); + #ifdef __cplusplus } #endif diff --git a/tizen/src/osutil-darwin.c b/tizen/src/osutil-darwin.c index 3298b55753..9caad84fff 100644 --- a/tizen/src/osutil-darwin.c +++ b/tizen/src/osutil-darwin.c @@ -52,6 +52,7 @@ MULTI_DEBUG_CHANNEL(qemu, osutil); +extern char tizen_target_img_path[]; extern int tizen_base_port; CFDictionaryRef proxySettings; @@ -84,7 +85,51 @@ void check_vm_lock_os(void) void make_vm_lock_os(void) { - /* TODO: */ + int shmid; + char *shared_memory; + + shmid = shmget((key_t)SHMKEY, MAXLEN, 0666|IPC_CREAT); + if (shmid == -1) { + ERR("shmget failed\n"); + perror("osutil-darwin: "); + return; + } + + shared_memory = shmat(shmid, (char *)0x00, 0); + if (shared_memory == (void *)-1) { + ERR("shmat failed\n"); + perror("osutil-darwin: "); + return; + } + sprintf(shared_memory, "%d", tizen_base_port + 2); + INFO("shared memory key: %d, value: %s\n", SHMKEY, (char *)shared_memory); + + if (shmdt(shared_memory) == -1) { + ERR("shmdt failed\n"); + perror("osutil-darwin: "); + } + + shmid = shmget((key_t)tizen_base_port, MAXLEN, 0666|IPC_CREAT); + if (shmid == -1) { + ERR("shmget failed\n"); + perror("osutil-darwin: "); + return; + } + + shared_memory = shmat(shmid, (char *)0x00, 0); + if (shared_memory == (void *)-1) { + ERR("shmat failed\n"); + perror("osutil-darwin: "); + return; + } + sprintf(shared_memory, "%s", tizen_target_img_path); + INFO("shared memory key: %d, value: %s\n", tizen_base_port, (char *)shared_memory); + + if (shmdt(shared_memory) == -1) { + ERR("shmdt failed\n"); + perror("osutil-darwin: "); + } + } void set_bin_path_os(gchar * exec_argv) diff --git a/tizen/src/skin/client/skins/emul-320x480/info.ini b/tizen/src/skin/client/skins/emul-320x480/info.ini index 94506dc96c..2de466a603 100644 --- a/tizen/src/skin/client/skins/emul-320x480/info.ini +++ b/tizen/src/skin/client/skins/emul-320x480/info.ini @@ -1,3 +1,3 @@ -skin.name=Phone 320x480 +skin.name=Phone 1btn 320x480 resolution.width=320 resolution.height=480 diff --git a/tizen/src/skin/client/skins/emul-480x800-3btn/default.dbi b/tizen/src/skin/client/skins/emul-480x800-3btn/default.dbi new file mode 100644 index 0000000000..0a9dfee3ed --- /dev/null +++ b/tizen/src/skin/client/skins/emul-480x800-3btn/default.dbi @@ -0,0 +1,245 @@ + + + + + + + + + + default_0.png + default_0_p.png + + + + + + 169 + Menu + + Menu + + + + + 139 + Home + + Home + + + + + 158 + Back + + Back + + + + + 116 + Power + + Power + + + + + 115 + Volume + + + Volume + + + + + + 114 + Volume - + + Volume - + + + + + + + + + default_L90.png + default_L90_p.png + + + + + + 169 + Menu + + Menu + + + + + 139 + Home + + Home + + + + + 158 + Back + + Back + + + + + 116 + Power + + Power + + + + + 115 + Volume + + + Volume + + + + + + 114 + Volume - + + Volume - + + + + + + + + + default_180.png + default_180_p.png + + + + + + 169 + Menu + + Menu + + + + + 139 + Home + + Home + + + + + 158 + Back + + Back + + + + + 116 + Power + + Power + + + + + 115 + Volume + + + Volume + + + + + + 114 + Volume - + + Volume - + + + + + + + + + default_R90.png + default_R90_p.png + + + + + + 169 + Menu + + Menu + + + + + 139 + Home + + Home + + + + + 158 + Back + + Back + + + + + 116 + Power + + Power + + + + + 115 + Volume + + + Volume + + + + + + 114 + Volume - + + Volume - + + + + + + + + diff --git a/tizen/src/skin/client/skins/emul-480x800-3btn/default_0.png b/tizen/src/skin/client/skins/emul-480x800-3btn/default_0.png new file mode 100644 index 0000000000..c440bfbbc7 Binary files /dev/null and b/tizen/src/skin/client/skins/emul-480x800-3btn/default_0.png differ diff --git a/tizen/src/skin/client/skins/emul-480x800-3btn/default_0_p.png b/tizen/src/skin/client/skins/emul-480x800-3btn/default_0_p.png new file mode 100644 index 0000000000..2bc3a6cc9f Binary files /dev/null and b/tizen/src/skin/client/skins/emul-480x800-3btn/default_0_p.png differ diff --git a/tizen/src/skin/client/skins/emul-480x800-3btn/default_180.png b/tizen/src/skin/client/skins/emul-480x800-3btn/default_180.png new file mode 100644 index 0000000000..d4ab274930 Binary files /dev/null and b/tizen/src/skin/client/skins/emul-480x800-3btn/default_180.png differ diff --git a/tizen/src/skin/client/skins/emul-480x800-3btn/default_180_p.png b/tizen/src/skin/client/skins/emul-480x800-3btn/default_180_p.png new file mode 100644 index 0000000000..49752fc3c7 Binary files /dev/null and b/tizen/src/skin/client/skins/emul-480x800-3btn/default_180_p.png differ diff --git a/tizen/src/skin/client/skins/emul-480x800-3btn/default_L90.png b/tizen/src/skin/client/skins/emul-480x800-3btn/default_L90.png new file mode 100644 index 0000000000..7826ddac80 Binary files /dev/null and b/tizen/src/skin/client/skins/emul-480x800-3btn/default_L90.png differ diff --git a/tizen/src/skin/client/skins/emul-480x800-3btn/default_L90_p.png b/tizen/src/skin/client/skins/emul-480x800-3btn/default_L90_p.png new file mode 100644 index 0000000000..a1125bc4a1 Binary files /dev/null and b/tizen/src/skin/client/skins/emul-480x800-3btn/default_L90_p.png differ diff --git a/tizen/src/skin/client/skins/emul-480x800-3btn/default_R90.png b/tizen/src/skin/client/skins/emul-480x800-3btn/default_R90.png new file mode 100644 index 0000000000..eb989a1032 Binary files /dev/null and b/tizen/src/skin/client/skins/emul-480x800-3btn/default_R90.png differ diff --git a/tizen/src/skin/client/skins/emul-480x800-3btn/default_R90_p.png b/tizen/src/skin/client/skins/emul-480x800-3btn/default_R90_p.png new file mode 100644 index 0000000000..a4b0da9d43 Binary files /dev/null and b/tizen/src/skin/client/skins/emul-480x800-3btn/default_R90_p.png differ diff --git a/tizen/src/skin/client/skins/emul-480x800-3btn/info.ini b/tizen/src/skin/client/skins/emul-480x800-3btn/info.ini new file mode 100644 index 0000000000..cc898a8d7e --- /dev/null +++ b/tizen/src/skin/client/skins/emul-480x800-3btn/info.ini @@ -0,0 +1,4 @@ +skin.name=Phone 480x800 +resolution.width=480 +resolution.height=800 +manager.priority=3 diff --git a/tizen/src/skin/client/skins/emul-480x800/info.ini b/tizen/src/skin/client/skins/emul-480x800/info.ini deleted file mode 100644 index 55f357b074..0000000000 --- a/tizen/src/skin/client/skins/emul-480x800/info.ini +++ /dev/null @@ -1,3 +0,0 @@ -skin.name=Phone 480x800 -resolution.width=480 -resolution.height=800 diff --git a/tizen/src/skin/client/skins/emul-480x800/info.ini.bak b/tizen/src/skin/client/skins/emul-480x800/info.ini.bak new file mode 100644 index 0000000000..b6a4af08f3 --- /dev/null +++ b/tizen/src/skin/client/skins/emul-480x800/info.ini.bak @@ -0,0 +1,4 @@ +skin.name=Phone 1btn 480x800 +resolution.width=480 +resolution.height=800 +manager.priority=2 diff --git a/tizen/src/skin/client/skins/emul-600x1024/info.ini b/tizen/src/skin/client/skins/emul-600x1024/info.ini index fb341783ab..ca034ddfff 100644 --- a/tizen/src/skin/client/skins/emul-600x1024/info.ini +++ b/tizen/src/skin/client/skins/emul-600x1024/info.ini @@ -1,3 +1,3 @@ -skin.name=Phone 600x1024 +skin.name=Phone 1btn 600x1024 resolution.width=600 resolution.height=1024 diff --git a/tizen/src/skin/client/skins/emul-720x1280-3btn/default.dbi b/tizen/src/skin/client/skins/emul-720x1280-3btn/default.dbi new file mode 100644 index 0000000000..0305f5237f --- /dev/null +++ b/tizen/src/skin/client/skins/emul-720x1280-3btn/default.dbi @@ -0,0 +1,245 @@ + + + + + + + + + + default_0.png + default_0_p.png + + + + + + 169 + Menu + + Menu + + + + + 139 + Home + + Home + + + + + 158 + Back + + Back + + + + + 116 + Power + + Power + + + + + 115 + Volume + + + Volume + + + + + + 114 + Volume - + + Volume - + + + + + + + + + default_L90.png + default_L90_p.png + + + + + + 169 + Menu + + Menu + + + + + 139 + Home + + Home + + + + + 158 + Back + + Back + + + + + 116 + Power + + Power + + + + + 115 + Volume + + + Volume + + + + + + 114 + Volume - + + Volume - + + + + + + + + + default_180.png + default_180_p.png + + + + + + 169 + Menu + + Menu + + + + + 139 + Home + + Home + + + + + 158 + Back + + Back + + + + + 116 + Power + + Power + + + + + 115 + Volume + + + Volume + + + + + + 114 + Volume - + + Volume - + + + + + + + + + default_R90.png + default_R90_p.png + + + + + + 169 + Menu + + Menu + + + + + 139 + Home + + Home + + + + + 158 + Back + + Back + + + + + 116 + Power + + Power + + + + + 115 + Volume + + + Volume + + + + + + 114 + Volume - + + Volume - + + + + + + + + diff --git a/tizen/src/skin/client/skins/emul-720x1280-3btn/default_0.png b/tizen/src/skin/client/skins/emul-720x1280-3btn/default_0.png new file mode 100644 index 0000000000..04e01d6e03 Binary files /dev/null and b/tizen/src/skin/client/skins/emul-720x1280-3btn/default_0.png differ diff --git a/tizen/src/skin/client/skins/emul-720x1280-3btn/default_0_p.png b/tizen/src/skin/client/skins/emul-720x1280-3btn/default_0_p.png new file mode 100644 index 0000000000..4049ae29f6 Binary files /dev/null and b/tizen/src/skin/client/skins/emul-720x1280-3btn/default_0_p.png differ diff --git a/tizen/src/skin/client/skins/emul-720x1280-3btn/default_180.png b/tizen/src/skin/client/skins/emul-720x1280-3btn/default_180.png new file mode 100644 index 0000000000..750d056fc6 Binary files /dev/null and b/tizen/src/skin/client/skins/emul-720x1280-3btn/default_180.png differ diff --git a/tizen/src/skin/client/skins/emul-720x1280-3btn/default_180_p.png b/tizen/src/skin/client/skins/emul-720x1280-3btn/default_180_p.png new file mode 100644 index 0000000000..c3fefa649b Binary files /dev/null and b/tizen/src/skin/client/skins/emul-720x1280-3btn/default_180_p.png differ diff --git a/tizen/src/skin/client/skins/emul-720x1280-3btn/default_L90.png b/tizen/src/skin/client/skins/emul-720x1280-3btn/default_L90.png new file mode 100644 index 0000000000..6d0724c950 Binary files /dev/null and b/tizen/src/skin/client/skins/emul-720x1280-3btn/default_L90.png differ diff --git a/tizen/src/skin/client/skins/emul-720x1280-3btn/default_L90_p.png b/tizen/src/skin/client/skins/emul-720x1280-3btn/default_L90_p.png new file mode 100644 index 0000000000..babe9d452b Binary files /dev/null and b/tizen/src/skin/client/skins/emul-720x1280-3btn/default_L90_p.png differ diff --git a/tizen/src/skin/client/skins/emul-720x1280-3btn/default_R90.png b/tizen/src/skin/client/skins/emul-720x1280-3btn/default_R90.png new file mode 100644 index 0000000000..462c544153 Binary files /dev/null and b/tizen/src/skin/client/skins/emul-720x1280-3btn/default_R90.png differ diff --git a/tizen/src/skin/client/skins/emul-720x1280-3btn/default_R90_p.png b/tizen/src/skin/client/skins/emul-720x1280-3btn/default_R90_p.png new file mode 100644 index 0000000000..2d54428e19 Binary files /dev/null and b/tizen/src/skin/client/skins/emul-720x1280-3btn/default_R90_p.png differ diff --git a/tizen/src/skin/client/skins/emul-720x1280-3btn/info.ini b/tizen/src/skin/client/skins/emul-720x1280-3btn/info.ini new file mode 100644 index 0000000000..656e11aceb --- /dev/null +++ b/tizen/src/skin/client/skins/emul-720x1280-3btn/info.ini @@ -0,0 +1,4 @@ +skin.name=Phone 720x1280 +resolution.width=720 +resolution.height=1280 +manager.priority=2 diff --git a/tizen/src/skin/client/skins/emul-720x1280/info.ini b/tizen/src/skin/client/skins/emul-720x1280/info.ini deleted file mode 100644 index e40f4461cc..0000000000 --- a/tizen/src/skin/client/skins/emul-720x1280/info.ini +++ /dev/null @@ -1,3 +0,0 @@ -skin.name=Phone 720x1280 -resolution.width=720 -resolution.height=1280 diff --git a/tizen/src/skin/client/skins/emul-720x1280/info.ini.bak b/tizen/src/skin/client/skins/emul-720x1280/info.ini.bak new file mode 100644 index 0000000000..16a00ef8f3 --- /dev/null +++ b/tizen/src/skin/client/skins/emul-720x1280/info.ini.bak @@ -0,0 +1,4 @@ +skin.name=Phone 1btn 720x1280 +resolution.width=720 +resolution.height=1280 +manager.priority=2 diff --git a/tizen/src/skin/client/skins/emul-general-3btn/default.dbi b/tizen/src/skin/client/skins/emul-general-3btn/default.dbi new file mode 100644 index 0000000000..d1a68bc5d6 --- /dev/null +++ b/tizen/src/skin/client/skins/emul-general-3btn/default.dbi @@ -0,0 +1,69 @@ + + + + + + + + + + + 169 + Menu + + Menu + + + + 139 + Home + + Home + + + + 158 + Back + + Back + + + + 116 + Power + + Power + + + + 115 + Volume + + + Volume + + + + + 114 + Volume - + + Volume - + + + + + + + + + + + + + + + + + + + + diff --git a/tizen/src/skin/client/skins/emul-general-3btn/info.ini b/tizen/src/skin/client/skins/emul-general-3btn/info.ini new file mode 100644 index 0000000000..b3d4100a3f --- /dev/null +++ b/tizen/src/skin/client/skins/emul-general-3btn/info.ini @@ -0,0 +1,4 @@ +skin.name=General purpose +resolution.width=all +resolution.height=all +manager.priority=1 diff --git a/tizen/src/skin/client/skins/emul-general/info.ini b/tizen/src/skin/client/skins/emul-general/info.ini deleted file mode 100644 index dfe953a6a2..0000000000 --- a/tizen/src/skin/client/skins/emul-general/info.ini +++ /dev/null @@ -1,3 +0,0 @@ -skin.name=General purpose -resolution.width=all -resolution.height=all diff --git a/tizen/src/skin/client/skins/emul-general/info.ini.bak b/tizen/src/skin/client/skins/emul-general/info.ini.bak new file mode 100644 index 0000000000..1823020106 --- /dev/null +++ b/tizen/src/skin/client/skins/emul-general/info.ini.bak @@ -0,0 +1,4 @@ +skin.name=General purpose 1btn +resolution.width=all +resolution.height=all +manager.priority=0 diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java index 8dc4e3924a..a9e802c1c5 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java @@ -57,6 +57,7 @@ import org.eclipse.swt.events.ShellListener; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.RGB; +import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Canvas; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Menu; @@ -421,16 +422,6 @@ public class EmulatorSkin { screenShotDialog = null; } - /* close the Key Window */ - if (skinInfo.isPhoneShape() == false) { - closeKeyWindow(); - } - - /* dispose the color */ - if (colorVM != null) { - colorVM.dispose(); - } - /* save config only for emulator close */ config.setSkinProperty( SkinPropertiesConstants.WINDOW_X, shell.getLocation().x); @@ -442,7 +433,25 @@ public class EmulatorSkin { SkinPropertiesConstants.WINDOW_ROTATION, currentState.getCurrentRotationId()); config.setSkinProperty( SkinPropertiesConstants.WINDOW_ONTOP, Boolean.toString(isOnTop)); + + int dockValue = 0; + if (keyWindow != null && keyWindow.getShell().isVisible()) { + dockValue = keyWindow.getDockPosition(); + } + config.setSkinProperty( + SkinPropertiesConstants.KEYWINDOW_POSITION, dockValue); + config.saveSkinProperties(); + + /* close the Key Window */ + if (skinInfo.isPhoneShape() == false) { + closeKeyWindow(); + } + + /* dispose the color */ + if (colorVM != null) { + colorVM.dispose(); + } } if (currentState.getCurrentImage() != null) { @@ -1418,6 +1427,13 @@ public class EmulatorSkin { // shell.setLocation(location); // SkinUtil.setTopMost(shell, isOnTop); // } + + /* location correction */ + Rectangle monitorBounds = Display.getDefault().getBounds(); + Rectangle emulatorBounds = shell.getBounds(); + shell.setLocation( + Math.max(emulatorBounds.x, monitorBounds.x), + Math.max(emulatorBounds.y, monitorBounds.y)); } }); @@ -1440,28 +1456,27 @@ public class EmulatorSkin { final List scaleList = new ArrayList(); - final MenuItem scaleOneItem = new MenuItem( menu, SWT.RADIO ); - scaleOneItem.setText( "1x" ); - scaleOneItem.setData( Scale.SCALE_100 ); - scaleList.add( scaleOneItem ); + final MenuItem scaleOneItem = new MenuItem(menu, SWT.RADIO); + scaleOneItem.setText("1x"); + scaleOneItem.setData(Scale.SCALE_100); + scaleList.add(scaleOneItem); - final MenuItem scaleThreeQtrItem = new MenuItem( menu, SWT.RADIO ); - scaleThreeQtrItem.setText( "3/4x" ); - scaleThreeQtrItem.setData( Scale.SCALE_75 ); + final MenuItem scaleThreeQtrItem = new MenuItem(menu, SWT.RADIO); + scaleThreeQtrItem.setText("3/4x"); + scaleThreeQtrItem.setData(Scale.SCALE_75); scaleList.add( scaleThreeQtrItem ); - final MenuItem scalehalfItem = new MenuItem( menu, SWT.RADIO ); - scalehalfItem.setText( "1/2x" ); - scalehalfItem.setData( Scale.SCALE_50 ); - scaleList.add( scalehalfItem ); + final MenuItem scalehalfItem = new MenuItem(menu, SWT.RADIO); + scalehalfItem.setText("1/2x"); + scalehalfItem.setData(Scale.SCALE_50); + scaleList.add(scalehalfItem); - final MenuItem scaleOneQtrItem = new MenuItem( menu, SWT.RADIO ); - scaleOneQtrItem.setText( "1/4x" ); - scaleOneQtrItem.setData( Scale.SCALE_25 ); - scaleList.add( scaleOneQtrItem ); + final MenuItem scaleOneQtrItem = new MenuItem(menu, SWT.RADIO); + scaleOneQtrItem.setText("1/4x"); + scaleOneQtrItem.setData(Scale.SCALE_25); + scaleList.add(scaleOneQtrItem); SelectionAdapter selectionAdapter = new SelectionAdapter() { - @Override public void widgetSelected(SelectionEvent e) { @@ -1492,6 +1507,13 @@ public class EmulatorSkin { // shell.setLocation(location); // SkinUtil.setTopMost(shell, isOnTop); // } + + /* location correction */ + Rectangle monitorBounds = Display.getDefault().getBounds(); + Rectangle emulatorBounds = shell.getBounds(); + shell.setLocation( + Math.max(emulatorBounds.x, monitorBounds.x), + Math.max(emulatorBounds.y, monitorBounds.y)); } }); diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/config/EmulatorConfig.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/config/EmulatorConfig.java index 3048bd4299..8bcd8ab3b8 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/config/EmulatorConfig.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/config/EmulatorConfig.java @@ -89,7 +89,8 @@ public class EmulatorConfig { public static final String WINDOW_Y = "window.y"; public static final String WINDOW_ROTATION = "window.rotate"; public static final String WINDOW_SCALE = "window.scale"; - public static final String WINDOW_ONTOP = "window.ontop"; // always on top + public static final String WINDOW_ONTOP = "window.ontop"; /* always on top */ + public static final String KEYWINDOW_POSITION = "window.keywindow.position"; } public interface ConfigPropertiesConstants { diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/custom/CustomButton.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/custom/CustomButton.java index 782e488129..2b0bc2a93f 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/custom/CustomButton.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/custom/CustomButton.java @@ -10,7 +10,7 @@ * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 - * of the License, or ( at your option ) any later version. + * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -137,6 +137,7 @@ public class CustomButton extends Canvas { if (e.x < 0 || e.y < 0 || e.x > getBounds().width || e.y > getBounds().height) { + /* dragging out */ mouse = 0; } @@ -243,4 +244,4 @@ public class CustomButton extends Canvas { return new Point(imageButton[0].getImageData().width, imageButton[0].getImageData().height); } -} \ No newline at end of file +} diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/custom/CustomScrollBar.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/custom/CustomScrollBar.java index 876c561843..49e2876139 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/custom/CustomScrollBar.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/custom/CustomScrollBar.java @@ -10,7 +10,7 @@ * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 - * of the License, or ( at your option ) any later version. + * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -33,20 +33,46 @@ import java.util.TimerTask; import java.util.logging.Logger; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DragDetectEvent; +import org.eclipse.swt.events.DragDetectListener; import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.events.MouseListener; +import org.eclipse.swt.events.MouseMoveListener; +import org.eclipse.swt.events.MouseWheelListener; import org.eclipse.swt.events.PaintEvent; import org.eclipse.swt.events.PaintListener; import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.layout.RowData; import org.eclipse.swt.layout.RowLayout; import org.eclipse.swt.widgets.Canvas; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; import org.tizen.emulator.skin.log.SkinLogger; +class CustomScrollBarThumbData { + public boolean isGrabbed; + public int yGrabPosition; + public int yGrabSelection; + + public Rectangle boundsThumb; + + CustomScrollBarThumbData() { + boundsThumb = new Rectangle(0, 0, 0, 0); + } +} + +class CustomScrollBarShaftData { + public int widthShaft; + public int heightShaft; +} + public class CustomScrollBar { - static final int SCROLL_SHIFT_LENGTH = 10; + static final int SCROLL_INCREMENT_AMOUNT = 10; + static final int SCROLL_PAGE_INCREMENT_AMOUNT = 144; private Logger logger = SkinLogger.getSkinLogger( CustomScrollBar.class).getLogger(); @@ -56,7 +82,8 @@ public class CustomScrollBar { CustomScrolledComposite compositeScroll; private int heightScrollBar; - private int maxShift; + private int amountIncrement; + private int amountPageIncrement; private Image[] imagesArrowUp; private Image[] imagesArrowDown; @@ -66,12 +93,39 @@ public class CustomScrollBar { private CustomButton buttonArrowUp; private CustomButton buttonArrowDown; private Canvas canvasShaft; - private CustomButton buttonThumb; + private CustomScrollBarThumbData dataThumb; + private CustomScrollBarShaftData dataShaft; private int valueSelection; private Timer timerScroller; - private TimerTask scroller; + class ScrollerTask extends TimerTask { + static final int SCROLLER_PERIOD_TIME = 60; + + private boolean isScrollDown; + + ScrollerTask(boolean isDown) { + this.isScrollDown = isDown; + } + + @Override + public void run() { + Display.getDefault().asyncExec(new Runnable() { + @Override + public void run() { + if (isScrollDown == true) { + scrollDown(amountIncrement * 2); + } else { + scrollUp(amountIncrement * 2); + } + } + }); + } + } + + /** + * Constructor + */ CustomScrollBar(Composite parent, int style, int heightScrollBar, Image[] imagesArrowUp, Image[] imagesArrowDown, Image imageThumb, Image imageShaft) { @@ -88,15 +142,18 @@ public class CustomScrollBar { composite.setLayout(rowLayout); this.heightScrollBar = heightScrollBar; - this.maxShift = SCROLL_SHIFT_LENGTH; + this.amountIncrement = SCROLL_INCREMENT_AMOUNT; + this.amountPageIncrement = SCROLL_PAGE_INCREMENT_AMOUNT; this.imagesArrowUp = imagesArrowUp; this.imagesArrowDown = imagesArrowDown; this.imageThumb = imageThumb; this.imageShaft = imageShaft; - //this.timerScroller = new Timer(); + this.dataThumb = new CustomScrollBarThumbData(); + this.dataShaft = new CustomScrollBarShaftData(); + this.timerScroller = new Timer(); createContents(); addScrollBarListener(); @@ -116,9 +173,10 @@ public class CustomScrollBar { /* shaft */ canvasShaft = new Canvas(composite, SWT.NONE); - final int widthShaft = width; - final int heightShaft = heightScrollBar - (height * 2); - canvasShaft.setLayoutData(new RowData(widthShaft, heightShaft)); + dataShaft.widthShaft = width; + dataShaft.heightShaft = heightScrollBar - (height * 2); + canvasShaft.setLayoutData(new RowData( + dataShaft.widthShaft, dataShaft.heightShaft)); canvasShaft.addPaintListener(new PaintListener() { @Override @@ -127,7 +185,27 @@ public class CustomScrollBar { e.gc.drawImage(imageShaft, 0, 0, imageShaft.getImageData().width, imageShaft.getImageData().height, - 0, 0, widthShaft, heightShaft); + 0, 0, dataShaft.widthShaft, dataShaft.heightShaft); + + /* draw a thumb */ + int heightScrollGap = compositeScroll.getMinHeight() - heightScrollBar; + + float tempHeightThumb = (compositeScroll.getMinHeight() - heightScrollGap) * + dataShaft.heightShaft / compositeScroll.getMinHeight(); + dataThumb.boundsThumb.height = Math.max(1, (int)tempHeightThumb); + + dataThumb.boundsThumb.x = 2; + dataThumb.boundsThumb.y = getSelection() * + (dataShaft.heightShaft - dataThumb.boundsThumb.height) / + heightScrollGap; + dataThumb.boundsThumb.width = dataShaft.widthShaft - + (dataThumb.boundsThumb.x * 2); + + e.gc.drawImage(imageThumb, 0, 0, + imageThumb.getImageData().width, + imageThumb.getImageData().height, + dataThumb.boundsThumb.x, dataThumb.boundsThumb.y, + dataThumb.boundsThumb.width, dataThumb.boundsThumb.height); } } }); @@ -140,39 +218,42 @@ public class CustomScrollBar { buttonArrowDown.setLayoutData(new RowData(width, height)); } - class ScrollerTask extends TimerTask { - @Override - public void run() { - int vSelection = getSelection(); - if (vSelection <= (173 - heightScrollBar - 1)) { - setSelection(getSelection() + 1); - logger.info("" + getSelection()); - -// Display.getCurrent().asyncExec(new Runnable() { -// @Override -// public void run() { - //compositeScroll.vScroll(); -// } -// }); - } + private void updateScrollbar() { + compositeScroll.vScroll(); + canvasShaft.redraw(); + } + + private void scrollUp(int amount) { + if (amount == 0) { + return; } + + setSelection(getSelection() - amount); + updateScrollbar(); + } + + private void scrollDown(int amount) { + if (amount == 0) { + return; + } + + setSelection(getSelection() + amount); + updateScrollbar(); } protected void addScrollBarListener() { buttonArrowUp.addMouseListener(new MouseListener() { @Override public void mouseDown(MouseEvent e) { - int shift = getSelection(); - - if (shift > 0) { - setSelection(getSelection() - Math.min(maxShift, shift)); - ((CustomScrolledComposite) parent.getParent()).vScroll(); - } + scrollUp(amountIncrement); } @Override public void mouseUp(MouseEvent e) { - /* do nothing */ + if (timerScroller != null) { + timerScroller.cancel(); + timerScroller = new Timer(); + } } @Override @@ -181,39 +262,110 @@ public class CustomScrollBar { } }); + buttonArrowUp.addDragDetectListener(new DragDetectListener() { + @Override + public void dragDetected(DragDetectEvent e) { + logger.info("ArrowUp dragDetected : " + e.button); + + if (timerScroller != null) { + timerScroller.schedule(new ScrollerTask(false), + 1, ScrollerTask.SCROLLER_PERIOD_TIME); + } + } + }); + buttonArrowDown.addMouseListener(new MouseListener() { @Override public void mouseDown(MouseEvent e) { - int minHeightContents = - ((CustomScrolledComposite) parent.getParent()).getMinHeight(); + scrollDown(amountIncrement); + } - int shift = (minHeightContents - heightScrollBar) - getSelection(); + @Override + public void mouseUp(MouseEvent e) { + if (timerScroller != null) { + timerScroller.cancel(); + timerScroller = new Timer(); + } + } - if (shift > 0) { - setSelection(getSelection() + Math.min(maxShift, shift)); - ((CustomScrolledComposite) parent.getParent()).vScroll(); + @Override + public void mouseDoubleClick(MouseEvent e) { + /* do nothing */ + } + }); + + buttonArrowDown.addDragDetectListener(new DragDetectListener() { + @Override + public void dragDetected(DragDetectEvent e) { + logger.info("ArrowDown dragDetected : " + e.button); + + if (timerScroller != null) { + timerScroller.schedule(new ScrollerTask(true), + 1, ScrollerTask.SCROLLER_PERIOD_TIME); } } + }); + compositeScroll.addMouseWheelListener(new MouseWheelListener() { @Override - public void mouseUp(MouseEvent e) { - timerScroller.cancel(); - timerScroller = new Timer(); + public void mouseScrolled(MouseEvent e) { + if (e.count > 0) { + scrollUp(amountIncrement); + } else { + scrollDown(amountIncrement); + } + } + }); + + canvasShaft.addMouseMoveListener(new MouseMoveListener() { + @Override + public void mouseMove(MouseEvent e) { + if (dataThumb.isGrabbed == true) { + int yDragged = e.y - dataThumb.yGrabPosition; + + float yDraggedScale = yDragged * + (compositeScroll.getMinHeight() - heightScrollBar) / + (dataShaft.heightShaft - dataThumb.boundsThumb.height); + + setSelection(dataThumb.yGrabSelection + (int)yDraggedScale); + updateScrollbar(); + } } + }); + canvasShaft.addMouseListener(new MouseListener() { @Override public void mouseDoubleClick(MouseEvent e) { /* do nothing */ } - }); -// buttonArrowDown.addDragDetectListener(new DragDetectListener() { -// @Override -// public void dragDetected( DragDetectEvent e ) { -// logger.info( "dragDetected:" + e.button ); -// timerScroller.schedule(new ScrollerTask(), 1, 100); -// } -// }); + @Override + public void mouseDown(MouseEvent e) { + Rectangle rectThumb = new Rectangle( + 0, dataThumb.boundsThumb.y, + dataThumb.boundsThumb.width + 2, dataThumb.boundsThumb.height); + + if (rectThumb.contains(e.x, e.y) == true) { + dataThumb.isGrabbed = true; + dataThumb.yGrabPosition = e.y; + dataThumb.yGrabSelection = getSelection(); + } else { + if (e.y < dataThumb.boundsThumb.y) { + scrollUp(amountPageIncrement); + } else { + scrollDown(amountPageIncrement); + } + } + } + + @Override + public void mouseUp(MouseEvent e) { + if (dataThumb.isGrabbed == true) { + dataThumb.isGrabbed = false; + dataThumb.yGrabSelection = dataThumb.yGrabPosition = 0; + } + } + }); } public int getSelection() { @@ -222,5 +374,12 @@ public class CustomScrollBar { public void setSelection(int selection) { valueSelection = selection; + + if (valueSelection < 0) { + valueSelection = 0; + } else { + int maxScroll = compositeScroll.getMinHeight() - heightScrollBar; + valueSelection = Math.min(selection, maxScroll); + } } } diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/custom/KeyWindow.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/custom/KeyWindow.java index 0eb30aa8ae..dfd84770fd 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/custom/KeyWindow.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/custom/KeyWindow.java @@ -10,7 +10,7 @@ * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 - * of the License, or ( at your option ) any later version. + * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -130,7 +130,7 @@ public class KeyWindow extends SkinWindow { int heightTailPart = SHELL_MARGIN_BOTTOM; /* make a frame image */ - this.cntHiddenButton = 0; //keyMapList.size() - BUTTON_DEFAULT_CNT; + this.cntHiddenButton = keyMapList.size() - BUTTON_DEFAULT_CNT; this.imageFrame = frameMaker.getPatchedImage( widthBase + ((cntHiddenButton > 0) ? widthScrollbar : 0), @@ -425,29 +425,53 @@ public class KeyWindow extends SkinWindow { Rectangle childBounds = shell.getBounds(); int heightOneThird = parentBounds.height / 3; + int widthDockingArea = 30; + int widthIntersectRegion = 5; /* right-middle */ - Rectangle attachBounds1 = new Rectangle( - (parentBounds.x + parentBounds.width) - 5, + Rectangle attachBoundsRC = new Rectangle( + (parentBounds.x + parentBounds.width) - widthIntersectRegion, parentBounds.y + heightOneThird, - 30, heightOneThird); + widthDockingArea, heightOneThird); /* right-top */ - Rectangle attachBounds2 = new Rectangle( - (parentBounds.x + parentBounds.width) - 5, + Rectangle attachBoundsRT = new Rectangle( + (parentBounds.x + parentBounds.width) - widthIntersectRegion, parentBounds.y, - 30, heightOneThird); + widthDockingArea, heightOneThird); /* right-bottom */ - Rectangle attachBounds3 = new Rectangle( - (parentBounds.x + parentBounds.width) - 5, + Rectangle attachBoundsRB = new Rectangle( + (parentBounds.x + parentBounds.width) - widthIntersectRegion, parentBounds.y + (heightOneThird * 2), - 30, heightOneThird); + widthDockingArea, heightOneThird); - if (childBounds.intersects(attachBounds1) == true) { + /* left-middle */ + Rectangle attachBoundsLC = new Rectangle( + parentBounds.x - (widthDockingArea - widthIntersectRegion), + parentBounds.y + heightOneThird, + widthDockingArea, heightOneThird); + /* left-top */ + Rectangle attachBoundsLT = new Rectangle( + parentBounds.x - (widthDockingArea - widthIntersectRegion), + parentBounds.y, + widthDockingArea, heightOneThird); + /* left-bottom */ + Rectangle attachBoundsLB = new Rectangle( + parentBounds.x - (widthDockingArea - widthIntersectRegion), + parentBounds.y + (heightOneThird * 2), + widthDockingArea, heightOneThird); + + if (childBounds.intersects(attachBoundsRC) == true) { dock(SWT.RIGHT | SWT.CENTER, false, true); - } else if (childBounds.intersects(attachBounds2) == true) { + } else if (childBounds.intersects(attachBoundsRT) == true) { dock(SWT.RIGHT | SWT.TOP, false, true); - } else if (childBounds.intersects(attachBounds3) == true) { + } else if (childBounds.intersects(attachBoundsRB) == true) { dock(SWT.RIGHT | SWT.BOTTOM, false, true); + } else if (childBounds.intersects(attachBoundsLC) == true) { + dock(SWT.LEFT | SWT.CENTER, false, true); + } else if (childBounds.intersects(attachBoundsLT) == true) { + dock(SWT.LEFT | SWT.TOP, false, true); + } else if (childBounds.intersects(attachBoundsLB) == true) { + dock(SWT.LEFT | SWT.BOTTOM, false, true); } else { dock(SWT.NONE, false, true); } diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/custom/SkinWindow.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/custom/SkinWindow.java index 19e08746aa..77618eda7a 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/custom/SkinWindow.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/custom/SkinWindow.java @@ -1,7 +1,7 @@ /** + * child window of skin * - * - * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved. * * Contact: * GiWoong Kim @@ -10,7 +10,7 @@ * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 - * of the License, or ( at your option ) any later version. + * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -105,7 +105,19 @@ public class SkinWindow { x += shift; parent.setLocation(parentBounds.x + shift, parentBounds.y); }*/ - } else { /* SWT.RIGHT | SWT.CENTER */ + } + else if (dockPosition == (SWT.LEFT | SWT.CENTER)) { + x = parentBounds.x - childBounds.width; + y = parentBounds.y + (parentBounds.height / 2) - + (childBounds.height / 2); + } else if (dockPosition == (SWT.LEFT | SWT.TOP)) { + x = parentBounds.x - childBounds.width; + y = parentBounds.y; + } else if (dockPosition == (SWT.LEFT | SWT.BOTTOM)) { + x = parentBounds.x - childBounds.width; + y = parentBounds.y + parentBounds.height - childBounds.height; + } + else { /* SWT.RIGHT | SWT.CENTER */ x = parentBounds.x + parentBounds.width; y = parentBounds.y + (parentBounds.height / 2) - (childBounds.height / 2); @@ -113,12 +125,20 @@ public class SkinWindow { /* correction of location */ if (correction == true) { + /* for right side */ int shift = (monitorBounds.x + monitorBounds.width) - (x + childBounds.width); if (shift < 0) { x += shift; parent.setLocation(parentBounds.x + shift, parentBounds.y); } + + /* for left side */ + shift = monitorBounds.x - x; + if (shift > 0) { + x += shift; + parent.setLocation(parentBounds.x + shift, parentBounds.y); + } } shell.setLocation(x, y); diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/image/ImageRegistry.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/image/ImageRegistry.java index d7623f82ed..be9149bcb9 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/image/ImageRegistry.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/image/ImageRegistry.java @@ -1,7 +1,7 @@ /** - * + * image resources management * - * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved. * * Contact: * GiWoong Kim @@ -61,7 +61,7 @@ public class ImageRegistry { SkinLogger.getSkinLogger(ImageRegistry.class).getLogger(); public static final String SKINS_FOLDER = "skins"; - public static final String GENERAL_FOLDER = "emul-general"; + public static final String GENERAL_FOLDER = "emul-general-3btn"; public static final String ICON_FOLDER = "icons"; public static final String IMAGES_FOLDER = "images"; public static final String KEYWINDOW_FOLDER = "key-window"; diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/GeneralPurposeSkinComposer.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/GeneralPurposeSkinComposer.java index 8a86922dc1..dde649279b 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/GeneralPurposeSkinComposer.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/GeneralPurposeSkinComposer.java @@ -203,10 +203,17 @@ public class GeneralPurposeSkinComposer implements ISkinComposer { arrangeSkin(scale, rotationId); /* open the key window */ + final int dockValue = config.getSkinPropertyInt( + SkinPropertiesConstants.KEYWINDOW_POSITION, 0); + shell.getDisplay().asyncExec(new Runnable() { @Override public void run() { - skin.openKeyWindow(SWT.RIGHT | SWT.CENTER, false); + if (dockValue == 0 || dockValue == SWT.NONE) { + skin.openKeyWindow(SWT.RIGHT | SWT.CENTER, false); + } else { + skin.openKeyWindow(dockValue, false); + } } }); } @@ -250,8 +257,8 @@ public class GeneralPurposeSkinComposer implements ISkinComposer { } /* arrange the toggle button of key window */ - toggleButton.setBounds(displayBounds.x + displayBounds.width, - displayBounds.y + (displayBounds.height / 2) - (toggleButton.getImageSize().y / 2), + toggleButton.setBounds(displayBounds.x + displayBounds.width + 4, + displayBounds.y + ((displayBounds.height - toggleButton.getImageSize().y) / 2), toggleButton.getImageSize().x, toggleButton.getImageSize().y); /* arrange the progress bar */ diff --git a/tizen/src/skin/maruskin_operation.c b/tizen/src/skin/maruskin_operation.c index 476c063372..65c6b3dd29 100644 --- a/tizen/src/skin/maruskin_operation.c +++ b/tizen/src/skin/maruskin_operation.c @@ -40,7 +40,7 @@ #include "emulator.h" #include "debug_ch.h" #include "sdb.h" -#include "nbd.h" +#include "qemu_socket.h" #include "mloop_event.h" #include "emul_state.h" #include "maruskin_keymap.h" @@ -582,10 +582,14 @@ static void* run_timed_shutdown_thread(void* args) static void send_to_emuld(const char* request_type, int request_size, const char* send_buf, int buf_size) { - int s = tcp_socket_outgoing( "127.0.0.1", (uint16_t) ( tizen_base_port + SDB_TCP_EMULD_INDEX ) ); + char addr[128]; + int s = 0; + + snprintf(addr, 128, ":%u", (uint16_t) (tizen_base_port + SDB_TCP_EMULD_INDEX)); + s = inet_connect(addr, true, NULL, NULL); if ( s < 0 ) { - ERR( "can't create socket to talk to the sdb forwarding session \n" ); + ERR( "can't create socket to emulator daemon in guest\n" ); ERR( "[127.0.0.1:%d/tcp] connect fail (%d:%s)\n" , tizen_base_port + SDB_TCP_EMULD_INDEX , errno, strerror(errno) ); return; }