4 * Implementations of plugin API functions
9 * change to iterative call, so we need no trigger in a seperate thread
10 * and hence no thread safety measures.
13 mep_asynccall (void *data
)
15 PluginInstance
*pi
= (PluginInstance
*) data
;
16 ecore_main_loop_iterate ();
20 mep_animator (void *data
)
22 PluginInstance
*pi
= (PluginInstance
*) data
;
23 evas_render (pi
->evas
);
28 * this is a bloody hack to enable ecore_main_loop_iterate
29 * ecore_main_loop_iterate does not run in a seperate thread
30 * we therefore send a signal via the X server to the event handle
31 * loop and call ecore_main_loop_iterate from the thread it
32 * was initiated. this works. the method with NPP_PluginAsyncCall
33 * would be ways more elegant, but does not yet work
36 mep_trigger (void *data
)
38 PluginInstance
*pi
= (PluginInstance
*) data
;
41 usleep (10000); // maximal FPS=100
42 NPN_PluginThreadAsyncCall (pi
->instance
, mep_asynccall
, NULL
);
50 NPN_InvalidateRect (pi->instance, &rect);
52 NPN_ForceRedraw (pi->instance);
53 XSendEvent (pi->display, pi->window, 1, NoEventMask, (XEvent *) &(pi->msg));
61 mep_event_handler (Widget xtwidget
, void *data
, XEvent
*xevent
, Boolean
*b
)
63 PluginInstance
*pi
= (PluginInstance
*) data
;
64 Evas
*evas
= pi
->evas
;
67 //printf ("event type: %d\n", ev.type);
72 evas_event_feed_mouse_move(evas
, ev
.xbutton
.x
, ev
.xbutton
.y
, 0, NULL
);
73 evas_event_feed_mouse_down(evas
, ev
.xbutton
.button
, EVAS_BUTTON_NONE
, 0, NULL
);
76 evas_event_feed_mouse_move(evas
, ev
.xbutton
.x
, ev
.xbutton
.y
, 0, NULL
);
77 evas_event_feed_mouse_up(evas
, ev
.xbutton
.button
, EVAS_BUTTON_NONE
, 0, NULL
);
80 evas_event_feed_mouse_move(evas
, ev
.xmotion
.x
, ev
.xmotion
.y
, 0, NULL
);
83 evas_damage_rectangle_add(evas
,
90 evas_output_size_set(evas
,
92 ev
.xconfigure
.height
);
95 evas_object_focus_set (pi
->edj
, 1);
99 evas_object_focus_set (pi
->edj
, 0);
102 case ClientMessage
: // 33
103 if (ev
.xclient
.message_type
== pi
->atom
)
104 ecore_main_loop_iterate ();
113 mep_cb_ui_play (void *data
, Evas_Object
*edj
, const char *emission
, const char *source
)
115 PluginInstance
*pi
= (PluginInstance
*) data
;
116 if (!edje_object_play_get (pi
->edj
)) // if paused
118 edje_object_play_set (pi
->edj
, 1);
119 //edje_object_animation_set (pi->edj, 1);
124 mep_cb_ui_pause (void *data
, Evas_Object
*edj
, const char *emission
, const char *source
)
126 PluginInstance
*pi
= (PluginInstance
*) data
;
127 if (edje_object_play_get (pi
->edj
)) // if playing
129 edje_object_play_set (pi
->edj
, 0);
130 //edje_object_animation_set (pi->edj, 0);
135 mep_cb_ui_save (void *data
, Evas_Object
*edj
, const char *emission
, const char *source
)
137 PluginInstance
*pi
= (PluginInstance
*) data
;
142 mep_cb_ui_config (void *data
, Evas_Object
*edj
, const char *emission
, const char *source
)
144 PluginInstance
*pi
= (PluginInstance
*) data
;
149 mep_configure (PluginInstance
*pi
)
151 char config_path
[256];
152 sprintf (config_path
, "%s/%s", CONFIGDIR
, "config.edb");
153 ecore_config_file_load (config_path
);
154 pi
->config_theme
= strdup (ecore_config_theme_get ("theme"));
155 pi
->config_engine
= strdup (ecore_config_string_get ("engine"));
156 pi
->config_fps
= ecore_config_int_get ("fps");