2 * Server-side window handling
4 * Copyright (C) 2001 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "wine/port.h"
39 /* a window property */
42 unsigned short type
; /* property type (see below) */
43 atom_t atom
; /* property atom */
44 obj_handle_t handle
; /* property handle (user-defined storage) */
49 PROP_TYPE_FREE
, /* free entry */
50 PROP_TYPE_STRING
, /* atom that was originally a string */
51 PROP_TYPE_ATOM
/* plain atom */
57 struct window
*parent
; /* parent window */
58 user_handle_t owner
; /* owner of this window */
59 struct window
*first_child
; /* first child in Z-order */
60 struct window
*last_child
; /* last child in Z-order */
61 struct window
*first_unlinked
; /* first child not linked in the Z-order list */
62 struct window
*next
; /* next window in Z-order */
63 struct window
*prev
; /* prev window in Z-order */
64 user_handle_t handle
; /* full handle for this window */
65 struct thread
*thread
; /* thread owning the window */
66 atom_t atom
; /* class atom */
67 user_handle_t last_active
; /* last active popup */
68 rectangle_t window_rect
; /* window rectangle */
69 rectangle_t client_rect
; /* client rectangle */
70 unsigned int style
; /* window style */
71 unsigned int ex_style
; /* window extended style */
72 unsigned int id
; /* window id */
73 void* instance
; /* creator instance */
74 void* user_data
; /* user-specific data */
75 WCHAR
*text
; /* window caption text */
76 int paint_count
; /* count of pending paints for this window */
77 int prop_inuse
; /* number of in-use window properties */
78 int prop_alloc
; /* number of allocated window properties */
79 struct property
*properties
; /* window properties array */
82 static struct window
*top_window
; /* top-level (desktop) window */
84 /* global window pointers */
85 static struct window
*shell_window
;
86 static struct window
*shell_listview
;
87 static struct window
*progman_window
;
88 static struct window
*taskman_window
;
90 /* retrieve a pointer to a window from its handle */
91 inline static struct window
*get_window( user_handle_t handle
)
93 struct window
*ret
= get_user_object( handle
, USER_WINDOW
);
94 if (!ret
) set_error( STATUS_INVALID_HANDLE
);
98 /* unlink a window from the tree */
99 static void unlink_window( struct window
*win
)
101 struct window
*parent
= win
->parent
;
105 if (win
->next
) win
->next
->prev
= win
->prev
;
106 else if (parent
->last_child
== win
) parent
->last_child
= win
->prev
;
108 if (win
->prev
) win
->prev
->next
= win
->next
;
109 else if (parent
->first_child
== win
) parent
->first_child
= win
->next
;
110 else if (parent
->first_unlinked
== win
) parent
->first_unlinked
= win
->next
;
114 /* link a window into the tree (or unlink it if the new parent is NULL) */
115 static void link_window( struct window
*win
, struct window
*parent
, struct window
*previous
)
117 unlink_window( win
); /* unlink it from the previous location */
121 win
->parent
= parent
;
122 if ((win
->prev
= previous
))
124 if ((win
->next
= previous
->next
)) win
->next
->prev
= win
;
125 else if (win
->parent
->last_child
== previous
) win
->parent
->last_child
= win
;
126 win
->prev
->next
= win
;
130 if ((win
->next
= parent
->first_child
)) win
->next
->prev
= win
;
131 else win
->parent
->last_child
= win
;
132 parent
->first_child
= win
;
135 else /* move it to parent unlinked list */
137 parent
= win
->parent
;
138 if ((win
->next
= parent
->first_unlinked
)) win
->next
->prev
= win
;
140 parent
->first_unlinked
= win
;
144 /* set a window property */
145 static void set_property( struct window
*win
, atom_t atom
, obj_handle_t handle
,
146 enum property_type type
)
149 struct property
*new_props
;
151 /* check if it exists already */
152 for (i
= 0; i
< win
->prop_inuse
; i
++)
154 if (win
->properties
[i
].type
== PROP_TYPE_FREE
)
159 if (win
->properties
[i
].atom
== atom
)
161 win
->properties
[i
].type
= type
;
162 win
->properties
[i
].handle
= handle
;
167 /* need to add an entry */
168 if (!grab_global_atom( atom
)) return;
172 if (win
->prop_inuse
>= win
->prop_alloc
)
174 /* need to grow the array */
175 if (!(new_props
= realloc( win
->properties
,
176 sizeof(*new_props
) * (win
->prop_alloc
+ 16) )))
178 set_error( STATUS_NO_MEMORY
);
179 release_global_atom( atom
);
182 win
->prop_alloc
+= 16;
183 win
->properties
= new_props
;
185 free
= win
->prop_inuse
++;
187 win
->properties
[free
].atom
= atom
;
188 win
->properties
[free
].type
= type
;
189 win
->properties
[free
].handle
= handle
;
192 /* remove a window property */
193 static obj_handle_t
remove_property( struct window
*win
, atom_t atom
)
197 for (i
= 0; i
< win
->prop_inuse
; i
++)
199 if (win
->properties
[i
].type
== PROP_TYPE_FREE
) continue;
200 if (win
->properties
[i
].atom
== atom
)
202 release_global_atom( atom
);
203 win
->properties
[i
].type
= PROP_TYPE_FREE
;
204 return win
->properties
[i
].handle
;
207 /* FIXME: last error? */
211 /* find a window property */
212 static obj_handle_t
get_property( struct window
*win
, atom_t atom
)
216 for (i
= 0; i
< win
->prop_inuse
; i
++)
218 if (win
->properties
[i
].type
== PROP_TYPE_FREE
) continue;
219 if (win
->properties
[i
].atom
== atom
) return win
->properties
[i
].handle
;
221 /* FIXME: last error? */
225 /* destroy all properties of a window */
226 inline static void destroy_properties( struct window
*win
)
230 if (!win
->properties
) return;
231 for (i
= 0; i
< win
->prop_inuse
; i
++)
233 if (win
->properties
[i
].type
== PROP_TYPE_FREE
) continue;
234 release_global_atom( win
->properties
[i
].atom
);
236 free( win
->properties
);
239 /* destroy a window */
240 static void destroy_window( struct window
*win
)
242 assert( win
!= top_window
);
244 /* destroy all children */
245 while (win
->first_child
) destroy_window( win
->first_child
);
246 while (win
->first_unlinked
) destroy_window( win
->first_unlinked
);
248 if (win
->thread
->queue
)
250 if (win
->paint_count
) inc_queue_paint_count( win
->thread
, -win
->paint_count
);
251 queue_cleanup_window( win
->thread
, win
->handle
);
253 /* reset global window pointers, if the corresponding window is destroyed */
254 if (win
== shell_window
) shell_window
= NULL
;
255 if (win
== shell_listview
) shell_listview
= NULL
;
256 if (win
== progman_window
) progman_window
= NULL
;
257 if (win
== taskman_window
) taskman_window
= NULL
;
258 free_user_handle( win
->handle
);
259 destroy_properties( win
);
260 unlink_window( win
);
261 if (win
->text
) free( win
->text
);
262 memset( win
, 0x55, sizeof(*win
) );
266 /* create a new window structure (note: the window is not linked in the window tree) */
267 static struct window
*create_window( struct window
*parent
, struct window
*owner
, atom_t atom
)
269 struct window
*win
= mem_alloc( sizeof(*win
) );
270 if (!win
) return NULL
;
272 if (!(win
->handle
= alloc_user_handle( win
, USER_WINDOW
)))
277 win
->parent
= parent
;
278 win
->owner
= owner
? owner
->handle
: 0;
279 win
->first_child
= NULL
;
280 win
->last_child
= NULL
;
281 win
->first_unlinked
= NULL
;
282 win
->thread
= current
;
284 win
->last_active
= win
->handle
;
288 win
->instance
= NULL
;
289 win
->user_data
= NULL
;
291 win
->paint_count
= 0;
294 win
->properties
= NULL
;
296 if (parent
) /* put it on parent unlinked list */
298 if ((win
->next
= parent
->first_unlinked
)) win
->next
->prev
= win
;
300 parent
->first_unlinked
= win
;
302 else win
->next
= win
->prev
= NULL
;
304 /* if parent belongs to a different thread, attach the two threads */
305 if (parent
&& parent
->thread
&& parent
->thread
!= current
)
306 attach_thread_input( current
, parent
->thread
);
310 /* destroy all windows belonging to a given thread */
311 void destroy_thread_windows( struct thread
*thread
)
313 user_handle_t handle
= 0;
316 while ((win
= next_user_handle( &handle
, USER_WINDOW
)))
318 if (win
->thread
!= thread
) continue;
319 destroy_window( win
);
323 /* check whether child is a descendant of parent */
324 int is_child_window( user_handle_t parent
, user_handle_t child
)
326 struct window
*child_ptr
= get_user_object( child
, USER_WINDOW
);
327 struct window
*parent_ptr
= get_user_object( parent
, USER_WINDOW
);
329 if (!child_ptr
|| !parent_ptr
) return 0;
330 while (child_ptr
->parent
)
332 if (child_ptr
->parent
== parent_ptr
) return 1;
333 child_ptr
= child_ptr
->parent
;
338 /* check whether window is a top-level window */
339 int is_top_level_window( user_handle_t window
)
341 struct window
*win
= get_user_object( window
, USER_WINDOW
);
342 return (win
&& win
->parent
== top_window
);
345 /* make a window active if possible */
346 int make_window_active( user_handle_t window
)
348 struct window
*owner
, *win
= get_window( window
);
352 /* set last active for window and its owner */
353 win
->last_active
= win
->handle
;
354 if ((owner
= get_user_object( win
->owner
, USER_WINDOW
))) owner
->last_active
= win
->handle
;
358 /* find child of 'parent' that contains the given point (in parent-relative coords) */
359 static struct window
*child_window_from_point( struct window
*parent
, int x
, int y
)
363 for (ptr
= parent
->first_child
; ptr
; ptr
= ptr
->next
)
365 if (!(ptr
->style
& WS_VISIBLE
)) continue; /* not visible -> skip */
366 if ((ptr
->style
& (WS_POPUP
|WS_CHILD
|WS_DISABLED
)) == (WS_CHILD
|WS_DISABLED
))
367 continue; /* disabled child -> skip */
368 if ((ptr
->ex_style
& (WS_EX_LAYERED
|WS_EX_TRANSPARENT
)) == (WS_EX_LAYERED
|WS_EX_TRANSPARENT
))
369 continue; /* transparent -> skip */
370 if (x
< ptr
->window_rect
.left
|| x
>= ptr
->window_rect
.right
||
371 y
< ptr
->window_rect
.top
|| y
>= ptr
->window_rect
.bottom
)
372 continue; /* not in window -> skip */
374 /* FIXME: check window region here */
376 /* if window is minimized or disabled, return at once */
377 if (ptr
->style
& (WS_MINIMIZE
|WS_DISABLED
)) return ptr
;
379 /* if point is not in client area, return at once */
380 if (x
< ptr
->client_rect
.left
|| x
>= ptr
->client_rect
.right
||
381 y
< ptr
->client_rect
.top
|| y
>= ptr
->client_rect
.bottom
)
384 return child_window_from_point( ptr
, x
- ptr
->client_rect
.left
, y
- ptr
->client_rect
.top
);
386 return parent
; /* not found any child */
389 /* find window containing point (in absolute coords) */
390 user_handle_t
window_from_point( int x
, int y
)
394 if (!top_window
) return 0;
395 ret
= child_window_from_point( top_window
, x
, y
);
399 /* return the thread owning a window */
400 struct thread
*get_window_thread( user_handle_t handle
)
402 struct window
*win
= get_user_object( handle
, USER_WINDOW
);
403 if (!win
|| !win
->thread
) return NULL
;
404 return (struct thread
*)grab_object( win
->thread
);
407 /* find a child of the specified window that needs repainting */
408 static struct window
*find_child_to_repaint( struct window
*parent
, struct thread
*thread
)
410 struct window
*ptr
, *ret
= NULL
;
412 for (ptr
= parent
->first_child
; ptr
&& !ret
; ptr
= ptr
->next
)
414 if (!(ptr
->style
& WS_VISIBLE
)) continue;
415 if (ptr
->paint_count
&& ptr
->thread
== thread
)
417 else /* explore its children */
418 ret
= find_child_to_repaint( ptr
, thread
);
421 if (ret
&& (ret
->ex_style
& WS_EX_TRANSPARENT
))
423 /* transparent window, check for non-transparent sibling to paint first */
424 for (ptr
= ret
->next
; ptr
; ptr
= ptr
->next
)
426 if (!(ptr
->style
& WS_VISIBLE
)) continue;
427 if (ptr
->ex_style
& WS_EX_TRANSPARENT
) continue;
428 if (ptr
->paint_count
&& ptr
->thread
== thread
) return ptr
;
435 /* find a window that needs repainting */
436 user_handle_t
find_window_to_repaint( user_handle_t parent
, struct thread
*thread
)
438 struct window
*win
= parent
? get_window( parent
) : top_window
;
440 if (!win
|| !(win
->style
& WS_VISIBLE
)) return 0;
441 if (!win
->paint_count
|| win
->thread
!= thread
)
442 win
= find_child_to_repaint( win
, thread
);
443 return win
? win
->handle
: 0;
447 /* create a window */
448 DECL_HANDLER(create_window
)
451 if (!req
->parent
) /* return desktop window */
455 if (!(top_window
= create_window( NULL
, NULL
, req
->atom
))) return;
456 top_window
->thread
= NULL
; /* no thread owns the desktop */
457 top_window
->style
= WS_POPUP
| WS_VISIBLE
| WS_CLIPSIBLINGS
| WS_CLIPCHILDREN
;
459 reply
->handle
= top_window
->handle
;
463 struct window
*win
, *parent
, *owner
= NULL
;
465 if (!(parent
= get_window( req
->parent
))) return;
466 if (req
->owner
&& !(owner
= get_window( req
->owner
))) return;
467 if (owner
== top_window
) owner
= NULL
;
468 else if (owner
&& parent
!= top_window
)
470 /* an owned window must be created as top-level */
471 set_error( STATUS_ACCESS_DENIED
);
474 if (!(win
= create_window( parent
, owner
, req
->atom
))) return;
475 reply
->handle
= win
->handle
;
480 /* link a window into the tree */
481 DECL_HANDLER(link_window
)
483 struct window
*win
, *parent
= NULL
, *previous
= NULL
;
485 if (!(win
= get_window( req
->handle
))) return;
486 if (req
->parent
&& !(parent
= get_window( req
->parent
))) return;
488 if (win
== top_window
)
490 set_error( STATUS_INVALID_PARAMETER
);
493 reply
->full_parent
= parent
? parent
->handle
: 0;
494 if (parent
&& req
->previous
)
496 if (req
->previous
== (user_handle_t
)1) /* special case: HWND_BOTTOM */
498 previous
= parent
->last_child
;
499 if (previous
== win
) return; /* nothing to do */
503 if (!(previous
= get_window( req
->previous
))) return;
504 /* previous must be a child of parent, and not win itself */
505 if (previous
->parent
!= parent
|| previous
== win
)
507 set_error( STATUS_INVALID_PARAMETER
);
512 link_window( win
, parent
, previous
);
516 /* destroy a window */
517 DECL_HANDLER(destroy_window
)
519 struct window
*win
= get_window( req
->handle
);
522 if (win
!= top_window
) destroy_window( win
);
523 else set_error( STATUS_ACCESS_DENIED
);
528 /* set a window owner */
529 DECL_HANDLER(set_window_owner
)
531 struct window
*win
= get_window( req
->handle
);
532 struct window
*owner
= NULL
;
535 if (req
->owner
&& !(owner
= get_window( req
->owner
))) return;
536 if (win
== top_window
)
538 set_error( STATUS_ACCESS_DENIED
);
541 reply
->prev_owner
= win
->owner
;
542 reply
->full_owner
= win
->owner
= owner
? owner
->handle
: 0;
546 /* get information from a window handle */
547 DECL_HANDLER(get_window_info
)
549 struct window
*win
= get_window( req
->handle
);
551 reply
->full_handle
= 0;
552 reply
->tid
= reply
->pid
= 0;
555 reply
->full_handle
= win
->handle
;
556 reply
->last_active
= win
->handle
;
557 if (get_user_object( win
->last_active
, USER_WINDOW
)) reply
->last_active
= win
->last_active
;
560 reply
->tid
= get_thread_id( win
->thread
);
561 reply
->pid
= get_process_id( win
->thread
->process
);
562 reply
->atom
= win
->atom
;
568 /* set some information in a window */
569 DECL_HANDLER(set_window_info
)
571 struct window
*win
= get_window( req
->handle
);
574 if (req
->flags
&& win
== top_window
)
576 set_error( STATUS_ACCESS_DENIED
);
579 reply
->old_style
= win
->style
;
580 reply
->old_ex_style
= win
->ex_style
;
581 reply
->old_id
= win
->id
;
582 reply
->old_instance
= win
->instance
;
583 reply
->old_user_data
= win
->user_data
;
584 if (req
->flags
& SET_WIN_STYLE
) win
->style
= req
->style
;
585 if (req
->flags
& SET_WIN_EXSTYLE
) win
->ex_style
= req
->ex_style
;
586 if (req
->flags
& SET_WIN_ID
) win
->id
= req
->id
;
587 if (req
->flags
& SET_WIN_INSTANCE
) win
->instance
= req
->instance
;
588 if (req
->flags
& SET_WIN_USERDATA
) win
->user_data
= req
->user_data
;
592 /* get a list of the window parents, up to the root of the tree */
593 DECL_HANDLER(get_window_parents
)
595 struct window
*ptr
, *win
= get_window( req
->handle
);
600 if (win
) for (ptr
= win
->parent
; ptr
; ptr
= ptr
->parent
) total
++;
602 reply
->count
= total
;
603 len
= min( get_reply_max_size(), total
* sizeof(user_handle_t
) );
604 if (len
&& ((data
= set_reply_data_size( len
))))
606 for (ptr
= win
->parent
; ptr
&& len
; ptr
= ptr
->parent
, len
-= sizeof(*data
))
607 *data
++ = ptr
->handle
;
612 /* get a list of the window children */
613 DECL_HANDLER(get_window_children
)
615 struct window
*ptr
, *parent
= get_window( req
->parent
);
621 for (ptr
= parent
->first_child
, total
= 0; ptr
; ptr
= ptr
->next
)
623 if (req
->atom
&& ptr
->atom
!= req
->atom
) continue;
624 if (req
->tid
&& get_thread_id(ptr
->thread
) != req
->tid
) continue;
628 reply
->count
= total
;
629 len
= min( get_reply_max_size(), total
* sizeof(user_handle_t
) );
630 if (len
&& ((data
= set_reply_data_size( len
))))
632 for (ptr
= parent
->first_child
; ptr
&& len
; ptr
= ptr
->next
)
634 if (req
->atom
&& ptr
->atom
!= req
->atom
) continue;
635 if (req
->tid
&& get_thread_id(ptr
->thread
) != req
->tid
) continue;
636 *data
++ = ptr
->handle
;
637 len
-= sizeof(*data
);
643 /* get window tree information from a window handle */
644 DECL_HANDLER(get_window_tree
)
646 struct window
*win
= get_window( req
->handle
);
652 struct window
*parent
= win
->parent
;
653 reply
->parent
= parent
->handle
;
654 reply
->owner
= win
->owner
;
655 reply
->next_sibling
= win
->next
? win
->next
->handle
: 0;
656 reply
->prev_sibling
= win
->prev
? win
->prev
->handle
: 0;
657 reply
->first_sibling
= parent
->first_child
? parent
->first_child
->handle
: 0;
658 reply
->last_sibling
= parent
->last_child
? parent
->last_child
->handle
: 0;
664 reply
->next_sibling
= 0;
665 reply
->prev_sibling
= 0;
666 reply
->first_sibling
= 0;
667 reply
->last_sibling
= 0;
669 reply
->first_child
= win
->first_child
? win
->first_child
->handle
: 0;
670 reply
->last_child
= win
->last_child
? win
->last_child
->handle
: 0;
674 /* set the window and client rectangles of a window */
675 DECL_HANDLER(set_window_rectangles
)
677 struct window
*win
= get_window( req
->handle
);
681 win
->window_rect
= req
->window
;
682 win
->client_rect
= req
->client
;
687 /* get the window and client rectangles of a window */
688 DECL_HANDLER(get_window_rectangles
)
690 struct window
*win
= get_window( req
->handle
);
694 reply
->window
= win
->window_rect
;
695 reply
->client
= win
->client_rect
;
700 /* get the window text */
701 DECL_HANDLER(get_window_text
)
703 struct window
*win
= get_window( req
->handle
);
705 if (win
&& win
->text
)
707 size_t len
= strlenW( win
->text
) * sizeof(WCHAR
);
708 if (len
> get_reply_max_size()) len
= get_reply_max_size();
709 set_reply_data( win
->text
, len
);
714 /* set the window text */
715 DECL_HANDLER(set_window_text
)
717 struct window
*win
= get_window( req
->handle
);
722 size_t len
= get_req_data_size() / sizeof(WCHAR
);
725 if (!(text
= mem_alloc( (len
+1) * sizeof(WCHAR
) ))) return;
726 memcpy( text
, get_req_data(), len
* sizeof(WCHAR
) );
729 if (win
->text
) free( win
->text
);
735 /* increment the window paint count */
736 DECL_HANDLER(inc_window_paint_count
)
738 struct window
*win
= get_window( req
->handle
);
740 if (win
&& win
->thread
)
742 int old
= win
->paint_count
;
743 if ((win
->paint_count
+= req
->incr
) < 0) win
->paint_count
= 0;
744 inc_queue_paint_count( win
->thread
, win
->paint_count
- old
);
749 /* get the coordinates offset between two windows */
750 DECL_HANDLER(get_windows_offset
)
754 reply
->x
= reply
->y
= 0;
757 if (!(win
= get_window( req
->from
))) return;
760 reply
->x
+= win
->client_rect
.left
;
761 reply
->y
+= win
->client_rect
.top
;
767 if (!(win
= get_window( req
->to
))) return;
770 reply
->x
-= win
->client_rect
.left
;
771 reply
->y
-= win
->client_rect
.top
;
778 /* set a window property */
779 DECL_HANDLER(set_window_property
)
781 struct window
*win
= get_window( req
->window
);
783 if (win
) set_property( win
, req
->atom
, req
->handle
,
784 req
->string
? PROP_TYPE_STRING
: PROP_TYPE_ATOM
);
788 /* remove a window property */
789 DECL_HANDLER(remove_window_property
)
791 struct window
*win
= get_window( req
->window
);
793 if (win
) reply
->handle
= remove_property( win
, req
->atom
);
797 /* get a window property */
798 DECL_HANDLER(get_window_property
)
800 struct window
*win
= get_window( req
->window
);
802 if (win
) reply
->handle
= get_property( win
, req
->atom
);
806 /* get the list of properties of a window */
807 DECL_HANDLER(get_window_properties
)
809 property_data_t
*data
;
810 int i
, count
, max
= get_reply_max_size() / sizeof(*data
);
811 struct window
*win
= get_window( req
->window
);
816 for (i
= count
= 0; i
< win
->prop_inuse
; i
++)
817 if (win
->properties
[i
].type
!= PROP_TYPE_FREE
) count
++;
818 reply
->total
= count
;
820 if (count
> max
) count
= max
;
821 if (!count
|| !(data
= set_reply_data_size( count
* sizeof(*data
) ))) return;
823 for (i
= 0; i
< win
->prop_inuse
&& count
; i
++)
825 if (win
->properties
[i
].type
== PROP_TYPE_FREE
) continue;
826 data
->atom
= win
->properties
[i
].atom
;
827 data
->string
= (win
->properties
[i
].type
== PROP_TYPE_STRING
);
828 data
->handle
= win
->properties
[i
].handle
;
835 /* get the new window pointer for a global window, checking permissions */
836 /* helper for set_global_windows request */
837 static int get_new_global_window( struct window
**win
, user_handle_t handle
)
846 set_error( STATUS_ACCESS_DENIED
);
849 *win
= get_window( handle
);
850 return (*win
!= NULL
);
853 /* Set/get the global windows */
854 DECL_HANDLER(set_global_windows
)
856 struct window
*new_shell_window
= shell_window
;
857 struct window
*new_shell_listview
= shell_listview
;
858 struct window
*new_progman_window
= progman_window
;
859 struct window
*new_taskman_window
= taskman_window
;
861 reply
->old_shell_window
= shell_window
? shell_window
->handle
: 0;
862 reply
->old_shell_listview
= shell_listview
? shell_listview
->handle
: 0;
863 reply
->old_progman_window
= progman_window
? progman_window
->handle
: 0;
864 reply
->old_taskman_window
= taskman_window
? taskman_window
->handle
: 0;
866 if (req
->flags
& SET_GLOBAL_SHELL_WINDOWS
)
868 if (!get_new_global_window( &new_shell_window
, req
->shell_window
)) return;
869 if (!get_new_global_window( &new_shell_listview
, req
->shell_listview
)) return;
871 if (req
->flags
& SET_GLOBAL_PROGMAN_WINDOW
)
873 if (!get_new_global_window( &new_progman_window
, req
->progman_window
)) return;
875 if (req
->flags
& SET_GLOBAL_TASKMAN_WINDOW
)
877 if (!get_new_global_window( &new_taskman_window
, req
->taskman_window
)) return;
879 shell_window
= new_shell_window
;
880 shell_listview
= new_shell_listview
;
881 progman_window
= new_progman_window
;
882 taskman_window
= new_taskman_window
;