summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorChristopher Michael <cpmichael1@comcast.net>2012-08-15 14:01:20 +0000
committerChristopher Michael <cpmichael1@comcast.net>2012-08-15 14:01:20 +0000
commit7a90ffb3b6a59a8f82b895490853270cf85b7b5b (patch)
treefe65936691310a700dd00e6ac7f926737b333ed0 /legacy
parenteb016fe9adef3349a8edc6b2d02fe67d39eb5379 (diff)
Ecore_Wayland: Fix ticket 1252 and stop segfaulting when we don't have
a keyboard or pointer interface available for drag-n-drop. SVN revision: 75295
Diffstat (limited to 'legacy')
-rw-r--r--legacy/ecore/src/lib/ecore_wayland/ecore_wl_dnd.c38
1 files changed, 31 insertions, 7 deletions
diff --git a/legacy/ecore/src/lib/ecore_wayland/ecore_wl_dnd.c b/legacy/ecore/src/lib/ecore_wayland/ecore_wl_dnd.c
index 164693fd30..fbf807517b 100644
--- a/legacy/ecore/src/lib/ecore_wayland/ecore_wl_dnd.c
+++ b/legacy/ecore/src/lib/ecore_wayland/ecore_wl_dnd.c
@@ -40,9 +40,10 @@ _ecore_wl_dnd_enter(void *data, struct wl_data_device *data_device __UNUSED__, u
40 40
41 LOGFN(__FILE__, __LINE__, __FUNCTION__); 41 LOGFN(__FILE__, __LINE__, __FUNCTION__);
42 42
43 if (!(input = data)) return; 43 if ((!(input = data)) || (!offer)) return;
44 44
45 input->drag_source = wl_data_offer_get_user_data(offer); 45 if (!(input->drag_source = wl_data_offer_get_user_data(offer)))
46 return;
46 47
47 win = wl_surface_get_user_data(surface); 48 win = wl_surface_get_user_data(surface);
48// input->pointer_focus = win; 49// input->pointer_focus = win;
@@ -53,7 +54,12 @@ _ecore_wl_dnd_enter(void *data, struct wl_data_device *data_device __UNUSED__, u
53 if (!(event = calloc(1, sizeof(Ecore_Wl_Event_Dnd_Enter)))) return; 54 if (!(event = calloc(1, sizeof(Ecore_Wl_Event_Dnd_Enter)))) return;
54 55
55 event->win = win->id; 56 event->win = win->id;
56 event->source = input->drag_source->input->keyboard_focus->id; 57 if (input->drag_source->input)
58 {
59 if (input->drag_source->input->keyboard_focus)
60 event->source = input->drag_source->input->keyboard_focus->id;
61 }
62
57 event->position.x = wl_fixed_to_int(x); 63 event->position.x = wl_fixed_to_int(x);
58 event->position.y = wl_fixed_to_int(y); 64 event->position.y = wl_fixed_to_int(y);
59 event->num_types = input->drag_source->types.size; 65 event->num_types = input->drag_source->types.size;
@@ -92,8 +98,17 @@ _ecore_wl_dnd_motion(void *data, struct wl_data_device *data_device __UNUSED__,
92 98
93 if (!(event = calloc(1, sizeof(Ecore_Wl_Event_Dnd_Position)))) return; 99 if (!(event = calloc(1, sizeof(Ecore_Wl_Event_Dnd_Position)))) return;
94 100
95 event->win = input->drag_source->input->pointer_focus->id; 101 if (input->drag_source)
96 event->source = input->drag_source->input->keyboard_focus->id; 102 {
103 if (input->drag_source->input)
104 {
105 if (input->drag_source->input->pointer_focus)
106 event->win = input->drag_source->input->pointer_focus->id;
107 if (input->drag_source->input->keyboard_focus)
108 event->source = input->drag_source->input->keyboard_focus->id;
109 }
110 }
111
97 event->position.x = input->sx; 112 event->position.x = input->sx;
98 event->position.y = input->sy; 113 event->position.y = input->sy;
99 114
@@ -112,8 +127,17 @@ _ecore_wl_dnd_drop(void *data, struct wl_data_device *data_device __UNUSED__)
112 127
113 if (!(event = calloc(1, sizeof(Ecore_Wl_Event_Dnd_Drop)))) return; 128 if (!(event = calloc(1, sizeof(Ecore_Wl_Event_Dnd_Drop)))) return;
114 129
115 event->win = input->drag_source->input->pointer_focus->id; 130 if (input->drag_source)
116 event->source = input->drag_source->input->keyboard_focus->id; 131 {
132 if (input->drag_source->input)
133 {
134 if (input->drag_source->input->pointer_focus)
135 event->win = input->drag_source->input->pointer_focus->id;
136 if (input->drag_source->input->keyboard_focus)
137 event->source = input->drag_source->input->keyboard_focus->id;
138 }
139 }
140
117 event->position.x = input->sx; 141 event->position.x = input->sx;
118 event->position.y = input->sy; 142 event->position.y = input->sy;
119 143