mirror of
				https://git.yoctoproject.org/matchbox-tests
				synced 2025-11-04 13:05:39 +08:00 
			
		
		
		
	remove msg's, add urgency + above
git-svn-id: https://svn.o-hand.com/repos/matchbox/trunk/matchbox-tests@1018 b067294f-1dea-0310-9683-c47a78595994
This commit is contained in:
		@@ -1,3 +1,11 @@
 | 
			
		||||
2005-01-10  mallum,,,  <mallum@openedhand.com>
 | 
			
		||||
 | 
			
		||||
	* test-windows.sh:
 | 
			
		||||
	Add basic urgent & above type wins. Remove message win tests
 | 
			
		||||
	* winspew.c: (create_atoms), (usage), (win_set_extened_options),
 | 
			
		||||
	(create_top_level):
 | 
			
		||||
	Remove msg options add new ones for above and urgentcy
 | 
			
		||||
 | 
			
		||||
2005-01-07  mallum,,,  <mallum@openedhand.com>
 | 
			
		||||
 | 
			
		||||
	* test-interaction-640x480.xnee:
 | 
			
		||||
 
 | 
			
		||||
@@ -48,10 +48,8 @@ echo
 | 
			
		||||
count=0
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if [ -z "$(matchbox-window-manager -h | grep 'Message Window Support' | grep 'no')" ]; then
 | 
			
		||||
 | 
			
		||||
echo; echo "$count. 4 queued message windows from two clients at alternate sides"; waitamo
 | 
			
		||||
./winspew -t "Window",normal -c "Dialog",300x200 -t MSG1,message,90x60+20-20,,10 -t MSG2,message,90x60-20-20,,10 >> $LOG &
 | 
			
		||||
echo; echo "$count. 1 app + 1urgent (message) windows "; waitamo
 | 
			
		||||
./winspew -t "Window",normal -c "Dialog",300x200+100+100,urgent >> $LOG &
 | 
			
		||||
TEST1=$!
 | 
			
		||||
sleep 1
 | 
			
		||||
./winspew -t MSG1,message,300x200+20+20,,10 -t MSG2,message,300x200-20+20,,10 >> $LOG &
 | 
			
		||||
@@ -59,15 +57,6 @@ TEST2=$!
 | 
			
		||||
sleep 4
 | 
			
		||||
waitamo; kill $TEST1 $TEST2; wait; count=$((count+1))
 | 
			
		||||
 | 
			
		||||
echo; echo "$count. 2 queued message windows with one modal dialog"; waitamo
 | 
			
		||||
./winspew -t "Window",normal -c "Dialog",300x200,modal -t MSG1,message,90x60+20-20,,10 -t MSG2,message,90x60-20-20,,10 >> $LOG &
 | 
			
		||||
TEST=$!; waitamo; kill $TEST; wait; count=$((count+1))
 | 
			
		||||
 | 
			
		||||
else
 | 
			
		||||
echo "*** Not testing message windows as Matchbox binary lacks support ***"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
echo; echo "$count. Fullscreen window"; waitamo
 | 
			
		||||
./winspew -t "Window",normal,,fullscreen >> $LOG &
 | 
			
		||||
TEST=$!; waitamo; kill $TEST; wait; count=$((count+1))
 | 
			
		||||
@@ -76,6 +65,10 @@ echo; echo "$count. Fullscreen window with dialog"; waitamo
 | 
			
		||||
./winspew -t "Window",normal,,fullscreen -c "Dialog",320x200 >> $LOG &
 | 
			
		||||
TEST=$!; waitamo; kill $TEST; wait; count=$((count+1))
 | 
			
		||||
 | 
			
		||||
echo; echo "$count. Fullscreen window with 'above' dialog"; waitamo
 | 
			
		||||
./winspew -t "Window",normal,,fullscreen -c "Dialog",320x200,above >> $LOG &
 | 
			
		||||
TEST=$!; waitamo; kill $TEST; wait; count=$((count+1))
 | 
			
		||||
 | 
			
		||||
echo; echo "$count. Fullscreen window with modal dialog"; waitamo
 | 
			
		||||
./winspew -t "Window",normal,,fullscreen -c "Dialog",320x200,modal >> $LOG &
 | 
			
		||||
TEST=$!; waitamo; kill $TEST; wait; count=$((count+1))
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										91
									
								
								winspew.c
									
									
									
									
									
								
							
							
						
						
									
										91
									
								
								winspew.c
									
									
									
									
									
								
							@@ -37,6 +37,9 @@
 | 
			
		||||
#define WIN_OPTS_NO_DECOR           (1<<8)
 | 
			
		||||
#define WIN_OPTS_WM_PROTO_CUSTOM    (1<<9)
 | 
			
		||||
#define WIN_OPTS_CM_TRANS           (1<<10)
 | 
			
		||||
#define WIN_OPTS_URGENT             (1<<12)
 | 
			
		||||
#define WIN_OPTS_STATE_ABOVE        (1<<13)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
enum { 				/* Window Atoms */
 | 
			
		||||
 | 
			
		||||
@@ -50,6 +53,7 @@ enum { 				/* Window Atoms */
 | 
			
		||||
  WINDOW_STATE,
 | 
			
		||||
  WINDOW_STATE_FULLSCREEN,
 | 
			
		||||
  WINDOW_STATE_MODAL,
 | 
			
		||||
  WINDOW_STATE_ABOVE,
 | 
			
		||||
  
 | 
			
		||||
  _NET_CLOSE_WINDOW,
 | 
			
		||||
  
 | 
			
		||||
@@ -67,11 +71,6 @@ enum { 				/* Window Atoms */
 | 
			
		||||
  _NET_WM_CONTEXT_ACCEPT,
 | 
			
		||||
  _NET_WM_CONTEXT_CUSTOM,
 | 
			
		||||
 | 
			
		||||
  WINDOW_TYPE_MESSAGE,
 | 
			
		||||
  WINDOW_TYPE_MESSAGE_TIMEOUT,
 | 
			
		||||
  WINDOW_TYPE_MESSAGE_HI,  
 | 
			
		||||
  WINDOW_TYPE_MESSAGE_LO,  
 | 
			
		||||
  
 | 
			
		||||
  _NET_SUPPORTED,
 | 
			
		||||
 | 
			
		||||
  CM_TRANSLUCENCY,
 | 
			
		||||
@@ -110,7 +109,8 @@ static struct {
 | 
			
		||||
  "Request 'OK' button in window title bar\n"},  
 | 
			
		||||
  { "custom_button",  WIN_OPTS_WM_PROTO_CUSTOM,
 | 
			
		||||
  "Request 'custom' button in window title bar\n"},  
 | 
			
		||||
 | 
			
		||||
  { "urgent", WIN_OPTS_URGENT, "Set Urgency flag on window\n" },
 | 
			
		||||
  { "above", WIN_OPTS_STATE_ABOVE, "Set above state hint on window\n" },
 | 
			
		||||
  { NULL, 0, NULL }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@@ -203,6 +203,8 @@ create_atoms(void)
 | 
			
		||||
  atoms[WINDOW_STATE_MODAL]
 | 
			
		||||
    = XInternAtom(dpy, "_NET_WM_STATE_MODAL",False);
 | 
			
		||||
 | 
			
		||||
  atoms[WINDOW_STATE_ABOVE]
 | 
			
		||||
    = XInternAtom(dpy, "_NET_WM_STATE_ABOVE",False);
 | 
			
		||||
 | 
			
		||||
  atoms[_NET_WM_NAME]
 | 
			
		||||
    = XInternAtom(dpy, "_NET_WM_NAME",False);
 | 
			
		||||
@@ -234,19 +236,6 @@ create_atoms(void)
 | 
			
		||||
   atoms[_NET_SUPPORTED]
 | 
			
		||||
      = XInternAtom(dpy, "_NET_SUPPORTED", False);
 | 
			
		||||
 | 
			
		||||
   atoms[WINDOW_TYPE_MESSAGE]
 | 
			
		||||
     = XInternAtom(dpy, "_MB_WM_WINDOW_TYPE_MESSAGE", False);
 | 
			
		||||
 | 
			
		||||
   atoms[WINDOW_TYPE_MESSAGE_TIMEOUT]
 | 
			
		||||
     = XInternAtom(dpy, "_MB_WM_WINDOW_TYPE_MESSAGE_TIMEOUT", False);
 | 
			
		||||
 | 
			
		||||
   atoms[WINDOW_TYPE_MESSAGE_LO]
 | 
			
		||||
     = XInternAtom(dpy, "_MB_WM_WINDOW_TYPE_MESSAGE_STATIC_1", False);
 | 
			
		||||
 | 
			
		||||
   atoms[WINDOW_TYPE_MESSAGE_HI]
 | 
			
		||||
     = XInternAtom(dpy, "_MB_WM_WINDOW_TYPE_MESSAGE_STATIC_0", False);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
   atoms[CM_TRANSLUCENCY]
 | 
			
		||||
     = XInternAtom(dpy, "CM_TRANSLUCENCY", False);
 | 
			
		||||
 | 
			
		||||
@@ -263,14 +252,13 @@ usage(char *bin_name, char *error)
 | 
			
		||||
  printf("\n %s usage:\n"
 | 
			
		||||
	 "%s [ -display <X11 display> ] [ -nopaint] -top <options> [ -dialog <options> ] ...\n\n"
 | 
			
		||||
	 "-top, ( -t ) creates a top level window, <options> should consist of;\n\n"
 | 
			
		||||
         "   <title>,<window type>[,[geom],[extra opts], [message window timeout]]\n\n"
 | 
			
		||||
         "   <title>,<window type>[,[geom],[extra opts]]\n\n"
 | 
			
		||||
	 "-dialog, ( -c) creates a dialog for the previous top level, <options> are;\n\n"
 | 
			
		||||
	 "   <title>[,[geom],[extra opts],]\n\n"
 | 
			
		||||
 | 
			
		||||
	 "   'window type' is one of normal, dock, toolbar, dialog, splash, desktop, message, message-hi, message-lo\n"
 | 
			
		||||
	 "   'window type' is one of normal, dock, toolbar, dialog, splash, desktop, message \n"
 | 
			
		||||
 | 
			
		||||
         "   'geom' is a X11 window geometry definition, like 100x100+100+100\n"
 | 
			
		||||
	 "   'message window timeout' is the time ( seconds ) a message win is active\n"
 | 
			
		||||
	 "   'extra opts' is a ':' seperated list of the following flags;\n\n",
 | 
			
		||||
	 bin_name, bin_name);
 | 
			
		||||
 | 
			
		||||
@@ -413,8 +401,8 @@ win_set_ewmh_type(Window win, Atom atom_type)
 | 
			
		||||
void
 | 
			
		||||
win_set_extened_options(Window win, int option_flags, int message_timeout)
 | 
			
		||||
{
 | 
			
		||||
  Atom wm_protocols[3];
 | 
			
		||||
  int wm_protocols_idx = 1;
 | 
			
		||||
  Atom wm_protocols[3], wm_states[3];
 | 
			
		||||
  int wm_protocols_idx = 1, wm_states_idx = 0;
 | 
			
		||||
 | 
			
		||||
  wm_protocols[0] = atoms[WM_DELETE_WINDOW];
 | 
			
		||||
 | 
			
		||||
@@ -434,10 +422,7 @@ win_set_extened_options(Window win, int option_flags, int message_timeout)
 | 
			
		||||
  if (option_flags & WIN_OPTS_STATE_FULLSCREEN)
 | 
			
		||||
    {
 | 
			
		||||
      printf("winspew log: Setting fullscreen hint\n"); 
 | 
			
		||||
      XChangeProperty(dpy, win, 
 | 
			
		||||
		      atoms[WINDOW_STATE], XA_ATOM, 32, 
 | 
			
		||||
		      PropModeReplace, 
 | 
			
		||||
		      (unsigned char *) &atoms[WINDOW_STATE_FULLSCREEN], 1);
 | 
			
		||||
      wm_states[wm_states_idx] = atoms[WINDOW_STATE_FULLSCREEN];
 | 
			
		||||
      WinIsFullscreen = True;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -452,25 +437,40 @@ win_set_extened_options(Window win, int option_flags, int message_timeout)
 | 
			
		||||
  if (option_flags & WIN_OPTS_STATE_MODAL)
 | 
			
		||||
    {
 | 
			
		||||
      printf("winspew log: Setting modal hint\n"); 
 | 
			
		||||
      XChangeProperty(dpy, win, 
 | 
			
		||||
		      atoms[WINDOW_STATE], XA_ATOM, 32, 
 | 
			
		||||
		      PropModeReplace, 
 | 
			
		||||
		      (unsigned char *) &atoms[WINDOW_STATE_MODAL], 1);
 | 
			
		||||
      wm_states[wm_states_idx] = atoms[WINDOW_STATE_MODAL];
 | 
			
		||||
      wm_states_idx++;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (message_timeout)
 | 
			
		||||
  if (option_flags & WIN_OPTS_STATE_ABOVE)
 | 
			
		||||
    {
 | 
			
		||||
      int data[1];
 | 
			
		||||
 | 
			
		||||
      printf("winspew log: Setting message timeout\n"); 
 | 
			
		||||
 | 
			
		||||
      data[0] = message_timeout;
 | 
			
		||||
      XChangeProperty(dpy, win, 
 | 
			
		||||
		      atoms[WINDOW_TYPE_MESSAGE_TIMEOUT], XA_CARDINAL, 32, 
 | 
			
		||||
		      PropModeReplace, 
 | 
			
		||||
		      (unsigned char *) &data[0], 1);
 | 
			
		||||
      printf("winspew log: Setting state above hint\n");
 | 
			
		||||
      wm_states[wm_states_idx] = atoms[WINDOW_STATE_ABOVE];
 | 
			
		||||
      wm_states_idx++;
 | 
			
		||||
    }
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  if (wm_states_idx)
 | 
			
		||||
    {
 | 
			
		||||
      XChangeProperty(dpy, win,
 | 
			
		||||
                      atoms[WINDOW_STATE], XA_ATOM, 32,
 | 
			
		||||
                      PropModeReplace,
 | 
			
		||||
                      (unsigned char *)wm_states, wm_states_idx);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (option_flags & WIN_OPTS_URGENT)
 | 
			
		||||
    {
 | 
			
		||||
      XWMHints *wmhints;
 | 
			
		||||
 | 
			
		||||
      wmhints = XAllocWMHints();
 | 
			
		||||
 | 
			
		||||
      wmhints->flags = XUrgencyHint;
 | 
			
		||||
 | 
			
		||||
      printf("winspew log: Setting urgency hint\n");
 | 
			
		||||
 | 
			
		||||
      XSetWMHints(dpy, win, wmhints);
 | 
			
		||||
 | 
			
		||||
      XFree(wmhints);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (option_flags & WIN_OPTS_WM_PROTO_ACCEPT)
 | 
			
		||||
    {
 | 
			
		||||
      printf("winspew log: Setting accept protocol\n"); 
 | 
			
		||||
@@ -588,9 +588,6 @@ create_top_level(int argc, char **argv, char *spec)
 | 
			
		||||
    {"splash",  WINDOW_TYPE_SPLASH},
 | 
			
		||||
    {"toolbar", WINDOW_TYPE_TOOLBAR},
 | 
			
		||||
    {"desktop", WINDOW_TYPE_DESKTOP},
 | 
			
		||||
    {"message", WINDOW_TYPE_MESSAGE},
 | 
			
		||||
    {"message-hi", WINDOW_TYPE_MESSAGE_HI},
 | 
			
		||||
    {"message-lo", WINDOW_TYPE_MESSAGE_LO},
 | 
			
		||||
    {NULL, 0}
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
@@ -651,7 +648,9 @@ create_top_level(int argc, char **argv, char *spec)
 | 
			
		||||
 | 
			
		||||
     if ((tmp = strsep (&str, delim)) != NULL)
 | 
			
		||||
       {
 | 
			
		||||
	 /* This is actually now ignored */
 | 
			
		||||
	 message_timeout = atoi(tmp);
 | 
			
		||||
	 fprintf(stderr, "*** Message timeout depreciated ***\n");
 | 
			
		||||
       }
 | 
			
		||||
 | 
			
		||||
     free(str);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user