Start of dnd code for dragging indicator bars.
SVN revision: 44472
This commit is contained in:
parent
c3b300cb3c
commit
23aa71925c
|
@ -40,7 +40,9 @@ module_la_SOURCES = e_mod_main.h \
|
|||
e_mod_policy_settings.h \
|
||||
e_mod_policy_settings.c \
|
||||
e_mod_gadcon.h \
|
||||
e_mod_gadcon.c
|
||||
e_mod_gadcon.c \
|
||||
e_mod_dnd.h \
|
||||
e_mod_dnd.c
|
||||
|
||||
module_la_LIBADD = @e_libs@ @dlopen_libs@
|
||||
module_la_LDFLAGS = -module -avoid-version
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
#include "e.h"
|
||||
#include "e_mod_main.h"
|
||||
#include "e_mod_dnd.h"
|
||||
|
||||
/* local function prototypes */
|
||||
static void _cb_dnd_enter(void *data, const char *type, void *event);
|
||||
static void _cb_dnd_move(void *data, const char *type, void *event);
|
||||
static void _cb_dnd_leave(void *data, const char *type, void *event);
|
||||
static void _cb_dnd_drop(void *data, const char *type, void *event);
|
||||
|
||||
/* local variables */
|
||||
static E_Drop_Handler *drop_handler = NULL;
|
||||
static const char *drop_types[] = { "illume/indicator" };
|
||||
|
||||
/* public functions */
|
||||
EAPI int
|
||||
e_mod_dnd_init(void)
|
||||
{
|
||||
E_Container *con;
|
||||
|
||||
con = e_container_current_get(e_manager_current_get());
|
||||
drop_handler =
|
||||
e_drop_handler_add(E_OBJECT(con), NULL,
|
||||
_cb_dnd_enter, _cb_dnd_move,
|
||||
_cb_dnd_leave, _cb_dnd_drop,
|
||||
drop_types, 1, con->x, con->y, con->w, con->h);
|
||||
if (!drop_handler) return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_mod_dnd_shutdown(void)
|
||||
{
|
||||
if (drop_handler) e_drop_handler_del(drop_handler);
|
||||
drop_handler = NULL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* local functions */
|
||||
static void
|
||||
_cb_dnd_enter(void *data, const char *type, void *event)
|
||||
{
|
||||
E_Event_Dnd_Enter *ev;
|
||||
|
||||
ev = event;
|
||||
if (strcmp(type, drop_types[0])) return;
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_dnd_move(void *data, const char *type, void *event)
|
||||
{
|
||||
E_Event_Dnd_Move *ev;
|
||||
|
||||
ev = event;
|
||||
if (strcmp(type, drop_types[0])) return;
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_dnd_leave(void *data, const char *type, void *event)
|
||||
{
|
||||
E_Event_Dnd_Leave *ev;
|
||||
|
||||
ev = event;
|
||||
if (strcmp(type, drop_types[0])) return;
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_dnd_drop(void *data, const char *type, void *event)
|
||||
{
|
||||
E_Event_Dnd_Drop *ev;
|
||||
|
||||
ev = event;
|
||||
if (strcmp(type, drop_types[0])) return;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
#ifndef E_MOD_DND_H
|
||||
#define E_MOD_DND_H
|
||||
|
||||
EAPI int e_mod_dnd_init(void);
|
||||
EAPI int e_mod_dnd_shutdown(void);
|
||||
|
||||
#endif
|
|
@ -4,7 +4,9 @@
|
|||
#include "e_mod_layout.h"
|
||||
#include "e_kbd.h"
|
||||
#include "e_mod_gadcon.h"
|
||||
#include "e_mod_dnd.h"
|
||||
|
||||
/* local variables */
|
||||
static E_Kbd *kbd = NULL;
|
||||
|
||||
/* this is needed to advertise a label for the module IN the code (not just
|
||||
|
@ -17,9 +19,16 @@ EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Illume2" };
|
|||
EAPI void *
|
||||
e_modapi_init(E_Module *m)
|
||||
{
|
||||
/* init the config system */
|
||||
/* init the config subsystem */
|
||||
if (!il_config_init(m)) return NULL;
|
||||
|
||||
/* init the drag-n-drop subsystem */
|
||||
if (!e_mod_dnd_init())
|
||||
{
|
||||
il_config_shutdown();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* init the gadcon subsystem for adding a "button" to any gadget container
|
||||
* which will allow easy switching between policy app modes */
|
||||
e_mod_gadcon_init();
|
||||
|
@ -27,17 +36,16 @@ e_modapi_init(E_Module *m)
|
|||
/* set up the virtual keyboard */
|
||||
e_kbd_init(m);
|
||||
|
||||
/* init the layout system */
|
||||
/* init the layout subsystem */
|
||||
e_mod_layout_init(m);
|
||||
|
||||
/* create a new keyboard */
|
||||
kbd = e_kbd_new(e_util_container_zone_number_get(0, 0),
|
||||
m->dir, m->dir, m->dir);
|
||||
kbd =
|
||||
e_kbd_new(e_util_container_zone_number_get(0, 0), m->dir, m->dir, m->dir);
|
||||
|
||||
/* show the keyboard if needed */
|
||||
e_kbd_show(kbd);
|
||||
|
||||
|
||||
/* return NULL on failure, anything else on success. the pointer
|
||||
* returned will be set as m->data for convenience tracking */
|
||||
return m;
|
||||
|
@ -60,6 +68,9 @@ e_modapi_shutdown(E_Module *m)
|
|||
/* shutdown the gadget subsystem */
|
||||
e_mod_gadcon_shutdown();
|
||||
|
||||
/* shutdown the dnd subsystem */
|
||||
e_mod_dnd_shutdown();
|
||||
|
||||
/* shutdown the config subsystem */
|
||||
il_config_shutdown();
|
||||
|
||||
|
@ -73,3 +84,22 @@ e_modapi_save(E_Module *m)
|
|||
{
|
||||
return il_config_save();
|
||||
}
|
||||
|
||||
/* local functions */
|
||||
static int
|
||||
_cb_event_dnd_drop(void *data, int type, void *event)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_cb_event_dnd_position(void *data, int type, void *event)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_cb_event_dnd_selection(void *data, int type, void *event)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue