1 /* winspector.c - window attribute inspector
3 * Window Maker window manager
5 * Copyright (c) 1997, 1998 Alfredo K. Kojima
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
26 #include <X11/Xutil.h>
31 #include "WindowMaker.h"
36 #include "workspace.h"
42 #include "application.h"
45 #include "winspector.h"
50 extern WDDomain
*WDWindowAttributes
;
52 static InspectorPanel
*panelList
=NULL
;
54 extern WPreferences wPreferences
;
56 static proplist_t ANoTitlebar
= NULL
;
57 static proplist_t ANoResizebar
;
58 static proplist_t ANoMiniaturizeButton
;
59 static proplist_t ANoCloseButton
;
60 static proplist_t ANoHideOthers
;
61 static proplist_t ANoMouseBindings
;
62 static proplist_t ANoKeyBindings
;
63 static proplist_t ANoAppIcon
;
64 static proplist_t AKeepOnTop
;
65 static proplist_t AKeepOnBottom
;
66 static proplist_t AOmnipresent
;
67 static proplist_t ASkipWindowList
;
68 static proplist_t AKeepInsideScreen
;
69 static proplist_t AUnfocusable
;
70 static proplist_t AAlwaysUserIcon
;
71 static proplist_t AStartMiniaturized
;
72 static proplist_t AStartMaximized
;
73 static proplist_t ADontSaveSession
;
74 static proplist_t AEmulateAppIcon
;
75 static proplist_t AFullMaximize
;
77 static proplist_t AStartWorkspace
;
79 static proplist_t AIcon
;
81 /* application wide options */
82 static proplist_t AStartHidden
;
85 static proplist_t AnyWindow
;
86 static proplist_t EmptyString
;
87 static proplist_t Yes
, No
;
94 static void applySettings(WMButton
*button
, InspectorPanel
*panel
);
99 if (ANoTitlebar
!=NULL
)
102 AIcon
= PLMakeString("Icon");
103 ANoTitlebar
= PLMakeString("NoTitlebar");
104 ANoResizebar
= PLMakeString("NoResizebar");
105 ANoMiniaturizeButton
= PLMakeString("NoMiniaturizeButton");
106 ANoCloseButton
= PLMakeString("NoCloseButton");
107 ANoHideOthers
= PLMakeString("NoHideOthers");
108 ANoMouseBindings
= PLMakeString("NoMouseBindings");
109 ANoKeyBindings
= PLMakeString("NoKeyBindings");
110 ANoAppIcon
= PLMakeString("NoAppIcon");
111 AKeepOnTop
= PLMakeString("KeepOnTop");
112 AKeepOnBottom
= PLMakeString("KeepOnBottom");
113 AOmnipresent
= PLMakeString("Omnipresent");
114 ASkipWindowList
= PLMakeString("SkipWindowList");
115 AKeepInsideScreen
= PLMakeString("KeepInsideScreen");
116 AUnfocusable
= PLMakeString("Unfocusable");
117 AAlwaysUserIcon
= PLMakeString("AlwaysUserIcon");
118 AStartMiniaturized
= PLMakeString("StartMiniaturized");
119 AStartMaximized
= PLMakeString("StartMaximized");
120 AStartHidden
= PLMakeString("StartHidden");
121 ADontSaveSession
= PLMakeString("DontSaveSession");
122 AEmulateAppIcon
= PLMakeString("EmulateAppIcon");
123 AFullMaximize
= PLMakeString("FullMaximize");
125 AStartWorkspace
= PLMakeString("StartWorkspace");
127 AnyWindow
= PLMakeString("*");
128 EmptyString
= PLMakeString("");
129 Yes
= PLMakeString("Yes");
130 No
= PLMakeString("No");
136 freeInspector(InspectorPanel
*panel
)
138 panel
->destroyed
= 1;
139 if (panel
->choosingIcon
)
142 WMDestroyWidget(panel
->win
);
144 XDestroyWindow(dpy
, panel
->parent
);
151 destroyInspector(WCoreWindow
*foo
, void *data
, XEvent
*event
)
153 InspectorPanel
*panel
;
157 while (panel
->frame
!=data
)
158 panel
= panel
->nextPtr
;
160 if (panelList
== panel
)
161 panelList
= panel
->nextPtr
;
164 while (tmp
->nextPtr
!=panel
) {
167 tmp
->nextPtr
= panel
->nextPtr
;
169 panel
->inspected
->flags
.inspector_open
= 0;
170 panel
->inspected
->inspector
= NULL
;
172 WMRemoveNotificationObserver(panel
);
174 wWindowUnmap(panel
->frame
);
175 wUnmanageWindow(panel
->frame
, True
, False
);
177 freeInspector(panel
);
183 wDestroyInspectorPanels()
185 InspectorPanel
*panel
;
187 while (panelList
!= NULL
) {
189 panelList
= panelList
->nextPtr
;
190 wUnmanageWindow(panel
->frame
, False
, False
);
191 WMDestroyWidget(panel
->win
);
193 panel
->inspected
->flags
.inspector_open
= 0;
194 panel
->inspected
->inspector
= NULL
;
202 changePage(WMPopUpButton
*bPtr
, InspectorPanel
*panel
)
206 page
= WMGetPopUpButtonSelectedItem(bPtr
);
209 WMMapWidget(panel
->specFrm
);
210 WMMapWidget(panel
->specLbl
);
211 } else if (page
== 1) {
212 WMMapWidget(panel
->attrFrm
);
213 } else if (page
== 2) {
214 WMMapWidget(panel
->moreFrm
);
215 } else if (page
== 3) {
216 WMMapWidget(panel
->iconFrm
);
217 WMMapWidget(panel
->wsFrm
);
219 WMMapWidget(panel
->appFrm
);
223 WMUnmapWidget(panel
->specFrm
);
224 WMUnmapWidget(panel
->specLbl
);
227 WMUnmapWidget(panel
->attrFrm
);
229 WMUnmapWidget(panel
->moreFrm
);
231 WMUnmapWidget(panel
->iconFrm
);
232 WMUnmapWidget(panel
->wsFrm
);
234 if (page
!= 4 && panel
->appFrm
)
235 WMUnmapWidget(panel
->appFrm
);
239 #define USE_TEXT_FIELD 1
240 #define UPDATE_TEXT_FIELD 2
241 #define REVERT_TO_DEFAULT 4
245 showIconFor(WMScreen
*scrPtr
, InspectorPanel
*panel
,
246 char *wm_instance
, char *wm_class
, int flags
)
248 WMPixmap
*pixmap
= (WMPixmap
*) NULL
;
249 char *file
=NULL
, *path
=NULL
;
252 if ((flags
& USE_TEXT_FIELD
) != 0) {
253 file
= WMGetTextFieldText(panel
->fileText
);
254 if (file
&& file
[0] == 0) {
259 db_icon
= wDefaultGetIconFile(panel
->inspected
->screen_ptr
,
260 wm_instance
, wm_class
, False
);
262 file
= wstrdup(db_icon
);
264 if (db_icon
!=NULL
&& (flags
& REVERT_TO_DEFAULT
)!=0) {
266 file
= wstrdup(db_icon
);
267 flags
|= UPDATE_TEXT_FIELD
;
270 if ((flags
& UPDATE_TEXT_FIELD
) != 0) {
271 WMSetTextFieldText(panel
->fileText
, file
);
275 path
= FindImage(wPreferences
.icon_path
, file
);
280 buf
= wmalloc(strlen(file
)+80);
281 sprintf(buf
, _("Could not find icon \"%s\" specified for this window"),
283 wMessageDialog(panel
->frame
->screen_ptr
, _("Error"), buf
,
284 _("OK"), NULL
, NULL
);
290 pixmap
= WMCreatePixmapFromFile(scrPtr
, path
);
296 buf
= wmalloc(strlen(file
)+80);
297 sprintf(buf
, _("Could not open specified icon \"%s\":%s"),
298 file
, RMessageForError(RErrorCode
));
299 wMessageDialog(panel
->frame
->screen_ptr
, _("Error"), buf
,
300 _("OK"), NULL
, NULL
);
308 WMSetLabelImage(panel
->iconLbl
, pixmap
);
310 WMReleasePixmap(pixmap
);
317 updateIcon(WMButton
*button
, InspectorPanel
*panel
)
319 showIconFor(WMWidgetScreen(button
), panel
, NULL
, NULL
, USE_TEXT_FIELD
);
324 getBool(proplist_t value
)
328 if (!PLIsString(value
)) {
331 if (!(val
= PLGetString(value
))) {
335 if ((val
[1]=='\0' && (val
[0]=='y' || val
[0]=='Y' || val
[0]=='T'
336 || val
[0]=='t' || val
[0]=='1'))
337 || (strcasecmp(val
, "YES")==0 || strcasecmp(val
, "TRUE")==0)) {
340 } else if ((val
[1]=='\0'
341 && (val
[0]=='n' || val
[0]=='N' || val
[0]=='F'
342 || val
[0]=='f' || val
[0]=='0'))
343 || (strcasecmp(val
, "NO")==0 || strcasecmp(val
, "FALSE")==0)) {
347 wwarning(_("can't convert \"%s\" to boolean"), val
);
353 #define UPDATE_DEFAULTS 1
358 * Will insert the attribute = value; pair in window's list,
359 * if it's different from the defaults.
360 * Defaults means either defaults database, or attributes saved
361 * for the default window "*". This is to let one revert options that are
362 * global because they were saved for all windows ("*").
368 insertAttribute(proplist_t dict
, proplist_t window
, proplist_t attr
,
369 proplist_t value
, int *modified
, int flags
)
371 proplist_t def_win
, def_value
=NULL
;
374 if (!(flags
& UPDATE_DEFAULTS
) && dict
) {
375 if ((def_win
= PLGetDictionaryEntry(dict
, AnyWindow
)) != NULL
) {
376 def_value
= PLGetDictionaryEntry(def_win
, attr
);
380 /* If we could not find defaults in database, fall to hardcoded values.
381 * Also this is true if we save defaults for all windows
384 def_value
= ((flags
& IS_BOOLEAN
) != 0) ? No
: EmptyString
;
386 if ((flags
& IS_BOOLEAN
))
387 update
= (getBool(value
) != getBool(def_value
));
389 update
= !PLIsEqual(value
, def_value
);
393 PLInsertDictionaryEntry(window
, attr
, value
);
400 saveSettings(WMButton
*button
, InspectorPanel
*panel
)
402 WWindow
*wwin
= panel
->inspected
;
403 WDDomain
*db
= WDWindowAttributes
;
404 proplist_t dict
= db
->dictionary
;
405 proplist_t winDic
, value
, key
;
406 char buffer
[256], *icon_file
;
410 /* Save will apply the changes and save them */
411 applySettings(panel
->applyBtn
, panel
);
413 if (WMGetButtonSelected(panel
->instRb
) != 0)
414 key
= PLMakeString(wwin
->wm_instance
);
415 else if (WMGetButtonSelected(panel
->clsRb
) != 0)
416 key
= PLMakeString(wwin
->wm_class
);
417 else if (WMGetButtonSelected(panel
->bothRb
) != 0) {
418 strcat(strcat(strcpy(buffer
, wwin
->wm_instance
), "."), wwin
->wm_class
);
419 key
= PLMakeString(buffer
);
421 else if (WMGetButtonSelected(panel
->defaultRb
) != 0) {
422 key
= PLRetain(AnyWindow
);
423 flags
= UPDATE_DEFAULTS
;
432 dict
= PLMakeDictionaryFromEntries(NULL
, NULL
, NULL
);
434 db
->dictionary
= dict
;
435 value
= PLMakeString(db
->path
);
436 PLSetFilename(dict
, value
);
445 if (showIconFor(WMWidgetScreen(button
), panel
, NULL
, NULL
,
449 PLSetStringCmpHook(NULL
);
451 winDic
= PLMakeDictionaryFromEntries(NULL
, NULL
, NULL
);
453 /* Update icon for window */
454 icon_file
= WMGetTextFieldText(panel
->fileText
);
456 if (icon_file
[0] != 0) {
457 value
= PLMakeString(icon_file
);
458 insertAttribute(dict
, winDic
, AIcon
, value
, &different
, flags
);
465 int i
= WMGetPopUpButtonSelectedItem(panel
->wsP
);
469 if (i
>=0 && i
< panel
->frame
->screen_ptr
->workspace_count
) {
470 value
= PLMakeString(panel
->frame
->screen_ptr
->workspaces
[i
]->name
);
471 insertAttribute(dict
, winDic
, AStartWorkspace
, value
, &different
, flags
);
478 value
= (WMGetButtonSelected(panel
->alwChk
)!=0) ? Yes
: No
;
479 insertAttribute(dict
, winDic
, AAlwaysUserIcon
, value
, &different
, flags
);
481 value
= (WMGetButtonSelected(panel
->attrChk
[0])!=0) ? Yes
: No
;
482 insertAttribute(dict
, winDic
, ANoTitlebar
, value
, &different
, flags
);
484 value
= (WMGetButtonSelected(panel
->attrChk
[1])!=0) ? Yes
: No
;
485 insertAttribute(dict
, winDic
, ANoResizebar
, value
, &different
, flags
);
487 value
= (WMGetButtonSelected(panel
->attrChk
[2])!=0) ? Yes
: No
;
488 insertAttribute(dict
, winDic
, ANoCloseButton
, value
, &different
, flags
);
490 value
= (WMGetButtonSelected(panel
->attrChk
[3])!=0) ? Yes
: No
;
491 insertAttribute(dict
, winDic
, ANoMiniaturizeButton
, value
, &different
, flags
);
493 value
= (WMGetButtonSelected(panel
->attrChk
[4])!=0) ? Yes
: No
;
494 insertAttribute(dict
, winDic
, AKeepOnTop
, value
, &different
, flags
);
496 value
= (WMGetButtonSelected(panel
->attrChk
[5])!=0) ? Yes
: No
;
497 insertAttribute(dict
, winDic
, AKeepOnBottom
, value
, &different
, flags
);
499 value
= (WMGetButtonSelected(panel
->attrChk
[6])!=0) ? Yes
: No
;
500 insertAttribute(dict
, winDic
, AOmnipresent
, value
, &different
, flags
);
502 value
= (WMGetButtonSelected(panel
->attrChk
[7])!=0) ? Yes
: No
;
503 insertAttribute(dict
, winDic
, AStartMiniaturized
, value
, &different
, flags
);
505 value
= (WMGetButtonSelected(panel
->attrChk
[8])!=0) ? Yes
: No
;
506 insertAttribute(dict
, winDic
, AStartMaximized
, value
, &different
, flags
);
508 value
= (WMGetButtonSelected(panel
->attrChk
[9])!=0) ? Yes
: No
;
509 insertAttribute(dict
, winDic
, ASkipWindowList
, value
, &different
, flags
);
512 value
= (WMGetButtonSelected(panel
->moreChk
[0])!=0) ? Yes
: No
;
513 insertAttribute(dict
, winDic
, ANoHideOthers
, value
, &different
, flags
);
515 value
= (WMGetButtonSelected(panel
->moreChk
[1])!=0) ? Yes
: No
;
516 insertAttribute(dict
, winDic
, ANoKeyBindings
, value
, &different
, flags
);
518 value
= (WMGetButtonSelected(panel
->moreChk
[2])!=0) ? Yes
: No
;
519 insertAttribute(dict
, winDic
, ANoMouseBindings
, value
, &different
, flags
);
521 value
= (WMGetButtonSelected(panel
->moreChk
[3])!=0) ? Yes
: No
;
522 insertAttribute(dict
, winDic
, AKeepInsideScreen
, value
, &different
, flags
);
524 value
= (WMGetButtonSelected(panel
->moreChk
[4])!=0) ? Yes
: No
;
525 insertAttribute(dict
, winDic
, AUnfocusable
, value
, &different
, flags
);
527 value
= (WMGetButtonSelected(panel
->moreChk
[5])!=0) ? Yes
: No
;
528 insertAttribute(dict
, winDic
, ADontSaveSession
, value
, &different
, flags
);
530 value
= (WMGetButtonSelected(panel
->moreChk
[6])!=0) ? Yes
: No
;
531 insertAttribute(dict
, winDic
, AEmulateAppIcon
, value
, &different
, flags
);
533 value
= (WMGetButtonSelected(panel
->moreChk
[7])!=0) ? Yes
: No
;
534 insertAttribute(dict
, winDic
, AFullMaximize
, value
, &different
, flags
);
536 /* application wide settings for when */
537 /* the window is the leader, save the attribute with the others */
538 if (panel
->inspected
->main_window
== panel
->inspected
->client_win
) {
540 value
= (WMGetButtonSelected(panel
->appChk
[0])!=0) ? Yes
: No
;
541 insertAttribute(dict
, winDic
, AStartHidden
, value
, &different
, flags
);
543 value
= (WMGetButtonSelected(panel
->appChk
[1])!=0) ? Yes
: No
;
544 insertAttribute(dict
, winDic
, ANoAppIcon
, value
, &different
, flags
);
547 PLRemoveDictionaryEntry(dict
, key
);
549 PLInsertDictionaryEntry(dict
, key
, winDic
);
557 /* application wide settings */
558 if (panel
->inspected
->main_window
!= panel
->inspected
->client_win
559 && !(flags
& UPDATE_DEFAULTS
)) {
563 wapp
= wApplicationOf(panel
->inspected
->main_window
);
567 appDic
= PLMakeDictionaryFromEntries(NULL
, NULL
, NULL
);
569 assert(wapp
->main_window_desc
->wm_instance
!=NULL
);
570 assert(wapp
->main_window_desc
->wm_class
!=NULL
);
572 strcat(strcpy(buffer
, wapp
->main_window_desc
->wm_instance
), ".");
573 strcat(buffer
, wwin
->wm_class
);
574 key
= PLMakeString(buffer
);
576 iconFile
= wDefaultGetIconFile(wwin
->screen_ptr
,
577 wapp
->main_window_desc
->wm_instance
,
578 wapp
->main_window_desc
->wm_class
,
581 if (iconFile
&& iconFile
[0]!=0) {
582 value
= PLMakeString(iconFile
);
583 insertAttribute(dict
, appDic
, AIcon
, value
, &different
,
588 value
= (WMGetButtonSelected(panel
->appChk
[0])!=0) ? Yes
: No
;
589 insertAttribute(dict
, appDic
, AStartHidden
, value
, &different
, flags
);
591 value
= (WMGetButtonSelected(panel
->appChk
[1])!=0) ? Yes
: No
;
592 insertAttribute(dict
, appDic
, ANoAppIcon
, value
, &different
, flags
);
594 PLRemoveDictionaryEntry(dict
, key
);
596 PLInsertDictionaryEntry(dict
, key
, appDic
);
606 PLSetStringCmpHook(StringCompareHook
);
611 makeAppIconFor(WApplication
*wapp
)
613 WScreen
*scr
= wapp
->main_window_desc
->screen_ptr
;
618 if (!WFLAGP(wapp
->main_window_desc
, no_appicon
))
619 wapp
->app_icon
= wAppIconCreate(wapp
->main_window_desc
);
621 wapp
->app_icon
= NULL
;
623 if (wapp
->app_icon
) {
624 WIcon
*icon
= wapp
->app_icon
->icon
;
625 WDock
*clip
= scr
->workspaces
[scr
->current_workspace
]->clip
;
628 wapp
->app_icon
->main_window
= wapp
->main_window
;
630 if (clip
&& clip
->attract_icons
&& wDockFindFreeSlot(clip
, &x
, &y
)) {
631 wapp
->app_icon
->attracted
= 1;
632 if (!clip
->keep_attracted
&& !wapp
->app_icon
->icon
->shadowed
) {
633 wapp
->app_icon
->icon
->shadowed
= 1;
634 wapp
->app_icon
->icon
->force_paint
= 1;
636 wDockAttachIcon(clip
, wapp
->app_icon
, x
, y
);
638 PlaceIcon(scr
, &x
, &y
);
639 wAppIconMove(wapp
->app_icon
, x
, y
);
641 if (!clip
|| !wapp
->app_icon
->attracted
|| !clip
->collapsed
)
642 XMapWindow(dpy
, icon
->core
->window
);
644 if (wPreferences
.auto_arrange_icons
&& !wapp
->app_icon
->attracted
)
645 wArrangeIcons(wapp
->main_window_desc
->screen_ptr
, True
);
651 removeAppIconFor(WApplication
*wapp
)
656 if (wapp
->app_icon
->docked
&&
657 (!wapp
->app_icon
->attracted
|| wapp
->app_icon
->dock
->keep_attracted
)) {
658 wapp
->app_icon
->running
= 0;
659 /* since we keep it, we don't care if it was attracted or not */
660 wapp
->app_icon
->attracted
= 0;
661 wapp
->app_icon
->icon
->shadowed
= 0;
662 wapp
->app_icon
->main_window
= None
;
663 wapp
->app_icon
->pid
= 0;
664 wapp
->app_icon
->icon
->owner
= NULL
;
665 wapp
->app_icon
->icon
->icon_win
= None
;
666 wapp
->app_icon
->icon
->force_paint
= 1;
667 wAppIconPaint(wapp
->app_icon
);
668 } else if (wapp
->app_icon
->docked
) {
669 wapp
->app_icon
->running
= 0;
670 wDockDetach(wapp
->app_icon
->dock
, wapp
->app_icon
);
672 wAppIconDestroy(wapp
->app_icon
);
674 wapp
->app_icon
= NULL
;
675 if (wPreferences
.auto_arrange_icons
)
676 wArrangeIcons(wapp
->main_window_desc
->screen_ptr
, True
);
681 applySettings(WMButton
*button
, InspectorPanel
*panel
)
683 WWindow
*wwin
= panel
->inspected
;
684 WApplication
*wapp
= wApplicationOf(wwin
->main_window
);
685 int floating
, sunken
, skip_window_list
;
687 int old_no_bind_keys
;
688 int old_no_bind_mouse
;
690 old_omnipresent
= WFLAGP(wwin
, omnipresent
);
691 old_no_bind_keys
= WFLAGP(wwin
, no_bind_keys
);
692 old_no_bind_mouse
= WFLAGP(wwin
, no_bind_mouse
);
694 showIconFor(WMWidgetScreen(button
), panel
, NULL
, NULL
, USE_TEXT_FIELD
);
696 WSETUFLAG(wwin
, no_titlebar
, WMGetButtonSelected(panel
->attrChk
[0]));
697 WSETUFLAG(wwin
, no_resizebar
, WMGetButtonSelected(panel
->attrChk
[1]));
698 WSETUFLAG(wwin
, no_close_button
, WMGetButtonSelected(panel
->attrChk
[2]));
699 WSETUFLAG(wwin
, no_miniaturize_button
, WMGetButtonSelected(panel
->attrChk
[3]));
700 floating
= WMGetButtonSelected(panel
->attrChk
[4]);
701 sunken
= WMGetButtonSelected(panel
->attrChk
[5]);
702 WSETUFLAG(wwin
, omnipresent
, WMGetButtonSelected(panel
->attrChk
[6]));
703 WSETUFLAG(wwin
, start_miniaturized
, WMGetButtonSelected(panel
->attrChk
[7]));
704 WSETUFLAG(wwin
, start_maximized
, WMGetButtonSelected(panel
->attrChk
[8]));
705 skip_window_list
= WMGetButtonSelected(panel
->attrChk
[9]);
707 WSETUFLAG(wwin
, no_hide_others
, WMGetButtonSelected(panel
->moreChk
[0]));
708 WSETUFLAG(wwin
, no_bind_keys
, WMGetButtonSelected(panel
->moreChk
[1]));
709 WSETUFLAG(wwin
, no_bind_mouse
, WMGetButtonSelected(panel
->moreChk
[2]));
710 WSETUFLAG(wwin
, dont_move_off
, WMGetButtonSelected(panel
->moreChk
[3]));
711 WSETUFLAG(wwin
, no_focusable
, WMGetButtonSelected(panel
->moreChk
[4]));
712 WSETUFLAG(wwin
, dont_save_session
, WMGetButtonSelected(panel
->moreChk
[5]));
713 WSETUFLAG(wwin
, emulate_appicon
, WMGetButtonSelected(panel
->moreChk
[6]));
714 WSETUFLAG(wwin
, full_maximize
, WMGetButtonSelected(panel
->moreChk
[7]));
715 WSETUFLAG(wwin
, always_user_icon
, WMGetButtonSelected(panel
->alwChk
));
717 if (WFLAGP(wwin
, no_titlebar
) && wwin
->flags
.shaded
)
718 wUnshadeWindow(wwin
);
720 WSETUFLAG(wwin
, no_shadeable
, WFLAGP(wwin
, no_titlebar
));
723 if (!WFLAGP(wwin
, floating
))
724 ChangeStackingLevel(wwin
->frame
->core
, WMFloatingLevel
);
726 if (!WFLAGP(wwin
, sunken
))
727 ChangeStackingLevel(wwin
->frame
->core
, WMSunkenLevel
);
729 if (WFLAGP(wwin
, floating
) || WFLAGP(wwin
, sunken
))
730 ChangeStackingLevel(wwin
->frame
->core
, WMNormalLevel
);
733 WSETUFLAG(wwin
, sunken
, sunken
);
734 WSETUFLAG(wwin
, floating
, floating
);
735 wwin
->flags
.omnipresent
= 0;
737 if (WFLAGP(wwin
, skip_window_list
) != skip_window_list
) {
738 WSETUFLAG(wwin
, skip_window_list
, skip_window_list
);
739 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
,
740 skip_window_list
? ACTION_REMOVE
: ACTION_ADD
);
742 if (WFLAGP(wwin
, omnipresent
) != old_omnipresent
) {
743 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_WORKSPACE
);
747 if (WFLAGP(wwin
, no_bind_keys
) != old_no_bind_keys
) {
748 if (WFLAGP(wwin
, no_bind_keys
)) {
749 XUngrabKey(dpy
, AnyKey
, AnyModifier
, wwin
->frame
->core
->window
);
751 wWindowSetKeyGrabs(wwin
);
755 if (WFLAGP(wwin
, no_bind_mouse
) != old_no_bind_mouse
) {
756 wWindowResetMouseGrabs(wwin
);
759 wwin
->frame
->flags
.need_texture_change
= 1;
760 wWindowConfigureBorders(wwin
);
761 wFrameWindowPaint(wwin
->frame
);
764 * Can't apply emulate_appicon because it will probably cause problems.
768 /* do application wide stuff */
769 WSETUFLAG(wapp
->main_window_desc
, start_hidden
,
770 WMGetButtonSelected(panel
->appChk
[0]));
772 WSETUFLAG(wapp
->main_window_desc
, no_appicon
,
773 WMGetButtonSelected(panel
->appChk
[1]));
775 if (WFLAGP(wapp
->main_window_desc
, no_appicon
))
776 removeAppIconFor(wapp
);
778 makeAppIconFor(wapp
);
780 if (wapp
->app_icon
&& wapp
->main_window
== wwin
->client_win
) {
781 char *file
= WMGetTextFieldText(panel
->fileText
);
787 wIconChangeImageFile(wapp
->app_icon
->icon
, file
);
790 wAppIconPaint(wapp
->app_icon
);
799 revertSettings(WMButton
*button
, InspectorPanel
*panel
)
801 WWindow
*wwin
= panel
->inspected
;
802 WApplication
*wapp
= wApplicationOf(wwin
->main_window
);
804 char *wm_instance
= NULL
;
805 char *wm_class
= NULL
;
806 int workspace
, level
;
808 if (WMGetButtonSelected(panel
->instRb
) != 0)
809 wm_instance
= wwin
->wm_instance
;
810 else if (WMGetButtonSelected(panel
->clsRb
) != 0)
811 wm_class
= wwin
->wm_class
;
812 else if (WMGetButtonSelected(panel
->bothRb
) != 0) {
813 wm_instance
= wwin
->wm_instance
;
814 wm_class
= wwin
->wm_class
;
816 memset(&wwin
->defined_user_flags
, 0, sizeof(WWindowAttributes
));
817 memset(&wwin
->user_flags
, 0, sizeof(WWindowAttributes
));
818 memset(&wwin
->client_flags
, 0, sizeof(WWindowAttributes
));
820 wWindowSetupInitialAttributes(wwin
, &level
, &workspace
);
822 for (i
=0; i
< 10; i
++) {
827 flag
= WFLAGP(wwin
, no_titlebar
);
830 flag
= WFLAGP(wwin
, no_resizebar
);
833 flag
= WFLAGP(wwin
, no_close_button
);
836 flag
= WFLAGP(wwin
, no_miniaturize_button
);
839 flag
= WFLAGP(wwin
, floating
);
842 flag
= WFLAGP(wwin
, sunken
);
845 flag
= WFLAGP(wwin
, omnipresent
);
848 flag
= WFLAGP(wwin
, start_miniaturized
);
851 flag
= WFLAGP(wwin
, start_maximized
!=0);
854 flag
= WFLAGP(wwin
, skip_window_list
);
857 WMSetButtonSelected(panel
->attrChk
[i
], flag
);
859 for (i
=0; i
< 8; i
++) {
864 flag
= WFLAGP(wwin
, no_hide_others
);
867 flag
= WFLAGP(wwin
, no_bind_keys
);
870 flag
= WFLAGP(wwin
, no_bind_mouse
);
873 flag
= WFLAGP(wwin
, dont_move_off
);
876 flag
= WFLAGP(wwin
, no_focusable
);
879 flag
= WFLAGP(wwin
, dont_save_session
);
882 flag
= WFLAGP(wwin
, emulate_appicon
);
885 flag
= WFLAGP(wwin
, full_maximize
);
888 WMSetButtonSelected(panel
->moreChk
[i
], flag
);
890 if (panel
->appFrm
&& wapp
) {
891 for (i
=0; i
< 2; i
++) {
896 flag
= WFLAGP(wapp
->main_window_desc
, start_hidden
);
899 flag
= WFLAGP(wapp
->main_window_desc
, no_appicon
);
902 WMSetButtonSelected(panel
->appChk
[i
], flag
);
905 WMSetButtonSelected(panel
->alwChk
, WFLAGP(wwin
, always_user_icon
));
907 showIconFor(WMWidgetScreen(panel
->alwChk
), panel
, wm_instance
, wm_class
,
910 n
= wDefaultGetStartWorkspace(wwin
->screen_ptr
, wm_instance
, wm_class
);
912 if (n
>= 0 && n
< wwin
->screen_ptr
->workspace_count
) {
913 WMSetPopUpButtonSelectedItem(panel
->wsP
, n
+1);
915 WMSetPopUpButtonSelectedItem(panel
->wsP
, 0);
921 chooseIconCallback(WMWidget
*self
, void *clientData
)
924 InspectorPanel
*panel
= (InspectorPanel
*)clientData
;
927 panel
->choosingIcon
= 1;
929 WMSetButtonEnabled(panel
->browseIconBtn
, False
);
931 result
= wIconChooserDialog(panel
->frame
->screen_ptr
, &file
,
932 panel
->inspected
->wm_instance
,
933 panel
->inspected
->wm_class
);
935 panel
->choosingIcon
= 0;
937 if (!panel
->destroyed
) { /* kluge */
939 WMSetTextFieldText(panel
->fileText
, file
);
940 showIconFor(WMWidgetScreen(self
), panel
, NULL
, NULL
,
944 WMSetButtonEnabled(panel
->browseIconBtn
, True
);
946 freeInspector(panel
);
952 textEditedObserver(void *observerData
, WMNotification
*notification
)
954 InspectorPanel
*panel
= (InspectorPanel
*)observerData
;
956 if ((long)WMGetNotificationClientData(notification
) != WMReturnTextMovement
)
959 showIconFor(WMWidgetScreen(panel
->win
), panel
, NULL
, NULL
,
962 WMPerformButtonClick(panel->updateIconBtn);
968 selectSpecification(WMWidget
*bPtr
, void *data
)
970 InspectorPanel
*panel
= (InspectorPanel
*)data
;
972 if (bPtr
== panel
->defaultRb
) {
973 WMSetButtonEnabled(panel
->applyBtn
, False
);
975 WMSetButtonEnabled(panel
->applyBtn
, True
);
980 static InspectorPanel
*
981 createInspectorForWindow(WWindow
*wwin
)
983 WScreen
*scr
= wwin
->screen_ptr
;
984 InspectorPanel
*panel
;
989 int btn_width
, frame_width
;
990 #ifdef wrong_behaviour
993 panel
= wmalloc(sizeof(InspectorPanel
));
994 memset(panel
, 0, sizeof(InspectorPanel
));
996 panel
->destroyed
= 0;
999 panel
->inspected
= wwin
;
1001 panel
->nextPtr
= panelList
;
1005 sprintf(charbuf
, "Inspecting %s.%s",
1006 wwin
->wm_instance
? wwin
->wm_instance
: "?",
1007 wwin
->wm_class
? wwin
->wm_class
: "?");
1009 panel
->win
= WMCreateWindow(scr
->wmscreen
, "windowInspector");
1010 WMResizeWidget(panel
->win
, PWIDTH
, PHEIGHT
);
1013 /**** create common stuff ****/
1015 /* command buttons */
1016 /* (PWIDTH - (left and right margin) - (btn interval)) / 3 */
1017 btn_width
= (PWIDTH
- (2 * 15) - (2 * 10)) / 3;
1018 panel
->saveBtn
= WMCreateCommandButton(panel
->win
);
1019 WMSetButtonAction(panel
->saveBtn
, (WMAction
*)saveSettings
, panel
);
1020 WMMoveWidget(panel
->saveBtn
, (2 * (btn_width
+ 10)) + 15, 310);
1021 WMSetButtonText(panel
->saveBtn
, _("Save"));
1022 WMResizeWidget(panel
->saveBtn
, btn_width
, 28);
1023 if (wPreferences
.flags
.noupdates
|| !(wwin
->wm_class
|| wwin
->wm_instance
))
1024 WMSetButtonEnabled(panel
->saveBtn
, False
);
1026 panel
->applyBtn
= WMCreateCommandButton(panel
->win
);
1027 WMSetButtonAction(panel
->applyBtn
, (WMAction
*)applySettings
, panel
);
1028 WMMoveWidget(panel
->applyBtn
, btn_width
+ 10 + 15, 310);
1029 WMSetButtonText(panel
->applyBtn
, _("Apply"));
1030 WMResizeWidget(panel
->applyBtn
, btn_width
, 28);
1032 panel
->revertBtn
= WMCreateCommandButton(panel
->win
);
1033 WMSetButtonAction(panel
->revertBtn
, (WMAction
*)revertSettings
, panel
);
1034 WMMoveWidget(panel
->revertBtn
, 15, 310);
1035 WMSetButtonText(panel
->revertBtn
, _("Reload"));
1036 WMResizeWidget(panel
->revertBtn
, btn_width
, 28);
1038 /* page selection popup button */
1039 panel
->pagePopUp
= WMCreatePopUpButton(panel
->win
);
1040 WMSetPopUpButtonAction(panel
->pagePopUp
, (WMAction
*)changePage
, panel
);
1041 WMMoveWidget(panel
->pagePopUp
, 25, 15);
1042 WMResizeWidget(panel
->pagePopUp
, PWIDTH
- 50, 20);
1044 WMAddPopUpButtonItem(panel
->pagePopUp
, _("Window Specification"));
1045 WMAddPopUpButtonItem(panel
->pagePopUp
, _("Window Attributes"));
1046 WMAddPopUpButtonItem(panel
->pagePopUp
, _("Advanced Options"));
1047 WMAddPopUpButtonItem(panel
->pagePopUp
, _("Icon and Initial Workspace"));
1048 WMAddPopUpButtonItem(panel
->pagePopUp
, _("Application Specific"));
1050 /**** window spec ****/
1051 frame_width
= PWIDTH
- (2 * 15);
1053 panel
->specFrm
= WMCreateFrame(panel
->win
);
1054 WMSetFrameTitle(panel
->specFrm
, _("Window Specification"));
1055 WMMoveWidget(panel
->specFrm
, 15, 65);
1056 WMResizeWidget(panel
->specFrm
, frame_width
, 105);
1059 panel
->defaultRb
= WMCreateRadioButton(panel
->specFrm
);
1060 WMMoveWidget(panel
->defaultRb
, 10, 78);
1061 WMResizeWidget(panel
->defaultRb
, frame_width
- (2 * 10), 20);
1062 WMSetButtonText(panel
->defaultRb
, _("Defaults for all windows"));
1063 WMSetButtonSelected(panel
->defaultRb
, False
);
1064 WMSetButtonAction(panel
->defaultRb
, selectSpecification
, panel
);
1067 if (wwin
->wm_class
&& wwin
->wm_instance
) {
1068 sprintf(charbuf
, "%s.%s", wwin
->wm_instance
, wwin
->wm_class
);
1069 panel
->bothRb
= WMCreateRadioButton(panel
->specFrm
);
1070 WMMoveWidget(panel
->bothRb
, 10, 18);
1071 WMResizeWidget(panel
->bothRb
, frame_width
- (2 * 10), 20);
1072 WMSetButtonText(panel
->bothRb
, charbuf
);
1073 WMSetButtonSelected(panel
->bothRb
, True
);
1074 WMGroupButtons(panel
->defaultRb
, panel
->bothRb
);
1076 WMSetButtonAction(panel
->bothRb
, selectSpecification
, panel
);
1079 if (wwin
->wm_instance
) {
1080 panel
->instRb
= WMCreateRadioButton(panel
->specFrm
);
1081 WMMoveWidget(panel
->instRb
, 10, 38);
1082 WMResizeWidget(panel
->instRb
, frame_width
- (2 * 10), 20);
1083 WMSetButtonText(panel
->instRb
, wwin
->wm_instance
);
1084 WMSetButtonSelected(panel
->instRb
, False
);
1085 WMGroupButtons(panel
->defaultRb
, panel
->instRb
);
1087 WMSetButtonAction(panel
->instRb
, selectSpecification
, panel
);
1090 if (wwin
->wm_class
) {
1091 panel
->clsRb
= WMCreateRadioButton(panel
->specFrm
);
1092 WMMoveWidget(panel
->clsRb
, 10, 58);
1093 WMResizeWidget(panel
->clsRb
, frame_width
- (2 * 10), 20);
1094 WMSetButtonText(panel
->clsRb
, wwin
->wm_class
);
1095 WMSetButtonSelected(panel
->clsRb
, False
);
1096 WMGroupButtons(panel
->defaultRb
, panel
->clsRb
);
1098 WMSetButtonAction(panel
->clsRb
, selectSpecification
, panel
);
1101 panel
->specLbl
= WMCreateLabel(panel
->win
);
1102 WMMoveWidget(panel
->specLbl
, 15, 170);
1103 WMResizeWidget(panel
->specLbl
, frame_width
, 100);
1104 WMSetLabelText(panel
->specLbl
,
1105 _("The configuration will apply to all\n"
1106 "windows that have their WM_CLASS property"
1107 " set to the above selected\nname, when saved."));
1108 WMSetLabelTextAlignment(panel
->specLbl
, WACenter
);
1110 /**** attributes ****/
1111 panel
->attrFrm
= WMCreateFrame(panel
->win
);
1112 WMSetFrameTitle(panel
->attrFrm
, _("Attributes"));
1113 WMMoveWidget(panel
->attrFrm
, 15, 45);
1114 WMResizeWidget(panel
->attrFrm
, frame_width
, 250);
1116 for (i
=0; i
< 10; i
++) {
1117 char *caption
= NULL
;
1122 caption
= _("Disable Titlebar");
1123 flag
= WFLAGP(wwin
, no_titlebar
);
1126 caption
= _("Disable Resizebar");
1127 flag
= WFLAGP(wwin
, no_resizebar
);
1130 caption
= _("Disable Close Button");
1131 flag
= WFLAGP(wwin
, no_close_button
);
1134 caption
= _("Disable Miniaturize Button");
1135 flag
= WFLAGP(wwin
, no_miniaturize_button
);
1138 caption
= _("Keep on Top / Floating");
1139 flag
= WFLAGP(wwin
, floating
);
1142 caption
= _("Keep at Bottom / Sunken");
1143 flag
= WFLAGP(wwin
, sunken
);
1146 caption
= _("Omnipresent");
1147 flag
= WFLAGP(wwin
, omnipresent
);
1150 caption
= _("Start Miniaturized");
1151 flag
= WFLAGP(wwin
, start_miniaturized
);
1154 caption
= _("Start Maximized");
1155 flag
= WFLAGP(wwin
, start_maximized
!=0);
1158 caption
= _("Skip Window List");
1159 flag
= WFLAGP(wwin
, skip_window_list
);
1162 panel
->attrChk
[i
] = WMCreateSwitchButton(panel
->attrFrm
);
1163 WMMoveWidget(panel
->attrChk
[i
], 10, 20*(i
+1));
1164 WMResizeWidget(panel
->attrChk
[i
], frame_width
-15, 20);
1165 WMSetButtonSelected(panel
->attrChk
[i
], flag
);
1166 WMSetButtonText(panel
->attrChk
[i
], caption
);
1170 /**** more attributes ****/
1171 panel
->moreFrm
= WMCreateFrame(panel
->win
);
1172 WMSetFrameTitle(panel
->moreFrm
, _("Advanced"));
1173 WMMoveWidget(panel
->moreFrm
, 15, 45);
1174 WMResizeWidget(panel
->moreFrm
, frame_width
, 250);
1176 for (i
=0; i
< 8; i
++) {
1177 char *caption
= NULL
;
1182 caption
= _("Ignore HideOthers");
1183 flag
= WFLAGP(wwin
, no_hide_others
);
1186 caption
= _("Don't Bind Keyboard Shortcuts");
1187 flag
= WFLAGP(wwin
, no_bind_keys
);
1190 caption
= _("Don't Bind Mouse Clicks");
1191 flag
= WFLAGP(wwin
, no_bind_mouse
);
1194 caption
= _("Keep Inside Screen");
1195 flag
= WFLAGP(wwin
, dont_move_off
);
1198 caption
= _("Don't Let It Take Focus");
1199 flag
= WFLAGP(wwin
, no_focusable
);
1202 caption
= _("Don't Save Session");
1203 flag
= WFLAGP(wwin
, dont_save_session
);
1206 caption
= _("Emulate Application Icon");
1207 flag
= WFLAGP(wwin
, emulate_appicon
);
1210 caption
= _("Full Screen Maximization");
1211 flag
= WFLAGP(wwin
, full_maximize
);
1214 panel
->moreChk
[i
] = WMCreateSwitchButton(panel
->moreFrm
);
1215 WMMoveWidget(panel
->moreChk
[i
], 10, 20*(i
+1));
1216 WMResizeWidget(panel
->moreChk
[i
], frame_width
-15, 20);
1217 WMSetButtonSelected(panel
->moreChk
[i
], flag
);
1218 WMSetButtonText(panel
->moreChk
[i
], caption
);
1221 panel
->moreLbl
= WMCreateLabel(panel
->moreFrm
);
1222 WMResizeWidget(panel
->moreLbl
, frame_width
- (2 * 5), 60);
1223 WMMoveWidget(panel
->moreLbl
, 5, 180);
1224 WMSetLabelText(panel
->moreLbl
,
1225 _("Enable the \"Don't bind...\" options to allow the "
1226 "application to receive all mouse or keyboard events."));
1228 /* miniwindow/workspace */
1229 panel
->iconFrm
= WMCreateFrame(panel
->win
);
1230 WMMoveWidget(panel
->iconFrm
, 15, 50);
1231 WMResizeWidget(panel
->iconFrm
, PWIDTH
- (2 * 15), 170);
1232 WMSetFrameTitle(panel
->iconFrm
, _("Miniwindow Image"));
1234 panel
->iconLbl
= WMCreateLabel(panel
->iconFrm
);
1235 WMMoveWidget(panel
->iconLbl
, PWIDTH
- (2 * 15) - 22 - 64, 30);
1236 WMResizeWidget(panel
->iconLbl
, 64, 64);
1237 WMSetLabelRelief(panel
->iconLbl
, WRGroove
);
1238 WMSetLabelImagePosition(panel
->iconLbl
, WIPImageOnly
);
1240 panel
->browseIconBtn
= WMCreateCommandButton(panel
->iconFrm
);
1241 WMSetButtonAction(panel
->browseIconBtn
, chooseIconCallback
, panel
);
1242 WMMoveWidget(panel
->browseIconBtn
, 22, 30);
1243 WMResizeWidget(panel
->browseIconBtn
, 100, 26);
1244 WMSetButtonText(panel
->browseIconBtn
, _("Browse..."));
1247 panel
->updateIconBtn
= WMCreateCommandButton(panel
->iconFrm
);
1248 WMSetButtonAction(panel
->updateIconBtn
, (WMAction
*)updateIcon
, panel
);
1249 WMMoveWidget(panel
->updateIconBtn
, 22, 65);
1250 WMResizeWidget(panel
->updateIconBtn
, 100, 26);
1251 WMSetButtonText(panel
->updateIconBtn
, _("Update"));
1253 #ifdef wrong_behaviour
1254 WMSetButtonImagePosition(panel
->updateIconBtn
, WIPRight
);
1255 pixmap
= WMGetSystemPixmap(scr
->wmscreen
, WSIReturnArrow
);
1256 WMSetButtonImage(panel
->updateIconBtn
, pixmap
);
1257 WMReleasePixmap(pixmap
);
1258 pixmap
= WMGetSystemPixmap(scr
->wmscreen
, WSIHighlightedReturnArrow
);
1259 WMSetButtonAltImage(panel
->updateIconBtn
, pixmap
);
1260 WMReleasePixmap(pixmap
);
1263 panel
->fileLbl
= WMCreateLabel(panel
->iconFrm
);
1264 WMMoveWidget(panel
->fileLbl
, 20, 95);
1265 WMResizeWidget(panel
->fileLbl
, PWIDTH
- (2 * 15) - (2 * 20), 14);
1266 WMSetLabelText(panel
->fileLbl
, _("Icon File Name:"));
1268 panel
->fileText
= WMCreateTextField(panel
->iconFrm
);
1269 WMMoveWidget(panel
->fileText
, 20, 115);
1270 WMResizeWidget(panel
->fileText
, PWIDTH
- (2 * 15) - (2 * 15), 20);
1271 WMSetTextFieldText(panel
->fileText
, NULL
);
1272 WMAddNotificationObserver(textEditedObserver
, panel
,
1273 WMTextDidEndEditingNotification
,
1275 panel
->alwChk
= WMCreateSwitchButton(panel
->iconFrm
);
1276 WMMoveWidget(panel
->alwChk
, 20, 140);
1277 WMResizeWidget(panel
->alwChk
, PWIDTH
- (2 * 15) - (2 * 15), 20);
1278 WMSetButtonText(panel
->alwChk
, _("Ignore client supplied icon"));
1279 WMSetButtonSelected(panel
->alwChk
, WFLAGP(wwin
, always_user_icon
));
1282 panel
->wsFrm
= WMCreateFrame(panel
->win
);
1283 WMMoveWidget(panel
->wsFrm
, 15, 225);
1284 WMResizeWidget(panel
->wsFrm
, PWIDTH
- (2 * 15), 70);
1285 WMSetFrameTitle(panel
->wsFrm
, _("Initial Workspace"));
1287 panel
->wsP
= WMCreatePopUpButton(panel
->wsFrm
);
1288 WMMoveWidget(panel
->wsP
, 20, 30);
1289 WMResizeWidget(panel
->wsP
, PWIDTH
- (2 * 15) - (2 * 20), 20);
1290 WMAddPopUpButtonItem(panel
->wsP
, _("Nowhere in particular"));
1291 for (i
= 0; i
< wwin
->screen_ptr
->workspace_count
; i
++) {
1292 WMAddPopUpButtonItem(panel
->wsP
, scr
->workspaces
[i
]->name
);
1295 i
= wDefaultGetStartWorkspace(wwin
->screen_ptr
, wwin
->wm_instance
,
1297 if (i
>= 0 && i
<= wwin
->screen_ptr
->workspace_count
) {
1298 WMSetPopUpButtonSelectedItem(panel
->wsP
, i
+ 1);
1300 WMSetPopUpButtonSelectedItem(panel
->wsP
, 0);
1303 /* application wide attributes */
1304 if (wwin
->main_window
!= None
) {
1305 WApplication
*wapp
= wApplicationOf(wwin
->main_window
);
1307 panel
->appFrm
= WMCreateFrame(panel
->win
);
1308 WMSetFrameTitle(panel
->appFrm
, _("Application Wide"));
1309 WMMoveWidget(panel
->appFrm
, 15, 50);
1310 WMResizeWidget(panel
->appFrm
, frame_width
, 240);
1312 for (i
=0; i
< 2; i
++) {
1313 char *caption
= NULL
;
1318 caption
= _("Start Hidden");
1319 flag
= WFLAGP(wapp
->main_window_desc
, start_hidden
);
1322 caption
= _("No Application Icon");
1323 flag
= WFLAGP(wapp
->main_window_desc
, no_appicon
);
1326 panel
->appChk
[i
] = WMCreateSwitchButton(panel
->appFrm
);
1327 WMMoveWidget(panel
->appChk
[i
], 10, 20*(i
+1));
1328 WMResizeWidget(panel
->appChk
[i
], 205, 20);
1329 WMSetButtonSelected(panel
->appChk
[i
], flag
);
1330 WMSetButtonText(panel
->appChk
[i
], caption
);
1333 if (WFLAGP(wwin
, emulate_appicon
)) {
1334 WMSetButtonEnabled(panel
->appChk
[1], False
);
1335 WMSetButtonEnabled(panel
->moreChk
[6], True
);
1337 WMSetButtonEnabled(panel
->appChk
[1], True
);
1338 WMSetButtonEnabled(panel
->moreChk
[6], False
);
1343 if ((wwin
->transient_for
!=None
&& wwin
->transient_for
!=scr
->root_win
)
1344 || !wwin
->wm_class
|| !wwin
->wm_instance
)
1348 WMSetButtonEnabled(panel
->moreChk
[6], tmp
);
1350 WMSetPopUpButtonItemEnabled(panel
->pagePopUp
, 4, False
);
1351 panel
->appFrm
= NULL
;
1354 /* if the window is a transient, don't let it have a miniaturize
1356 if (wWindowFor(wwin
->transient_for
)!=NULL
)
1357 WMSetButtonEnabled(panel
->attrChk
[3], False
);
1359 WMSetButtonEnabled(panel
->attrChk
[3], True
);
1362 if (!wwin
->wm_class
&& !wwin
->wm_instance
) {
1363 WMSetPopUpButtonItemEnabled(panel
->pagePopUp
, 0, False
);
1367 WMRealizeWidget(panel
->win
);
1369 WMMapSubwidgets(panel
->win
);
1370 WMMapSubwidgets(panel
->specFrm
);
1371 WMMapSubwidgets(panel
->attrFrm
);
1372 WMMapSubwidgets(panel
->moreFrm
);
1373 WMMapSubwidgets(panel
->iconFrm
);
1374 WMMapSubwidgets(panel
->wsFrm
);
1376 WMMapSubwidgets(panel
->appFrm
);
1378 WMSetPopUpButtonSelectedItem(panel
->pagePopUp
, 1);
1379 changePage(panel
->pagePopUp
, panel
);
1382 parent
= XCreateSimpleWindow(dpy
, scr
->root_win
, 0, 0, PWIDTH
, PHEIGHT
,
1384 XSelectInput(dpy
, parent
, KeyPressMask
|KeyReleaseMask
);
1385 panel
->parent
= parent
;
1386 XReparentWindow(dpy
, WMWidgetXID(panel
->win
), parent
, 0, 0);
1388 WMMapWidget(panel
->win
);
1390 XSetTransientForHint(dpy
, parent
, wwin
->client_win
);
1392 x
= wwin
->frame_x
+wwin
->frame
->core
->width
/2;
1393 y
= wwin
->frame_y
+wwin
->frame
->top_width
*2;
1394 if (y
+ PHEIGHT
> scr
->scr_height
)
1395 y
= scr
->scr_height
- PHEIGHT
- 30;
1396 if (x
+ PWIDTH
> scr
->scr_width
)
1397 x
= scr
->scr_width
- PWIDTH
;
1398 panel
->frame
= wManageInternalWindow(scr
, parent
, wwin
->client_win
,
1399 charbuf
, x
, y
, PWIDTH
, PHEIGHT
);
1401 /* kluge to know who should get the key events */
1402 panel
->frame
->client_leader
= WMWidgetXID(panel
->win
);
1404 WSETUFLAG(panel
->frame
, no_closable
, 0);
1405 WSETUFLAG(panel
->frame
, no_close_button
, 0);
1406 wWindowUpdateButtonImages(panel
->frame
);
1407 wFrameWindowShowButton(panel
->frame
->frame
, WFF_RIGHT_BUTTON
);
1408 panel
->frame
->frame
->on_click_right
= destroyInspector
;
1410 wWindowMap(panel
->frame
);
1412 showIconFor(WMWidgetScreen(panel
->alwChk
), panel
, wwin
->wm_instance
,
1413 wwin
->wm_class
, UPDATE_TEXT_FIELD
);
1420 wShowInspectorForWindow(WWindow
*wwin
)
1422 if (wwin
->flags
.inspector_open
)
1426 wwin
->flags
.inspector_open
= 1;
1427 wwin
->inspector
= createInspectorForWindow(wwin
);;