Enlightenment CVS committal
Author : dj2
Project : e17
Module : libs/ewl
Dir : e17/libs/ewl/src/bin/tests
Modified Files:
ewl_dnd_snoop.c
Log Message:
- make dnd snoop output to both the terminal and the window
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/bin/tests/ewl_dnd_snoop.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- ewl_dnd_snoop.c 13 Jul 2006 20:47:31 -0000 1.3
+++ ewl_dnd_snoop.c 13 Jul 2006 21:10:35 -0000 1.4
@@ -25,6 +25,10 @@
static int ewl_dnd_snoop_cb_drop(void *data, int type, void *ev);
static int ewl_dnd_snoop_cb_finished(void *data, int type, void *ev);
+static void ewl_dnd_snoop_cb_clear(Ewl_Widget *w, void *ev, void *data);
+
+static Ewl_Widget *text = NULL;
+
void
test_info(Ewl_Test *test)
{
@@ -40,7 +44,7 @@
create_test(Ewl_Container *box)
{
- Ewl_Widget *hbox, *scroll, *o;
+ Ewl_Widget *scroll, *o;
/* Register DND handlers */
ewl_dnd_enter_handler = ecore_event_handler_add(
@@ -62,18 +66,13 @@
ECORE_X_EVENT_XDND_FINISHED,
ewl_dnd_snoop_cb_finished, NULL);
- scroll = ewl_scrollpane_new();
- ewl_container_child_append(EWL_CONTAINER(box), scroll);
- ewl_callback_append(scroll, EWL_CALLBACK_REALIZE,
- ewl_dnd_snoop_cb_realize, NULL);
- ewl_widget_show(scroll);
-
o = ewl_entry_new();
- ewl_container_child_append(EWL_CONTAINER(scroll), o);
+ ewl_container_child_append(EWL_CONTAINER(box), o);
ewl_widget_name_set(o, "entry");
ewl_entry_multiline_set(EWL_ENTRY(o), TRUE);
ewl_text_wrap_set(EWL_TEXT(o), TRUE);
ewl_text_font_size_set(EWL_TEXT(o), 12);
+ ewl_text_text_set(EWL_TEXT(o), "Drop Here");
ewl_text_underline_color_set(EWL_TEXT(o), 0, 0, 0, 255);
ewl_text_double_underline_color_set(EWL_TEXT(o), 50, 50, 50, 255);
@@ -83,18 +82,38 @@
ewl_text_glow_color_set(EWL_TEXT(o), 0, 255, 0, 128);
ewl_object_fill_policy_set(EWL_OBJECT(o),
- EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_VFILL);
+ EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_VSHRINK);
ewl_widget_show(o);
- hbox = ewl_hbox_new();
- ewl_container_child_append(EWL_CONTAINER(box), hbox);
- ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_NONE);
- ewl_widget_show(hbox);
+ scroll = ewl_scrollpane_new();
+ ewl_container_child_append(EWL_CONTAINER(box), scroll);
+ ewl_callback_append(scroll, EWL_CALLBACK_REALIZE,
+ ewl_dnd_snoop_cb_realize, NULL);
+ ewl_widget_show(scroll);
+
+ text = ewl_text_new();
+ ewl_container_child_append(EWL_CONTAINER(scroll), text);
+ ewl_widget_show(text);
+
+ o = ewl_button_new();
+ ewl_button_label_set(EWL_BUTTON(o), "Clear");
+ ewl_container_child_append(EWL_CONTAINER(box), o);
+ ewl_callback_append(o, EWL_CALLBACK_CLICKED,
+ ewl_dnd_snoop_cb_clear, NULL);
+ ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_SHRINK);
+ ewl_widget_show(o);
return 1;
}
static void
+ewl_dnd_snoop_output(char *buf)
+{
+ printf(buf);
+ ewl_text_text_append(EWL_TEXT(text), buf);
+}
+
+static void
ewl_dnd_snoop_cb_realize(Ewl_Widget *w, void *event, void *data)
{
Ewl_Embed *embed;
@@ -106,12 +125,19 @@
ewl_dnd_snoop_cb_enter(void *data, int type, void *ev)
{
int i;
+ char buf[1024];
Ecore_X_Event_Xdnd_Enter *event = ev;
- printf("\nXdnd Enter\n");
- printf("\tWindow: %d\n\tSource: %d\n", event->win, event->source);
+ snprintf(buf, sizeof(buf), "\nXdnd Enter\n");
+ ewl_dnd_snoop_output(buf);
+
+ snprintf(buf, sizeof(buf), "\tWindow: %d\n\tSource: %d\n",
+ event->win, event->source);
+ ewl_dnd_snoop_output(buf);
+
for (i = 0; i < event->num_types; i++) {
- printf("\tType: %s\n", event->types[i]);
+ snprintf(buf, sizeof(buf), "\tType: %s\n", event->types[i]);
+ ewl_dnd_snoop_output(buf);
}
return 1;
}
@@ -119,66 +145,128 @@
static int
ewl_dnd_snoop_cb_position(void *data, int type, void *ev)
{
+ char buf[1024];
Ecore_X_Event_Xdnd_Position *event = ev;
- printf("\nXdnd Position\n");
- printf("\tWindow: %d\n\tSource: %d\n", event->win, event->source);
- printf("\tPosition: %d,%d\n", event->position.x, event->position.y);
- printf("\tAction: %s\n", XGetAtomName(ecore_x_display_get(),
- event->action));
+ snprintf(buf, sizeof(buf), "\nXdnd Position\n");
+ ewl_dnd_snoop_output(buf);
+
+ snprintf(buf, sizeof(buf), "\tWindow: %d\n\tSource: %d\n", event->win,
+ event->source);
+ ewl_dnd_snoop_output(buf);
+
+ snprintf(buf, sizeof(buf), "\tPosition: %d,%d\n", event->position.x,
+ event->position.y);
+ ewl_dnd_snoop_output(buf);
+
+ snprintf(buf, sizeof(buf), "\tAction: %s\n",
+ XGetAtomName(ecore_x_display_get(),
+ event->action));
+ ewl_dnd_snoop_output(buf);
+
return 1;
}
static int
ewl_dnd_snoop_cb_status(void *data, int type, void *ev)
{
+ char buf[1024];
Ecore_X_Event_Xdnd_Status *event = ev;
- printf("\nXdnd Status\n");
- printf("\tWindow: %d\n\tTarget: %d\n", event->win, event->target);
- printf("\tAccepts: %d\n", event->will_accept);
- printf("\tRegion: %d,%d %dx%d\n", event->rectangle.x,
+ snprintf(buf, sizeof(buf), "\nXdnd Status\n");
+ ewl_dnd_snoop_output(buf);
+
+ snprintf(buf, sizeof(buf), "\tWindow: %d\n\tTarget: %d\n",
+ event->win, event->target);
+ ewl_dnd_snoop_output(buf);
+
+ snprintf(buf, sizeof(buf), "\tAccepts: %d\n", event->will_accept);
+ ewl_dnd_snoop_output(buf);
+
+ snprintf(buf, sizeof(buf), "\tRegion: %d,%d %dx%d\n",
+ event->rectangle.x,
event->rectangle.y,
event->rectangle.width,
event->rectangle.height);
- printf("\tAction: %s\n", XGetAtomName(ecore_x_display_get(),
- event->action));
+ ewl_dnd_snoop_output(buf);
+
+ snprintf(buf, sizeof(buf), "\tAction: %s\n",
+ XGetAtomName(ecore_x_display_get(),
+ event->action));
+ ewl_dnd_snoop_output(buf);
+
return 1;
}
static int
ewl_dnd_snoop_cb_leave(void *data, int type, void *ev)
{
+ char buf[1024];
Ecore_X_Event_Xdnd_Leave *event = ev;
- printf("\nXdnd Leave\n");
- printf("\tWindow: %d\n\tSource: %d\n", event->win, event->source);
+ snprintf(buf, sizeof(buf), "\nXdnd Leave\n");
+ ewl_dnd_snoop_output(buf);
+
+ snprintf(buf, sizeof(buf), "\tWindow: %d\n\tSource: %d\n",
+ event->win, event->source);
+ ewl_dnd_snoop_output(buf);
+
return 1;
}
static int
ewl_dnd_snoop_cb_drop(void *data, int type, void *ev)
{
+ char buf[1024];
Ecore_X_Event_Xdnd_Drop *event = ev;
- printf("\nXdnd Drop\n");
- printf("\tWindow: %d\n\tSource: %d\n", event->win, event->source);
- printf("\tAction: %s\n", XGetAtomName(ecore_x_display_get(),
- event->action));
- printf("\tPosition: %d,%d\n", event->position.x, event->position.y);
+ snprintf(buf, sizeof(buf), "\nXdnd Drop\n");
+ ewl_dnd_snoop_output(buf);
+
+ snprintf(buf, sizeof(buf), "\tWindow: %d\n\tSource: %d\n",
+ event->win, event->source);
+ ewl_dnd_snoop_output(buf);
+
+ snprintf(buf, sizeof(buf), "\tAction: %s\n",
+ XGetAtomName(ecore_x_display_get(),
+ event->action));
+ ewl_dnd_snoop_output(buf);
+
+ snprintf(buf, sizeof(buf), "\tPosition: %d,%d\n",
+ event->position.x, event->position.y);
+ ewl_dnd_snoop_output(buf);
+
return 1;
}
static int
ewl_dnd_snoop_cb_finished(void *data, int type, void *ev)
{
+ char buf[1024];
Ecore_X_Event_Xdnd_Finished *event = ev;
- printf("\nXdnd Finished\n");
- printf("\tWindow: %d\n\tTarget: %d\n", event->win, event->target);
- printf("\tCompleted: %d\n", event->completed);
- printf("\tAction: %s\n", XGetAtomName(ecore_x_display_get(),
- event->action));
+ snprintf(buf, sizeof(buf), "\nXdnd Finished\n");
+ ewl_dnd_snoop_output(buf);
+
+ snprintf(buf, sizeof(buf), "\tWindow: %d\n\tTarget: %d\n",
+ event->win, event->target);
+ ewl_dnd_snoop_output(buf);
+
+ snprintf(buf, sizeof(buf), "\tCompleted: %d\n", event->completed);
+ ewl_dnd_snoop_output(buf);
+
+ snprintf(buf, sizeof(buf), "\tAction: %s\n",
+ XGetAtomName(ecore_x_display_get(),
+ event->action));
+ ewl_dnd_snoop_output(buf);
+
return 1;
}
+
+static void
+ewl_dnd_snoop_cb_clear(Ewl_Widget *w, void *ev, void *data)
+{
+ ewl_text_clear(EWL_TEXT(text));
+}
+
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs