Update of /cvsroot/xine/xine-ui/src/xitk/xine-toolkit
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv23639

Modified Files:
        widget.c xitk.c 
Log Message:
Another revision of widget focus handling.
Affected files: widget.c xitk.c


Index: widget.c
===================================================================
RCS file: /cvsroot/xine/xine-ui/src/xitk/xine-toolkit/widget.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -r1.68 -r1.69
--- widget.c    26 Aug 2006 01:37:11 -0000      1.68
+++ widget.c    23 Nov 2006 23:30:07 -0000      1.69
@@ -1,5 +1,5 @@
 /* 
- * Copyright (C) 2000-2004 the xine project
+ * Copyright (C) 2000-2006 the xine project
  * 
  * This file is part of xine, a unix video player.
  * 
@@ -848,8 +848,8 @@
     return 0;
   }
 
-  if(((x >= widget->x) && (x <= (widget->x + widget->width))) && 
-     ((y >= widget->y) && (y <= (widget->y + widget->height)))) {
+  if(((x >= widget->x) && (x < (widget->x + widget->width))) && 
+     ((y >= widget->y) && (y < (widget->y + widget->height)))) {
     widget_event_t        event;
     widget_event_result_t result;
 
@@ -938,8 +938,8 @@
        event.focus = FOCUS_MOUSE_OUT;
        (void) wl->widget_under_mouse->event(wl->widget_under_mouse, &event, 
NULL);
 
-      event.type = WIDGET_EVENT_PAINT;
-      (void) wl->widget_under_mouse->event(wl->widget_under_mouse, &event, 
NULL);
+       event.type = WIDGET_EVENT_PAINT;
+       (void) wl->widget_under_mouse->event(wl->widget_under_mouse, &event, 
NULL);
       }
     }
     
@@ -951,17 +951,19 @@
       dump_widget_type(mywidget);
 #endif
       
+      /* Only give focus and paint when tips are accepted, otherwise 
associated window is invisible. */
+      /* This call may occur from MotionNotify directly after iconifying 
window.                     */
       if(xitk_tips_show_widget_tips(mywidget)) {
       
-       /* Only give focus and paint when tips are accepted, otherwise 
associated window is invisible. */
-       /* This call may occur from MotionNotify directly after iconifying 
window.                     */
        if(!(wl->widget_focused && wl->widget_focused == wl->widget_under_mouse 
&&
             (((wl->widget_focused->type & WIDGET_GROUP_MASK) & 
WIDGET_GROUP_BROWSER) ||
              ((wl->widget_focused->type & WIDGET_TYPE_MASK) == 
WIDGET_TYPE_SLIDER &&
               (wl->widget_focused->type & WIDGET_KEYABLE)))) &&
           (mywidget->type & WIDGET_FOCUSABLE) && mywidget->enable == 
WIDGET_ENABLE) {
          event.type  = WIDGET_EVENT_FOCUS;
-         event.focus = FOCUS_MOUSE_IN;
+         /* If widget still marked pressed or focus received, it shall receive 
the focus again. */
+         event.focus = (mywidget == wl->widget_pressed || mywidget == 
wl->widget_focused) ?
+                       FOCUS_RECEIVED : FOCUS_MOUSE_IN;
          (void) mywidget->event(mywidget, &event, NULL);
 
          event.type  = WIDGET_EVENT_PAINT;
@@ -1005,6 +1007,7 @@
   mywidget = xitk_get_widget_at (wl, x, y);
 
   if(mywidget != wl->widget_focused && !bUp) {
+
     if (wl->widget_focused) {
       
       /* Kill (hide) tips */
@@ -1044,7 +1047,6 @@
       (void) wl->widget_focused->event(wl->widget_focused, &event, NULL);
     }
     
-    
     wl->widget_focused = mywidget;
     
     if (mywidget) {
@@ -1100,6 +1102,7 @@
     }
   }
   else {
+
     if(wl->widget_pressed) {
       if((wl->widget_pressed->type & WIDGET_CLICKABLE) &&
         (wl->widget_pressed->enable == WIDGET_ENABLE) && 
wl->widget_pressed->running) {
@@ -1333,9 +1336,6 @@
     
     if (wl->widget_focused->enable == WIDGET_ENABLE && 
wl->widget_focused->running) {
 
-      if(wl->widget_focused->type & WIDGET_CLICKABLE)
-       wl->widget_under_mouse = wl->widget_focused;
-
       if((wl->widget_focused->type & WIDGET_CLICKABLE) &&
         (wl->widget_focused->type & WIDGET_TYPE_MASK) == 
WIDGET_TYPE_INPUTTEXT) {
        widget_event_result_t  result;
@@ -2082,8 +2082,8 @@
   }
   else {
     
-    if(((win_x >= w->x) && (win_x <= (w->x + w->width))) && 
-       ((win_y >= w->y) && (win_y <= (w->y + w->height)))) {
+    if(((win_x >= w->x) && (win_x < (w->x + w->width))) && 
+       ((win_y >= w->y) && (win_y < (w->y + w->height)))) {
       retval = 1;
     }
     

Index: xitk.c
===================================================================
RCS file: /cvsroot/xine/xine-ui/src/xitk/xine-toolkit/xitk.c,v
retrieving revision 1.157
retrieving revision 1.158
diff -u -r1.157 -r1.158
--- xitk.c      22 Nov 2006 23:33:26 -0000      1.157
+++ xitk.c      23 Nov 2006 23:30:07 -0000      1.158
@@ -1579,8 +1579,10 @@
        }
          break;
          
-       case EnterNotify:
        case LeaveNotify:
+         event->xcrossing.x = event->xcrossing.y = -1; /* Same as moving 
outside any widget */
+         /* fall through */
+       case EnterNotify:
          if(fx->widget_list)
            if(event->xcrossing.mode == NotifyNormal) /* Ptr. moved rel. to 
win., not (un)grab */
              xitk_motion_notify_widget_list (fx->widget_list,


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Xine-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xine-cvslog

Reply via email to