2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
21 #include <Elementary.h>
25 # define PACKAGE "CBHM"
29 # define APPNAME "Clipboard History Manager"
32 #if !defined(LOCALEDIR)
33 # define LOCALEDIR "/usr/share/locale"
36 #define CBHM_MAGIC 0xad960009
38 typedef struct _TargetHandler TargetHandler;
39 typedef struct _AppData AppData;
40 typedef struct _ClipdrawerData ClipdrawerData;
41 typedef struct _CNP_ITEM CNP_ITEM;
42 typedef struct _XHandlerData XHandlerData;
43 typedef struct _SCaptureData SCaptureData;
44 typedef struct _StorageData StorageData;
45 typedef char *(*text_converter_func)(AppData *ad, int type_index, const char *str);
47 #include "clipdrawer.h"
48 #include "item_manager.h"
50 #include "xconverter.h"
51 #include "scrcapture.h"
54 struct _TargetHandler {
58 text_converter_func convert_for_entry;
59 text_converter_func convert_to_target[ATOM_INDEX_MAX];
64 Ecore_X_Display *x_disp;
65 Ecore_X_Window x_root_win;
66 Ecore_X_Window x_event_win;
67 Ecore_X_Window x_active_win;
70 Eina_Bool (*draw_item_add)(AppData *ad, CNP_ITEM *item);
71 Eina_Bool (*draw_item_del)(AppData *ad, CNP_ITEM *item);
72 Eina_Bool (*storage_item_add)(AppData *ad, CNP_ITEM *item);
73 Eina_Bool (*storage_item_del)(AppData *ad, CNP_ITEM *item);
74 // CNP_ITEM *(*storage_item_load)(AppData *ad, int index);
76 ClipdrawerData *clipdrawer;
77 XHandlerData *xhandler;
78 SCaptureData *screencapture;
81 CNP_ITEM *clip_selected_item;
82 TargetHandler targetAtoms[ATOM_INDEX_MAX];
85 void *d_malloc(char *func, int line, size_t size);
86 void *d_calloc(char *func, int line, size_t n, size_t size);
87 void d_free(char *func, int line, void *m);
92 #define DTRACE(fmt, args...) \
93 {do { fprintf(stderr, "[%s:%04d] " fmt, __func__,__LINE__, ##args); } while (0); }
94 #define DMSG(fmt, args...) printf("[%s] " fmt, __func__, ## args )
95 #define CALLED() printf("called %s, %s\n", __FILE__, __func__);
96 #define DTIME(fmt, args...) \
97 {do { struct timeval tv1; gettimeofday(&tv1, NULL); double t1=tv1.tv_sec+(tv1.tv_usec/1000000.0); fprintf(stderr, "[CBHM][time=%lf:%s:%04d] " fmt, t1, __func__, __LINE__, ##args); } while (0); }
99 #define MALLOC(size) d_malloc(__func__, __LINE__, size)
100 #define CALLOC(n, size) d_calloc(__func__, __LINE__, n, size)
101 #define FREE(p) d_free(__func__, __LINE__, p)
103 #define MALLOC(size) malloc(size)
104 #define CALLOC(n, size) calloc(n, size)
105 #define FREE(p) free(p)
108 #define DMSG(fmt, args...)
110 #define DTIME(fmt, args...)
111 #define MALLOC(size) malloc(size)
112 #define CALLOC(n, size) calloc(n, size)
113 #define FREE(p) free(p)