buf_time, debug_classes[cls], channel->name);
if (*channel->multiname) {
- ret += snprintf(buf_msg + ret, sizeof(buf_msg) - ret, ":%s]", channel->multiname);
+ ret += snprintf(buf_msg + ret, sizeof(buf_msg) - ret, ":%s] ", channel->multiname);
} else {
- ret += snprintf(buf_msg + ret, sizeof(buf_msg) - ret, "]");
+ ret += snprintf(buf_msg + ret, sizeof(buf_msg) - ret, "] ");
}
va_start(valist, format);
mts->finger_slot = NULL;
}
mts->finger_slot =
- (FingerPoint *)g_malloc0(sizeof(FingerPoint) * mts->finger_cnt_max);
+ (FingerPoint *) g_malloc0(sizeof(FingerPoint) * mts->finger_cnt_max);
for (i = 0; i < mts->finger_cnt_max; i++) {
finger = get_finger_point_from_slot(i);
- //finger->id = 0;
- finger->origin_x = finger->origin_y = -1;
- finger->x = finger->y = -1;
+ if (finger != NULL) {
+ finger->origin_x = finger->origin_y = -1;
+ finger->x = finger->y = -1;
+ }
}
mts->finger_point_size = DEFAULT_FINGER_POINT_SIZE;
INFO("Set up a video mode with the specified width, "
"height and bits-per-pixel\n");
+ sdl_alteration = 1;
+ sdl_skip_update = 0;
+
#ifdef SDL_THREAD
pthread_mutex_lock(&sdl_mutex);
#endif
- sdl_alteration = 1;
- sdl_skip_update = 0;
-
/* get current setting information and calculate screen size */
display_width = get_emul_lcd_width();
display_height = get_emul_lcd_height();
ERR("Could not open SDL display (%dx%dx%d) : %s\n",
surface_width, surface_height,
get_emul_sdl_bpp(), SDL_GetError());
+
+#ifdef SDL_THREAD
+ pthread_mutex_unlock(&sdl_mutex);
+#endif
+
return;
}
qemu_bh_delete(sdl_resize_bh);
}
+ sdl_alteration = -1;
+
#ifdef SDL_THREAD
pthread_mutex_lock(&sdl_mutex);
#endif
- sdl_alteration = -1;
-
SDL_Quit();
#ifdef SDL_THREAD
initMultiTouchState(maximum);
}
- class FingerPoint {
+ static class FingerPoint {
private int id;
private int originX;
private int originY;
/* org.eclipse.swt.widgets.Widget */
if (SwtUtil.isLinuxPlatform()) {
-
try {
Field field = lcdCanvas.getClass().getField("embeddedHandle");
windowHandleId = field.getLong(lcdCanvas);
logger.log(Level.SEVERE, e.getMessage(), e);
shutdown();
}
-
} else if (SwtUtil.isWindowsPlatform()) {
-
try {
Field field = lcdCanvas.getClass().getField("handle");
windowHandleId = field.getLong(lcdCanvas);
logger.log(Level.SEVERE, e.getMessage(), e);
shutdown();
}
-
- } else if (SwtUtil.isMacPlatform()) {
-
- // not supported
- windowHandleId = 0;
-
} else {
+ /* not supported */
logger.severe("Not Supported OS platform:" + SWT.getPlatform());
- System.exit(-1);
+ shutdown();
}
return windowHandleId;
*
*/
public class SocketCommunicator implements ICommunicator {
- public class DataTranfer {
+ public static class DataTranfer {
private boolean isTransferState;
private byte[] receivedData;
}
private void sendToQEMUInternal(SkinSendData sendData) {
- try {
- if (null == sendData) {
- return;
- }
-
- SendCommand command = sendData.getCommand();
- ISendData data = sendData.getSendData();
+ if (null == sendData) {
+ return;
+ }
+
+ SendCommand command = sendData.getCommand();
+ ISendData data = sendData.getSendData();
- reqId = (Integer.MAX_VALUE == reqId) ? 0 : ++reqId;
+ reqId = (Integer.MAX_VALUE == reqId) ? 0 : ++reqId;
+ try {
dataOutputStream.writeInt(uId);
dataOutputStream.writeInt(reqId);
dataOutputStream.writeShort(command.value());
logger.fine("[Socket] data - " + data.toString());
}
}
-
} catch (IOException e) {
logger.log(Level.SEVERE, e.getMessage(), e);
}
-
}
public byte[] getReceivedData(DataTranfer dataTranfer) {
isTerminated = true;
- if (null != sendQueue) {
- synchronized (sendQueue) {
- sendQueue.notifyAll();
- }
+ synchronized (sendQueue) {
+ sendQueue.notifyAll();
}
if (null != heartbeatTimer) {
/**
- *
+ * Custom Scroll Bar
*
* Copyright (C) 2013 Samsung Electronics Co., Ltd. All rights reserved.
*
/* draw a thumb */
int heightScrollGap = compositeScroll.getMinHeight() - heightScrollBar;
- float tempHeightThumb = (compositeScroll.getMinHeight() - heightScrollGap) *
+ int tempHeightThumb = (compositeScroll.getMinHeight() - heightScrollGap) *
dataShaft.heightShaft / compositeScroll.getMinHeight();
- dataThumb.boundsThumb.height = Math.max(1, (int)tempHeightThumb);
+ dataThumb.boundsThumb.height = Math.max(1, tempHeightThumb);
dataThumb.boundsThumb.x = 2;
dataThumb.boundsThumb.y = getSelection() *
if (dataThumb.isGrabbed == true) {
int yDragged = e.y - dataThumb.yGrabPosition;
- float yDraggedScale = yDragged *
+ int yDraggedScale = yDragged *
(compositeScroll.getMinHeight() - heightScrollBar) /
(dataShaft.heightShaft - dataThumb.boundsThumb.height);
- setSelection(dataThumb.yGrabSelection + (int)yDraggedScale);
+ setSelection(dataThumb.yGrabSelection + yDraggedScale);
updateScrollbar();
}
}
/**
- *
+ * Custom Scrolled Composite
*
* Copyright (C) 2013 Samsung Electronics Co., Ltd. All rights reserved.
*
/**
- *
+ * Custom Scrolled Composite Layout
*
* Copyright (C) 2013 Samsung Electronics Co., Ltd. All rights reserved.
*
shellMouseMoveListener = new MouseMoveListener() {
@Override
public void mouseMove(MouseEvent e) {
- if (isTouch == true) {
+ if (isTouch == true) {
logger.info("mouseMove in KeyWindow : " + e.x + ", " + e.y);
- HWKey pressedHWKey = currentPressedHWKey;
+ HWKey pressedHWKey = currentPressedHWKey;
int x = pressedHWKey.getRegion().x;
int y = pressedHWKey.getRegion().y;
int width = pressedHWKey.getRegion().width;
int height = pressedHWKey.getRegion().height;
- int eventType;
+ //int eventType;
if (SkinUtil.isInGeometry(e.x, e.y, x, y, width, height)) {
- eventType = MouseEventType.DRAG.value();
+ //eventType = MouseEventType.DRAG.value();
} else {
isTouch = false;
- eventType = MouseEventType.RELEASE.value();
- /* rollback a keyPressed image resion */
+ //eventType = MouseEventType.RELEASE.value();
+ /* rollback a keyPressed image region */
shell.redraw(x, y, width, height, false);
}
while (imageIterator.hasNext()) {
image = imageIterator.next();
- image.dispose();
+ if (image != null) {
+ image.dispose();
+ }
}
}
}
while (imageIterator.hasNext()) {
image = imageIterator.next();
- image.dispose();
+ if (image != null) {
+ image.dispose();
+ }
}
}
}
while (imageIterator.hasNext()) {
image = imageIterator.next();
- image.dispose();
+ if (image != null) {
+ image.dispose();
+ }
}
}
}
while (imageIterator.hasNext()) {
image = imageIterator.next();
- image.dispose();
+ if (image != null) {
+ image.dispose();
+ }
}
}
}
while (imageIterator.hasNext()) {
image = imageIterator.next();
- image.dispose();
+ if (image != null) {
+ image.dispose();
+ }
}
}
}
}
File dir = new File(path + LOG_FOLDER);
- dir.mkdir();
+ if (dir.mkdir() == false) {
+ /* do nothing */
+ }
- /* delete .lck files after abnomal skin termination */
+ /* delete .lck files after abnormal skin termination */
File[] listFiles = dir.listFiles();
for (File f : listFiles) {
String name = f.getName();
/* create a Key Window */
determineLayout();
- if (isGeneralKeyWindow() == true) {
+ if (isGeneralKeyWindow() == true
+ || skin.getPopupMenu().keyWindowItem.getMenu() == null) {
if (imageRegstry == null) {
logger.warning("GeneralKeyWindowImageRegistry is null");
return;
skin.getEmulatorSkinState().getCurrentRotationId());
if (keyMapList == null) {
- selectKeyWindowMenu(skin.isKeyWindow = false);
logger.info("keyMapList is null");
+
+ selectKeyWindowMenu(skin.isKeyWindow = false);
return;
} else if (keyMapList.isEmpty() == true) {
- selectKeyWindowMenu(skin.isKeyWindow = false);
logger.info("keyMapList is empty");
+
+ selectKeyWindowMenu(skin.isKeyWindow = false);
return;
}
/* for Menu */
public boolean isSelectKeyWindowMenu() {
- MenuItem keywindow = skin.getPopupMenu().keyWindowItem;
+ MenuItem keywindowMenu = skin.getPopupMenu().keyWindowItem;
- if (keywindow != null) {
+ if (keywindowMenu != null) {
if (isGeneralKeyWindow() == true) {
- return keywindow.getSelection();
+ return keywindowMenu.getSelection();
} else {
- for (MenuItem layout : keywindow.getMenu().getItems()) {
- if (layout.getSelection() == true) {
- return true;
+ if (keywindowMenu.getMenu() == null) {
+ logger.info("Special KeyWindow menu item is null");
+ } else {
+ for (MenuItem layout : keywindowMenu.getMenu().getItems()) {
+ if (layout.getSelection() == true) {
+ return true;
+ }
}
}
}
}
public void selectKeyWindowMenu(boolean on) {
- MenuItem keywindow = skin.getPopupMenu().keyWindowItem;
+ MenuItem keywindowMenu = skin.getPopupMenu().keyWindowItem;
- if (keywindow != null) {
+ if (keywindowMenu != null) {
if (isGeneralKeyWindow() == true) {
- keywindow.setSelection(on);
+ keywindowMenu.setSelection(on);
} else {
- keywindow.getMenu().getItem(indexLayout).setSelection(on);
+ if (keywindowMenu.getMenu() == null) {
+ logger.info("Special KeyWindow menu item is null");
+ } else {
+ keywindowMenu.getMenu().getItem(indexLayout).setSelection(on);
+ }
}
}
}
#include <winsock2.h>
#include <ws2tcpip.h>
-#define socket_error() WSAGetLastError()
+#define SLEEP(x) Sleep(x)
+#define SOCKET_CLOSE(sock) closesocket(sock)
+#define SOCKET_ERROR() WSAGetLastError()
#else
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/socket.h>
-#define socket_error() errno
+#define SLEEP(x) usleep(x * 1000)
+#define SOCKET_CLOSE(sock) close(sock)
+#define SOCKET_ERROR() errno
#endif
#include "debug_ch.h"
INFO("skin client sent normal shutdown response.\n");
break;
} else {
-#ifdef CONFIG_WIN32
- Sleep(1); /* 1ms */
-#else
- usleep(1000);
-#endif
+ SLEEP(1); /* 1ms */
+
count++;
}
}
is_force_close_client = 1;
if (client_sock) {
-#ifdef CONFIG_WIN32
- closesocket(client_sock);
-#else
- close(client_sock);
-#endif
+ SOCKET_CLOSE(client_sock);
+
client_sock = 0;
}
if (close_server_socket) {
INFO("skin client did not send normal shutdown response.\n");
if (server_sock) {
-#ifdef CONFIG_WIN32
- closesocket(server_sock);
-#else
- close(server_sock);
-#endif
+ SOCKET_CLOSE(server_sock);
+
server_sock = 0;
}
}
ERR("fail to send SEND_BOOTING_PROGRESS to skin.\n");
}
-#ifdef CONFIG_WIN32
- Sleep(1); /* 1ms */
-#else
- usleep(1000);
-#endif
+ SLEEP(1); /* 1ms */
} else {
INFO("skin client socket is not connected yet\n");
}
perror("skin server bind error : ");
if (server_sock) {
-#ifdef CONFIG_WIN32
- closesocket(server_sock);
-#else
- close(server_sock);
-#endif
+ SOCKET_CLOSE(server_sock);
+
server_sock = 0;
}
perror("skin_server listen error : ");
if (server_sock) {
-#ifdef CONFIG_WIN32
- closesocket(server_sock);
-#else
- close(server_sock);
-#endif
+ SOCKET_CLOSE(server_sock);
+
server_sock = 0;
}
}
}
+ if (client_sock != 0) {
+ SOCKET_CLOSE(client_sock);
+ }
+
INFO("start accepting socket...\n");
if (0 > (client_sock = accept(
is_force_close_client = 0;
} else {
ERR("skin_server read error (%d): %d\n",
- socket_error(), read_cnt);
+ SOCKET_ERROR(), read_cnt);
perror("skin_server read error : ");
}
break;
}
case RECV_RESPONSE_SHUTDOWN: {
- log_cnt += sprintf( log_buf + log_cnt, "RECV_RESPONSE_SHUTDOWN ==\n" );
- INFO( log_buf );
+ log_cnt += sprintf(log_buf + log_cnt, "RECV_RESPONSE_SHUTDOWN ==\n");
+ INFO(log_buf);
stop_server = 1;
break;
}
default: {
- log_cnt += sprintf( log_buf + log_cnt, "!!! unknown command : %d\n", cmd );
- TRACE( log_buf );
+ log_cnt += sprintf(log_buf + log_cnt, "!!! unknown command : %d\n", cmd);
+ TRACE(log_buf);
- ERR( "!!! unknown command : %d\n", cmd );
+ ERR("!!! unknown command : %d\n", cmd);
break;
}
}
-
}
- }
-
- }
+ } /* end of while */
+ } /* end of while */
stop_heart_beat();
/* clean up */
if (server_sock) {
-#ifdef CONFIG_WIN32
- closesocket(server_sock);
-#else
- close(server_sock);
-#endif
+ SOCKET_CLOSE(server_sock);
+
server_sock = 0;
}
if (booting_handicap_cnt < 5) {
booting_handicap_cnt++;
-#ifdef CONFIG_WIN32
- Sleep(hb_interval * 10); /* 10sec */
-#else
- usleep(hb_interval * 1000 * 10);
-#endif
+ SLEEP(hb_interval * 10); /* 10sec */
} else {
-#ifdef CONFIG_WIN32
- Sleep(hb_interval); /* 1sec */
-#else
- usleep(hb_interval * 1000);
-#endif
+ SLEEP(hb_interval); /* 1sec */
}
if (stop_heartbeat) {
is_force_close_client = 1;
if (client_sock) {
-#ifdef CONFIG_WIN32
- closesocket(client_sock);
-#else
- close(client_sock);
-#endif
+ SOCKET_CLOSE(client_sock);
+
client_sock = 0;
}
stop_server = 1;
if (server_sock) {
-#ifdef CONFIG_WIN32
- closesocket(server_sock);
-#else
- close(server_sock);
-#endif
+ SOCKET_CLOSE(server_sock);
+
server_sock = 0;
}
static void stop_heart_beat(void)
{
+ INFO("stop the heart beat signal\n");
+
stop_heartbeat = 1;
}