#include "emotion_gstreamer.h"
#include "Emotion.h"
+Eina_Bool window_manager_video = EINA_FALSE;
int _emotion_gstreamer_log_domain = -1;
Eina_Bool debug_fps = EINA_FALSE;
void **video,
Emotion_Module_Options *opt)
{
+#ifdef HAVE_ECORE_X
+ Ecore_X_Window *roots;
+ int num;
+#endif
+
if (!module)
return EINA_FALSE;
eina_threads_init();
+#ifdef HAVE_ECORE_X
+ /* Check if the window manager is able to handle our special Xv window. */
+ roots = ecore_x_window_root_list(&num);
+ if (roots && num > 0)
+ {
+ Ecore_X_Window win, twin;
+ int nwins;
+
+ nwins = ecore_x_window_prop_window_get(roots[0],
+ ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK,
+ &win, 1);
+ if (nwins > 0)
+ {
+ nwins = ecore_x_window_prop_window_get(win,
+ ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK,
+ &twin, 1);
+ if (nwins > 0 && twin == win)
+ {
+ Ecore_X_Atom *supported;
+ int supported_num;
+ int i;
+
+ if (ecore_x_netwm_supported_get(roots[0], &supported, &supported_num))
+ {
+ Eina_Bool parent = EINA_FALSE;
+ Eina_Bool video_position = EINA_FALSE;
+
+ for (i = 0; i < supported_num; ++i)
+ {
+ if (supported[i] == ECORE_X_ATOM_E_VIDEO_PARENT)
+ parent = EINA_TRUE;
+ else if (supported[i] == ECORE_X_ATOM_E_VIDEO_POSITION)
+ video_position = EINA_TRUE;
+ if (parent && video_position)
+ break;
+ }
+
+ if (parent && video_position)
+ {
+ window_manager_video = EINA_TRUE;
+ }
+ }
+ }
+ }
+ }
+ free(roots);
+#endif
+
*module = &em_module;
return EINA_TRUE;
}
}
#if defined HAVE_ECORE_X && defined HAVE_XOVERLAY_H
- engines = evas_render_method_list();
+ if (window_manager_video)
+ {
+ engines = evas_render_method_list();
- engine = eina_list_nth(engines, evas_output_method_get(evas_object_evas_get(obj)) - 1);
+ engine = eina_list_nth(engines, evas_output_method_get(evas_object_evas_get(obj)) - 1);
- if (ev->priority && engine && strstr(engine, "_x11") != NULL)
- {
- Ecore_Evas *ee;
- Evas_Coord x, y, w, h;
- Ecore_X_Window win;
- Ecore_X_Window parent;
+ if (ev->priority && engine && strstr(engine, "_x11") != NULL)
+ {
+ Ecore_Evas *ee;
+ Evas_Coord x, y, w, h;
+ Ecore_X_Window win;
+ Ecore_X_Window parent;
- evas_object_geometry_get(obj, &x, &y, &w, &h);
+ evas_object_geometry_get(obj, &x, &y, &w, &h);
- ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
+ ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
- if (w < 4) w = 4;
- if (h < 2) h = 2;
+ if (w < 4) w = 4;
+ if (h < 2) h = 2;
- /* Here we really need to have the help of the window manager, this code will change when we update E17. */
- parent = (Ecore_X_Window) ecore_evas_window_get(ee);
- fprintf(stderr, "parent: %x\n", parent);
+ /* Here we really need to have the help of the window manager, this code will change when we update E17. */
+ parent = (Ecore_X_Window) ecore_evas_window_get(ee);
+ fprintf(stderr, "parent: %x\n", parent);
- win = ecore_x_window_new(0, x, y, w, h);
- fprintf(stderr, "creating window: %x [%i, %i, %i, %i]\n", win, x, y, w, h);
- if (win)
- {
- ecore_x_mwm_borderless_set(win, EINA_TRUE);
- ecore_x_window_show(win);
- xvsink = gst_element_factory_make("xvimagesink", NULL);
- if (xvsink)
- {
- unsigned int pos[2];
+ win = ecore_x_window_new(0, x, y, w, h);
+ fprintf(stderr, "creating window: %x [%i, %i, %i, %i]\n", win, x, y, w, h);
+ if (win)
+ {
+ /* ecore_x_mwm_borderless_set(win, EINA_TRUE); */
+ ecore_x_window_hide(win);
+ xvsink = gst_element_factory_make("xvimagesink", NULL);
+ if (xvsink)
+ {
+ unsigned int pos[2];
#ifdef HAVE_X_OVERLAY_SET
- gst_x_overlay_set_window_handle(GST_X_OVERLAY(xvsink), win);
+ gst_x_overlay_set_window_handle(GST_X_OVERLAY(xvsink), win);
#else
- gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(xvsink), win);
+ gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(xvsink), win);
#endif
- ev->win = win;
-
- ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_VIDEO_PARENT, &parent, 1);
-
- pos[0] = x; pos[1] = y;
- ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_VIDEO_POSITION, pos, 2);
- }
- else
- {
- fprintf(stderr, "destroying win: %x\n", win);
- ecore_x_window_free(win);
- }
- }
+ ev->win = win;
+
+ ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_VIDEO_PARENT, &parent, 1);
+
+ pos[0] = x; pos[1] = y;
+ ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_VIDEO_POSITION, pos, 2);
+ }
+ else
+ {
+ fprintf(stderr, "destroying win: %x\n", win);
+ ecore_x_window_free(win);
+ }
+ }
+ }
+ evas_render_method_list_free(engines);
}
- evas_render_method_list_free(engines);
#else
# warning "no ecore_x or xoverlay"
#endif