4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
7 * Jaeho Lee <jaeho81.lee@samsung.com>
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
24 #include "syspopup_core.h"
26 #include "syspopup_api.h"
27 #include "simple_util.h"
30 #include <Ecore_Input.h>
33 static Eina_Bool __x_keypress_cb(void *data, int type, void *event)
36 Ecore_Event_Key *ev = event;
41 X_syspopup_process_keypress(id, ev->keyname);
43 return ECORE_CALLBACK_RENEW;
46 #ifdef ROTATE_USING_X_CLIENT
47 static Eina_Bool __x_rotate_cb(void *data, int type, void *event)
50 Ecore_X_Event_Client_Message *ev = event;
53 return ECORE_CALLBACK_RENEW;
55 if (ev->message_type == ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE)
56 X_syspopup_process_rotate(id);
58 return ECORE_CALLBACK_RENEW;
61 static int __efl_rotate(Display *dpy, Window win, syspopup *sp)
65 rotation = X_syspopup_rotation_get(dpy, win);
72 elm_win_rotation_with_resize_set(sp->win, rotation);
77 static int __efl_rotate(Display *dpy, Window win, syspopup *sp)
83 API int syspopup_create(bundle *b, syspopup_handler *handler,
84 Evas_Object *parent, void *user_data)
88 const char *popup_name;
91 XWindowAttributes attr;
92 int is_unviewable = 0;
94 popup_name = _syspopup_get_name_from_bundle(b);
95 if (popup_name == NULL || handler == NULL) {
96 _E("popup_name or handler is NULL");
100 if (parent == NULL) {
101 _E("parent window is NULL");
105 sp = _syspopup_find(popup_name);
107 _E("already exist - syspopup %s", popup_name);
110 xwin = elm_win_xwindow_get(parent);
111 dpy = ecore_x_display_get();
113 id = X_make_syspopup(b, dpy, xwin, parent, __efl_rotate,
116 _E("fail to make X syspopup");
120 /* X_syspopup_core should process 2 events */
121 /* First, rotate event */
122 /* Second, keypress event */
123 utilx_grab_key(dpy, xwin, KEY_BACK, TOP_POSITION_GRAB);
124 ecore_event_handler_add(ECORE_EVENT_KEY_UP, __x_keypress_cb, (void *)id);
126 #ifdef ROTATE_USING_X_CLIENT
127 ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE,__x_rotate_cb, (void *)id);
134 API int syspopup_reset(bundle *b)
136 return X_syspopup_reset(b);