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
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
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
cat > $TMPC <<EOF
#include <signal.h>
#include <time.h>
+/* 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
}
#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");
PCI_FUNC(dev->devfn));
} else
monitor_printf(mon, "failed to add %s\n", opts);
+#ifdef CONFIG_MARU
+ return dev;
+#endif
}
#endif
+* 2.2.0
+- tizen_2.2 source update
+== Sangjin Kim <sangjin3.kim@samsung.com> 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 <sungmin82.ha@samsung.com> 2013-05-14
-Version: 1.5.38
+Version: 2.2.0
Maintainer: Yeong-Kyoon Lee<yeongkyoon.lee@samsung.com>
Source: 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
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,
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);
# 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
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];
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);
/* 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);
extern void glo_surface_getcontents_readpixels(int formatFlags, int stride,
int bpp, int width, int height,
- void *data);
+ void *data, int noflip);
{
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);
}
}
}
/* 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;
// ---------------------------------------------------
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);
// ---------------------------------------------------
}
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;
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);
};
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);
/* ------------------------------------------------------------------------ */
// Compatible / fallback method.
glo_surface_getcontents_readpixels(surface->context->formatFlags,
stride, bpp, surface->width,
- surface->height, data);
+ surface->height, data, 0);
}
// while(0) {
#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).
*
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);
/* ------------------------------------------------------------------------ */
// 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 */
}
/* 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)
#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);
};
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);
/* ------------------------------------------------------------------------ */
// 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 */
}
/* 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);
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;
}
g_free(tmp);
}
+ }
+
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, surface->width, surface->height, 0, glFormat, glType, surface->image->data);
#endif
}
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;
+ }
}
}
{
VirtIOKeyboard *vkbd = (VirtIOKeyboard *)opaque;
EmulKbdEvent *kbdevt;
- int index = 0;
int written_cnt = 0;
if (!vkbd) {
/* 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;
}
}
else
- glo_surface_as_texture(process->current_state->context, qsurface->surface);
+ glo_surface_as_texture(process->current_state->context, qsurface->surface, qsurface->type);
break;
}
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
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);*/
}
}
* Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
* GiWoong Kim <giwoong.kim@samsung.com>
* SeokYeon Hwang <syeon.hwang@samsung.com>
* YeongKyoon Lee <yeongkyoon.lee@samsung.com>
#include <pthread.h>
#include <math.h>
+#include <pixman.h>
#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"
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;
#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 */
//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) {
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) {
temp = w;
w = h;
h = temp;
+ temp = rwidth;
+ rwidth = rheight;
+ rheight = temp;
}
#if 0
#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);
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();
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);
#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};
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)
{
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
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;
}
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);
void mloop_evcmd_keyboard(void *data);
void mloop_evcmd_ramdump(void);
+void mloop_evcmd_sdcard(char* img);
+
#ifdef __cplusplus
}
#endif
MULTI_DEBUG_CHANNEL(qemu, osutil);
+extern char tizen_target_img_path[];
extern int tizen_base_port;
CFDictionaryRef proxySettings;
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)
-skin.name=Phone 320x480
+skin.name=Phone 1btn 320x480
resolution.width=320
resolution.height=480
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<EmulatorUI xmlns="http://www.tizen.org/emulator/skin/dbi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <dbi version="2.0"/>
+ <rotations>
+ <rotation name="Portrait">
+ <lcd id="0">
+ <region left="35" top="86" width="480" height="800"/>
+ </lcd>
+ <imageList>
+ <mainImage>default_0.png</mainImage>
+ <keyPressedImage>default_0_p.png</keyPressedImage>
+ </imageList>
+ <keyMapList>
+ <keyMap>
+ <region left="118" top="887" width="74" height="74"/>
+ <eventInfo>
+ <keyCode>169</keyCode>
+ <keyName>Menu</keyName>
+ </eventInfo>
+ <tooltip>Menu</tooltip>
+ </keyMap>
+ <keyMap>
+ <region height="74" left="238" top="887" width="74"/>
+ <eventInfo>
+ <keyCode>139</keyCode>
+ <keyName>Home</keyName>
+ </eventInfo>
+ <tooltip>Home</tooltip>
+ </keyMap>
+ <keyMap>
+ <region left="360" top="887" width="74" height="74"/>
+ <eventInfo>
+ <keyCode>158</keyCode>
+ <keyName>Back</keyName>
+ </eventInfo>
+ <tooltip>Back</tooltip>
+ </keyMap>
+ <keyMap>
+ <region height="74" left="541" top="819" width="20"/>
+ <eventInfo>
+ <keyCode>116</keyCode>
+ <keyName>Power</keyName>
+ </eventInfo>
+ <tooltip>Power</tooltip>
+ </keyMap>
+ <keyMap>
+ <region height="74" left="541" top="81" width="20"/>
+ <eventInfo>
+ <keyCode>115</keyCode>
+ <keyName>Volume +</keyName>
+ </eventInfo>
+ <tooltip>Volume +</tooltip>
+ </keyMap>
+ <keyMap>
+ <region height="74" left="541" top="167" width="20"/>
+ <eventInfo>
+ <keyCode>114</keyCode>
+ <keyName>Volume -</keyName>
+ </eventInfo>
+ <tooltip>Volume -</tooltip>
+ </keyMap>
+ </keyMapList>
+ </rotation>
+ <rotation name="Landscape">
+ <lcd id="0">
+ <region height="480" left="86" top="46" width="800"/>
+ </lcd>
+ <imageList>
+ <mainImage>default_L90.png</mainImage>
+ <keyPressedImage>default_L90_p.png</keyPressedImage>
+ </imageList>
+ <keyMapList>
+ <keyMap>
+ <region left="887" top="369" width="74" height="74"/>
+ <eventInfo>
+ <keyCode>169</keyCode>
+ <keyName>Menu</keyName>
+ </eventInfo>
+ <tooltip>Menu</tooltip>
+ </keyMap>
+ <keyMap>
+ <region height="74" left="887" top="249" width="74"/>
+ <eventInfo>
+ <keyCode>139</keyCode>
+ <keyName>Home</keyName>
+ </eventInfo>
+ <tooltip>Home</tooltip>
+ </keyMap>
+ <keyMap>
+ <region left="887" top="127" width="74" height="74"/>
+ <eventInfo>
+ <keyCode>158</keyCode>
+ <keyName>Back</keyName>
+ </eventInfo>
+ <tooltip>Back</tooltip>
+ </keyMap>
+ <keyMap>
+ <region height="20" left="818" top="2" width="74"/>
+ <eventInfo>
+ <keyCode>116</keyCode>
+ <keyName>Power</keyName>
+ </eventInfo>
+ <tooltip>Power</tooltip>
+ </keyMap>
+ <keyMap>
+ <region left="80" top="2" width="74" height="20"/>
+ <eventInfo>
+ <keyCode>115</keyCode>
+ <keyName>Volume +</keyName>
+ </eventInfo>
+ <tooltip>Volume +</tooltip>
+ </keyMap>
+ <keyMap>
+ <region left="165" top="2" width="74" height="20"/>
+ <eventInfo>
+ <keyCode>114</keyCode>
+ <keyName>Volume -</keyName>
+ </eventInfo>
+ <tooltip>Volume -</tooltip>
+ </keyMap>
+ </keyMapList>
+ </rotation>
+ <rotation name="Reverse Portrait">
+ <lcd id="0">
+ <region left="46" top="89" width="480" height="800"/>
+ </lcd>
+ <imageList>
+ <mainImage>default_180.png</mainImage>
+ <keyPressedImage>default_180_p.png</keyPressedImage>
+ </imageList>
+ <keyMapList>
+ <keyMap>
+ <region left="368" top="14" width="74" height="74"/>
+ <eventInfo>
+ <keyCode>169</keyCode>
+ <keyName>Menu</keyName>
+ </eventInfo>
+ <tooltip>Menu</tooltip>
+ </keyMap>
+ <keyMap>
+ <region left="249" top="14" width="74" height="74"/>
+ <eventInfo>
+ <keyCode>139</keyCode>
+ <keyName>Home</keyName>
+ </eventInfo>
+ <tooltip>Home</tooltip>
+ </keyMap>
+ <keyMap>
+ <region left="126" top="14" width="74" height="74"/>
+ <eventInfo>
+ <keyCode>158</keyCode>
+ <keyName>Back</keyName>
+ </eventInfo>
+ <tooltip>Back</tooltip>
+ </keyMap>
+ <keyMap>
+ <region left="2" top="84" width="20" height="74"/>
+ <eventInfo>
+ <keyCode>116</keyCode>
+ <keyName>Power</keyName>
+ </eventInfo>
+ <tooltip>Power</tooltip>
+ </keyMap>
+ <keyMap>
+ <region left="2" top="821" width="20" height="74"/>
+ <eventInfo>
+ <keyCode>115</keyCode>
+ <keyName>Volume +</keyName>
+ </eventInfo>
+ <tooltip>Volume +</tooltip>
+ </keyMap>
+ <keyMap>
+ <region left="2" top="735" width="20" height="74"/>
+ <eventInfo>
+ <keyCode>114</keyCode>
+ <keyName>Volume -</keyName>
+ </eventInfo>
+ <tooltip>Volume -</tooltip>
+ </keyMap>
+ </keyMapList>
+ </rotation>
+ <rotation name="Reverse Landscape">
+ <lcd id="0">
+ <region left="90" top="35" width="800" height="480"/>
+ </lcd>
+ <imageList>
+ <mainImage>default_R90.png</mainImage>
+ <keyPressedImage>default_R90_p.png</keyPressedImage>
+ </imageList>
+ <keyMapList>
+ <keyMap>
+ <region left="15" top="118" width="74" height="74"/>
+ <eventInfo>
+ <keyCode>169</keyCode>
+ <keyName>Menu</keyName>
+ </eventInfo>
+ <tooltip>Menu</tooltip>
+ </keyMap>
+ <keyMap>
+ <region left="15" top="239" width="74" height="74"/>
+ <eventInfo>
+ <keyCode>139</keyCode>
+ <keyName>Home</keyName>
+ </eventInfo>
+ <tooltip>Home</tooltip>
+ </keyMap>
+ <keyMap>
+ <region left="15" top="360" width="74" height="74"/>
+ <eventInfo>
+ <keyCode>158</keyCode>
+ <keyName>Back</keyName>
+ </eventInfo>
+ <tooltip>Back</tooltip>
+ </keyMap>
+ <keyMap>
+ <region left="84" top="539" width="74" height="20"/>
+ <eventInfo>
+ <keyCode>116</keyCode>
+ <keyName>Power</keyName>
+ </eventInfo>
+ <tooltip>Power</tooltip>
+ </keyMap>
+ <keyMap>
+ <region left="822" top="539" width="74" height="20"/>
+ <eventInfo>
+ <keyCode>115</keyCode>
+ <keyName>Volume +</keyName>
+ </eventInfo>
+ <tooltip>Volume +</tooltip>
+ </keyMap>
+ <keyMap>
+ <region left="735" top="539" width="74" height="20"/>
+ <eventInfo>
+ <keyCode>114</keyCode>
+ <keyName>Volume -</keyName>
+ </eventInfo>
+ <tooltip>Volume -</tooltip>
+ </keyMap>
+ </keyMapList>
+ </rotation>
+ </rotations>
+ <colors>
+ <hoverColor B="255" G="255" R="255" />
+ </colors>
+</EmulatorUI>
--- /dev/null
+skin.name=Phone 480x800
+resolution.width=480
+resolution.height=800
+manager.priority=3
+++ /dev/null
-skin.name=Phone 480x800
-resolution.width=480
-resolution.height=800
--- /dev/null
+skin.name=Phone 1btn 480x800
+resolution.width=480
+resolution.height=800
+manager.priority=2
-skin.name=Phone 600x1024
+skin.name=Phone 1btn 600x1024
resolution.width=600
resolution.height=1024
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<EmulatorUI xmlns="http://www.tizen.org/emulator/skin/dbi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <dbi version="2.0"/>
+ <rotations>
+ <rotation name="Portrait">
+ <lcd id="0">
+ <region left="67" top="116" width="720" height="1280"/>
+ </lcd>
+ <imageList>
+ <mainImage>default_0.png</mainImage>
+ <keyPressedImage>default_0_p.png</keyPressedImage>
+ </imageList>
+ <keyMapList>
+ <keyMap>
+ <region left="210" top="1401" width="84" height="84"/>
+ <eventInfo>
+ <keyCode>169</keyCode>
+ <keyName>Menu</keyName>
+ </eventInfo>
+ <tooltip>Menu</tooltip>
+ </keyMap>
+ <keyMap>
+ <region left="390" top="1401" width="84" height="84"/>
+ <eventInfo>
+ <keyCode>139</keyCode>
+ <keyName>Home</keyName>
+ </eventInfo>
+ <tooltip>Home</tooltip>
+ </keyMap>
+ <keyMap>
+ <region left="570" top="1401" width="84" height="84"/>
+ <eventInfo>
+ <keyCode>158</keyCode>
+ <keyName>Back</keyName>
+ </eventInfo>
+ <tooltip>Back</tooltip>
+ </keyMap>
+ <keyMap>
+ <region left="841" top="1309" width="24" height="96"/>
+ <eventInfo>
+ <keyCode>116</keyCode>
+ <keyName>Power</keyName>
+ </eventInfo>
+ <tooltip>Power</tooltip>
+ </keyMap>
+ <keyMap>
+ <region left="841" top="108" width="24" height="96"/>
+ <eventInfo>
+ <keyCode>115</keyCode>
+ <keyName>Volume +</keyName>
+ </eventInfo>
+ <tooltip>Volume +</tooltip>
+ </keyMap>
+ <keyMap>
+ <region left="841" top="219" width="24" height="96"/>
+ <eventInfo>
+ <keyCode>114</keyCode>
+ <keyName>Volume -</keyName>
+ </eventInfo>
+ <tooltip>Volume -</tooltip>
+ </keyMap>
+ </keyMapList>
+ </rotation>
+ <rotation name="Landscape">
+ <lcd id="0">
+ <region left="116" top="78" width="1280" height="720"/>
+ </lcd>
+ <imageList>
+ <mainImage>default_L90.png</mainImage>
+ <keyPressedImage>default_L90_p.png</keyPressedImage>
+ </imageList>
+ <keyMapList>
+ <keyMap>
+ <region left="1400" top="570" width="84" height="84"/>
+ <eventInfo>
+ <keyCode>169</keyCode>
+ <keyName>Menu</keyName>
+ </eventInfo>
+ <tooltip>Menu</tooltip>
+ </keyMap>
+ <keyMap>
+ <region left="1400" top="392" width="84" height="84"/>
+ <eventInfo>
+ <keyCode>139</keyCode>
+ <keyName>Home</keyName>
+ </eventInfo>
+ <tooltip>Home</tooltip>
+ </keyMap>
+ <keyMap>
+ <region left="1400" top="210" width="84" height="84"/>
+ <eventInfo>
+ <keyCode>158</keyCode>
+ <keyName>Back</keyName>
+ </eventInfo>
+ <tooltip>Back</tooltip>
+ </keyMap>
+ <keyMap>
+ <region left="1308" top="2" width="96" height="24"/>
+ <eventInfo>
+ <keyCode>116</keyCode>
+ <keyName>Power</keyName>
+ </eventInfo>
+ <tooltip>Power</tooltip>
+ </keyMap>
+ <keyMap>
+ <region left="108" top="2" width="96" height="24"/>
+ <eventInfo>
+ <keyCode>115</keyCode>
+ <keyName>Volume +</keyName>
+ </eventInfo>
+ <tooltip>Volume +</tooltip>
+ </keyMap>
+ <keyMap>
+ <region left="217" top="2" width="96" height="24"/>
+ <eventInfo>
+ <keyCode>114</keyCode>
+ <keyName>Volume -</keyName>
+ </eventInfo>
+ <tooltip>Volume -</tooltip>
+ </keyMap>
+ </keyMapList>
+ </rotation>
+ <rotation name="Reverse Portrait">
+ <lcd id="0">
+ <region left="78" top="117" width="720" height="1280"/>
+ </lcd>
+ <imageList>
+ <mainImage>default_180.png</mainImage>
+ <keyPressedImage>default_180_p.png</keyPressedImage>
+ </imageList>
+ <keyMapList>
+ <keyMap>
+ <region left="570" top="30" width="84" height="84"/>
+ <eventInfo>
+ <keyCode>169</keyCode>
+ <keyName>Menu</keyName>
+ </eventInfo>
+ <tooltip>Menu</tooltip>
+ </keyMap>
+ <keyMap>
+ <region left="390" top="30" width="84" height="84"/>
+ <eventInfo>
+ <keyCode>139</keyCode>
+ <keyName>Home</keyName>
+ </eventInfo>
+ <tooltip>Home</tooltip>
+ </keyMap>
+ <keyMap>
+ <region left="210" top="30" width="84" height="84"/>
+ <eventInfo>
+ <keyCode>158</keyCode>
+ <keyName>Back</keyName>
+ </eventInfo>
+ <tooltip>Back</tooltip>
+ </keyMap>
+ <keyMap>
+ <region left="2" top="110" width="24" height="96"/>
+ <eventInfo>
+ <keyCode>116</keyCode>
+ <keyName>Power</keyName>
+ </eventInfo>
+ <tooltip>Power</tooltip>
+ </keyMap>
+ <keyMap>
+ <region left="2" top="1310" width="24" height="96"/>
+ <eventInfo>
+ <keyCode>115</keyCode>
+ <keyName>Volume +</keyName>
+ </eventInfo>
+ <tooltip>Volume +</tooltip>
+ </keyMap>
+ <keyMap>
+ <region left="2" top="1200" width="24" height="96"/>
+ <eventInfo>
+ <keyCode>114</keyCode>
+ <keyName>Volume -</keyName>
+ </eventInfo>
+ <tooltip>Volume -</tooltip>
+ </keyMap>
+ </keyMapList>
+ </rotation>
+ <rotation name="Reverse Landscape">
+ <lcd id="0">
+ <region left="117" top="67" width="1280" height="720"/>
+ </lcd>
+ <imageList>
+ <mainImage>default_R90.png</mainImage>
+ <keyPressedImage>default_R90_p.png</keyPressedImage>
+ </imageList>
+ <keyMapList>
+ <keyMap>
+ <region left="28" top="209" width="84" height="84"/>
+ <eventInfo>
+ <keyCode>169</keyCode>
+ <keyName>Menu</keyName>
+ </eventInfo>
+ <tooltip>Menu</tooltip>
+ </keyMap>
+ <keyMap>
+ <region left="28" top="391" width="84" height="84"/>
+ <eventInfo>
+ <keyCode>139</keyCode>
+ <keyName>Home</keyName>
+ </eventInfo>
+ <tooltip>Home</tooltip>
+ </keyMap>
+ <keyMap>
+ <region left="28" top="568" width="84" height="84"/>
+ <eventInfo>
+ <keyCode>158</keyCode>
+ <keyName>Back</keyName>
+ </eventInfo>
+ <tooltip>Back</tooltip>
+ </keyMap>
+ <keyMap>
+ <region left="109" top="841" width="96" height="24"/>
+ <eventInfo>
+ <keyCode>116</keyCode>
+ <keyName>Power</keyName>
+ </eventInfo>
+ <tooltip>Power</tooltip>
+ </keyMap>
+ <keyMap>
+ <region left="1309" top="841" width="96" height="24"/>
+ <eventInfo>
+ <keyCode>115</keyCode>
+ <keyName>Volume +</keyName>
+ </eventInfo>
+ <tooltip>Volume +</tooltip>
+ </keyMap>
+ <keyMap>
+ <region left="1199" top="841" width="96" height="24"/>
+ <eventInfo>
+ <keyCode>114</keyCode>
+ <keyName>Volume -</keyName>
+ </eventInfo>
+ <tooltip>Volume -</tooltip>
+ </keyMap>
+ </keyMapList>
+ </rotation>
+ </rotations>
+ <colors>
+ <hoverColor B="255" G="255" R="255" />
+ </colors>
+</EmulatorUI>
--- /dev/null
+skin.name=Phone 720x1280
+resolution.width=720
+resolution.height=1280
+manager.priority=2
+++ /dev/null
-skin.name=Phone 720x1280
-resolution.width=720
-resolution.height=1280
--- /dev/null
+skin.name=Phone 1btn 720x1280
+resolution.width=720
+resolution.height=1280
+manager.priority=2
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<EmulatorUI xmlns="http://www.tizen.org/emulator/skin/dbi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <dbi version="2.0"/>
+ <rotations>
+ <rotation name="Portrait">
+ <lcd id="0">
+ </lcd>
+ <keyMapList>
+ <keyMap>
+ <eventInfo>
+ <keyCode>169</keyCode>
+ <keyName>Menu</keyName>
+ </eventInfo>
+ <tooltip>Menu</tooltip>
+ </keyMap>
+ <keyMap>
+ <eventInfo>
+ <keyCode>139</keyCode>
+ <keyName>Home</keyName>
+ </eventInfo>
+ <tooltip>Home</tooltip>
+ </keyMap>
+ <keyMap>
+ <eventInfo>
+ <keyCode>158</keyCode>
+ <keyName>Back</keyName>
+ </eventInfo>
+ <tooltip>Back</tooltip>
+ </keyMap>
+ <keyMap>
+ <eventInfo>
+ <keyCode>116</keyCode>
+ <keyName>Power</keyName>
+ </eventInfo>
+ <tooltip>Power</tooltip>
+ </keyMap>
+ <keyMap>
+ <eventInfo>
+ <keyCode>115</keyCode>
+ <keyName>Volume +</keyName>
+ </eventInfo>
+ <tooltip>Volume +</tooltip>
+ </keyMap>
+ <keyMap>
+ <eventInfo>
+ <keyCode>114</keyCode>
+ <keyName>Volume -</keyName>
+ </eventInfo>
+ <tooltip>Volume -</tooltip>
+ </keyMap>
+ </keyMapList>
+ </rotation>
+ <rotation name="Landscape">
+ <lcd id="0">
+ </lcd>
+ </rotation>
+ <rotation name="Reverse Portrait">
+ <lcd id="0">
+ </lcd>
+ </rotation>
+ <rotation name="Reverse Landscape">
+ <lcd id="0">
+ </lcd>
+ </rotation>
+ </rotations>
+ <colors>
+ <hoverColor B="255" G="255" R="255" />
+ </colors>
+</EmulatorUI>
--- /dev/null
+skin.name=General purpose
+resolution.width=all
+resolution.height=all
+manager.priority=1
+++ /dev/null
-skin.name=General purpose
-resolution.width=all
-resolution.height=all
--- /dev/null
+skin.name=General purpose 1btn
+resolution.width=all
+resolution.height=all
+manager.priority=0
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;
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);
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) {
// 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));
}
});
final List<MenuItem> scaleList = new ArrayList<MenuItem>();
- 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) {
// 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));
}
});
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 {
* 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
if (e.x < 0 || e.y < 0 ||
e.x > getBounds().width || e.y > getBounds().height) {
+ /* dragging out */
mouse = 0;
}
return new Point(imageButton[0].getImageData().width,
imageButton[0].getImageData().height);
}
-}
\ No newline at end of file
+}
* 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
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();
CustomScrolledComposite compositeScroll;
private int heightScrollBar;
- private int maxShift;
+ private int amountIncrement;
+ private int amountPageIncrement;
private Image[] imagesArrowUp;
private Image[] imagesArrowDown;
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) {
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();
/* 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
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);
}
}
});
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
}
});
+ 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() {
public void setSelection(int selection) {
valueSelection = selection;
+
+ if (valueSelection < 0) {
+ valueSelection = 0;
+ } else {
+ int maxScroll = compositeScroll.getMinHeight() - heightScrollBar;
+ valueSelection = Math.min(selection, maxScroll);
+ }
}
}
* 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
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),
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);
}
/**
+ * 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 <giwoong.kim@samsung.com>
* 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
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);
/* 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);
/**
- *
+ * 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 <giwoong.kim@samsung.com>
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";
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);
+ }
}
});
}
}
/* 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 */
#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"
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;
}