1 /* winspector.c - window attribute inspector
3 * Window Maker window manager
5 * Copyright (c) 1997, 1998 Alfredo K. Kojima
6 * Copyright (c) 1998 Dan Pascu
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
27 #include <X11/Xutil.h>
32 #include "WindowMaker.h"
37 #include "workspace.h"
43 #include "application.h"
46 #include "winspector.h"
51 extern WDDomain
*WDWindowAttributes
;
53 static InspectorPanel
*panelList
=NULL
;
55 extern WPreferences wPreferences
;
57 static proplist_t ANoTitlebar
= NULL
;
58 static proplist_t ANoResizebar
;
59 static proplist_t ANoMiniaturizeButton
;
60 static proplist_t ANoCloseButton
;
61 static proplist_t ANoHideOthers
;
62 static proplist_t ANoMouseBindings
;
63 static proplist_t ANoKeyBindings
;
64 static proplist_t ANoAppIcon
;
65 static proplist_t AKeepOnTop
;
66 static proplist_t AKeepOnBottom
;
67 static proplist_t AOmnipresent
;
68 static proplist_t ASkipWindowList
;
69 static proplist_t AKeepInsideScreen
;
70 static proplist_t AUnfocusable
;
71 static proplist_t AAlwaysUserIcon
;
72 static proplist_t AStartMiniaturized
;
73 static proplist_t AStartMaximized
;
74 static proplist_t ADontSaveSession
;
75 static proplist_t AEmulateAppIcon
;
76 static proplist_t AFullMaximize
;
78 static proplist_t AStartWorkspace
;
80 static proplist_t AIcon
;
82 /* application wide options */
83 static proplist_t AStartHidden
;
86 static proplist_t AnyWindow
;
87 static proplist_t EmptyString
;
88 static proplist_t Yes
, No
;
95 static void applySettings(WMButton
*button
, InspectorPanel
*panel
);
100 if (ANoTitlebar
!=NULL
)
103 AIcon
= PLMakeString("Icon");
104 ANoTitlebar
= PLMakeString("NoTitlebar");
105 ANoResizebar
= PLMakeString("NoResizebar");
106 ANoMiniaturizeButton
= PLMakeString("NoMiniaturizeButton");
107 ANoCloseButton
= PLMakeString("NoCloseButton");
108 ANoHideOthers
= PLMakeString("NoHideOthers");
109 ANoMouseBindings
= PLMakeString("NoMouseBindings");
110 ANoKeyBindings
= PLMakeString("NoKeyBindings");
111 ANoAppIcon
= PLMakeString("NoAppIcon");
112 AKeepOnTop
= PLMakeString("KeepOnTop");
113 AKeepOnBottom
= PLMakeString("KeepOnBottom");
114 AOmnipresent
= PLMakeString("Omnipresent");
115 ASkipWindowList
= PLMakeString("SkipWindowList");
116 AKeepInsideScreen
= PLMakeString("KeepInsideScreen");
117 AUnfocusable
= PLMakeString("Unfocusable");
118 AAlwaysUserIcon
= PLMakeString("AlwaysUserIcon");
119 AStartMiniaturized
= PLMakeString("StartMiniaturized");
120 AStartMaximized
= PLMakeString("StartMaximized");
121 AStartHidden
= PLMakeString("StartHidden");
122 ADontSaveSession
= PLMakeString("DontSaveSession");
123 AEmulateAppIcon
= PLMakeString("EmulateAppIcon");
124 AFullMaximize
= PLMakeString("FullMaximize");
126 AStartWorkspace
= PLMakeString("StartWorkspace");
128 AnyWindow
= PLMakeString("*");
129 EmptyString
= PLMakeString("");
130 Yes
= PLMakeString("Yes");
131 No
= PLMakeString("No");
137 freeInspector(InspectorPanel
*panel
)
139 panel
->destroyed
= 1;
140 if (panel
->choosingIcon
)
143 WMDestroyWidget(panel
->win
);
145 XDestroyWindow(dpy
, panel
->parent
);
152 destroyInspector(WCoreWindow
*foo
, void *data
, XEvent
*event
)
154 InspectorPanel
*panel
;
158 while (panel
->frame
!=data
)
159 panel
= panel
->nextPtr
;
161 if (panelList
== panel
)
162 panelList
= panel
->nextPtr
;
165 while (tmp
->nextPtr
!=panel
) {
168 tmp
->nextPtr
= panel
->nextPtr
;
170 panel
->inspected
->flags
.inspector_open
= 0;
171 panel
->inspected
->inspector
= NULL
;
173 WMRemoveNotificationObserver(panel
);
175 wWindowUnmap(panel
->frame
);
176 wUnmanageWindow(panel
->frame
, True
, False
);
178 freeInspector(panel
);
184 wDestroyInspectorPanels()
186 InspectorPanel
*panel
;
188 while (panelList
!= NULL
) {
190 panelList
= panelList
->nextPtr
;
191 wUnmanageWindow(panel
->frame
, False
, False
);
192 WMDestroyWidget(panel
->win
);
194 panel
->inspected
->flags
.inspector_open
= 0;
195 panel
->inspected
->inspector
= NULL
;
203 changePage(WMPopUpButton
*bPtr
, InspectorPanel
*panel
)
207 page
= WMGetPopUpButtonSelectedItem(bPtr
);
210 WMMapWidget(panel
->specFrm
);
211 WMMapWidget(panel
->specLbl
);
212 } else if (page
== 1) {
213 WMMapWidget(panel
->attrFrm
);
214 } else if (page
== 2) {
215 WMMapWidget(panel
->moreFrm
);
216 } else if (page
== 3) {
217 WMMapWidget(panel
->iconFrm
);
218 WMMapWidget(panel
->wsFrm
);
220 WMMapWidget(panel
->appFrm
);
224 WMUnmapWidget(panel
->specFrm
);
225 WMUnmapWidget(panel
->specLbl
);
228 WMUnmapWidget(panel
->attrFrm
);
230 WMUnmapWidget(panel
->moreFrm
);
232 WMUnmapWidget(panel
->iconFrm
);
233 WMUnmapWidget(panel
->wsFrm
);
235 if (page
!= 4 && panel
->appFrm
)
236 WMUnmapWidget(panel
->appFrm
);
240 #define USE_TEXT_FIELD 1
241 #define UPDATE_TEXT_FIELD 2
242 #define REVERT_TO_DEFAULT 4
246 showIconFor(WMScreen
*scrPtr
, InspectorPanel
*panel
,
247 char *wm_instance
, char *wm_class
, int flags
)
249 WMPixmap
*pixmap
= (WMPixmap
*) NULL
;
250 char *file
=NULL
, *path
=NULL
;
253 if ((flags
& USE_TEXT_FIELD
) != 0) {
254 file
= WMGetTextFieldText(panel
->fileText
);
255 if (file
&& file
[0] == 0) {
260 db_icon
= wDefaultGetIconFile(panel
->inspected
->screen_ptr
,
261 wm_instance
, wm_class
, False
);
263 file
= wstrdup(db_icon
);
265 if (db_icon
!=NULL
&& (flags
& REVERT_TO_DEFAULT
)!=0) {
267 file
= wstrdup(db_icon
);
268 flags
|= UPDATE_TEXT_FIELD
;
271 if ((flags
& UPDATE_TEXT_FIELD
) != 0) {
272 WMSetTextFieldText(panel
->fileText
, file
);
276 path
= FindImage(wPreferences
.icon_path
, file
);
281 buf
= wmalloc(strlen(file
)+80);
282 sprintf(buf
, _("Could not find icon \"%s\" specified for this window"),
284 wMessageDialog(panel
->frame
->screen_ptr
, _("Error"), buf
,
285 _("OK"), NULL
, NULL
);
291 pixmap
= WMCreatePixmapFromFile(scrPtr
, path
);
297 buf
= wmalloc(strlen(file
)+80);
298 sprintf(buf
, _("Could not open specified icon \"%s\":%s"),
299 file
, RMessageForError(RErrorCode
));
300 wMessageDialog(panel
->frame
->screen_ptr
, _("Error"), buf
,
301 _("OK"), NULL
, NULL
);
309 WMSetLabelImage(panel
->iconLbl
, pixmap
);
311 WMReleasePixmap(pixmap
);
318 updateIcon(WMButton
*button
, InspectorPanel
*panel
)
320 showIconFor(WMWidgetScreen(button
), panel
, NULL
, NULL
, USE_TEXT_FIELD
);
325 getBool(proplist_t value
)
329 if (!PLIsString(value
)) {
332 if (!(val
= PLGetString(value
))) {
336 if ((val
[1]=='\0' && (val
[0]=='y' || val
[0]=='Y' || val
[0]=='T'
337 || val
[0]=='t' || val
[0]=='1'))
338 || (strcasecmp(val
, "YES")==0 || strcasecmp(val
, "TRUE")==0)) {
341 } else if ((val
[1]=='\0'
342 && (val
[0]=='n' || val
[0]=='N' || val
[0]=='F'
343 || val
[0]=='f' || val
[0]=='0'))
344 || (strcasecmp(val
, "NO")==0 || strcasecmp(val
, "FALSE")==0)) {
348 wwarning(_("can't convert \"%s\" to boolean"), val
);
354 #define UPDATE_DEFAULTS 1
359 * Will insert the attribute = value; pair in window's list,
360 * if it's different from the defaults.
361 * Defaults means either defaults database, or attributes saved
362 * for the default window "*". This is to let one revert options that are
363 * global because they were saved for all windows ("*").
369 insertAttribute(proplist_t dict
, proplist_t window
, proplist_t attr
,
370 proplist_t value
, int *modified
, int flags
)
372 proplist_t def_win
, def_value
=NULL
;
375 if (!(flags
& UPDATE_DEFAULTS
) && dict
) {
376 if ((def_win
= PLGetDictionaryEntry(dict
, AnyWindow
)) != NULL
) {
377 def_value
= PLGetDictionaryEntry(def_win
, attr
);
381 /* If we could not find defaults in database, fall to hardcoded values.
382 * Also this is true if we save defaults for all windows
385 def_value
= ((flags
& IS_BOOLEAN
) != 0) ? No
: EmptyString
;
387 if ((flags
& IS_BOOLEAN
))
388 update
= (getBool(value
) != getBool(def_value
));
390 update
= !PLIsEqual(value
, def_value
);
394 PLInsertDictionaryEntry(window
, attr
, value
);
401 saveSettings(WMButton
*button
, InspectorPanel
*panel
)
403 WWindow
*wwin
= panel
->inspected
;
404 WDDomain
*db
= WDWindowAttributes
;
405 proplist_t dict
= db
->dictionary
;
406 proplist_t winDic
, value
, key
;
407 char buffer
[256], *icon_file
;
411 /* Save will apply the changes and save them */
412 applySettings(panel
->applyBtn
, panel
);
414 if (WMGetButtonSelected(panel
->instRb
) != 0)
415 key
= PLMakeString(wwin
->wm_instance
);
416 else if (WMGetButtonSelected(panel
->clsRb
) != 0)
417 key
= PLMakeString(wwin
->wm_class
);
418 else if (WMGetButtonSelected(panel
->bothRb
) != 0) {
419 strcat(strcat(strcpy(buffer
, wwin
->wm_instance
), "."), wwin
->wm_class
);
420 key
= PLMakeString(buffer
);
422 else if (WMGetButtonSelected(panel
->defaultRb
) != 0) {
423 key
= PLRetain(AnyWindow
);
424 flags
= UPDATE_DEFAULTS
;
433 dict
= PLMakeDictionaryFromEntries(NULL
, NULL
, NULL
);
435 db
->dictionary
= dict
;
436 value
= PLMakeString(db
->path
);
437 PLSetFilename(dict
, value
);
446 if (showIconFor(WMWidgetScreen(button
), panel
, NULL
, NULL
,
450 PLSetStringCmpHook(NULL
);
452 winDic
= PLMakeDictionaryFromEntries(NULL
, NULL
, NULL
);
454 /* Update icon for window */
455 icon_file
= WMGetTextFieldText(panel
->fileText
);
457 if (icon_file
[0] != 0) {
458 value
= PLMakeString(icon_file
);
459 insertAttribute(dict
, winDic
, AIcon
, value
, &different
, flags
);
466 int i
= WMGetPopUpButtonSelectedItem(panel
->wsP
);
470 if (i
>=0 && i
< panel
->frame
->screen_ptr
->workspace_count
) {
471 value
= PLMakeString(panel
->frame
->screen_ptr
->workspaces
[i
]->name
);
472 insertAttribute(dict
, winDic
, AStartWorkspace
, value
, &different
, flags
);
479 value
= (WMGetButtonSelected(panel
->alwChk
)!=0) ? Yes
: No
;
480 insertAttribute(dict
, winDic
, AAlwaysUserIcon
, value
, &different
, flags
);
482 value
= (WMGetButtonSelected(panel
->attrChk
[0])!=0) ? Yes
: No
;
483 insertAttribute(dict
, winDic
, ANoTitlebar
, value
, &different
, flags
);
485 value
= (WMGetButtonSelected(panel
->attrChk
[1])!=0) ? Yes
: No
;
486 insertAttribute(dict
, winDic
, ANoResizebar
, value
, &different
, flags
);
488 value
= (WMGetButtonSelected(panel
->attrChk
[2])!=0) ? Yes
: No
;
489 insertAttribute(dict
, winDic
, ANoCloseButton
, value
, &different
, flags
);
491 value
= (WMGetButtonSelected(panel
->attrChk
[3])!=0) ? Yes
: No
;
492 insertAttribute(dict
, winDic
, ANoMiniaturizeButton
, value
, &different
, flags
);
494 value
= (WMGetButtonSelected(panel
->attrChk
[4])!=0) ? Yes
: No
;
495 insertAttribute(dict
, winDic
, AKeepOnTop
, value
, &different
, flags
);
497 value
= (WMGetButtonSelected(panel
->attrChk
[5])!=0) ? Yes
: No
;
498 insertAttribute(dict
, winDic
, AKeepOnBottom
, value
, &different
, flags
);
500 value
= (WMGetButtonSelected(panel
->attrChk
[6])!=0) ? Yes
: No
;
501 insertAttribute(dict
, winDic
, AOmnipresent
, value
, &different
, flags
);
503 value
= (WMGetButtonSelected(panel
->attrChk
[7])!=0) ? Yes
: No
;
504 insertAttribute(dict
, winDic
, AStartMiniaturized
, value
, &different
, flags
);
506 value
= (WMGetButtonSelected(panel
->attrChk
[8])!=0) ? Yes
: No
;
507 insertAttribute(dict
, winDic
, AStartMaximized
, value
, &different
, flags
);
509 value
= (WMGetButtonSelected(panel
->attrChk
[9])!=0) ? Yes
: No
;
510 insertAttribute(dict
, winDic
, ASkipWindowList
, value
, &different
, flags
);
513 value
= (WMGetButtonSelected(panel
->moreChk
[0])!=0) ? Yes
: No
;
514 insertAttribute(dict
, winDic
, ANoHideOthers
, value
, &different
, flags
);
516 value
= (WMGetButtonSelected(panel
->moreChk
[1])!=0) ? Yes
: No
;
517 insertAttribute(dict
, winDic
, ANoKeyBindings
, value
, &different
, flags
);
519 value
= (WMGetButtonSelected(panel
->moreChk
[2])!=0) ? Yes
: No
;
520 insertAttribute(dict
, winDic
, ANoMouseBindings
, value
, &different
, flags
);
522 value
= (WMGetButtonSelected(panel
->moreChk
[3])!=0) ? Yes
: No
;
523 insertAttribute(dict
, winDic
, AKeepInsideScreen
, value
, &different
, flags
);
525 value
= (WMGetButtonSelected(panel
->moreChk
[4])!=0) ? Yes
: No
;
526 insertAttribute(dict
, winDic
, AUnfocusable
, value
, &different
, flags
);
528 value
= (WMGetButtonSelected(panel
->moreChk
[5])!=0) ? Yes
: No
;
529 insertAttribute(dict
, winDic
, ADontSaveSession
, value
, &different
, flags
);
531 value
= (WMGetButtonSelected(panel
->moreChk
[6])!=0) ? Yes
: No
;
532 insertAttribute(dict
, winDic
, AEmulateAppIcon
, value
, &different
, flags
);
534 value
= (WMGetButtonSelected(panel
->moreChk
[7])!=0) ? Yes
: No
;
535 insertAttribute(dict
, winDic
, AFullMaximize
, value
, &different
, flags
);
537 /* application wide settings for when */
538 /* the window is the leader, save the attribute with the others */
539 if (panel
->inspected
->main_window
== panel
->inspected
->client_win
) {
541 value
= (WMGetButtonSelected(panel
->appChk
[0])!=0) ? Yes
: No
;
542 insertAttribute(dict
, winDic
, AStartHidden
, value
, &different
, flags
);
544 value
= (WMGetButtonSelected(panel
->appChk
[1])!=0) ? Yes
: No
;
545 insertAttribute(dict
, winDic
, ANoAppIcon
, value
, &different
, flags
);
548 PLRemoveDictionaryEntry(dict
, key
);
550 PLInsertDictionaryEntry(dict
, key
, winDic
);
558 /* application wide settings */
559 if (panel
->inspected
->main_window
!= panel
->inspected
->client_win
560 && !(flags
& UPDATE_DEFAULTS
)) {
564 wapp
= wApplicationOf(panel
->inspected
->main_window
);
568 appDic
= PLMakeDictionaryFromEntries(NULL
, NULL
, NULL
);
570 assert(wapp
->main_window_desc
->wm_instance
!=NULL
);
571 assert(wapp
->main_window_desc
->wm_class
!=NULL
);
573 strcat(strcpy(buffer
, wapp
->main_window_desc
->wm_instance
), ".");
574 strcat(buffer
, wwin
->wm_class
);
575 key
= PLMakeString(buffer
);
577 iconFile
= wDefaultGetIconFile(wwin
->screen_ptr
,
578 wapp
->main_window_desc
->wm_instance
,
579 wapp
->main_window_desc
->wm_class
,
582 if (iconFile
&& iconFile
[0]!=0) {
583 value
= PLMakeString(iconFile
);
584 insertAttribute(dict
, appDic
, AIcon
, value
, &different
,
589 value
= (WMGetButtonSelected(panel
->appChk
[0])!=0) ? Yes
: No
;
590 insertAttribute(dict
, appDic
, AStartHidden
, value
, &different
, flags
);
592 value
= (WMGetButtonSelected(panel
->appChk
[1])!=0) ? Yes
: No
;
593 insertAttribute(dict
, appDic
, ANoAppIcon
, value
, &different
, flags
);
595 PLRemoveDictionaryEntry(dict
, key
);
597 PLInsertDictionaryEntry(dict
, key
, appDic
);
607 PLSetStringCmpHook(StringCompareHook
);
612 makeAppIconFor(WApplication
*wapp
)
614 WScreen
*scr
= wapp
->main_window_desc
->screen_ptr
;
619 if (!WFLAGP(wapp
->main_window_desc
, no_appicon
))
620 wapp
->app_icon
= wAppIconCreate(wapp
->main_window_desc
);
622 wapp
->app_icon
= NULL
;
624 if (wapp
->app_icon
) {
625 WIcon
*icon
= wapp
->app_icon
->icon
;
626 WDock
*clip
= scr
->workspaces
[scr
->current_workspace
]->clip
;
629 wapp
->app_icon
->main_window
= wapp
->main_window
;
631 if (clip
&& clip
->attract_icons
&& wDockFindFreeSlot(clip
, &x
, &y
)) {
632 wapp
->app_icon
->attracted
= 1;
633 if (!clip
->keep_attracted
&& !wapp
->app_icon
->icon
->shadowed
) {
634 wapp
->app_icon
->icon
->shadowed
= 1;
635 wapp
->app_icon
->icon
->force_paint
= 1;
637 wDockAttachIcon(clip
, wapp
->app_icon
, x
, y
);
639 PlaceIcon(scr
, &x
, &y
);
640 wAppIconMove(wapp
->app_icon
, x
, y
);
642 if (!clip
|| !wapp
->app_icon
->attracted
|| !clip
->collapsed
)
643 XMapWindow(dpy
, icon
->core
->window
);
645 if (wPreferences
.auto_arrange_icons
&& !wapp
->app_icon
->attracted
)
646 wArrangeIcons(wapp
->main_window_desc
->screen_ptr
, True
);
652 removeAppIconFor(WApplication
*wapp
)
657 if (wapp
->app_icon
->docked
&&
658 (!wapp
->app_icon
->attracted
|| wapp
->app_icon
->dock
->keep_attracted
)) {
659 wapp
->app_icon
->running
= 0;
660 /* since we keep it, we don't care if it was attracted or not */
661 wapp
->app_icon
->attracted
= 0;
662 wapp
->app_icon
->icon
->shadowed
= 0;
663 wapp
->app_icon
->main_window
= None
;
664 wapp
->app_icon
->pid
= 0;
665 wapp
->app_icon
->icon
->owner
= NULL
;
666 wapp
->app_icon
->icon
->icon_win
= None
;
667 wapp
->app_icon
->icon
->force_paint
= 1;
668 wAppIconPaint(wapp
->app_icon
);
669 } else if (wapp
->app_icon
->docked
) {
670 wapp
->app_icon
->running
= 0;
671 wDockDetach(wapp
->app_icon
->dock
, wapp
->app_icon
);
673 wAppIconDestroy(wapp
->app_icon
);
675 wapp
->app_icon
= NULL
;
676 if (wPreferences
.auto_arrange_icons
)
677 wArrangeIcons(wapp
->main_window_desc
->screen_ptr
, True
);
682 applySettings(WMButton
*button
, InspectorPanel
*panel
)
684 WWindow
*wwin
= panel
->inspected
;
685 WApplication
*wapp
= wApplicationOf(wwin
->main_window
);
686 int floating
, sunken
, skip_window_list
;
688 int old_no_bind_keys
;
689 int old_no_bind_mouse
;
691 old_omnipresent
= WFLAGP(wwin
, omnipresent
);
692 old_no_bind_keys
= WFLAGP(wwin
, no_bind_keys
);
693 old_no_bind_mouse
= WFLAGP(wwin
, no_bind_mouse
);
695 showIconFor(WMWidgetScreen(button
), panel
, NULL
, NULL
, USE_TEXT_FIELD
);
697 WSETUFLAG(wwin
, no_titlebar
, WMGetButtonSelected(panel
->attrChk
[0]));
698 WSETUFLAG(wwin
, no_resizebar
, WMGetButtonSelected(panel
->attrChk
[1]));
699 WSETUFLAG(wwin
, no_close_button
, WMGetButtonSelected(panel
->attrChk
[2]));
700 WSETUFLAG(wwin
, no_miniaturize_button
, WMGetButtonSelected(panel
->attrChk
[3]));
701 floating
= WMGetButtonSelected(panel
->attrChk
[4]);
702 sunken
= WMGetButtonSelected(panel
->attrChk
[5]);
703 WSETUFLAG(wwin
, omnipresent
, WMGetButtonSelected(panel
->attrChk
[6]));
704 WSETUFLAG(wwin
, start_miniaturized
, WMGetButtonSelected(panel
->attrChk
[7]));
705 WSETUFLAG(wwin
, start_maximized
, WMGetButtonSelected(panel
->attrChk
[8]));
706 skip_window_list
= WMGetButtonSelected(panel
->attrChk
[9]);
708 WSETUFLAG(wwin
, no_hide_others
, WMGetButtonSelected(panel
->moreChk
[0]));
709 WSETUFLAG(wwin
, no_bind_keys
, WMGetButtonSelected(panel
->moreChk
[1]));
710 WSETUFLAG(wwin
, no_bind_mouse
, WMGetButtonSelected(panel
->moreChk
[2]));
711 WSETUFLAG(wwin
, dont_move_off
, WMGetButtonSelected(panel
->moreChk
[3]));
712 WSETUFLAG(wwin
, no_focusable
, WMGetButtonSelected(panel
->moreChk
[4]));
713 WSETUFLAG(wwin
, dont_save_session
, WMGetButtonSelected(panel
->moreChk
[5]));
714 WSETUFLAG(wwin
, emulate_appicon
, WMGetButtonSelected(panel
->moreChk
[6]));
715 WSETUFLAG(wwin
, full_maximize
, WMGetButtonSelected(panel
->moreChk
[7]));
716 WSETUFLAG(wwin
, always_user_icon
, WMGetButtonSelected(panel
->alwChk
));
718 if (WFLAGP(wwin
, no_titlebar
) && wwin
->flags
.shaded
)
719 wUnshadeWindow(wwin
);
721 WSETUFLAG(wwin
, no_shadeable
, WFLAGP(wwin
, no_titlebar
));
724 if (!WFLAGP(wwin
, floating
))
725 ChangeStackingLevel(wwin
->frame
->core
, WMFloatingLevel
);
727 if (!WFLAGP(wwin
, sunken
))
728 ChangeStackingLevel(wwin
->frame
->core
, WMSunkenLevel
);
730 if (WFLAGP(wwin
, floating
) || WFLAGP(wwin
, sunken
))
731 ChangeStackingLevel(wwin
->frame
->core
, WMNormalLevel
);
734 WSETUFLAG(wwin
, sunken
, sunken
);
735 WSETUFLAG(wwin
, floating
, floating
);
736 wwin
->flags
.omnipresent
= 0;
738 if (WFLAGP(wwin
, skip_window_list
) != skip_window_list
) {
739 WSETUFLAG(wwin
, skip_window_list
, skip_window_list
);
740 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
,
741 skip_window_list
? ACTION_REMOVE
: ACTION_ADD
);
743 if (WFLAGP(wwin
, omnipresent
) != old_omnipresent
) {
744 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_WORKSPACE
);
748 if (WFLAGP(wwin
, no_bind_keys
) != old_no_bind_keys
) {
749 if (WFLAGP(wwin
, no_bind_keys
)) {
750 XUngrabKey(dpy
, AnyKey
, AnyModifier
, wwin
->frame
->core
->window
);
752 wWindowSetKeyGrabs(wwin
);
756 if (WFLAGP(wwin
, no_bind_mouse
) != old_no_bind_mouse
) {
757 wWindowResetMouseGrabs(wwin
);
760 wwin
->frame
->flags
.need_texture_change
= 1;
761 wWindowConfigureBorders(wwin
);
762 wFrameWindowPaint(wwin
->frame
);
765 * Can't apply emulate_appicon because it will probably cause problems.
769 /* do application wide stuff */
770 WSETUFLAG(wapp
->main_window_desc
, start_hidden
,
771 WMGetButtonSelected(panel
->appChk
[0]));
773 WSETUFLAG(wapp
->main_window_desc
, no_appicon
,
774 WMGetButtonSelected(panel
->appChk
[1]));
776 if (WFLAGP(wapp
->main_window_desc
, no_appicon
))
777 removeAppIconFor(wapp
);
779 makeAppIconFor(wapp
);
781 if (wapp
->app_icon
&& wapp
->main_window
== wwin
->client_win
) {
782 char *file
= WMGetTextFieldText(panel
->fileText
);
788 wIconChangeImageFile(wapp
->app_icon
->icon
, file
);
791 wAppIconPaint(wapp
->app_icon
);
800 revertSettings(WMButton
*button
, InspectorPanel
*panel
)
802 WWindow
*wwin
= panel
->inspected
;
803 WApplication
*wapp
= wApplicationOf(wwin
->main_window
);
805 char *wm_instance
= NULL
;
806 char *wm_class
= NULL
;
807 int workspace
, level
;
809 if (WMGetButtonSelected(panel
->instRb
) != 0)
810 wm_instance
= wwin
->wm_instance
;
811 else if (WMGetButtonSelected(panel
->clsRb
) != 0)
812 wm_class
= wwin
->wm_class
;
813 else if (WMGetButtonSelected(panel
->bothRb
) != 0) {
814 wm_instance
= wwin
->wm_instance
;
815 wm_class
= wwin
->wm_class
;
817 memset(&wwin
->defined_user_flags
, 0, sizeof(WWindowAttributes
));
818 memset(&wwin
->user_flags
, 0, sizeof(WWindowAttributes
));
819 memset(&wwin
->client_flags
, 0, sizeof(WWindowAttributes
));
821 wWindowSetupInitialAttributes(wwin
, &level
, &workspace
);
823 for (i
=0; i
< 10; i
++) {
828 flag
= WFLAGP(wwin
, no_titlebar
);
831 flag
= WFLAGP(wwin
, no_resizebar
);
834 flag
= WFLAGP(wwin
, no_close_button
);
837 flag
= WFLAGP(wwin
, no_miniaturize_button
);
840 flag
= WFLAGP(wwin
, floating
);
843 flag
= WFLAGP(wwin
, sunken
);
846 flag
= WFLAGP(wwin
, omnipresent
);
849 flag
= WFLAGP(wwin
, start_miniaturized
);
852 flag
= WFLAGP(wwin
, start_maximized
!=0);
855 flag
= WFLAGP(wwin
, skip_window_list
);
858 WMSetButtonSelected(panel
->attrChk
[i
], flag
);
860 for (i
=0; i
< 8; i
++) {
865 flag
= WFLAGP(wwin
, no_hide_others
);
868 flag
= WFLAGP(wwin
, no_bind_keys
);
871 flag
= WFLAGP(wwin
, no_bind_mouse
);
874 flag
= WFLAGP(wwin
, dont_move_off
);
877 flag
= WFLAGP(wwin
, no_focusable
);
880 flag
= WFLAGP(wwin
, dont_save_session
);
883 flag
= WFLAGP(wwin
, emulate_appicon
);
886 flag
= WFLAGP(wwin
, full_maximize
);
889 WMSetButtonSelected(panel
->moreChk
[i
], flag
);
891 if (panel
->appFrm
&& wapp
) {
892 for (i
=0; i
< 2; i
++) {
897 flag
= WFLAGP(wapp
->main_window_desc
, start_hidden
);
900 flag
= WFLAGP(wapp
->main_window_desc
, no_appicon
);
903 WMSetButtonSelected(panel
->appChk
[i
], flag
);
906 WMSetButtonSelected(panel
->alwChk
, WFLAGP(wwin
, always_user_icon
));
908 showIconFor(WMWidgetScreen(panel
->alwChk
), panel
, wm_instance
, wm_class
,
911 n
= wDefaultGetStartWorkspace(wwin
->screen_ptr
, wm_instance
, wm_class
);
913 if (n
>= 0 && n
< wwin
->screen_ptr
->workspace_count
) {
914 WMSetPopUpButtonSelectedItem(panel
->wsP
, n
+1);
916 WMSetPopUpButtonSelectedItem(panel
->wsP
, 0);
922 chooseIconCallback(WMWidget
*self
, void *clientData
)
925 InspectorPanel
*panel
= (InspectorPanel
*)clientData
;
928 panel
->choosingIcon
= 1;
930 WMSetButtonEnabled(panel
->browseIconBtn
, False
);
932 result
= wIconChooserDialog(panel
->frame
->screen_ptr
, &file
,
933 panel
->inspected
->wm_instance
,
934 panel
->inspected
->wm_class
);
936 panel
->choosingIcon
= 0;
938 if (!panel
->destroyed
) { /* kluge */
940 WMSetTextFieldText(panel
->fileText
, file
);
941 showIconFor(WMWidgetScreen(self
), panel
, NULL
, NULL
,
945 WMSetButtonEnabled(panel
->browseIconBtn
, True
);
947 freeInspector(panel
);
953 textEditedObserver(void *observerData
, WMNotification
*notification
)
955 InspectorPanel
*panel
= (InspectorPanel
*)observerData
;
957 if ((long)WMGetNotificationClientData(notification
) != WMReturnTextMovement
)
960 showIconFor(WMWidgetScreen(panel
->win
), panel
, NULL
, NULL
,
963 WMPerformButtonClick(panel->updateIconBtn);
969 selectSpecification(WMWidget
*bPtr
, void *data
)
971 InspectorPanel
*panel
= (InspectorPanel
*)data
;
973 if (bPtr
== panel
->defaultRb
) {
974 WMSetButtonEnabled(panel
->applyBtn
, False
);
976 WMSetButtonEnabled(panel
->applyBtn
, True
);
981 static InspectorPanel
*
982 createInspectorForWindow(WWindow
*wwin
)
984 WScreen
*scr
= wwin
->screen_ptr
;
985 InspectorPanel
*panel
;
990 int btn_width
, frame_width
;
991 #ifdef wrong_behaviour
994 panel
= wmalloc(sizeof(InspectorPanel
));
995 memset(panel
, 0, sizeof(InspectorPanel
));
997 panel
->destroyed
= 0;
1000 panel
->inspected
= wwin
;
1002 panel
->nextPtr
= panelList
;
1006 sprintf(charbuf
, "Inspecting %s.%s",
1007 wwin
->wm_instance
? wwin
->wm_instance
: "?",
1008 wwin
->wm_class
? wwin
->wm_class
: "?");
1010 panel
->win
= WMCreateWindow(scr
->wmscreen
, "windowInspector");
1011 WMResizeWidget(panel
->win
, PWIDTH
, PHEIGHT
);
1014 /**** create common stuff ****/
1016 /* command buttons */
1017 /* (PWIDTH - (left and right margin) - (btn interval)) / 3 */
1018 btn_width
= (PWIDTH
- (2 * 15) - (2 * 10)) / 3;
1019 panel
->saveBtn
= WMCreateCommandButton(panel
->win
);
1020 WMSetButtonAction(panel
->saveBtn
, (WMAction
*)saveSettings
, panel
);
1021 WMMoveWidget(panel
->saveBtn
, (2 * (btn_width
+ 10)) + 15, 310);
1022 WMSetButtonText(panel
->saveBtn
, _("Save"));
1023 WMResizeWidget(panel
->saveBtn
, btn_width
, 28);
1024 if (wPreferences
.flags
.noupdates
|| !(wwin
->wm_class
|| wwin
->wm_instance
))
1025 WMSetButtonEnabled(panel
->saveBtn
, False
);
1027 panel
->applyBtn
= WMCreateCommandButton(panel
->win
);
1028 WMSetButtonAction(panel
->applyBtn
, (WMAction
*)applySettings
, panel
);
1029 WMMoveWidget(panel
->applyBtn
, btn_width
+ 10 + 15, 310);
1030 WMSetButtonText(panel
->applyBtn
, _("Apply"));
1031 WMResizeWidget(panel
->applyBtn
, btn_width
, 28);
1033 panel
->revertBtn
= WMCreateCommandButton(panel
->win
);
1034 WMSetButtonAction(panel
->revertBtn
, (WMAction
*)revertSettings
, panel
);
1035 WMMoveWidget(panel
->revertBtn
, 15, 310);
1036 WMSetButtonText(panel
->revertBtn
, _("Reload"));
1037 WMResizeWidget(panel
->revertBtn
, btn_width
, 28);
1039 /* page selection popup button */
1040 panel
->pagePopUp
= WMCreatePopUpButton(panel
->win
);
1041 WMSetPopUpButtonAction(panel
->pagePopUp
, (WMAction
*)changePage
, panel
);
1042 WMMoveWidget(panel
->pagePopUp
, 25, 15);
1043 WMResizeWidget(panel
->pagePopUp
, PWIDTH
- 50, 20);
1045 WMAddPopUpButtonItem(panel
->pagePopUp
, _("Window Specification"));
1046 WMAddPopUpButtonItem(panel
->pagePopUp
, _("Window Attributes"));
1047 WMAddPopUpButtonItem(panel
->pagePopUp
, _("Advanced Options"));
1048 WMAddPopUpButtonItem(panel
->pagePopUp
, _("Icon and Initial Workspace"));
1049 WMAddPopUpButtonItem(panel
->pagePopUp
, _("Application Specific"));
1051 /**** window spec ****/
1052 frame_width
= PWIDTH
- (2 * 15);
1054 panel
->specFrm
= WMCreateFrame(panel
->win
);
1055 WMSetFrameTitle(panel
->specFrm
, _("Window Specification"));
1056 WMMoveWidget(panel
->specFrm
, 15, 65);
1057 WMResizeWidget(panel
->specFrm
, frame_width
, 105);
1060 panel
->defaultRb
= WMCreateRadioButton(panel
->specFrm
);
1061 WMMoveWidget(panel
->defaultRb
, 10, 78);
1062 WMResizeWidget(panel
->defaultRb
, frame_width
- (2 * 10), 20);
1063 WMSetButtonText(panel
->defaultRb
, _("Defaults for all windows"));
1064 WMSetButtonSelected(panel
->defaultRb
, False
);
1065 WMSetButtonAction(panel
->defaultRb
, selectSpecification
, panel
);
1068 if (wwin
->wm_class
&& wwin
->wm_instance
) {
1069 sprintf(charbuf
, "%s.%s", wwin
->wm_instance
, wwin
->wm_class
);
1070 panel
->bothRb
= WMCreateRadioButton(panel
->specFrm
);
1071 WMMoveWidget(panel
->bothRb
, 10, 18);
1072 WMResizeWidget(panel
->bothRb
, frame_width
- (2 * 10), 20);
1073 WMSetButtonText(panel
->bothRb
, charbuf
);
1074 WMSetButtonSelected(panel
->bothRb
, True
);
1075 WMGroupButtons(panel
->defaultRb
, panel
->bothRb
);
1077 WMSetButtonAction(panel
->bothRb
, selectSpecification
, panel
);
1080 if (wwin
->wm_instance
) {
1081 panel
->instRb
= WMCreateRadioButton(panel
->specFrm
);
1082 WMMoveWidget(panel
->instRb
, 10, 38);
1083 WMResizeWidget(panel
->instRb
, frame_width
- (2 * 10), 20);
1084 WMSetButtonText(panel
->instRb
, wwin
->wm_instance
);
1085 WMSetButtonSelected(panel
->instRb
, False
);
1086 WMGroupButtons(panel
->defaultRb
, panel
->instRb
);
1088 WMSetButtonAction(panel
->instRb
, selectSpecification
, panel
);
1091 if (wwin
->wm_class
) {
1092 panel
->clsRb
= WMCreateRadioButton(panel
->specFrm
);
1093 WMMoveWidget(panel
->clsRb
, 10, 58);
1094 WMResizeWidget(panel
->clsRb
, frame_width
- (2 * 10), 20);
1095 WMSetButtonText(panel
->clsRb
, wwin
->wm_class
);
1096 WMSetButtonSelected(panel
->clsRb
, False
);
1097 WMGroupButtons(panel
->defaultRb
, panel
->clsRb
);
1099 WMSetButtonAction(panel
->clsRb
, selectSpecification
, panel
);
1102 panel
->specLbl
= WMCreateLabel(panel
->win
);
1103 WMMoveWidget(panel
->specLbl
, 15, 170);
1104 WMResizeWidget(panel
->specLbl
, frame_width
, 100);
1105 WMSetLabelText(panel
->specLbl
,
1106 _("The configuration will apply to all\n"
1107 "windows that have their WM_CLASS property"
1108 " set to the above selected\nname, when saved."));
1109 WMSetLabelTextAlignment(panel
->specLbl
, WACenter
);
1111 /**** attributes ****/
1112 panel
->attrFrm
= WMCreateFrame(panel
->win
);
1113 WMSetFrameTitle(panel
->attrFrm
, _("Attributes"));
1114 WMMoveWidget(panel
->attrFrm
, 15, 45);
1115 WMResizeWidget(panel
->attrFrm
, frame_width
, 250);
1117 for (i
=0; i
< 10; i
++) {
1118 char *caption
= NULL
;
1123 caption
= _("Disable Titlebar");
1124 flag
= WFLAGP(wwin
, no_titlebar
);
1127 caption
= _("Disable Resizebar");
1128 flag
= WFLAGP(wwin
, no_resizebar
);
1131 caption
= _("Disable Close Button");
1132 flag
= WFLAGP(wwin
, no_close_button
);
1135 caption
= _("Disable Miniaturize Button");
1136 flag
= WFLAGP(wwin
, no_miniaturize_button
);
1139 caption
= _("Keep on Top / Floating");
1140 flag
= WFLAGP(wwin
, floating
);
1143 caption
= _("Keep at Bottom / Sunken");
1144 flag
= WFLAGP(wwin
, sunken
);
1147 caption
= _("Omnipresent");
1148 flag
= WFLAGP(wwin
, omnipresent
);
1151 caption
= _("Start Miniaturized");
1152 flag
= WFLAGP(wwin
, start_miniaturized
);
1155 caption
= _("Start Maximized");
1156 flag
= WFLAGP(wwin
, start_maximized
!=0);
1159 caption
= _("Skip Window List");
1160 flag
= WFLAGP(wwin
, skip_window_list
);
1163 panel
->attrChk
[i
] = WMCreateSwitchButton(panel
->attrFrm
);
1164 WMMoveWidget(panel
->attrChk
[i
], 10, 20*(i
+1));
1165 WMResizeWidget(panel
->attrChk
[i
], frame_width
-15, 20);
1166 WMSetButtonSelected(panel
->attrChk
[i
], flag
);
1167 WMSetButtonText(panel
->attrChk
[i
], caption
);
1171 /**** more attributes ****/
1172 panel
->moreFrm
= WMCreateFrame(panel
->win
);
1173 WMSetFrameTitle(panel
->moreFrm
, _("Advanced"));
1174 WMMoveWidget(panel
->moreFrm
, 15, 45);
1175 WMResizeWidget(panel
->moreFrm
, frame_width
, 250);
1177 for (i
=0; i
< 8; i
++) {
1178 char *caption
= NULL
;
1183 caption
= _("Ignore HideOthers");
1184 flag
= WFLAGP(wwin
, no_hide_others
);
1187 caption
= _("Don't Bind Keyboard Shortcuts");
1188 flag
= WFLAGP(wwin
, no_bind_keys
);
1191 caption
= _("Don't Bind Mouse Clicks");
1192 flag
= WFLAGP(wwin
, no_bind_mouse
);
1195 caption
= _("Keep Inside Screen");
1196 flag
= WFLAGP(wwin
, dont_move_off
);
1199 caption
= _("Don't Let It Take Focus");
1200 flag
= WFLAGP(wwin
, no_focusable
);
1203 caption
= _("Don't Save Session");
1204 flag
= WFLAGP(wwin
, dont_save_session
);
1207 caption
= _("Emulate Application Icon");
1208 flag
= WFLAGP(wwin
, emulate_appicon
);
1211 caption
= _("Full Screen Maximization");
1212 flag
= WFLAGP(wwin
, full_maximize
);
1215 panel
->moreChk
[i
] = WMCreateSwitchButton(panel
->moreFrm
);
1216 WMMoveWidget(panel
->moreChk
[i
], 10, 20*(i
+1));
1217 WMResizeWidget(panel
->moreChk
[i
], frame_width
-15, 20);
1218 WMSetButtonSelected(panel
->moreChk
[i
], flag
);
1219 WMSetButtonText(panel
->moreChk
[i
], caption
);
1222 panel
->moreLbl
= WMCreateLabel(panel
->moreFrm
);
1223 WMResizeWidget(panel
->moreLbl
, frame_width
- (2 * 5), 60);
1224 WMMoveWidget(panel
->moreLbl
, 5, 180);
1225 WMSetLabelText(panel
->moreLbl
,
1226 _("Enable the \"Don't bind...\" options to allow the "
1227 "application to receive all mouse or keyboard events."));
1229 /* miniwindow/workspace */
1230 panel
->iconFrm
= WMCreateFrame(panel
->win
);
1231 WMMoveWidget(panel
->iconFrm
, 15, 50);
1232 WMResizeWidget(panel
->iconFrm
, PWIDTH
- (2 * 15), 170);
1233 WMSetFrameTitle(panel
->iconFrm
, _("Miniwindow Image"));
1235 panel
->iconLbl
= WMCreateLabel(panel
->iconFrm
);
1236 WMMoveWidget(panel
->iconLbl
, PWIDTH
- (2 * 15) - 22 - 64, 30);
1237 WMResizeWidget(panel
->iconLbl
, 64, 64);
1238 WMSetLabelRelief(panel
->iconLbl
, WRGroove
);
1239 WMSetLabelImagePosition(panel
->iconLbl
, WIPImageOnly
);
1241 panel
->browseIconBtn
= WMCreateCommandButton(panel
->iconFrm
);
1242 WMSetButtonAction(panel
->browseIconBtn
, chooseIconCallback
, panel
);
1243 WMMoveWidget(panel
->browseIconBtn
, 22, 30);
1244 WMResizeWidget(panel
->browseIconBtn
, 100, 26);
1245 WMSetButtonText(panel
->browseIconBtn
, _("Browse..."));
1248 panel
->updateIconBtn
= WMCreateCommandButton(panel
->iconFrm
);
1249 WMSetButtonAction(panel
->updateIconBtn
, (WMAction
*)updateIcon
, panel
);
1250 WMMoveWidget(panel
->updateIconBtn
, 22, 65);
1251 WMResizeWidget(panel
->updateIconBtn
, 100, 26);
1252 WMSetButtonText(panel
->updateIconBtn
, _("Update"));
1254 #ifdef wrong_behaviour
1255 WMSetButtonImagePosition(panel
->updateIconBtn
, WIPRight
);
1256 pixmap
= WMGetSystemPixmap(scr
->wmscreen
, WSIReturnArrow
);
1257 WMSetButtonImage(panel
->updateIconBtn
, pixmap
);
1258 WMReleasePixmap(pixmap
);
1259 pixmap
= WMGetSystemPixmap(scr
->wmscreen
, WSIHighlightedReturnArrow
);
1260 WMSetButtonAltImage(panel
->updateIconBtn
, pixmap
);
1261 WMReleasePixmap(pixmap
);
1264 panel
->fileLbl
= WMCreateLabel(panel
->iconFrm
);
1265 WMMoveWidget(panel
->fileLbl
, 20, 95);
1266 WMResizeWidget(panel
->fileLbl
, PWIDTH
- (2 * 15) - (2 * 20), 14);
1267 WMSetLabelText(panel
->fileLbl
, _("Icon File Name:"));
1269 panel
->fileText
= WMCreateTextField(panel
->iconFrm
);
1270 WMMoveWidget(panel
->fileText
, 20, 115);
1271 WMResizeWidget(panel
->fileText
, PWIDTH
- (2 * 15) - (2 * 15), 20);
1272 WMSetTextFieldText(panel
->fileText
, NULL
);
1273 WMAddNotificationObserver(textEditedObserver
, panel
,
1274 WMTextDidEndEditingNotification
,
1276 panel
->alwChk
= WMCreateSwitchButton(panel
->iconFrm
);
1277 WMMoveWidget(panel
->alwChk
, 20, 140);
1278 WMResizeWidget(panel
->alwChk
, PWIDTH
- (2 * 15) - (2 * 15), 20);
1279 WMSetButtonText(panel
->alwChk
, _("Ignore client supplied icon"));
1280 WMSetButtonSelected(panel
->alwChk
, WFLAGP(wwin
, always_user_icon
));
1283 panel
->wsFrm
= WMCreateFrame(panel
->win
);
1284 WMMoveWidget(panel
->wsFrm
, 15, 225);
1285 WMResizeWidget(panel
->wsFrm
, PWIDTH
- (2 * 15), 70);
1286 WMSetFrameTitle(panel
->wsFrm
, _("Initial Workspace"));
1288 panel
->wsP
= WMCreatePopUpButton(panel
->wsFrm
);
1289 WMMoveWidget(panel
->wsP
, 20, 30);
1290 WMResizeWidget(panel
->wsP
, PWIDTH
- (2 * 15) - (2 * 20), 20);
1291 WMAddPopUpButtonItem(panel
->wsP
, _("Nowhere in particular"));
1292 for (i
= 0; i
< wwin
->screen_ptr
->workspace_count
; i
++) {
1293 WMAddPopUpButtonItem(panel
->wsP
, scr
->workspaces
[i
]->name
);
1296 i
= wDefaultGetStartWorkspace(wwin
->screen_ptr
, wwin
->wm_instance
,
1298 if (i
>= 0 && i
<= wwin
->screen_ptr
->workspace_count
) {
1299 WMSetPopUpButtonSelectedItem(panel
->wsP
, i
+ 1);
1301 WMSetPopUpButtonSelectedItem(panel
->wsP
, 0);
1304 /* application wide attributes */
1305 if (wwin
->main_window
!= None
) {
1306 WApplication
*wapp
= wApplicationOf(wwin
->main_window
);
1308 panel
->appFrm
= WMCreateFrame(panel
->win
);
1309 WMSetFrameTitle(panel
->appFrm
, _("Application Wide"));
1310 WMMoveWidget(panel
->appFrm
, 15, 50);
1311 WMResizeWidget(panel
->appFrm
, frame_width
, 240);
1313 for (i
=0; i
< 2; i
++) {
1314 char *caption
= NULL
;
1319 caption
= _("Start Hidden");
1320 flag
= WFLAGP(wapp
->main_window_desc
, start_hidden
);
1323 caption
= _("No Application Icon");
1324 flag
= WFLAGP(wapp
->main_window_desc
, no_appicon
);
1327 panel
->appChk
[i
] = WMCreateSwitchButton(panel
->appFrm
);
1328 WMMoveWidget(panel
->appChk
[i
], 10, 20*(i
+1));
1329 WMResizeWidget(panel
->appChk
[i
], 205, 20);
1330 WMSetButtonSelected(panel
->appChk
[i
], flag
);
1331 WMSetButtonText(panel
->appChk
[i
], caption
);
1334 if (WFLAGP(wwin
, emulate_appicon
)) {
1335 WMSetButtonEnabled(panel
->appChk
[1], False
);
1336 WMSetButtonEnabled(panel
->moreChk
[6], True
);
1338 WMSetButtonEnabled(panel
->appChk
[1], True
);
1339 WMSetButtonEnabled(panel
->moreChk
[6], False
);
1344 if ((wwin
->transient_for
!=None
&& wwin
->transient_for
!=scr
->root_win
)
1345 || !wwin
->wm_class
|| !wwin
->wm_instance
)
1349 WMSetButtonEnabled(panel
->moreChk
[6], tmp
);
1351 WMSetPopUpButtonItemEnabled(panel
->pagePopUp
, 4, False
);
1352 panel
->appFrm
= NULL
;
1355 /* if the window is a transient, don't let it have a miniaturize
1357 if (wWindowFor(wwin
->transient_for
)!=NULL
)
1358 WMSetButtonEnabled(panel
->attrChk
[3], False
);
1360 WMSetButtonEnabled(panel
->attrChk
[3], True
);
1363 if (!wwin
->wm_class
&& !wwin
->wm_instance
) {
1364 WMSetPopUpButtonItemEnabled(panel
->pagePopUp
, 0, False
);
1368 WMRealizeWidget(panel
->win
);
1370 WMMapSubwidgets(panel
->win
);
1371 WMMapSubwidgets(panel
->specFrm
);
1372 WMMapSubwidgets(panel
->attrFrm
);
1373 WMMapSubwidgets(panel
->moreFrm
);
1374 WMMapSubwidgets(panel
->iconFrm
);
1375 WMMapSubwidgets(panel
->wsFrm
);
1377 WMMapSubwidgets(panel
->appFrm
);
1379 WMSetPopUpButtonSelectedItem(panel
->pagePopUp
, 1);
1380 changePage(panel
->pagePopUp
, panel
);
1383 parent
= XCreateSimpleWindow(dpy
, scr
->root_win
, 0, 0, PWIDTH
, PHEIGHT
,
1385 XSelectInput(dpy
, parent
, KeyPressMask
|KeyReleaseMask
);
1386 panel
->parent
= parent
;
1387 XReparentWindow(dpy
, WMWidgetXID(panel
->win
), parent
, 0, 0);
1389 WMMapWidget(panel
->win
);
1391 XSetTransientForHint(dpy
, parent
, wwin
->client_win
);
1393 x
= wwin
->frame_x
+wwin
->frame
->core
->width
/2;
1394 y
= wwin
->frame_y
+wwin
->frame
->top_width
*2;
1395 if (y
+ PHEIGHT
> scr
->scr_height
)
1396 y
= scr
->scr_height
- PHEIGHT
- 30;
1397 if (x
+ PWIDTH
> scr
->scr_width
)
1398 x
= scr
->scr_width
- PWIDTH
;
1399 panel
->frame
= wManageInternalWindow(scr
, parent
, wwin
->client_win
,
1400 charbuf
, x
, y
, PWIDTH
, PHEIGHT
);
1402 /* kluge to know who should get the key events */
1403 panel
->frame
->client_leader
= WMWidgetXID(panel
->win
);
1405 WSETUFLAG(panel
->frame
, no_closable
, 0);
1406 WSETUFLAG(panel
->frame
, no_close_button
, 0);
1407 wWindowUpdateButtonImages(panel
->frame
);
1408 wFrameWindowShowButton(panel
->frame
->frame
, WFF_RIGHT_BUTTON
);
1409 panel
->frame
->frame
->on_click_right
= destroyInspector
;
1411 wWindowMap(panel
->frame
);
1413 showIconFor(WMWidgetScreen(panel
->alwChk
), panel
, wwin
->wm_instance
,
1414 wwin
->wm_class
, UPDATE_TEXT_FIELD
);
1421 wShowInspectorForWindow(WWindow
*wwin
)
1423 if (wwin
->flags
.inspector_open
)
1427 wwin
->flags
.inspector_open
= 1;
1428 wwin
->inspector
= createInspectorForWindow(wwin
);;