Enlightenment CVS schrieb:
Enlightenment CVS committal
Author : dj2
Project : e17
Module : libs/ewl
Dir : e17/libs/ewl/src/lib
Modified Files:
ewl_menu.c
Log Message:
- fix the menu corruption when you open and close the same menu multiple
times.
- needed to actually call ewl_widget_configure instead of just calling
the CONFIGURE callback
Yes, this fixed it for the menu, but the real problem lies a bit deeper.
When you hide and show a override window again the output is corrupted,
but when you call ewl_widget_configure it works. Attached is a little
prog demonstrating this. I cannot imagine why, because this only happens
with override set to true. Anyway it doesn't bother me, I only want to
mention it.
Also attached you will find a patch for the context menu placment in the
iconbox.
peter
#include <Ewl.h>
void _win_show(Ewl_Widget * w, void * e, void * data)
{
ewl_widget_show(EWL_WIDGET(data));
}
void _win_hide(Ewl_Widget * w, void * e, void * data)
{
ewl_widget_hide(EWL_WIDGET(data));
}
void _win_conf(Ewl_Widget * w, void * e, void * data)
{
ewl_widget_configure(EWL_WIDGET(data));
}
void _destroy_main_window(Ewl_Widget * main_win, void * ev_data, void *
user_data)
{
ewl_main_quit();
return;
}
int main(int argc, char ** argv)
{
Ewl_Widget * win, * win2, * w, * c;
ewl_init(&argc, argv);
win = ewl_window_new();
ewl_object_size_request(EWL_OBJECT(win), 300, 100);
ewl_callback_append(win, EWL_CALLBACK_DELETE_WINDOW,
_destroy_main_window, NULL);
ewl_widget_show(win);
win2 = ewl_window_new();
ewl_window_transient_for(EWL_WINDOW(win2), EWL_WINDOW(win));
ewl_window_override_set(EWL_WINDOW(win2), TRUE);
ewl_window_borderless_set(EWL_WINDOW(win2));
ewl_object_size_request(EWL_OBJECT(win2), 100, 200);
c = ewl_hbox_new();
ewl_widget_show(c);
ewl_container_child_append(EWL_CONTAINER(win), c);
w = ewl_button_new();
ewl_button_label_set(EWL_BUTTON(w), "show");
ewl_widget_show(w);
ewl_container_child_append(EWL_CONTAINER(c), w);
ewl_callback_append(w, EWL_CALLBACK_CLICKED, _win_show, win2);
w = ewl_button_new();
ewl_button_label_set(EWL_BUTTON(w), "configure");
ewl_widget_show(w);
ewl_container_child_append(EWL_CONTAINER(c), w);
ewl_callback_append(w, EWL_CALLBACK_CLICKED, _win_conf, win2);
w = ewl_button_new();
ewl_button_label_set(EWL_BUTTON(w), "hide");
ewl_widget_show(w);
ewl_container_child_append(EWL_CONTAINER(c), w);
ewl_callback_append(w, EWL_CALLBACK_CLICKED, _win_hide, win2);
ewl_main();
}
Index: ewl_iconbox.c
===================================================================
RCS file: /var/cvs/e/e17/libs/ewl/src/lib/ewl_iconbox.c,v
retrieving revision 1.112
diff -u -r1.112 ewl_iconbox.c
--- ewl_iconbox.c 2 Apr 2006 01:45:45 -0000 1.112
+++ ewl_iconbox.c 13 Apr 2006 20:30:31 -0000
@@ -1367,10 +1367,13 @@
&& (ib->xdown != ev->x
&& ib->ydown != ev->y))
{
+ int h;
+
+ h =
ewl_object_current_h_get(EWL_OBJECT(ib->ewl_iconbox_context_menu));
ewl_widget_show(ib->ewl_iconbox_menu_floater);
ewl_floater_position_set(EWL_FLOATER(ib->ewl_iconbox_menu_floater),
- ev->x-ibx +
abs(px-ibx),
- ev->y-iby +abs(py-iby));
+ ev->x - px,
+ ev->y - py - h);
ewl_callback_call(EWL_WIDGET(ib->ewl_iconbox_context_menu),
EWL_CALLBACK_FOCUS_IN);
@@ -1424,9 +1427,12 @@
iby = ewl_object_current_y_get(EWL_OBJECT(ib->icon_box_parent));
if (ev->button == 3) {
+ int h;
+
+ h =
ewl_object_current_h_get(EWL_OBJECT(ib->icon_box_parent->icon_menu));
ewl_floater_position_set(EWL_FLOATER(ib->icon_box_parent->icon_menu_floater),
- ev->x-ibx + abs(sx-ibx),
- ev->y-iby +abs(sy-iby));
+ ev->x - sx,
+ ev->y - sy - h);
ewl_callback_call(EWL_WIDGET(ib->icon_box_parent->icon_menu),
EWL_CALLBACK_FOCUS_IN);
} else {