ecore/wayland: Make Ecore_Wl_Input private.

It's mostly only used inside ecore_wayland library anyway.

The only bit needed outside of the library is the "seat" pointer, but a
new function was added to retrieve such pointer from Ecore_Wl_Input.
This commit is contained in:
Rafael Antognolli 2013-10-31 19:09:30 -02:00
parent 35d2f195de
commit e56428f4ad
4 changed files with 74 additions and 56 deletions

View File

@ -109,58 +109,6 @@ struct _Ecore_Wl_Output
void *data;
};
struct _Ecore_Wl_Input
{
Ecore_Wl_Display *display;
struct wl_seat *seat;
struct wl_pointer *pointer;
struct wl_keyboard *keyboard;
struct wl_touch *touch;
const char *cursor_name;
struct wl_cursor *cursor;
struct wl_surface *cursor_surface;
struct wl_callback *cursor_frame_cb;
Ecore_Timer *cursor_timer;
unsigned int cursor_current_index;
struct wl_data_device *data_device;
struct wl_data_source *data_source;
struct wl_array data_types;
Ecore_Wl_Window *pointer_focus;
Ecore_Wl_Window *keyboard_focus;
unsigned int button;
unsigned int timestamp;
unsigned int modifiers;
unsigned int pointer_enter_serial;
int sx, sy;
struct wl_list link;
Ecore_Wl_Window *grab;
unsigned int grab_button;
Ecore_Wl_Dnd_Source *drag_source;
Ecore_Wl_Dnd_Source *selection_source;
struct
{
struct xkb_keymap *keymap;
struct xkb_state *state;
xkb_mod_mask_t control_mask;
xkb_mod_mask_t alt_mask;
xkb_mod_mask_t shift_mask;
} xkb;
struct
{
Ecore_Timer *tmr;
unsigned int sym, key, time;
} repeat;
};
struct _Ecore_Wl_Window
{
Ecore_Wl_Display *display;
@ -524,6 +472,7 @@ EAPI void ecore_wl_input_ungrab(Ecore_Wl_Input *input);
EAPI void ecore_wl_input_pointer_set(Ecore_Wl_Input *input, struct wl_surface *surface, int hot_x, int hot_y);
EAPI void ecore_wl_input_cursor_from_name_set(Ecore_Wl_Input *input, const char *cursor_name);
EAPI void ecore_wl_input_cursor_default_restore(Ecore_Wl_Input *input);
EAPI struct wl_seat *ecore_wl_input_seat_get(Ecore_Wl_Input *input);
EAPI struct wl_list *ecore_wl_outputs_get(void);

View File

@ -287,6 +287,19 @@ ecore_wl_input_get(void)
return _ecore_wl_disp->input;
}
/**
* @since 1.8
*/
EAPI struct wl_seat *
ecore_wl_input_seat_get(Ecore_Wl_Input *input)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!input) return NULL;
return input->seat;
}
/* local functions */
void
_ecore_wl_input_add(Ecore_Wl_Display *ewd, unsigned int id)

View File

@ -92,6 +92,58 @@ struct _Ecore_Wl_Display
void *data;
};
struct _Ecore_Wl_Input
{
Ecore_Wl_Display *display;
struct wl_seat *seat;
struct wl_pointer *pointer;
struct wl_keyboard *keyboard;
struct wl_touch *touch;
const char *cursor_name;
struct wl_cursor *cursor;
struct wl_surface *cursor_surface;
struct wl_callback *cursor_frame_cb;
Ecore_Timer *cursor_timer;
unsigned int cursor_current_index;
struct wl_data_device *data_device;
struct wl_data_source *data_source;
struct wl_array data_types;
Ecore_Wl_Window *pointer_focus;
Ecore_Wl_Window *keyboard_focus;
unsigned int button;
unsigned int timestamp;
unsigned int modifiers;
unsigned int pointer_enter_serial;
int sx, sy;
struct wl_list link;
Ecore_Wl_Window *grab;
unsigned int grab_button;
Ecore_Wl_Dnd_Source *drag_source;
Ecore_Wl_Dnd_Source *selection_source;
struct
{
struct xkb_keymap *keymap;
struct xkb_state *state;
xkb_mod_mask_t control_mask;
xkb_mod_mask_t alt_mask;
xkb_mod_mask_t shift_mask;
} xkb;
struct
{
Ecore_Timer *tmr;
unsigned int sym, key, time;
} repeat;
};
struct _Ecore_Wl_Dnd
{
Ecore_Wl_Display *ewd;

View File

@ -619,13 +619,18 @@ wayland_im_context_focus_in(Ecore_IMF_Context *ctx)
{
WaylandIMContext *imcontext = (WaylandIMContext *)ecore_imf_context_data_get(ctx);
Ecore_Wl_Input *input;
struct wl_seat *seat;
EINA_LOG_DOM_INFO(_ecore_imf_wayland_log_dom, "focus-in");
if (!imcontext->window) return;
input = imcontext->window->keyboard_device;
if (!input || !input->seat)
if (!input)
return;
seat = ecore_wl_input_seat_get(input);
if (!seat)
return;
imcontext->input = input;
@ -633,8 +638,7 @@ wayland_im_context_focus_in(Ecore_IMF_Context *ctx)
if (imcontext->text_input)
{
wl_text_input_show_input_panel(imcontext->text_input);
wl_text_input_activate(imcontext->text_input,
input->seat,
wl_text_input_activate(imcontext->text_input, seat,
ecore_wl_window_surface_get(imcontext->window));
}
}
@ -650,7 +654,7 @@ wayland_im_context_focus_out(Ecore_IMF_Context *ctx)
if (imcontext->text_input)
wl_text_input_deactivate(imcontext->text_input,
imcontext->input->seat);
ecore_wl_input_seat_get(imcontext->input));
imcontext->input = NULL;
}