forked from enlightenment/efl
parent
0b893f7b7c
commit
6dd589c4c4
|
@ -553,6 +553,13 @@ typedef enum _Ecore_X_Window_State {
|
|||
|
||||
} Ecore_X_Window_State;
|
||||
|
||||
typedef enum _Ecore_X_Selection_Target {
|
||||
ECORE_X_SELECTION_TARGET_FILENAME,
|
||||
ECORE_X_SELECTION_TARGET_STRING,
|
||||
ECORE_X_SELECTION_TARGET_UTF8_STRING,
|
||||
ECORE_X_SELECTION_TARGET_TEXT
|
||||
} Ecore_X_Selection_Target;
|
||||
|
||||
int ecore_x_init(const char *name);
|
||||
int ecore_x_shutdown(void);
|
||||
Ecore_X_Display *ecore_x_display_get(void);
|
||||
|
@ -567,6 +574,13 @@ void ecore_x_io_error_handler_set(void (*func) (void *data), const v
|
|||
int ecore_x_error_request_get(void);
|
||||
int ecore_x_error_code_get(void);
|
||||
|
||||
int ecore_x_selection_primary_set(Ecore_X_Window w, char *data, int len);
|
||||
int ecore_x_selection_primary_clear(void);
|
||||
int ecore_x_selection_secondary_set(Ecore_X_Window w, char *data, int len);
|
||||
int ecore_x_selection_secondary_clear(void);
|
||||
int ecore_x_selection_clipboard_set(Ecore_X_Window w, char *data, int len);
|
||||
int ecore_x_selection_clipboard_clear(void);
|
||||
|
||||
Ecore_X_Window ecore_x_window_new(Ecore_X_Window parent, int x, int y, int w, int h);
|
||||
Ecore_X_Window ecore_x_window_override_new(Ecore_X_Window parent, int x, int y, int w, int h);
|
||||
Ecore_X_Window ecore_x_window_input_new(Ecore_X_Window parent, int x, int y, int w, int h);
|
||||
|
|
|
@ -39,6 +39,9 @@ Atom _ecore_x_atom_win_layer = 0;
|
|||
Atom _ecore_x_atom_selection_primary = 0;
|
||||
Atom _ecore_x_atom_selection_secondary = 0;
|
||||
Atom _ecore_x_atom_selection_clipboard = 0;
|
||||
Atom _ecore_x_atom_selection_prop_primary = 0;
|
||||
Atom _ecore_x_atom_selection_prop_secondary = 0;
|
||||
Atom _ecore_x_atom_selection_prop_clipboard = 0;
|
||||
|
||||
/*
|
||||
* Root window NetWM hints.
|
||||
|
@ -97,6 +100,9 @@ Atom _ecore_x_atom_net_wm_state_fullscreen = 0;
|
|||
Atom _ecore_x_atom_net_wm_state_above = 0;
|
||||
Atom _ecore_x_atom_net_wm_state_below = 0;
|
||||
|
||||
Atom _ecore_x_atom_file_name = 0;
|
||||
Atom _ecore_x_atom_string = 0;
|
||||
Atom _ecore_x_atom_text = 0;
|
||||
Atom _ecore_x_atom_utf8_string = 0;
|
||||
|
||||
Atom _ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_NUM] = {0};
|
||||
|
@ -307,6 +313,10 @@ ecore_x_init(const char *name)
|
|||
_ecore_x_atom_selection_primary = XA_PRIMARY;
|
||||
_ecore_x_atom_selection_secondary = XA_SECONDARY;
|
||||
_ecore_x_atom_selection_clipboard = XInternAtom(_ecore_x_disp, "CLIPBOARD", False);
|
||||
_ecore_x_atom_selection_prop_primary = XInternAtom(_ecore_x_disp, "_ECORE_SELECTION_PRIMARY", False);
|
||||
_ecore_x_atom_selection_prop_secondary = XInternAtom(_ecore_x_disp, "_ECORE_SELECTION_SECONDARY", False);
|
||||
_ecore_x_atom_selection_prop_clipboard = XInternAtom(_ecore_x_disp, "_ECORE_SELECTION_CLIPBOARD", False);
|
||||
|
||||
_ecore_x_atom_net_current_desktop = XInternAtom(_ecore_x_disp, "_NET_CURRENT_DESKTOP", False);
|
||||
_ecore_x_atom_net_wm_name = XInternAtom(_ecore_x_disp, "_NET_WM_NAME", False);
|
||||
_ecore_x_atom_net_wm_visible_name = XInternAtom(_ecore_x_disp, "_NET_WM_VISIBLE_NAME", False);
|
||||
|
@ -345,6 +355,9 @@ ecore_x_init(const char *name)
|
|||
_ecore_x_atom_net_wm_state_below = XInternAtom(_ecore_x_disp, "_NET_WM_STATE_BELOW", False);
|
||||
|
||||
_ecore_x_atom_utf8_string = XInternAtom(_ecore_x_disp, "UTF8_STRING", False);
|
||||
_ecore_x_atom_file_name = XInternAtom(_ecore_x_disp, "FILE_NAME", False);
|
||||
_ecore_x_atom_string = XInternAtom(_ecore_x_disp, "STRING", False);
|
||||
_ecore_x_atom_text = XInternAtom(_ecore_x_disp, "TEXT", False);
|
||||
|
||||
_ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_DELETE_REQUEST] = _ecore_x_atom_wm_delete_window;
|
||||
_ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_TAKE_FOCUS] = _ecore_x_atom_wm_take_focus;
|
||||
|
|
|
@ -111,10 +111,16 @@ extern Atom _ecore_x_atom_net_wm_state_below;
|
|||
extern Atom _ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_NUM];
|
||||
|
||||
extern Atom _ecore_x_atom_utf8_string;
|
||||
extern Atom _ecore_x_atom_file_name;
|
||||
extern Atom _ecore_x_atom_string;
|
||||
extern Atom _ecore_x_atom_text;
|
||||
|
||||
extern Atom _ecore_x_atom_selection_primary;
|
||||
extern Atom _ecore_x_atom_selection_secondary;
|
||||
extern Atom _ecore_x_atom_selection_clipboard;
|
||||
extern Atom _ecore_x_atom_selection_prop_primary;
|
||||
extern Atom _ecore_x_atom_selection_prop_secondary;
|
||||
extern Atom _ecore_x_atom_selection_prop_clipboard;
|
||||
|
||||
void _ecore_x_error_handler_init(void);
|
||||
void _ecore_x_event_handle_key_press(XEvent *xevent);
|
||||
|
|
|
@ -42,4 +42,50 @@ int ecore_x_selection_clipboard_clear(void)
|
|||
return _ecore_x_selection_set(None, NULL, 0, _ecore_x_atom_selection_clipboard);
|
||||
}
|
||||
|
||||
static void _ecore_x_selection_request(Ecore_X_Window w, Ecore_X_Atom selection, Ecore_X_Selection_Target t)
|
||||
{
|
||||
Ecore_X_Atom target, prop;
|
||||
|
||||
switch (t) {
|
||||
case ECORE_X_SELECTION_TARGET_FILENAME:
|
||||
target = _ecore_x_atom_file_name;
|
||||
break;
|
||||
case ECORE_X_SELECTION_TARGET_STRING:
|
||||
target = _ecore_x_atom_string;
|
||||
break;
|
||||
case ECORE_X_SELECTION_TARGET_UTF8_STRING:
|
||||
target = _ecore_x_atom_utf8_string;
|
||||
break;
|
||||
case ECORE_X_SELECTION_TARGET_TEXT:
|
||||
target = _ecore_x_atom_text;
|
||||
break;
|
||||
default:
|
||||
target = _ecore_x_atom_text;
|
||||
}
|
||||
|
||||
if (selection == _ecore_x_atom_selection_primary)
|
||||
prop = _ecore_x_atom_selection_prop_primary;
|
||||
else if (selection == _ecore_x_atom_selection_secondary)
|
||||
prop = _ecore_x_atom_selection_prop_secondary;
|
||||
else
|
||||
prop = _ecore_x_atom_selection_prop_clipboard;
|
||||
|
||||
XConvertSelection(_ecore_x_disp, selection, target, prop,
|
||||
w, _ecore_x_event_last_time);
|
||||
}
|
||||
|
||||
void ecore_x_selection_primary_request(Ecore_X_Window w, Ecore_X_Selection_Target t)
|
||||
{
|
||||
_ecore_x_selection_request(w, _ecore_x_atom_selection_primary, t);
|
||||
}
|
||||
|
||||
void ecore_x_selection_secondary_request(Ecore_X_Window w, Ecore_X_Selection_Target t)
|
||||
{
|
||||
_ecore_x_selection_request(w, _ecore_x_atom_selection_secondary, t);
|
||||
}
|
||||
|
||||
void ecore_x_selection_clipboard_request(Ecore_X_Window w, Ecore_X_Selection_Target t)
|
||||
{
|
||||
_ecore_x_selection_request(w, _ecore_x_atom_selection_clipboard, t);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue