forked from enlightenment/efl
Beginnings of support for X selections. Does nothing right now expect set
and clear selections (no actual events handled yet). SVN revision: 7935
This commit is contained in:
parent
89060aec27
commit
0b893f7b7c
|
@ -19,6 +19,7 @@ libecore_x_la_SOURCES = \
|
|||
ecore_x.c \
|
||||
ecore_x_error.c \
|
||||
ecore_x_events.c \
|
||||
ecore_x_selection.c \
|
||||
ecore_x_window.c \
|
||||
ecore_x_window_prop.c \
|
||||
ecore_x_window_shape.c \
|
||||
|
@ -43,6 +44,7 @@ Ecore_X.h \
|
|||
ecore_x.c \
|
||||
ecore_x_error.c \
|
||||
ecore_x_events.c \
|
||||
ecore_x_selection.c \
|
||||
ecore_x_window.c \
|
||||
ecore_x_window_prop.c \
|
||||
ecore_x_window_shape.c \
|
||||
|
|
|
@ -36,6 +36,9 @@ Atom _ecore_x_atom_wm_icon_name = 0;
|
|||
Atom _ecore_x_atom_wm_client_machine = 0;
|
||||
Atom _ecore_x_atom_motif_wm_hints = 0;
|
||||
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;
|
||||
|
||||
/*
|
||||
* Root window NetWM hints.
|
||||
|
@ -300,6 +303,10 @@ ecore_x_init(const char *name)
|
|||
_ecore_x_atom_wm_client_machine = XInternAtom(_ecore_x_disp, "WM_CLIENT_MACHINE", False);
|
||||
_ecore_x_atom_motif_wm_hints = XInternAtom(_ecore_x_disp, "_MOTIF_WM_HINTS", False);
|
||||
_ecore_x_atom_win_layer = XInternAtom(_ecore_x_disp, "_WIN_LAYER", False);
|
||||
/* This is just to be anal about naming conventions */
|
||||
_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_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);
|
||||
|
|
|
@ -112,6 +112,10 @@ extern Atom _ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_NUM];
|
|||
|
||||
extern Atom _ecore_x_atom_utf8_string;
|
||||
|
||||
extern Atom _ecore_x_atom_selection_primary;
|
||||
extern Atom _ecore_x_atom_selection_secondary;
|
||||
extern Atom _ecore_x_atom_selection_clipboard;
|
||||
|
||||
void _ecore_x_error_handler_init(void);
|
||||
void _ecore_x_event_handle_key_press(XEvent *xevent);
|
||||
void _ecore_x_event_handle_key_release(XEvent *xevent);
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
#include <Ecore.h>
|
||||
#include "ecore_x_private.h"
|
||||
#include <Ecore_X.h>
|
||||
|
||||
static int _ecore_x_selection_set(Ecore_X_Window w, char *data, int len, Ecore_X_Atom selection)
|
||||
{
|
||||
XSetSelectionOwner(_ecore_x_disp, selection, w, _ecore_x_event_last_time);
|
||||
if (XGetSelectionOwner(_ecore_x_disp, selection) != w)
|
||||
return 0;
|
||||
/* ecore_x_window_prop_property_set(_ecore_x_disp, w, selection,
|
||||
XA_STRING, 8, data, len); */
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ecore_x_selection_primary_set(Ecore_X_Window w, char *data, int len)
|
||||
{
|
||||
return _ecore_x_selection_set(w, data, len, _ecore_x_atom_selection_primary);
|
||||
}
|
||||
|
||||
int ecore_x_selection_primary_clear(void)
|
||||
{
|
||||
return _ecore_x_selection_set(None, NULL, 0, _ecore_x_atom_selection_primary);
|
||||
}
|
||||
|
||||
int ecore_x_selection_secondary_set(Ecore_X_Window w, char *data, int len)
|
||||
{
|
||||
return _ecore_x_selection_set(w, data, len, _ecore_x_atom_selection_secondary);
|
||||
}
|
||||
|
||||
int ecore_x_selection_secondary_clear(void)
|
||||
{
|
||||
return _ecore_x_selection_set(None, NULL, 0, _ecore_x_atom_selection_secondary);
|
||||
}
|
||||
|
||||
int ecore_x_selection_clipboard_set(Ecore_X_Window w, char *data, int len)
|
||||
{
|
||||
return _ecore_x_selection_set(w, data, len, _ecore_x_atom_selection_clipboard);
|
||||
}
|
||||
|
||||
int ecore_x_selection_clipboard_clear(void)
|
||||
{
|
||||
return _ecore_x_selection_set(None, NULL, 0, _ecore_x_atom_selection_clipboard);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue