summaryrefslogtreecommitdiff
path: root/src/modules/ecore_evas/engines/x/ecore_evas_x.c
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2020-01-05 15:05:36 +0100
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-03-08 10:59:25 +0100
commit39f3ce42dcde447779cb1583501b681ba85d86d4 (patch)
tree4bb1c113250dbabbcd8ee6405c34c8539bf53004 /src/modules/ecore_evas/engines/x/ecore_evas_x.c
parent40a62ddf94f590b2e79caf63eb399d9bc257b216 (diff)
ecore_evas: Introduce cnp / dnd API for ecore evas
The idea of copy and paste here is: - The user specifies the content he wants to have in the selection buffer with a Eina_Content, these content pointer ownerships are passed to the called. Internally ecore_evas code will memorieze the pointer, and pass on function callbacks to the modules, which then do not have to deal with the ownership. - In case the module does not specify these APIs, the callback implementation will be called, which only works for cnp *not* dnd. - Action and mime types are handled as strings, which allows way better custom organisations. (The docs needs improvement) Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Differential Revision: https://phab.enlightenment.org/D11192
Diffstat (limited to '')
-rw-r--r--src/modules/ecore_evas/engines/x/ecore_evas_x.c73
1 files changed, 38 insertions, 35 deletions
diff --git a/src/modules/ecore_evas/engines/x/ecore_evas_x.c b/src/modules/ecore_evas/engines/x/ecore_evas_x.c
index abea314d33..fb6eaa63f1 100644
--- a/src/modules/ecore_evas/engines/x/ecore_evas_x.c
+++ b/src/modules/ecore_evas/engines/x/ecore_evas_x.c
@@ -361,7 +361,7 @@ _ecore_evas_x_aux_hints_supported_update(Ecore_Evas *ee)
361 for (i = 0; i < num; i++) 361 for (i = 0; i < num; i++)
362 { 362 {
363 hint = eina_stringshare_add(str[i]); 363 hint = eina_stringshare_add(str[i]);
364 ee->prop.aux_hint.supported_list = 364 ee->prop.aux_hint.supported_list =
365 eina_list_append(ee->prop.aux_hint.supported_list, hint); 365 eina_list_append(ee->prop.aux_hint.supported_list, hint);
366 } 366 }
367 367
@@ -414,7 +414,7 @@ _ecore_evas_x_gl_window_new(Ecore_Evas *ee, Ecore_X_Window parent, int x, int y,
414 op++; 414 op++;
415 einfo->vsync = opt[op]; 415 einfo->vsync = opt[op];
416 } 416 }
417#ifdef EVAS_ENGINE_GL_X11_SWAP_MODE_EXISTS 417#ifdef EVAS_ENGINE_GL_X11_SWAP_MODE_EXISTS
418 else if (opt[op] == ECORE_EVAS_GL_X11_OPT_SWAP_MODE) 418 else if (opt[op] == ECORE_EVAS_GL_X11_OPT_SWAP_MODE)
419 { 419 {
420 op++; 420 op++;
@@ -845,7 +845,7 @@ _ecore_evas_x_event_property_change(void *data EINA_UNUSED, int type EINA_UNUSED
845 Eina_Bool focus_skip : 1; 845 Eina_Bool focus_skip : 1;
846 } prop; 846 } prop;
847 } prev; 847 } prev;
848 848
849 prev.x.modal = edata->state.modal; 849 prev.x.modal = edata->state.modal;
850 prev.x.sticky = edata->state.sticky; 850 prev.x.sticky = edata->state.sticky;
851 prev.x.maximized_v = edata->state.maximized_v; 851 prev.x.maximized_v = edata->state.maximized_v;
@@ -856,7 +856,7 @@ _ecore_evas_x_event_property_change(void *data EINA_UNUSED, int type EINA_UNUSED
856 prev.x.fullscreen = edata->state.fullscreen; 856 prev.x.fullscreen = edata->state.fullscreen;
857 prev.x.above = edata->state.above; 857 prev.x.above = edata->state.above;
858 prev.x.below = edata->state.below; 858 prev.x.below = edata->state.below;
859 859
860 prev.prop.modal = ee->prop.modal; 860 prev.prop.modal = ee->prop.modal;
861 prev.prop.maximized = ee->prop.maximized; 861 prev.prop.maximized = ee->prop.maximized;
862 prev.prop.sticky = ee->prop.sticky; 862 prev.prop.sticky = ee->prop.sticky;
@@ -879,7 +879,7 @@ _ecore_evas_x_event_property_change(void *data EINA_UNUSED, int type EINA_UNUSED
879 ee->prop.sticky = EINA_FALSE; 879 ee->prop.sticky = EINA_FALSE;
880 ee->prop.fullscreen = EINA_FALSE; 880 ee->prop.fullscreen = EINA_FALSE;
881// ee->prop.focus_skip = EINA_FALSE; 881// ee->prop.focus_skip = EINA_FALSE;
882 882
883 ecore_x_netwm_window_state_get(e->win, &state, &num); 883 ecore_x_netwm_window_state_get(e->win, &state, &num);
884 if (state) 884 if (state)
885 { 885 {
@@ -1253,7 +1253,7 @@ _ecore_evas_x_event_mouse_in(void *data EINA_UNUSED, int type EINA_UNUSED, void
1253 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */ 1253 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */
1254 if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; 1254 if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
1255 edata = ee->engine.data; 1255 edata = ee->engine.data;
1256/* 1256/*
1257 { 1257 {
1258 time_t t; 1258 time_t t;
1259 char *ct; 1259 char *ct;
@@ -1304,7 +1304,7 @@ _ecore_evas_x_event_mouse_in(void *data EINA_UNUSED, int type EINA_UNUSED, void
1304 edata->outdelay = NULL; 1304 edata->outdelay = NULL;
1305 _fake_out(ee); 1305 _fake_out(ee);
1306 } 1306 }
1307 1307
1308 /* if (e->mode != ECORE_X_EVENT_MODE_NORMAL) return 0; */ 1308 /* if (e->mode != ECORE_X_EVENT_MODE_NORMAL) return 0; */
1309 if (!_ecore_evas_mouse_in_check(ee, NULL)) 1309 if (!_ecore_evas_mouse_in_check(ee, NULL))
1310 { 1310 {
@@ -1388,7 +1388,7 @@ _ecore_evas_x_event_mouse_out(void *data EINA_UNUSED, int type EINA_UNUSED, void
1388 ecore_timer_del(edata->outdelay); 1388 ecore_timer_del(edata->outdelay);
1389 edata->outdelay = NULL; 1389 edata->outdelay = NULL;
1390 } 1390 }
1391 1391
1392// if (e->mode != ECORE_X_EVENT_MODE_NORMAL) return 0; 1392// if (e->mode != ECORE_X_EVENT_MODE_NORMAL) return 0;
1393// printf("OUT: ee->in=%i, e->mode=%i, e->detail=%i, dount_count=%i\n", 1393// printf("OUT: ee->in=%i, e->mode=%i, e->detail=%i, dount_count=%i\n",
1394// ee->in, e->mode, e->detail, evas_event_down_count_get(ee->evas)); 1394// ee->in, e->mode, e->detail, evas_event_down_count_get(ee->evas));
@@ -1417,7 +1417,7 @@ _ecore_evas_x_event_window_focus_in(void *data EINA_UNUSED, int type EINA_UNUSED
1417 ee = ecore_event_window_match(e->win); 1417 ee = ecore_event_window_match(e->win);
1418 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */ 1418 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */
1419 if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; 1419 if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
1420//xx// filtering with these doesnt help 1420//xx// filtering with these doesnt help
1421//xx// if (e->mode == ECORE_X_EVENT_MODE_UNGRAB) return ECORE_CALLBACK_PASS_ON; 1421//xx// if (e->mode == ECORE_X_EVENT_MODE_UNGRAB) return ECORE_CALLBACK_PASS_ON;
1422 _ecore_evas_focus_device_set(ee, NULL, EINA_TRUE); 1422 _ecore_evas_focus_device_set(ee, NULL, EINA_TRUE);
1423 return ECORE_CALLBACK_PASS_ON; 1423 return ECORE_CALLBACK_PASS_ON;
@@ -1433,7 +1433,7 @@ _ecore_evas_x_event_window_focus_out(void *data EINA_UNUSED, int type EINA_UNUSE
1433 ee = ecore_event_window_match(e->win); 1433 ee = ecore_event_window_match(e->win);
1434 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */ 1434 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */
1435 if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; 1435 if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
1436//xx// filtering with these doesnt help 1436//xx// filtering with these doesnt help
1437//xx// if (e->mode == ECORE_X_EVENT_MODE_GRAB) return ECORE_CALLBACK_PASS_ON; 1437//xx// if (e->mode == ECORE_X_EVENT_MODE_GRAB) return ECORE_CALLBACK_PASS_ON;
1438 1438
1439// if (ee->prop.fullscreen) 1439// if (ee->prop.fullscreen)
@@ -2145,7 +2145,7 @@ _ecore_evas_x_resize(Ecore_Evas *ee, int w, int h)
2145 } 2145 }
2146 2146
2147 /* check for valid property window 2147 /* check for valid property window
2148 * 2148 *
2149 * NB: If we do not have one, check for valid pixmap rendering */ 2149 * NB: If we do not have one, check for valid pixmap rendering */
2150 if (!ee->prop.window) 2150 if (!ee->prop.window)
2151 { 2151 {
@@ -2153,7 +2153,7 @@ _ecore_evas_x_resize(Ecore_Evas *ee, int w, int h)
2153 if ((edata->pixmap.w != vw) || (edata->pixmap.h != vh)) 2153 if ((edata->pixmap.w != vw) || (edata->pixmap.h != vh))
2154 { 2154 {
2155 /* free the backing pixmap */ 2155 /* free the backing pixmap */
2156 if (edata->pixmap.back) 2156 if (edata->pixmap.back)
2157 ecore_x_pixmap_free(edata->pixmap.back); 2157 ecore_x_pixmap_free(edata->pixmap.back);
2158 } 2158 }
2159 } 2159 }
@@ -2918,7 +2918,7 @@ _ecore_evas_x_aspect_set(Ecore_Evas *ee, double aspect)
2918 2918
2919 ee->prop.aspect = aspect; 2919 ee->prop.aspect = aspect;
2920 _ecore_evas_x_size_pos_hints_update(ee); 2920 _ecore_evas_x_size_pos_hints_update(ee);
2921// netwm state 2921// netwm state
2922// if (ee->should_be_visible) 2922// if (ee->should_be_visible)
2923// ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root, 2923// ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root,
2924// ECORE_X_WINDOW_STATE_STICKY, -1, sticky); 2924// ECORE_X_WINDOW_STATE_STICKY, -1, sticky);
@@ -3545,14 +3545,14 @@ norandr:
3545 if (!found) goto norandr; 3545 if (!found) goto norandr;
3546} 3546}
3547 3547
3548static void 3548static void
3549_ecore_evas_x_pointer_xy_get(const Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y) 3549_ecore_evas_x_pointer_xy_get(const Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y)
3550{ 3550{
3551 if (ee->prop.window) 3551 if (ee->prop.window)
3552 ecore_x_pointer_xy_get(ee->prop.window, x, y); 3552 ecore_x_pointer_xy_get(ee->prop.window, x, y);
3553} 3553}
3554 3554
3555static Eina_Bool 3555static Eina_Bool
3556_ecore_evas_x_pointer_warp(const Ecore_Evas *ee, Evas_Coord x, Evas_Coord y) 3556_ecore_evas_x_pointer_warp(const Ecore_Evas *ee, Evas_Coord x, Evas_Coord y)
3557{ 3557{
3558 return ecore_x_pointer_warp(ee->prop.window, x, y); 3558 return ecore_x_pointer_warp(ee->prop.window, x, y);
@@ -3754,6 +3754,9 @@ static Ecore_Evas_Engine_Func _ecore_x_engine_func =
3754 NULL, //fn_pointer_device_xy_get 3754 NULL, //fn_pointer_device_xy_get
3755 NULL, //fn_prepare 3755 NULL, //fn_prepare
3756 NULL, //fn_last_tick_get 3756 NULL, //fn_last_tick_get
3757 NULL, //fn_selection_claim
3758 NULL, //fn_selection_has_owner
3759 NULL, //fn_selection_request
3757}; 3760};
3758 3761
3759/* 3762/*
@@ -3772,19 +3775,19 @@ _ecore_evas_x_render_pre(void *data, Evas *e EINA_UNUSED, void *event_info EINA_
3772 /* printf("\tPixman Size: %d %d\n", edata->pixmap.w, edata->pixmap.h); */ 3775 /* printf("\tPixman Size: %d %d\n", edata->pixmap.w, edata->pixmap.h); */
3773 /* printf("\tEE Size: %d %d\n", ee->w, ee->h); */ 3776 /* printf("\tEE Size: %d %d\n", ee->w, ee->h); */
3774 3777
3775 /* before rendering to the back buffer pixmap, we should check the 3778 /* before rendering to the back buffer pixmap, we should check the
3776 * size. If the back buffer is not the proper size, destroy it and 3779 * size. If the back buffer is not the proper size, destroy it and
3777 * create a new one at the proper size */ 3780 * create a new one at the proper size */
3778 if ((edata->pixmap.w != ee->w) || (edata->pixmap.h != ee->h)) 3781 if ((edata->pixmap.w != ee->w) || (edata->pixmap.h != ee->h))
3779 { 3782 {
3780 int fw = 0, fh = 0; 3783 int fw = 0, fh = 0;
3781 3784
3782 /* free the backing pixmap */ 3785 /* free the backing pixmap */
3783 if (edata->pixmap.back) 3786 if (edata->pixmap.back)
3784 ecore_x_pixmap_free(edata->pixmap.back); 3787 ecore_x_pixmap_free(edata->pixmap.back);
3785 3788
3786 edata->pixmap.back = 3789 edata->pixmap.back =
3787 ecore_x_pixmap_new(edata->win_root, ee->w, ee->h, 3790 ecore_x_pixmap_new(edata->win_root, ee->w, ee->h,
3788 edata->pixmap.depth); 3791 edata->pixmap.depth);
3789 3792
3790 evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh); 3793 evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
@@ -3803,7 +3806,7 @@ _ecore_evas_x_render_pre(void *data, Evas *e EINA_UNUSED, void *event_info EINA_
3803 3806
3804 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) 3807 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
3805 { 3808 {
3806 ERR("evas_engine_info_set() init engine '%s' failed.", 3809 ERR("evas_engine_info_set() init engine '%s' failed.",
3807 ee->driver); 3810 ee->driver);
3808 } 3811 }
3809 } 3812 }
@@ -3821,7 +3824,7 @@ _ecore_evas_x_render_pre(void *data, Evas *e EINA_UNUSED, void *event_info EINA_
3821 3824
3822 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) 3825 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
3823 { 3826 {
3824 ERR("evas_engine_info_set() init engine '%s' failed.", 3827 ERR("evas_engine_info_set() init engine '%s' failed.",
3825 ee->driver); 3828 ee->driver);
3826 } 3829 }
3827 } 3830 }
@@ -3844,8 +3847,8 @@ _ecore_evas_x_flush_post(void *data, Evas *e EINA_UNUSED, void *event_info EINA_
3844 /* printf("\tBack Pixmap: %d\n", edata->pixmap.back); */ 3847 /* printf("\tBack Pixmap: %d\n", edata->pixmap.back); */
3845 /* printf("\tFront Pixmap: %d\n", edata->pixmap.front); */ 3848 /* printf("\tFront Pixmap: %d\n", edata->pixmap.front); */
3846 3849
3847 /* done drawing to the back buffer. flip it to the front so that 3850 /* done drawing to the back buffer. flip it to the front so that
3848 * any calls to "fetch pixmap" will return the front buffer already 3851 * any calls to "fetch pixmap" will return the front buffer already
3849 * pre-rendered */ 3852 * pre-rendered */
3850 3853
3851 /* record the current front buffer */ 3854 /* record the current front buffer */
@@ -3870,7 +3873,7 @@ _ecore_evas_x_flush_post(void *data, Evas *e EINA_UNUSED, void *event_info EINA_
3870 3873
3871 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) 3874 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
3872 { 3875 {
3873 ERR("evas_engine_info_set() init engine '%s' failed.", 3876 ERR("evas_engine_info_set() init engine '%s' failed.",
3874 ee->driver); 3877 ee->driver);
3875 } 3878 }
3876 } 3879 }
@@ -3888,7 +3891,7 @@ _ecore_evas_x_flush_post(void *data, Evas *e EINA_UNUSED, void *event_info EINA_
3888 3891
3889 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) 3892 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
3890 { 3893 {
3891 ERR("evas_engine_info_set() init engine '%s' failed.", 3894 ERR("evas_engine_info_set() init engine '%s' failed.",
3892 ee->driver); 3895 ee->driver);
3893 } 3896 }
3894 } 3897 }
@@ -4307,9 +4310,9 @@ ecore_evas_software_x11_pixmap_new_internal(const char *disp_name, Ecore_X_Windo
4307 edata->pixmap.colormap = einfo->info.colormap; 4310 edata->pixmap.colormap = einfo->info.colormap;
4308 4311
4309 /* create front and back pixmaps for double-buffer rendering */ 4312 /* create front and back pixmaps for double-buffer rendering */
4310 edata->pixmap.front = 4313 edata->pixmap.front =
4311 ecore_x_pixmap_new(parent, w, h, edata->pixmap.depth); 4314 ecore_x_pixmap_new(parent, w, h, edata->pixmap.depth);
4312 edata->pixmap.back = 4315 edata->pixmap.back =
4313 ecore_x_pixmap_new(parent, w, h, edata->pixmap.depth); 4316 ecore_x_pixmap_new(parent, w, h, edata->pixmap.depth);
4314 4317
4315 einfo->info.drawable = edata->pixmap.back; 4318 einfo->info.drawable = edata->pixmap.back;
@@ -4322,7 +4325,7 @@ ecore_evas_software_x11_pixmap_new_internal(const char *disp_name, Ecore_X_Windo
4322 } 4325 }
4323 } 4326 }
4324 4327
4325 /* FIXME: Allow of these set properties or do something with the 4328 /* FIXME: Allow of these set properties or do something with the
4326 * ee->prop.window (x window), which we do not have in pixmap case */ 4329 * ee->prop.window (x window), which we do not have in pixmap case */
4327 4330
4328 /* _ecore_evas_x_hints_update(ee); */ 4331 /* _ecore_evas_x_hints_update(ee); */
@@ -4370,7 +4373,7 @@ _ecore_evas_software_x11_pixmap_visual_get(const Ecore_Evas *ee)
4370 return edata->pixmap.visual; 4373 return edata->pixmap.visual;
4371} 4374}
4372 4375
4373static unsigned long 4376static unsigned long
4374_ecore_evas_software_x11_pixmap_colormap_get(const Ecore_Evas *ee) 4377_ecore_evas_software_x11_pixmap_colormap_get(const Ecore_Evas *ee)
4375{ 4378{
4376 if (!(!strcmp(ee->driver, "software_x11"))) return 0; 4379 if (!(!strcmp(ee->driver, "software_x11"))) return 0;
@@ -4378,7 +4381,7 @@ _ecore_evas_software_x11_pixmap_colormap_get(const Ecore_Evas *ee)
4378 return edata->pixmap.colormap; 4381 return edata->pixmap.colormap;
4379} 4382}
4380 4383
4381static int 4384static int
4382_ecore_evas_software_x11_pixmap_depth_get(const Ecore_Evas *ee) 4385_ecore_evas_software_x11_pixmap_depth_get(const Ecore_Evas *ee)
4383{ 4386{
4384 if (!(!strcmp(ee->driver, "software_x11"))) return 0; 4387 if (!(!strcmp(ee->driver, "software_x11"))) return 0;
@@ -4719,9 +4722,9 @@ ecore_evas_gl_x11_pixmap_new_internal(const char *disp_name, Ecore_X_Window pare
4719 edata->pixmap.colormap = einfo->info.colormap; 4722 edata->pixmap.colormap = einfo->info.colormap;
4720 4723
4721 /* create front and back pixmaps for double-buffer rendering */ 4724 /* create front and back pixmaps for double-buffer rendering */
4722 edata->pixmap.front = 4725 edata->pixmap.front =
4723 ecore_x_pixmap_new(parent, w, h, edata->pixmap.depth); 4726 ecore_x_pixmap_new(parent, w, h, edata->pixmap.depth);
4724 edata->pixmap.back = 4727 edata->pixmap.back =
4725 ecore_x_pixmap_new(parent, w, h, edata->pixmap.depth); 4728 ecore_x_pixmap_new(parent, w, h, edata->pixmap.depth);
4726 4729
4727 einfo->info.drawable = edata->pixmap.back; 4730 einfo->info.drawable = edata->pixmap.back;
@@ -4779,7 +4782,7 @@ _ecore_evas_gl_x11_pixmap_visual_get(const Ecore_Evas *ee)
4779 return edata->pixmap.visual; 4782 return edata->pixmap.visual;
4780} 4783}
4781 4784
4782static unsigned long 4785static unsigned long
4783_ecore_evas_gl_x11_pixmap_colormap_get(const Ecore_Evas *ee) 4786_ecore_evas_gl_x11_pixmap_colormap_get(const Ecore_Evas *ee)
4784{ 4787{
4785 if (!(!strcmp(ee->driver, "opengl_x11"))) return 0; 4788 if (!(!strcmp(ee->driver, "opengl_x11"))) return 0;
@@ -4787,7 +4790,7 @@ _ecore_evas_gl_x11_pixmap_colormap_get(const Ecore_Evas *ee)
4787 return edata->pixmap.colormap; 4790 return edata->pixmap.colormap;
4788} 4791}
4789 4792
4790static int 4793static int
4791_ecore_evas_gl_x11_pixmap_depth_get(const Ecore_Evas *ee) 4794_ecore_evas_gl_x11_pixmap_depth_get(const Ecore_Evas *ee)
4792{ 4795{
4793 if (!(!strcmp(ee->driver, "opengl_x11"))) return 0; 4796 if (!(!strcmp(ee->driver, "opengl_x11"))) return 0;