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
;
76 static proplist_t AStartWorkspace
;
78 static proplist_t AIcon
;
80 /* application wide options */
81 static proplist_t AStartHidden
;
84 static proplist_t AnyWindow
;
85 static proplist_t EmptyString
;
86 static proplist_t Yes
, No
;
93 static void applySettings(WMButton
*button
, InspectorPanel
*panel
);
98 if (ANoTitlebar
!=NULL
)
101 AIcon
= PLMakeString("Icon");
102 ANoTitlebar
= PLMakeString("NoTitlebar");
103 ANoResizebar
= PLMakeString("NoResizebar");
104 ANoMiniaturizeButton
= PLMakeString("NoMiniaturizeButton");
105 ANoCloseButton
= PLMakeString("NoCloseButton");
106 ANoHideOthers
= PLMakeString("NoHideOthers");
107 ANoMouseBindings
= PLMakeString("NoMouseBindings");
108 ANoKeyBindings
= PLMakeString("NoKeyBindings");
109 ANoAppIcon
= PLMakeString("NoAppIcon");
110 AKeepOnTop
= PLMakeString("KeepOnTop");
111 AKeepOnBottom
= PLMakeString("KeepOnBottom");
112 AOmnipresent
= PLMakeString("Omnipresent");
113 ASkipWindowList
= PLMakeString("SkipWindowList");
114 AKeepInsideScreen
= PLMakeString("KeepInsideScreen");
115 AUnfocusable
= PLMakeString("Unfocusable");
116 AAlwaysUserIcon
= PLMakeString("AlwaysUserIcon");
117 AStartMiniaturized
= PLMakeString("StartMiniaturized");
118 AStartMaximized
= PLMakeString("StartMaximized");
119 AStartHidden
= PLMakeString("StartHidden");
120 ADontSaveSession
= PLMakeString("DontSaveSession");
121 AEmulateAppIcon
= PLMakeString("EmulateAppIcon");
123 AStartWorkspace
= PLMakeString("StartWorkspace");
125 AnyWindow
= PLMakeString("*");
126 EmptyString
= PLMakeString("");
127 Yes
= PLMakeString("Yes");
128 No
= PLMakeString("No");
134 freeInspector(InspectorPanel
*panel
)
136 panel
->destroyed
= 1;
137 if (panel
->choosingIcon
)
140 WMDestroyWidget(panel
->win
);
142 XDestroyWindow(dpy
, panel
->parent
);
149 destroyInspector(WCoreWindow
*foo
, void *data
, XEvent
*event
)
151 InspectorPanel
*panel
;
155 while (panel
->frame
!=data
)
156 panel
= panel
->nextPtr
;
158 if (panelList
== panel
)
159 panelList
= panel
->nextPtr
;
162 while (tmp
->nextPtr
!=panel
) {
165 tmp
->nextPtr
= panel
->nextPtr
;
167 panel
->inspected
->flags
.inspector_open
= 0;
168 panel
->inspected
->inspector
= NULL
;
170 WMRemoveNotificationObserver(panel
);
172 wWindowUnmap(panel
->frame
);
173 wUnmanageWindow(panel
->frame
, True
, False
);
175 freeInspector(panel
);
181 wDestroyInspectorPanels()
183 InspectorPanel
*panel
;
185 while (panelList
!= NULL
) {
187 panelList
= panelList
->nextPtr
;
188 wUnmanageWindow(panel
->frame
, False
, False
);
189 WMDestroyWidget(panel
->win
);
191 panel
->inspected
->flags
.inspector_open
= 0;
192 panel
->inspected
->inspector
= NULL
;
200 changePage(WMPopUpButton
*bPtr
, InspectorPanel
*panel
)
204 page
= WMGetPopUpButtonSelectedItem(bPtr
);
207 WMMapWidget(panel
->specFrm
);
208 WMMapWidget(panel
->specLbl
);
209 } else if (page
== 1) {
210 WMMapWidget(panel
->attrFrm
);
211 } else if (page
== 2) {
212 WMMapWidget(panel
->moreFrm
);
213 } else if (page
== 3) {
214 WMMapWidget(panel
->iconFrm
);
215 WMMapWidget(panel
->wsFrm
);
217 WMMapWidget(panel
->appFrm
);
221 WMUnmapWidget(panel
->specFrm
);
222 WMUnmapWidget(panel
->specLbl
);
225 WMUnmapWidget(panel
->attrFrm
);
227 WMUnmapWidget(panel
->moreFrm
);
229 WMUnmapWidget(panel
->iconFrm
);
230 WMUnmapWidget(panel
->wsFrm
);
232 if (page
!= 4 && panel
->appFrm
)
233 WMUnmapWidget(panel
->appFrm
);
237 #define USE_TEXT_FIELD 1
238 #define UPDATE_TEXT_FIELD 2
239 #define REVERT_TO_DEFAULT 4
243 showIconFor(WMScreen
*scrPtr
, InspectorPanel
*panel
,
244 char *wm_instance
, char *wm_class
, int flags
)
246 WMPixmap
*pixmap
= (WMPixmap
*) NULL
;
247 char *file
=NULL
, *path
=NULL
;
250 if ((flags
& USE_TEXT_FIELD
) != 0) {
251 file
= WMGetTextFieldText(panel
->fileText
);
252 if (file
&& file
[0] == 0) {
257 db_icon
= wDefaultGetIconFile(panel
->inspected
->screen_ptr
,
258 wm_instance
, wm_class
, False
);
260 file
= wstrdup(db_icon
);
262 if (db_icon
!=NULL
&& (flags
& REVERT_TO_DEFAULT
)!=0) {
264 file
= wstrdup(db_icon
);
265 flags
|= UPDATE_TEXT_FIELD
;
268 if ((flags
& UPDATE_TEXT_FIELD
) != 0) {
269 WMSetTextFieldText(panel
->fileText
, file
);
273 path
= FindImage(wPreferences
.icon_path
, file
);
278 buf
= wmalloc(strlen(file
)+80);
279 sprintf(buf
, _("Could not find icon \"%s\" specified for this window"),
281 wMessageDialog(panel
->frame
->screen_ptr
, _("Error"), buf
,
282 _("OK"), NULL
, NULL
);
288 pixmap
= WMCreatePixmapFromFile(scrPtr
, path
);
294 buf
= wmalloc(strlen(file
)+80);
295 sprintf(buf
, _("Could not open specified icon \"%s\":%s"),
296 file
, RMessageForError(RErrorCode
));
297 wMessageDialog(panel
->frame
->screen_ptr
, _("Error"), buf
,
298 _("OK"), NULL
, NULL
);
306 WMSetLabelImage(panel
->iconLbl
, pixmap
);
308 WMReleasePixmap(pixmap
);
315 updateIcon(WMButton
*button
, InspectorPanel
*panel
)
317 showIconFor(WMWidgetScreen(button
), panel
, NULL
, NULL
, USE_TEXT_FIELD
);
322 getBool(proplist_t value
)
326 if (!PLIsString(value
)) {
329 if (!(val
= PLGetString(value
))) {
333 if ((val
[1]=='\0' && (val
[0]=='y' || val
[0]=='Y' || val
[0]=='T'
334 || val
[0]=='t' || val
[0]=='1'))
335 || (strcasecmp(val
, "YES")==0 || strcasecmp(val
, "TRUE")==0)) {
338 } else if ((val
[1]=='\0'
339 && (val
[0]=='n' || val
[0]=='N' || val
[0]=='F'
340 || val
[0]=='f' || val
[0]=='0'))
341 || (strcasecmp(val
, "NO")==0 || strcasecmp(val
, "FALSE")==0)) {
345 wwarning(_("can't convert \"%s\" to boolean"), val
);
351 #define UPDATE_DEFAULTS 1
356 * Will insert the attribute = value; pair in window's list,
357 * if it's different from the defaults.
358 * Defaults means either defaults database, or attributes saved
359 * for the default window "*". This is to let one revert options that are
360 * global because they were saved for all windows ("*").
366 insertAttribute(proplist_t dict
, proplist_t window
, proplist_t attr
,
367 proplist_t value
, int *modified
, int flags
)
369 proplist_t def_win
, def_value
=NULL
;
372 if (!(flags
& UPDATE_DEFAULTS
) && dict
) {
373 if ((def_win
= PLGetDictionaryEntry(dict
, AnyWindow
)) != NULL
) {
374 def_value
= PLGetDictionaryEntry(def_win
, attr
);
378 /* If we could not find defaults in database, fall to hardcoded values.
379 * Also this is true if we save defaults for all windows
382 def_value
= ((flags
& IS_BOOLEAN
) != 0) ? No
: EmptyString
;
384 if ((flags
& IS_BOOLEAN
))
385 update
= (getBool(value
) != getBool(def_value
));
387 update
= !PLIsEqual(value
, def_value
);
391 PLInsertDictionaryEntry(window
, attr
, value
);
398 saveSettings(WMButton
*button
, InspectorPanel
*panel
)
400 WWindow
*wwin
= panel
->inspected
;
401 WDDomain
*db
= WDWindowAttributes
;
402 proplist_t dict
= db
->dictionary
;
403 proplist_t winDic
, value
, key
;
404 char buffer
[256], *icon_file
;
408 /* Save will apply the changes and save them */
409 applySettings(panel
->applyBtn
, panel
);
411 if (WMGetButtonSelected(panel
->instRb
) != 0)
412 key
= PLMakeString(wwin
->wm_instance
);
413 else if (WMGetButtonSelected(panel
->clsRb
) != 0)
414 key
= PLMakeString(wwin
->wm_class
);
415 else if (WMGetButtonSelected(panel
->bothRb
) != 0) {
416 strcat(strcat(strcpy(buffer
, wwin
->wm_instance
), "."), wwin
->wm_class
);
417 key
= PLMakeString(buffer
);
419 else if (WMGetButtonSelected(panel
->defaultRb
) != 0) {
420 key
= PLRetain(AnyWindow
);
421 flags
= UPDATE_DEFAULTS
;
430 dict
= PLMakeDictionaryFromEntries(NULL
, NULL
, NULL
);
432 db
->dictionary
= dict
;
433 value
= PLMakeString(db
->path
);
434 PLSetFilename(dict
, value
);
443 if (showIconFor(WMWidgetScreen(button
), panel
, NULL
, NULL
,
447 PLSetStringCmpHook(NULL
);
449 winDic
= PLMakeDictionaryFromEntries(NULL
, NULL
, NULL
);
451 /* Update icon for window */
452 icon_file
= WMGetTextFieldText(panel
->fileText
);
454 if (icon_file
[0] != 0) {
455 value
= PLMakeString(icon_file
);
456 insertAttribute(dict
, winDic
, AIcon
, value
, &different
, flags
);
462 if (WMGetButtonSelected(panel
->curRb
) != 0) {
463 value
= PLMakeString("");
464 insertAttribute(dict
, winDic
, AStartWorkspace
, value
, &different
, flags
);
466 } else if (WMGetButtonSelected(panel
->setRb
) != 0) {
467 char *ws_name
= WMGetTextFieldText(panel
->wsText
);
469 if (ws_name
[0] != 0) {
470 value
= PLMakeString(ws_name
);
471 insertAttribute(dict
, winDic
, AStartWorkspace
, value
, &different
, flags
);
480 value
= (WMGetButtonSelected(panel
->alwChk
)!=0) ? Yes
: No
;
481 insertAttribute(dict
, winDic
, AAlwaysUserIcon
, value
, &different
, flags
);
483 value
= (WMGetButtonSelected(panel
->attrChk
[0])!=0) ? Yes
: No
;
484 insertAttribute(dict
, winDic
, ANoTitlebar
, value
, &different
, flags
);
486 value
= (WMGetButtonSelected(panel
->attrChk
[1])!=0) ? Yes
: No
;
487 insertAttribute(dict
, winDic
, ANoResizebar
, value
, &different
, flags
);
489 value
= (WMGetButtonSelected(panel
->attrChk
[2])!=0) ? Yes
: No
;
490 insertAttribute(dict
, winDic
, ANoCloseButton
, value
, &different
, flags
);
492 value
= (WMGetButtonSelected(panel
->attrChk
[3])!=0) ? Yes
: No
;
493 insertAttribute(dict
, winDic
, ANoMiniaturizeButton
, value
, &different
, flags
);
495 value
= (WMGetButtonSelected(panel
->attrChk
[4])!=0) ? Yes
: No
;
496 insertAttribute(dict
, winDic
, AKeepOnTop
, value
, &different
, flags
);
498 value
= (WMGetButtonSelected(panel
->attrChk
[5])!=0) ? Yes
: No
;
499 insertAttribute(dict
, winDic
, AKeepOnBottom
, value
, &different
, flags
);
501 value
= (WMGetButtonSelected(panel
->attrChk
[6])!=0) ? Yes
: No
;
502 insertAttribute(dict
, winDic
, AOmnipresent
, value
, &different
, flags
);
504 value
= (WMGetButtonSelected(panel
->attrChk
[7])!=0) ? Yes
: No
;
505 insertAttribute(dict
, winDic
, AStartMiniaturized
, value
, &different
, flags
);
507 value
= (WMGetButtonSelected(panel
->attrChk
[8])!=0) ? Yes
: No
;
508 insertAttribute(dict
, winDic
, AStartMaximized
, value
, &different
, flags
);
510 value
= (WMGetButtonSelected(panel
->attrChk
[9])!=0) ? Yes
: No
;
511 insertAttribute(dict
, winDic
, ASkipWindowList
, value
, &different
, flags
);
514 value
= (WMGetButtonSelected(panel
->moreChk
[0])!=0) ? Yes
: No
;
515 insertAttribute(dict
, winDic
, ANoHideOthers
, value
, &different
, flags
);
517 value
= (WMGetButtonSelected(panel
->moreChk
[1])!=0) ? Yes
: No
;
518 insertAttribute(dict
, winDic
, ANoKeyBindings
, value
, &different
, flags
);
520 value
= (WMGetButtonSelected(panel
->moreChk
[2])!=0) ? Yes
: No
;
521 insertAttribute(dict
, winDic
, ANoMouseBindings
, value
, &different
, flags
);
523 value
= (WMGetButtonSelected(panel
->moreChk
[3])!=0) ? Yes
: No
;
524 insertAttribute(dict
, winDic
, AKeepInsideScreen
, value
, &different
, flags
);
526 value
= (WMGetButtonSelected(panel
->moreChk
[4])!=0) ? Yes
: No
;
527 insertAttribute(dict
, winDic
, AUnfocusable
, value
, &different
, flags
);
529 value
= (WMGetButtonSelected(panel
->moreChk
[5])!=0) ? Yes
: No
;
530 insertAttribute(dict
, winDic
, ADontSaveSession
, value
, &different
, flags
);
532 value
= (WMGetButtonSelected(panel
->moreChk
[6])!=0) ? Yes
: No
;
533 insertAttribute(dict
, winDic
, AEmulateAppIcon
, value
, &different
, flags
);
535 /* application wide settings for when */
536 /* the window is the leader, save the attribute with the others */
537 if (panel
->inspected
->main_window
== panel
->inspected
->client_win
) {
539 value
= (WMGetButtonSelected(panel
->appChk
[0])!=0) ? Yes
: No
;
540 insertAttribute(dict
, winDic
, AStartHidden
, value
, &different
, flags
);
542 value
= (WMGetButtonSelected(panel
->appChk
[1])!=0) ? Yes
: No
;
543 insertAttribute(dict
, winDic
, ANoAppIcon
, value
, &different
, flags
);
546 PLRemoveDictionaryEntry(dict
, key
);
548 PLInsertDictionaryEntry(dict
, key
, winDic
);
555 /* application wide settings */
556 if (panel
->inspected
->main_window
!= panel
->inspected
->client_win
557 && !(flags
& UPDATE_DEFAULTS
)) {
561 wapp
= wApplicationOf(panel
->inspected
->main_window
);
565 appDic
= PLMakeDictionaryFromEntries(NULL
, NULL
, NULL
);
567 assert(wapp
->main_window_desc
->wm_instance
!=NULL
);
568 assert(wapp
->main_window_desc
->wm_class
!=NULL
);
570 strcat(strcpy(buffer
, wapp
->main_window_desc
->wm_instance
), ".");
571 strcat(buffer
, wwin
->wm_class
);
572 key
= PLMakeString(buffer
);
574 iconFile
= wDefaultGetIconFile(wwin
->screen_ptr
,
575 wapp
->main_window_desc
->wm_instance
,
576 wapp
->main_window_desc
->wm_class
,
579 if (iconFile
&& iconFile
[0]!=0) {
580 value
= PLMakeString(iconFile
);
581 insertAttribute(dict
, appDic
, AIcon
, value
, &different
,
586 value
= (WMGetButtonSelected(panel
->appChk
[0])!=0) ? Yes
: No
;
587 insertAttribute(dict
, appDic
, AStartHidden
, value
, &different
, flags
);
589 value
= (WMGetButtonSelected(panel
->appChk
[1])!=0) ? Yes
: No
;
590 insertAttribute(dict
, appDic
, ANoAppIcon
, value
, &different
, flags
);
592 PLRemoveDictionaryEntry(dict
, key
);
594 PLInsertDictionaryEntry(dict
, key
, appDic
);
604 PLSetStringCmpHook(StringCompareHook
);
609 makeAppIconFor(WApplication
*wapp
)
611 WScreen
*scr
= wapp
->main_window_desc
->screen_ptr
;
616 if (!WFLAGP(wapp
->main_window_desc
, no_appicon
))
617 wapp
->app_icon
= wAppIconCreate(wapp
->main_window_desc
);
619 wapp
->app_icon
= NULL
;
621 if (wapp
->app_icon
) {
622 WIcon
*icon
= wapp
->app_icon
->icon
;
623 WDock
*clip
= scr
->workspaces
[scr
->current_workspace
]->clip
;
626 wapp
->app_icon
->main_window
= wapp
->main_window
;
628 if (clip
&& clip
->attract_icons
&& wDockFindFreeSlot(clip
, &x
, &y
)) {
629 wapp
->app_icon
->attracted
= 1;
630 if (!clip
->keep_attracted
&& !wapp
->app_icon
->icon
->shadowed
) {
631 wapp
->app_icon
->icon
->shadowed
= 1;
632 wapp
->app_icon
->icon
->force_paint
= 1;
634 wDockAttachIcon(clip
, wapp
->app_icon
, x
, y
);
636 PlaceIcon(scr
, &x
, &y
);
637 wAppIconMove(wapp
->app_icon
, x
, y
);
639 if (!clip
|| !wapp
->app_icon
->attracted
|| !clip
->collapsed
)
640 XMapWindow(dpy
, icon
->core
->window
);
642 if (wPreferences
.auto_arrange_icons
&& !wapp
->app_icon
->attracted
)
643 wArrangeIcons(wapp
->main_window_desc
->screen_ptr
, True
);
649 removeAppIconFor(WApplication
*wapp
)
654 if (wapp
->app_icon
->docked
&&
655 (!wapp
->app_icon
->attracted
|| wapp
->app_icon
->dock
->keep_attracted
)) {
656 wapp
->app_icon
->running
= 0;
657 /* since we keep it, we don't care if it was attracted or not */
658 wapp
->app_icon
->attracted
= 0;
659 wapp
->app_icon
->icon
->shadowed
= 0;
660 wapp
->app_icon
->main_window
= None
;
661 wapp
->app_icon
->pid
= 0;
662 wapp
->app_icon
->icon
->owner
= NULL
;
663 wapp
->app_icon
->icon
->icon_win
= None
;
664 wapp
->app_icon
->icon
->force_paint
= 1;
665 wAppIconPaint(wapp
->app_icon
);
666 } else if (wapp
->app_icon
->docked
) {
667 wapp
->app_icon
->running
= 0;
668 wDockDetach(wapp
->app_icon
->dock
, wapp
->app_icon
);
670 wAppIconDestroy(wapp
->app_icon
);
672 wapp
->app_icon
= NULL
;
673 if (wPreferences
.auto_arrange_icons
)
674 wArrangeIcons(wapp
->main_window_desc
->screen_ptr
, True
);
679 applySettings(WMButton
*button
, InspectorPanel
*panel
)
681 WWindow
*wwin
= panel
->inspected
;
682 WApplication
*wapp
= wApplicationOf(wwin
->main_window
);
683 int floating
, sunken
, skip_window_list
;
685 int old_no_bind_keys
;
686 int old_no_bind_mouse
;
688 old_omnipresent
= WFLAGP(wwin
, omnipresent
);
689 old_no_bind_keys
= WFLAGP(wwin
, no_bind_keys
);
690 old_no_bind_mouse
= WFLAGP(wwin
, no_bind_mouse
);
692 showIconFor(WMWidgetScreen(button
), panel
, NULL
, NULL
, USE_TEXT_FIELD
);
694 WSETUFLAG(wwin
, no_titlebar
, WMGetButtonSelected(panel
->attrChk
[0]));
695 WSETUFLAG(wwin
, no_resizebar
, WMGetButtonSelected(panel
->attrChk
[1]));
696 WSETUFLAG(wwin
, no_close_button
, WMGetButtonSelected(panel
->attrChk
[2]));
697 WSETUFLAG(wwin
, no_miniaturize_button
, WMGetButtonSelected(panel
->attrChk
[3]));
698 floating
= WMGetButtonSelected(panel
->attrChk
[4]);
699 sunken
= WMGetButtonSelected(panel
->attrChk
[5]);
700 WSETUFLAG(wwin
, omnipresent
, WMGetButtonSelected(panel
->attrChk
[6]));
701 WSETUFLAG(wwin
, start_miniaturized
, WMGetButtonSelected(panel
->attrChk
[7]));
702 WSETUFLAG(wwin
, start_maximized
, WMGetButtonSelected(panel
->attrChk
[8]));
703 skip_window_list
= WMGetButtonSelected(panel
->attrChk
[9]);
705 WSETUFLAG(wwin
, no_hide_others
, WMGetButtonSelected(panel
->moreChk
[0]));
706 WSETUFLAG(wwin
, no_bind_keys
, WMGetButtonSelected(panel
->moreChk
[1]));
707 WSETUFLAG(wwin
, no_bind_mouse
, WMGetButtonSelected(panel
->moreChk
[2]));
708 WSETUFLAG(wwin
, dont_move_off
, WMGetButtonSelected(panel
->moreChk
[3]));
709 WSETUFLAG(wwin
, no_focusable
, WMGetButtonSelected(panel
->moreChk
[4]));
710 WSETUFLAG(wwin
, dont_save_session
, WMGetButtonSelected(panel
->moreChk
[5]));
711 WSETUFLAG(wwin
, emulate_appicon
, WMGetButtonSelected(panel
->moreChk
[6]));
712 WSETUFLAG(wwin
, always_user_icon
, WMGetButtonSelected(panel
->alwChk
));
714 if (WFLAGP(wwin
, no_titlebar
) && wwin
->flags
.shaded
)
715 wUnshadeWindow(wwin
);
717 WSETUFLAG(wwin
, no_shadeable
, WFLAGP(wwin
, no_titlebar
));
720 if (!WFLAGP(wwin
, floating
))
721 ChangeStackingLevel(wwin
->frame
->core
, WMFloatingLevel
);
723 if (!WFLAGP(wwin
, sunken
))
724 ChangeStackingLevel(wwin
->frame
->core
, WMSunkenLevel
);
726 if (WFLAGP(wwin
, floating
) || WFLAGP(wwin
, sunken
))
727 ChangeStackingLevel(wwin
->frame
->core
, WMNormalLevel
);
730 WSETUFLAG(wwin
, sunken
, sunken
);
731 WSETUFLAG(wwin
, floating
, floating
);
732 wwin
->flags
.omnipresent
= 0;
734 if (WFLAGP(wwin
, skip_window_list
) != skip_window_list
) {
735 WSETUFLAG(wwin
, skip_window_list
, skip_window_list
);
736 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
,
737 skip_window_list
? ACTION_REMOVE
: ACTION_ADD
);
739 if (WFLAGP(wwin
, omnipresent
) != old_omnipresent
) {
740 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_WORKSPACE
);
744 if (WFLAGP(wwin
, no_bind_keys
) != old_no_bind_keys
) {
745 if (WFLAGP(wwin
, no_bind_keys
)) {
746 XUngrabKey(dpy
, AnyKey
, AnyModifier
, wwin
->frame
->core
->window
);
748 wWindowSetKeyGrabs(wwin
);
752 if (WFLAGP(wwin
, no_bind_mouse
) != old_no_bind_mouse
) {
753 wWindowResetMouseGrabs(wwin
);
756 wwin
->frame
->flags
.need_texture_change
= 1;
757 wWindowConfigureBorders(wwin
);
758 wFrameWindowPaint(wwin
->frame
);
761 * Can't apply emulate_appicon because it will probably cause problems.
765 /* do application wide stuff */
766 WSETUFLAG(wapp
->main_window_desc
, start_hidden
,
767 WMGetButtonSelected(panel
->appChk
[0]));
769 WSETUFLAG(wapp
->main_window_desc
, no_appicon
,
770 WMGetButtonSelected(panel
->appChk
[1]));
772 if (WFLAGP(wapp
->main_window_desc
, no_appicon
))
773 removeAppIconFor(wapp
);
775 makeAppIconFor(wapp
);
777 if (wapp
->app_icon
&& wapp
->main_window
== wwin
->client_win
) {
778 char *file
= WMGetTextFieldText(panel
->fileText
);
784 wIconChangeImageFile(wapp
->app_icon
->icon
, file
);
787 wAppIconPaint(wapp
->app_icon
);
794 revertSettings(WMButton
*button
, InspectorPanel
*panel
)
796 WWindow
*wwin
= panel
->inspected
;
797 WApplication
*wapp
= wApplicationOf(wwin
->main_window
);
799 char *wm_instance
= NULL
;
800 char *wm_class
= NULL
;
801 int workspace
, level
;
803 if (WMGetButtonSelected(panel
->instRb
) != 0)
804 wm_instance
= wwin
->wm_instance
;
805 else if (WMGetButtonSelected(panel
->clsRb
) != 0)
806 wm_class
= wwin
->wm_class
;
807 else if (WMGetButtonSelected(panel
->bothRb
) != 0) {
808 wm_instance
= wwin
->wm_instance
;
809 wm_class
= wwin
->wm_class
;
811 memset(&wwin
->defined_user_flags
, 0, sizeof(WWindowAttributes
));
812 memset(&wwin
->user_flags
, 0, sizeof(WWindowAttributes
));
813 memset(&wwin
->client_flags
, 0, sizeof(WWindowAttributes
));
815 wWindowSetupInitialAttributes(wwin
, &level
, &workspace
);
817 for (i
=0; i
< 10; i
++) {
822 flag
= WFLAGP(wwin
, no_titlebar
);
825 flag
= WFLAGP(wwin
, no_resizebar
);
828 flag
= WFLAGP(wwin
, no_close_button
);
831 flag
= WFLAGP(wwin
, no_miniaturize_button
);
834 flag
= WFLAGP(wwin
, floating
);
837 flag
= WFLAGP(wwin
, sunken
);
840 flag
= WFLAGP(wwin
, omnipresent
);
843 flag
= WFLAGP(wwin
, start_miniaturized
);
846 flag
= WFLAGP(wwin
, start_maximized
!=0);
849 flag
= WFLAGP(wwin
, skip_window_list
);
852 WMSetButtonSelected(panel
->attrChk
[i
], flag
);
854 for (i
=0; i
< 7; i
++) {
859 flag
= WFLAGP(wwin
, no_hide_others
);
862 flag
= WFLAGP(wwin
, no_bind_keys
);
865 flag
= WFLAGP(wwin
, no_bind_mouse
);
868 flag
= WFLAGP(wwin
, dont_move_off
);
871 flag
= WFLAGP(wwin
, no_focusable
);
874 flag
= WFLAGP(wwin
, dont_save_session
);
877 flag
= WFLAGP(wwin
, emulate_appicon
);
880 WMSetButtonSelected(panel
->moreChk
[i
], flag
);
882 if (panel
->appFrm
&& wapp
) {
883 for (i
=0; i
< 2; i
++) {
888 flag
= WFLAGP(wapp
->main_window_desc
, start_hidden
);
891 flag
= WFLAGP(wapp
->main_window_desc
, no_appicon
);
894 WMSetButtonSelected(panel
->appChk
[i
], flag
);
897 WMSetButtonSelected(panel
->alwChk
, WFLAGP(wwin
, always_user_icon
));
899 showIconFor(WMWidgetScreen(panel
->alwChk
), panel
, wm_instance
, wm_class
,
902 n
= wDefaultGetStartWorkspace(wwin
->screen_ptr
, wm_instance
, wm_class
);
904 if (n
>= 0 && n
<= wwin
->screen_ptr
->workspace_count
) {
905 WMPerformButtonClick(panel
->setRb
);
906 WMSetTextFieldText(panel
->wsText
, wwin
->screen_ptr
->workspaces
[n
]->name
);
908 WMPerformButtonClick(panel
->curRb
);
914 chooseIconCallback(WMWidget
*self
, void *clientData
)
917 InspectorPanel
*panel
= (InspectorPanel
*)clientData
;
920 panel
->choosingIcon
= 1;
922 WMSetButtonEnabled(panel
->browseIconBtn
, False
);
924 result
= wIconChooserDialog(panel
->frame
->screen_ptr
, &file
,
925 panel
->inspected
->wm_instance
,
926 panel
->inspected
->wm_class
);
928 panel
->choosingIcon
= 0;
930 if (!panel
->destroyed
) { /* kluge */
932 WMSetTextFieldText(panel
->fileText
, file
);
933 showIconFor(WMWidgetScreen(self
), panel
, NULL
, NULL
,
937 WMSetButtonEnabled(panel
->browseIconBtn
, True
);
939 freeInspector(panel
);
945 textEditedObserver(void *observerData
, WMNotification
*notification
)
947 InspectorPanel
*panel
= (InspectorPanel
*)observerData
;
949 if ((long)WMGetNotificationClientData(notification
) != WMReturnTextMovement
)
952 if (observerData
== panel
->fileText
) {
953 showIconFor(WMWidgetScreen(panel
->win
), panel
, NULL
, NULL
,
956 WMPerformButtonClick(panel->updateIconBtn);
959 WMPerformButtonClick(panel
->setRb
);
964 selectSpecification(WMWidget
*bPtr
, void *data
)
966 InspectorPanel
*panel
= (InspectorPanel
*)data
;
968 if (bPtr
== panel
->defaultRb
) {
969 WMSetButtonEnabled(panel
->applyBtn
, False
);
971 WMSetButtonEnabled(panel
->applyBtn
, True
);
976 static InspectorPanel
*
977 createInspectorForWindow(WWindow
*wwin
)
979 WScreen
*scr
= wwin
->screen_ptr
;
980 InspectorPanel
*panel
;
985 int btn_width
, frame_width
;
986 #ifdef wrong_behaviour
989 panel
= wmalloc(sizeof(InspectorPanel
));
990 memset(panel
, 0, sizeof(InspectorPanel
));
992 panel
->destroyed
= 0;
995 panel
->inspected
= wwin
;
997 panel
->nextPtr
= panelList
;
1001 sprintf(charbuf
, "Inspecting %s.%s",
1002 wwin
->wm_instance
? wwin
->wm_instance
: "?",
1003 wwin
->wm_class
? wwin
->wm_class
: "?");
1005 panel
->win
= WMCreateWindow(scr
->wmscreen
, "windowInspector");
1006 WMResizeWidget(panel
->win
, PWIDTH
, PHEIGHT
);
1009 /**** create common stuff ****/
1011 /* command buttons */
1012 /* (PWIDTH - (left and right margin) - (btn interval)) / 3 */
1013 btn_width
= (PWIDTH
- (2 * 15) - (2 * 10)) / 3;
1014 panel
->saveBtn
= WMCreateCommandButton(panel
->win
);
1015 WMSetButtonAction(panel
->saveBtn
, (WMAction
*)saveSettings
, panel
);
1016 WMMoveWidget(panel
->saveBtn
, (2 * (btn_width
+ 10)) + 15, 310);
1017 WMSetButtonText(panel
->saveBtn
, _("Save"));
1018 WMResizeWidget(panel
->saveBtn
, btn_width
, 28);
1019 if (wPreferences
.flags
.noupdates
)
1020 WMSetButtonEnabled(panel
->saveBtn
, False
);
1022 panel
->applyBtn
= WMCreateCommandButton(panel
->win
);
1023 WMSetButtonAction(panel
->applyBtn
, (WMAction
*)applySettings
, panel
);
1024 WMMoveWidget(panel
->applyBtn
, btn_width
+ 10 + 15, 310);
1025 WMSetButtonText(panel
->applyBtn
, _("Apply"));
1026 WMResizeWidget(panel
->applyBtn
, btn_width
, 28);
1028 panel
->revertBtn
= WMCreateCommandButton(panel
->win
);
1029 WMSetButtonAction(panel
->revertBtn
, (WMAction
*)revertSettings
, panel
);
1030 WMMoveWidget(panel
->revertBtn
, 15, 310);
1031 WMSetButtonText(panel
->revertBtn
, _("Reload"));
1032 WMResizeWidget(panel
->revertBtn
, btn_width
, 28);
1034 /* page selection popup button */
1035 panel
->pagePopUp
= WMCreatePopUpButton(panel
->win
);
1036 WMSetPopUpButtonAction(panel
->pagePopUp
, (WMAction
*)changePage
, panel
);
1037 WMMoveWidget(panel
->pagePopUp
, 25, 15);
1038 WMResizeWidget(panel
->pagePopUp
, PWIDTH
- 50, 20);
1040 WMAddPopUpButtonItem(panel
->pagePopUp
, _("Window Specification"));
1041 WMAddPopUpButtonItem(panel
->pagePopUp
, _("Window Attributes"));
1042 WMAddPopUpButtonItem(panel
->pagePopUp
, _("Advanced Options"));
1043 WMAddPopUpButtonItem(panel
->pagePopUp
, _("Icon and Initial Workspace"));
1044 WMAddPopUpButtonItem(panel
->pagePopUp
, _("Application Specific"));
1046 /**** window spec ****/
1047 frame_width
= PWIDTH
- (2 * 15);
1049 panel
->specFrm
= WMCreateFrame(panel
->win
);
1050 WMSetFrameTitle(panel
->specFrm
, _("Window Specification"));
1051 WMMoveWidget(panel
->specFrm
, 15, 65);
1052 WMResizeWidget(panel
->specFrm
, frame_width
, 105);
1055 panel
->defaultRb
= WMCreateRadioButton(panel
->specFrm
);
1056 WMMoveWidget(panel
->defaultRb
, 10, 78);
1057 WMResizeWidget(panel
->defaultRb
, frame_width
- (2 * 10), 20);
1058 WMSetButtonText(panel
->defaultRb
, _("Defaults for all windows"));
1059 WMSetButtonSelected(panel
->defaultRb
, False
);
1060 WMSetButtonAction(panel
->defaultRb
, selectSpecification
, panel
);
1063 if (wwin
->wm_class
&& wwin
->wm_instance
) {
1064 sprintf(charbuf
, "%s.%s", wwin
->wm_instance
, wwin
->wm_class
);
1065 panel
->bothRb
= WMCreateRadioButton(panel
->specFrm
);
1066 WMMoveWidget(panel
->bothRb
, 10, 18);
1067 WMResizeWidget(panel
->bothRb
, frame_width
- (2 * 10), 20);
1068 WMSetButtonText(panel
->bothRb
, charbuf
);
1069 WMSetButtonSelected(panel
->bothRb
, True
);
1070 WMGroupButtons(panel
->defaultRb
, panel
->bothRb
);
1072 WMSetButtonAction(panel
->bothRb
, selectSpecification
, panel
);
1075 if (wwin
->wm_instance
) {
1076 panel
->instRb
= WMCreateRadioButton(panel
->specFrm
);
1077 WMMoveWidget(panel
->instRb
, 10, 38);
1078 WMResizeWidget(panel
->instRb
, frame_width
- (2 * 10), 20);
1079 WMSetButtonText(panel
->instRb
, wwin
->wm_instance
);
1080 WMSetButtonSelected(panel
->instRb
, False
);
1081 WMGroupButtons(panel
->defaultRb
, panel
->instRb
);
1083 WMSetButtonAction(panel
->instRb
, selectSpecification
, panel
);
1086 if (wwin
->wm_class
) {
1087 panel
->clsRb
= WMCreateRadioButton(panel
->specFrm
);
1088 WMMoveWidget(panel
->clsRb
, 10, 58);
1089 WMResizeWidget(panel
->clsRb
, frame_width
- (2 * 10), 20);
1090 WMSetButtonText(panel
->clsRb
, wwin
->wm_class
);
1091 WMSetButtonSelected(panel
->clsRb
, False
);
1092 WMGroupButtons(panel
->defaultRb
, panel
->clsRb
);
1094 WMSetButtonAction(panel
->clsRb
, selectSpecification
, panel
);
1097 panel
->specLbl
= WMCreateLabel(panel
->win
);
1098 WMMoveWidget(panel
->specLbl
, 15, 170);
1099 WMResizeWidget(panel
->specLbl
, frame_width
, 100);
1100 WMSetLabelText(panel
->specLbl
,
1101 _("The configuration will apply to all\n"
1102 "windows that have their WM_CLASS property"
1103 " set to the above selected\nname, when saved."));
1104 WMSetLabelTextAlignment(panel
->specLbl
, WACenter
);
1106 /**** attributes ****/
1107 panel
->attrFrm
= WMCreateFrame(panel
->win
);
1108 WMSetFrameTitle(panel
->attrFrm
, _("Attributes"));
1109 WMMoveWidget(panel
->attrFrm
, 15, 50);
1110 WMResizeWidget(panel
->attrFrm
, frame_width
, 240);
1112 for (i
=0; i
< 10; i
++) {
1113 char *caption
= NULL
;
1118 caption
= _("Disable Titlebar");
1119 flag
= WFLAGP(wwin
, no_titlebar
);
1122 caption
= _("Disable Resizebar");
1123 flag
= WFLAGP(wwin
, no_resizebar
);
1126 caption
= _("Disable Close Button");
1127 flag
= WFLAGP(wwin
, no_close_button
);
1130 caption
= _("Disable Miniaturize Button");
1131 flag
= WFLAGP(wwin
, no_miniaturize_button
);
1134 caption
= _("Keep on Top / Floating");
1135 flag
= WFLAGP(wwin
, floating
);
1138 caption
= _("Keep at Bottom / Sunken");
1139 flag
= WFLAGP(wwin
, sunken
);
1142 caption
= _("Omnipresent");
1143 flag
= WFLAGP(wwin
, omnipresent
);
1146 caption
= _("Start Miniaturized");
1147 flag
= WFLAGP(wwin
, start_miniaturized
);
1150 caption
= _("Start Maximized");
1151 flag
= WFLAGP(wwin
, start_maximized
!=0);
1154 caption
= _("Skip Window List");
1155 flag
= WFLAGP(wwin
, skip_window_list
);
1158 panel
->attrChk
[i
] = WMCreateSwitchButton(panel
->attrFrm
);
1159 WMMoveWidget(panel
->attrChk
[i
], 10, 20*(i
+1));
1160 WMResizeWidget(panel
->attrChk
[i
], frame_width
-15, 20);
1161 WMSetButtonSelected(panel
->attrChk
[i
], flag
);
1162 WMSetButtonText(panel
->attrChk
[i
], caption
);
1166 /**** more attributes ****/
1167 panel
->moreFrm
= WMCreateFrame(panel
->win
);
1168 WMSetFrameTitle(panel
->moreFrm
, _("Advanced"));
1169 WMMoveWidget(panel
->moreFrm
, 15, 50);
1170 WMResizeWidget(panel
->moreFrm
, frame_width
, 240);
1172 for (i
=0; i
< 7; i
++) {
1173 char *caption
= NULL
;
1178 caption
= _("Ignore HideOthers");
1179 flag
= WFLAGP(wwin
, no_hide_others
);
1182 caption
= _("Don't Bind Keyboard Shortcuts");
1183 flag
= WFLAGP(wwin
, no_bind_keys
);
1186 caption
= _("Don't Bind Mouse Clicks");
1187 flag
= WFLAGP(wwin
, no_bind_mouse
);
1190 caption
= _("Keep Inside Screen");
1191 flag
= WFLAGP(wwin
, dont_move_off
);
1194 caption
= _("Don't Let It Take Focus");
1195 flag
= WFLAGP(wwin
, no_focusable
);
1198 caption
= _("Don't Save Session");
1199 flag
= WFLAGP(wwin
, dont_save_session
);
1202 caption
= _("Emulate Application Icon");
1203 flag
= WFLAGP(wwin
, emulate_appicon
);
1206 panel
->moreChk
[i
] = WMCreateSwitchButton(panel
->moreFrm
);
1207 WMMoveWidget(panel
->moreChk
[i
], 10, 20*(i
+1));
1208 WMResizeWidget(panel
->moreChk
[i
], frame_width
-15, 20);
1209 WMSetButtonSelected(panel
->moreChk
[i
], flag
);
1210 WMSetButtonText(panel
->moreChk
[i
], caption
);
1213 panel
->moreLbl
= WMCreateLabel(panel
->moreFrm
);
1214 WMResizeWidget(panel
->moreLbl
, frame_width
- (2 * 5), 60);
1215 WMMoveWidget(panel
->moreLbl
, 5, 160);
1216 WMSetLabelText(panel
->moreLbl
,
1217 _("Enable the \"Don't bind...\" options to allow the "
1218 "application to receive all mouse or keyboard events."));
1220 /* miniwindow/workspace */
1221 panel
->iconFrm
= WMCreateFrame(panel
->win
);
1222 WMMoveWidget(panel
->iconFrm
, 15, 50);
1223 WMResizeWidget(panel
->iconFrm
, PWIDTH
- (2 * 15), 170);
1224 WMSetFrameTitle(panel
->iconFrm
, _("Miniwindow Image"));
1226 panel
->iconLbl
= WMCreateLabel(panel
->iconFrm
);
1227 WMMoveWidget(panel
->iconLbl
, PWIDTH
- (2 * 15) - 22 - 64, 30);
1228 WMResizeWidget(panel
->iconLbl
, 64, 64);
1229 WMSetLabelRelief(panel
->iconLbl
, WRRaised
);
1230 WMSetLabelImagePosition(panel
->iconLbl
, WIPImageOnly
);
1232 panel
->browseIconBtn
= WMCreateCommandButton(panel
->iconFrm
);
1233 WMSetButtonAction(panel
->browseIconBtn
, chooseIconCallback
, panel
);
1234 WMMoveWidget(panel
->browseIconBtn
, 22, 30);
1235 WMResizeWidget(panel
->browseIconBtn
, 100, 26);
1236 WMSetButtonText(panel
->browseIconBtn
, _("Browse..."));
1239 panel
->updateIconBtn
= WMCreateCommandButton(panel
->iconFrm
);
1240 WMSetButtonAction(panel
->updateIconBtn
, (WMAction
*)updateIcon
, panel
);
1241 WMMoveWidget(panel
->updateIconBtn
, 22, 65);
1242 WMResizeWidget(panel
->updateIconBtn
, 100, 26);
1243 WMSetButtonText(panel
->updateIconBtn
, _("Update"));
1245 #ifdef wrong_behaviour
1246 WMSetButtonImagePosition(panel
->updateIconBtn
, WIPRight
);
1247 pixmap
= WMGetSystemPixmap(scr
->wmscreen
, WSIReturnArrow
);
1248 WMSetButtonImage(panel
->updateIconBtn
, pixmap
);
1249 WMReleasePixmap(pixmap
);
1250 pixmap
= WMGetSystemPixmap(scr
->wmscreen
, WSIHighlightedReturnArrow
);
1251 WMSetButtonAltImage(panel
->updateIconBtn
, pixmap
);
1252 WMReleasePixmap(pixmap
);
1255 panel
->fileLbl
= WMCreateLabel(panel
->iconFrm
);
1256 WMMoveWidget(panel
->fileLbl
, 20, 95);
1257 WMResizeWidget(panel
->fileLbl
, PWIDTH
- (2 * 15) - (2 * 20), 14);
1258 WMSetLabelText(panel
->fileLbl
, _("Icon File Name:"));
1260 panel
->fileText
= WMCreateTextField(panel
->iconFrm
);
1261 WMMoveWidget(panel
->fileText
, 20, 115);
1262 WMResizeWidget(panel
->fileText
, PWIDTH
- (2 * 15) - (2 * 15), 20);
1263 WMSetTextFieldText(panel
->fileText
, NULL
);
1264 WMAddNotificationObserver(textEditedObserver
, panel
,
1265 WMTextDidEndEditingNotification
,
1267 panel
->alwChk
= WMCreateSwitchButton(panel
->iconFrm
);
1268 WMMoveWidget(panel
->alwChk
, 20, 140);
1269 WMResizeWidget(panel
->alwChk
, PWIDTH
- (2 * 15) - (2 * 15), 20);
1270 WMSetButtonText(panel
->alwChk
, _("Ignore client supplied icon"));
1271 WMSetButtonSelected(panel
->alwChk
, WFLAGP(wwin
, always_user_icon
));
1274 panel
->wsFrm
= WMCreateFrame(panel
->win
);
1275 WMMoveWidget(panel
->wsFrm
, 15, 225);
1276 WMResizeWidget(panel
->wsFrm
, PWIDTH
- (2 * 15), 70);
1277 WMSetFrameTitle(panel
->wsFrm
, _("Initial Workspace"));
1279 panel
->curRb
= WMCreateRadioButton(panel
->wsFrm
);
1280 WMMoveWidget(panel
->curRb
, 10, 15);
1281 WMResizeWidget(panel
->curRb
, frame_width
- (2 * 10), 20);
1282 WMSetButtonText(panel
->curRb
, _("Nowhere in particular"));
1285 panel
->setRb
= WMCreateRadioButton(panel
->wsFrm
);
1286 WMMoveWidget(panel
->setRb
, 10, 40);
1287 WMResizeWidget(panel
->setRb
, 25, 20);
1288 WMGroupButtons(panel
->curRb
, panel
->setRb
);
1289 WMSetButtonText(panel
->setRb
, NULL
);
1291 panel
->wsText
= WMCreateTextField(panel
->wsFrm
);
1292 WMMoveWidget(panel
->wsText
, 30, 40);
1293 WMResizeWidget(panel
->wsText
, PWIDTH
- (2 * 15) - 25 - 10 - (2 * 5), 20);
1294 WMAddNotificationObserver(textEditedObserver
, panel
,
1295 WMTextDidEndEditingNotification
,
1299 i
= wDefaultGetStartWorkspace(wwin
->screen_ptr
, wwin
->wm_instance
,
1301 if (i
>= 0 && i
<= wwin
->screen_ptr
->workspace_count
) {
1302 WMSetButtonSelected(panel
->curRb
, False
);
1303 WMSetButtonSelected(panel
->setRb
, True
);
1304 WMSetTextFieldText(panel
->wsText
,
1305 wwin
->screen_ptr
->workspaces
[i
]->name
);
1307 WMSetButtonSelected(panel
->curRb
, True
);
1308 WMSetButtonSelected(panel
->setRb
, False
);
1311 /* application wide attributes */
1312 if (wwin
->main_window
!= None
) {
1313 WApplication
*wapp
= wApplicationOf(wwin
->main_window
);
1315 panel
->appFrm
= WMCreateFrame(panel
->win
);
1316 WMSetFrameTitle(panel
->appFrm
, _("Application Wide"));
1317 WMMoveWidget(panel
->appFrm
, 15, 50);
1318 WMResizeWidget(panel
->appFrm
, frame_width
, 240);
1320 for (i
=0; i
< 2; i
++) {
1321 char *caption
= NULL
;
1326 caption
= _("Start Hidden");
1327 flag
= WFLAGP(wapp
->main_window_desc
, start_hidden
);
1330 caption
= _("No Application Icon");
1331 flag
= WFLAGP(wapp
->main_window_desc
, no_appicon
);
1334 panel
->appChk
[i
] = WMCreateSwitchButton(panel
->appFrm
);
1335 WMMoveWidget(panel
->appChk
[i
], 10, 20*(i
+1));
1336 WMResizeWidget(panel
->appChk
[i
], 205, 20);
1337 WMSetButtonSelected(panel
->appChk
[i
], flag
);
1338 WMSetButtonText(panel
->appChk
[i
], caption
);
1341 if (WFLAGP(wwin
, emulate_appicon
)) {
1342 WMSetButtonEnabled(panel
->appChk
[1], False
);
1343 WMSetButtonEnabled(panel
->moreChk
[6], True
);
1345 WMSetButtonEnabled(panel
->appChk
[1], True
);
1346 WMSetButtonEnabled(panel
->moreChk
[6], False
);
1351 if (wwin
->transient_for
!=None
1352 && wwin
->transient_for
!=scr
->root_win
)
1356 WMSetButtonEnabled(panel
->moreChk
[6], tmp
);
1358 WMSetPopUpButtonItemEnabled(panel
->pagePopUp
, 4, False
);
1359 panel
->appFrm
= NULL
;
1362 /* if the window is a transient, don't let it have a miniaturize
1364 if (wWindowFor(wwin
->transient_for
)!=NULL
)
1365 WMSetButtonEnabled(panel
->attrChk
[3], False
);
1367 WMSetButtonEnabled(panel
->attrChk
[3], True
);
1370 WMRealizeWidget(panel
->win
);
1372 WMMapSubwidgets(panel
->win
);
1373 WMMapSubwidgets(panel
->specFrm
);
1374 WMMapSubwidgets(panel
->attrFrm
);
1375 WMMapSubwidgets(panel
->moreFrm
);
1376 WMMapSubwidgets(panel
->iconFrm
);
1377 WMMapSubwidgets(panel
->wsFrm
);
1379 WMMapSubwidgets(panel
->appFrm
);
1381 WMSetPopUpButtonSelectedItem(panel
->pagePopUp
, 1);
1382 changePage(panel
->pagePopUp
, panel
);
1385 parent
= XCreateSimpleWindow(dpy
, scr
->root_win
, 0, 0, PWIDTH
, PHEIGHT
,
1387 XSelectInput(dpy
, parent
, KeyPressMask
|KeyReleaseMask
);
1388 panel
->parent
= parent
;
1389 XReparentWindow(dpy
, WMWidgetXID(panel
->win
), parent
, 0, 0);
1391 WMMapWidget(panel
->win
);
1393 XSetTransientForHint(dpy
, parent
, wwin
->client_win
);
1395 x
= wwin
->frame_x
+wwin
->frame
->core
->width
/2;
1396 y
= wwin
->frame_y
+wwin
->frame
->top_width
*2;
1397 if (y
+ PHEIGHT
> scr
->scr_height
)
1398 y
= scr
->scr_height
- PHEIGHT
- 30;
1399 if (x
+ PWIDTH
> scr
->scr_width
)
1400 x
= scr
->scr_width
- PWIDTH
;
1401 panel
->frame
= wManageInternalWindow(scr
, parent
, wwin
->client_win
,
1402 charbuf
, x
, y
, PWIDTH
, PHEIGHT
);
1404 /* kluge to know who should get the key events */
1405 panel
->frame
->client_leader
= WMWidgetXID(panel
->win
);
1407 WSETUFLAG(panel
->frame
, no_closable
, 0);
1408 WSETUFLAG(panel
->frame
, no_close_button
, 0);
1409 wWindowUpdateButtonImages(panel
->frame
);
1410 wFrameWindowShowButton(panel
->frame
->frame
, WFF_RIGHT_BUTTON
);
1411 panel
->frame
->frame
->on_click_right
= destroyInspector
;
1413 wWindowMap(panel
->frame
);
1415 showIconFor(WMWidgetScreen(panel
->alwChk
), panel
, wwin
->wm_instance
,
1416 wwin
->wm_class
, UPDATE_TEXT_FIELD
);
1422 wShowInspectorForWindow(WWindow
*wwin
)
1424 if (wwin
->flags
.inspector_open
)
1428 wwin
->flags
.inspector_open
= 1;
1429 wwin
->inspector
= createInspectorForWindow(wwin
);;