]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/matchbox-panel/matchbox-panel-0.9.2/mb-panel-0.9.2-polling.patch
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / matchbox-panel / matchbox-panel-0.9.2 / mb-panel-0.9.2-polling.patch
1 --- clean/matchbox-panel-0.9.2/src/msg.c        2005-03-20 17:43:32.000000000 +0000
2 +++ matchbox-panel-0.9.2/src/msg.c      2006-01-12 20:35:29.151432064 +0000
3 @@ -604,21 +604,38 @@ msg_handle_events(MBPanel *panel, XEvent
4     }
5  }
6  
7 -void
8 -msg_handle_timeouts(MBPanel *d)
9 +Bool
10 +msg_set_timeout(MBPanel *d, struct timeval *tv, struct timeval **tvp)
11  {
12     if (d->msg_win)
13     {
14       if (d->msg_timeout)       /* NON ZERO */
15         {
16 -        if ((d->msg_starttime+d->msg_timeout) < _get_server_time(d))
17 +        int timeleft, sec, usec;
18 +        
19 +        timeleft = d->msg_timeout - (_get_server_time (d) - d->msg_starttime);
20 +        if (timeleft < 0)
21            {
22 -              XDestroyWindow(d->dpy, d->msg_win);
23 -              d->msg_win = None;
24 -              return;
25 +            XDestroyWindow(d->dpy, d->msg_win);
26 +            d->msg_win = None;
27 +            return False;
28            }
29 +
30 +        sec = timeleft / 1000;
31 +        usec = (timeleft % 1000) * 1000;
32 +
33 +        if (!*tvp || tv->tv_sec > sec || (tv->tv_sec == sec && tv->tv_usec > usec))
34 +          {
35 +            tv->tv_usec = usec;
36 +            tv->tv_sec = sec;
37 +            *tvp = tv;
38 +          }
39 +
40 +        return True;
41         }
42     }
43 +
44 +   return False;
45  }
46  
47  static MBLayout*
48 diff -upr clean/matchbox-panel-0.9.2/src/msg.h matchbox-panel-0.9.2/src/msg.h
49 --- clean/matchbox-panel-0.9.2/src/msg.h        2005-03-20 17:43:32.000000000 +0000
50 +++ matchbox-panel-0.9.2/src/msg.h      2006-01-12 20:30:40.843261568 +0000
51 @@ -15,6 +15,6 @@ MBPanelMessageQueue* msg_new(MBPanel *do
52  void msg_destroy(MBPanel *d, MBPanelMessageQueue *m);
53  void msg_add_data(MBPanel *d, XClientMessageEvent *e);
54  void msg_handle_events(MBPanel *d, XEvent *e);
55 -void msg_handle_timeouts(MBPanel *d);
56 +Bool msg_set_timeout(MBPanel *d, struct timeval *tv, struct timeval **tvp);
57  
58  #endif
59 diff -upr clean/matchbox-panel-0.9.2/src/panel.c matchbox-panel-0.9.2/src/panel.c
60 --- clean/matchbox-panel-0.9.2/src/panel.c      2005-04-06 21:11:52.000000000 +0100
61 +++ matchbox-panel-0.9.2/src/panel.c    2006-01-12 20:33:13.282087344 +0000
62 @@ -1023,11 +1023,12 @@ panel_main(MBPanel *panel)
63  
64    while(1)
65      {
66 -      struct timeval tvt;
67 -      tvt.tv_usec = 500;
68 -      tvt.tv_sec = 0;
69 +      struct timeval tvt, *tvp = NULL;
70 +
71 +      session_preexisting_set_timeout (panel, &tvt, &tvp);
72 +      msg_set_timeout (panel, &tvt, &tvp);
73        
74 -      if (get_xevent_timed(panel->dpy, &an_event, &tvt))
75 +      if (get_xevent_timed(panel->dpy, &an_event, tvp))
76         {
77  #ifdef USE_XSETTINGS
78           if (panel->xsettings_client != NULL)
79 @@ -1225,8 +1226,6 @@ panel_main(MBPanel *panel)
80             }
81           msg_handle_events(panel, &an_event);
82         }
83 -      session_preexisting_handle_timeouts(panel);
84 -      msg_handle_timeouts(panel);
85      }
86  }
87  
88 Only in matchbox-panel-0.9.2/src: panel.c~
89 Only in matchbox-panel-0.9.2/src: panel_menu.o
90 Only in matchbox-panel-0.9.2/src: panel.o
91 Only in matchbox-panel-0.9.2/src: panel_util.o
92 diff -upr clean/matchbox-panel-0.9.2/src/session.c matchbox-panel-0.9.2/src/session.c
93 --- clean/matchbox-panel-0.9.2/src/session.c    2005-03-20 17:43:33.000000000 +0000
94 +++ matchbox-panel-0.9.2/src/session.c  2006-01-12 20:24:15.986768648 +0000
95 @@ -235,23 +235,39 @@ session_preexisting_clear_current(MBPane
96    panel->session_entry_cur[0] = '\0';
97  }
98  
99 -Bool 
100 -session_preexisting_handle_timeouts(MBPanel *panel)
101 +Bool
102 +session_preexisting_set_timeout(MBPanel *panel, struct timeval *tv, struct timeval **tvp)
103  {
104 -  if (!session_preexisting_restarting(panel)) return False;
105 -
106 -  /* DBG("%s() called\n", __func__); */
107 +  int timeleft;
108  
109 -  /* catch session timeouts */
110 -  if (panel->session_entry_cur[0] != '\0')
111 +  for (;;)
112      {
113 -      if ( (time(NULL)-panel->session_start_time) > SESSION_TIMEOUT)
114 +      if (!session_preexisting_restarting(panel)) 
115 +       return False;
116 +
117 +      if (panel->session_entry_cur[0] == '\0')
118 +       return False;
119 +
120 +      timeleft = SESSION_TIMEOUT - (time (NULL) - panel->session_start_time);
121 +
122 +      if (timeleft <= 0)
123         {
124           fprintf(stderr, "Session timeout on %s\n", panel->session_entry_cur);
125           session_preexisting_clear_current(panel);
126           session_preexisting_start_next(panel);
127 +         continue;
128         }
129 +
130 +      break;
131      }
132 +
133 +  if (!*tvp || tv->tv_sec > timeleft)
134 +    {
135 +      tv->tv_usec = 0;
136 +      tv->tv_sec = timeleft;
137 +      *tvp = tv;
138 +    }
139 +
140    return True;
141  }
142  
143 diff -upr clean/matchbox-panel-0.9.2/src/session.h matchbox-panel-0.9.2/src/session.h
144 --- clean/matchbox-panel-0.9.2/src/session.h    2005-03-20 17:43:33.000000000 +0000
145 +++ matchbox-panel-0.9.2/src/session.h  2006-01-12 20:24:37.310526944 +0000
146 @@ -28,7 +28,7 @@ Bool session_preexisting_win_matches_wan
147  
148  void session_preexisting_clear_current(MBPanel *panel);
149  
150 -Bool session_preexisting_handle_timeouts(MBPanel *panel);
151 +Bool session_preexisting_set_timeout(MBPanel *panel, struct timeval *tv, struct timeval **tvp);
152  
153  Bool session_preexisting_get_next(MBPanel *panel);
154