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
);
464 if (WMGetButtonSelected(panel
->curRb
) != 0) {
465 value
= PLMakeString("");
466 insertAttribute(dict
, winDic
, AStartWorkspace
, value
, &different
, flags
);
468 } else if (WMGetButtonSelected(panel
->setRb
) != 0) {
469 char *ws_name
= WMGetTextFieldText(panel
->wsText
);
471 if (ws_name
[0] != 0) {
472 value
= PLMakeString(ws_name
);
473 insertAttribute(dict
, winDic
, AStartWorkspace
, value
, &different
, flags
);
482 value
= (WMGetButtonSelected(panel
->alwChk
)!=0) ? Yes
: No
;
483 insertAttribute(dict
, winDic
, AAlwaysUserIcon
, value
, &different
, flags
);
485 value
= (WMGetButtonSelected(panel
->attrChk
[0])!=0) ? Yes
: No
;
486 insertAttribute(dict
, winDic
, ANoTitlebar
, value
, &different
, flags
);
488 value
= (WMGetButtonSelected(panel
->attrChk
[1])!=0) ? Yes
: No
;
489 insertAttribute(dict
, winDic
, ANoResizebar
, value
, &different
, flags
);
491 value
= (WMGetButtonSelected(panel
->attrChk
[2])!=0) ? Yes
: No
;
492 insertAttribute(dict
, winDic
, ANoCloseButton
, value
, &different
, flags
);
494 value
= (WMGetButtonSelected(panel
->attrChk
[3])!=0) ? Yes
: No
;
495 insertAttribute(dict
, winDic
, ANoMiniaturizeButton
, value
, &different
, flags
);
497 value
= (WMGetButtonSelected(panel
->attrChk
[4])!=0) ? Yes
: No
;
498 insertAttribute(dict
, winDic
, AKeepOnTop
, value
, &different
, flags
);
500 value
= (WMGetButtonSelected(panel
->attrChk
[5])!=0) ? Yes
: No
;
501 insertAttribute(dict
, winDic
, AKeepOnBottom
, value
, &different
, flags
);
503 value
= (WMGetButtonSelected(panel
->attrChk
[6])!=0) ? Yes
: No
;
504 insertAttribute(dict
, winDic
, AOmnipresent
, value
, &different
, flags
);
506 value
= (WMGetButtonSelected(panel
->attrChk
[7])!=0) ? Yes
: No
;
507 insertAttribute(dict
, winDic
, AStartMiniaturized
, value
, &different
, flags
);
509 value
= (WMGetButtonSelected(panel
->attrChk
[8])!=0) ? Yes
: No
;
510 insertAttribute(dict
, winDic
, AStartMaximized
, value
, &different
, flags
);
512 value
= (WMGetButtonSelected(panel
->attrChk
[9])!=0) ? Yes
: No
;
513 insertAttribute(dict
, winDic
, ASkipWindowList
, value
, &different
, flags
);
516 value
= (WMGetButtonSelected(panel
->moreChk
[0])!=0) ? Yes
: No
;
517 insertAttribute(dict
, winDic
, ANoHideOthers
, value
, &different
, flags
);
519 value
= (WMGetButtonSelected(panel
->moreChk
[1])!=0) ? Yes
: No
;
520 insertAttribute(dict
, winDic
, ANoKeyBindings
, value
, &different
, flags
);
522 value
= (WMGetButtonSelected(panel
->moreChk
[2])!=0) ? Yes
: No
;
523 insertAttribute(dict
, winDic
, ANoMouseBindings
, value
, &different
, flags
);
525 value
= (WMGetButtonSelected(panel
->moreChk
[3])!=0) ? Yes
: No
;
526 insertAttribute(dict
, winDic
, AKeepInsideScreen
, value
, &different
, flags
);
528 value
= (WMGetButtonSelected(panel
->moreChk
[4])!=0) ? Yes
: No
;
529 insertAttribute(dict
, winDic
, AUnfocusable
, value
, &different
, flags
);
531 value
= (WMGetButtonSelected(panel
->moreChk
[5])!=0) ? Yes
: No
;
532 insertAttribute(dict
, winDic
, ADontSaveSession
, value
, &different
, flags
);
534 value
= (WMGetButtonSelected(panel
->moreChk
[6])!=0) ? Yes
: No
;
535 insertAttribute(dict
, winDic
, AEmulateAppIcon
, value
, &different
, flags
);
537 value
= (WMGetButtonSelected(panel
->moreChk
[7])!=0) ? Yes
: No
;
538 insertAttribute(dict
, winDic
, AFullMaximize
, value
, &different
, flags
);
540 /* application wide settings for when */
541 /* the window is the leader, save the attribute with the others */
542 if (panel
->inspected
->main_window
== panel
->inspected
->client_win
) {
544 value
= (WMGetButtonSelected(panel
->appChk
[0])!=0) ? Yes
: No
;
545 insertAttribute(dict
, winDic
, AStartHidden
, value
, &different
, flags
);
547 value
= (WMGetButtonSelected(panel
->appChk
[1])!=0) ? Yes
: No
;
548 insertAttribute(dict
, winDic
, ANoAppIcon
, value
, &different
, flags
);
551 PLRemoveDictionaryEntry(dict
, key
);
553 PLInsertDictionaryEntry(dict
, key
, winDic
);
561 /* application wide settings */
562 if (panel
->inspected
->main_window
!= panel
->inspected
->client_win
563 && !(flags
& UPDATE_DEFAULTS
)) {
567 wapp
= wApplicationOf(panel
->inspected
->main_window
);
571 appDic
= PLMakeDictionaryFromEntries(NULL
, NULL
, NULL
);
573 assert(wapp
->main_window_desc
->wm_instance
!=NULL
);
574 assert(wapp
->main_window_desc
->wm_class
!=NULL
);
576 strcat(strcpy(buffer
, wapp
->main_window_desc
->wm_instance
), ".");
577 strcat(buffer
, wwin
->wm_class
);
578 key
= PLMakeString(buffer
);
580 iconFile
= wDefaultGetIconFile(wwin
->screen_ptr
,
581 wapp
->main_window_desc
->wm_instance
,
582 wapp
->main_window_desc
->wm_class
,
585 if (iconFile
&& iconFile
[0]!=0) {
586 value
= PLMakeString(iconFile
);
587 insertAttribute(dict
, appDic
, AIcon
, value
, &different
,
592 value
= (WMGetButtonSelected(panel
->appChk
[0])!=0) ? Yes
: No
;
593 insertAttribute(dict
, appDic
, AStartHidden
, value
, &different
, flags
);
595 value
= (WMGetButtonSelected(panel
->appChk
[1])!=0) ? Yes
: No
;
596 insertAttribute(dict
, appDic
, ANoAppIcon
, value
, &different
, flags
);
598 PLRemoveDictionaryEntry(dict
, key
);
600 PLInsertDictionaryEntry(dict
, key
, appDic
);
610 PLSetStringCmpHook(StringCompareHook
);
615 makeAppIconFor(WApplication
*wapp
)
617 WScreen
*scr
= wapp
->main_window_desc
->screen_ptr
;
622 if (!WFLAGP(wapp
->main_window_desc
, no_appicon
))
623 wapp
->app_icon
= wAppIconCreate(wapp
->main_window_desc
);
625 wapp
->app_icon
= NULL
;
627 if (wapp
->app_icon
) {
628 WIcon
*icon
= wapp
->app_icon
->icon
;
629 WDock
*clip
= scr
->workspaces
[scr
->current_workspace
]->clip
;
632 wapp
->app_icon
->main_window
= wapp
->main_window
;
634 if (clip
&& clip
->attract_icons
&& wDockFindFreeSlot(clip
, &x
, &y
)) {
635 wapp
->app_icon
->attracted
= 1;
636 if (!clip
->keep_attracted
&& !wapp
->app_icon
->icon
->shadowed
) {
637 wapp
->app_icon
->icon
->shadowed
= 1;
638 wapp
->app_icon
->icon
->force_paint
= 1;
640 wDockAttachIcon(clip
, wapp
->app_icon
, x
, y
);
642 PlaceIcon(scr
, &x
, &y
);
643 wAppIconMove(wapp
->app_icon
, x
, y
);
645 if (!clip
|| !wapp
->app_icon
->attracted
|| !clip
->collapsed
)
646 XMapWindow(dpy
, icon
->core
->window
);
648 if (wPreferences
.auto_arrange_icons
&& !wapp
->app_icon
->attracted
)
649 wArrangeIcons(wapp
->main_window_desc
->screen_ptr
, True
);
655 removeAppIconFor(WApplication
*wapp
)
660 if (wapp
->app_icon
->docked
&&
661 (!wapp
->app_icon
->attracted
|| wapp
->app_icon
->dock
->keep_attracted
)) {
662 wapp
->app_icon
->running
= 0;
663 /* since we keep it, we don't care if it was attracted or not */
664 wapp
->app_icon
->attracted
= 0;
665 wapp
->app_icon
->icon
->shadowed
= 0;
666 wapp
->app_icon
->main_window
= None
;
667 wapp
->app_icon
->pid
= 0;
668 wapp
->app_icon
->icon
->owner
= NULL
;
669 wapp
->app_icon
->icon
->icon_win
= None
;
670 wapp
->app_icon
->icon
->force_paint
= 1;
671 wAppIconPaint(wapp
->app_icon
);
672 } else if (wapp
->app_icon
->docked
) {
673 wapp
->app_icon
->running
= 0;
674 wDockDetach(wapp
->app_icon
->dock
, wapp
->app_icon
);
676 wAppIconDestroy(wapp
->app_icon
);
678 wapp
->app_icon
= NULL
;
679 if (wPreferences
.auto_arrange_icons
)
680 wArrangeIcons(wapp
->main_window_desc
->screen_ptr
, True
);
685 applySettings(WMButton
*button
, InspectorPanel
*panel
)
687 WWindow
*wwin
= panel
->inspected
;
688 WApplication
*wapp
= wApplicationOf(wwin
->main_window
);
689 int floating
, sunken
, skip_window_list
;
691 int old_no_bind_keys
;
692 int old_no_bind_mouse
;
694 old_omnipresent
= WFLAGP(wwin
, omnipresent
);
695 old_no_bind_keys
= WFLAGP(wwin
, no_bind_keys
);
696 old_no_bind_mouse
= WFLAGP(wwin
, no_bind_mouse
);
698 showIconFor(WMWidgetScreen(button
), panel
, NULL
, NULL
, USE_TEXT_FIELD
);
700 WSETUFLAG(wwin
, no_titlebar
, WMGetButtonSelected(panel
->attrChk
[0]));
701 WSETUFLAG(wwin
, no_resizebar
, WMGetButtonSelected(panel
->attrChk
[1]));
702 WSETUFLAG(wwin
, no_close_button
, WMGetButtonSelected(panel
->attrChk
[2]));
703 WSETUFLAG(wwin
, no_miniaturize_button
, WMGetButtonSelected(panel
->attrChk
[3]));
704 floating
= WMGetButtonSelected(panel
->attrChk
[4]);
705 sunken
= WMGetButtonSelected(panel
->attrChk
[5]);
706 WSETUFLAG(wwin
, omnipresent
, WMGetButtonSelected(panel
->attrChk
[6]));
707 WSETUFLAG(wwin
, start_miniaturized
, WMGetButtonSelected(panel
->attrChk
[7]));
708 WSETUFLAG(wwin
, start_maximized
, WMGetButtonSelected(panel
->attrChk
[8]));
709 skip_window_list
= WMGetButtonSelected(panel
->attrChk
[9]);
711 WSETUFLAG(wwin
, no_hide_others
, WMGetButtonSelected(panel
->moreChk
[0]));
712 WSETUFLAG(wwin
, no_bind_keys
, WMGetButtonSelected(panel
->moreChk
[1]));
713 WSETUFLAG(wwin
, no_bind_mouse
, WMGetButtonSelected(panel
->moreChk
[2]));
714 WSETUFLAG(wwin
, dont_move_off
, WMGetButtonSelected(panel
->moreChk
[3]));
715 WSETUFLAG(wwin
, no_focusable
, WMGetButtonSelected(panel
->moreChk
[4]));
716 WSETUFLAG(wwin
, dont_save_session
, WMGetButtonSelected(panel
->moreChk
[5]));
717 WSETUFLAG(wwin
, emulate_appicon
, WMGetButtonSelected(panel
->moreChk
[6]));
718 WSETUFLAG(wwin
, full_maximize
, WMGetButtonSelected(panel
->moreChk
[7]));
719 WSETUFLAG(wwin
, always_user_icon
, WMGetButtonSelected(panel
->alwChk
));
721 if (WFLAGP(wwin
, no_titlebar
) && wwin
->flags
.shaded
)
722 wUnshadeWindow(wwin
);
724 WSETUFLAG(wwin
, no_shadeable
, WFLAGP(wwin
, no_titlebar
));
727 if (!WFLAGP(wwin
, floating
))
728 ChangeStackingLevel(wwin
->frame
->core
, WMFloatingLevel
);
730 if (!WFLAGP(wwin
, sunken
))
731 ChangeStackingLevel(wwin
->frame
->core
, WMSunkenLevel
);
733 if (WFLAGP(wwin
, floating
) || WFLAGP(wwin
, sunken
))
734 ChangeStackingLevel(wwin
->frame
->core
, WMNormalLevel
);
737 WSETUFLAG(wwin
, sunken
, sunken
);
738 WSETUFLAG(wwin
, floating
, floating
);
739 wwin
->flags
.omnipresent
= 0;
741 if (WFLAGP(wwin
, skip_window_list
) != skip_window_list
) {
742 WSETUFLAG(wwin
, skip_window_list
, skip_window_list
);
743 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
,
744 skip_window_list
? ACTION_REMOVE
: ACTION_ADD
);
746 if (WFLAGP(wwin
, omnipresent
) != old_omnipresent
) {
747 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_WORKSPACE
);
751 if (WFLAGP(wwin
, no_bind_keys
) != old_no_bind_keys
) {
752 if (WFLAGP(wwin
, no_bind_keys
)) {
753 XUngrabKey(dpy
, AnyKey
, AnyModifier
, wwin
->frame
->core
->window
);
755 wWindowSetKeyGrabs(wwin
);
759 if (WFLAGP(wwin
, no_bind_mouse
) != old_no_bind_mouse
) {
760 wWindowResetMouseGrabs(wwin
);
763 wwin
->frame
->flags
.need_texture_change
= 1;
764 wWindowConfigureBorders(wwin
);
765 wFrameWindowPaint(wwin
->frame
);
768 * Can't apply emulate_appicon because it will probably cause problems.
772 /* do application wide stuff */
773 WSETUFLAG(wapp
->main_window_desc
, start_hidden
,
774 WMGetButtonSelected(panel
->appChk
[0]));
776 WSETUFLAG(wapp
->main_window_desc
, no_appicon
,
777 WMGetButtonSelected(panel
->appChk
[1]));
779 if (WFLAGP(wapp
->main_window_desc
, no_appicon
))
780 removeAppIconFor(wapp
);
782 makeAppIconFor(wapp
);
784 if (wapp
->app_icon
&& wapp
->main_window
== wwin
->client_win
) {
785 char *file
= WMGetTextFieldText(panel
->fileText
);
791 wIconChangeImageFile(wapp
->app_icon
->icon
, file
);
794 wAppIconPaint(wapp
->app_icon
);
801 revertSettings(WMButton
*button
, InspectorPanel
*panel
)
803 WWindow
*wwin
= panel
->inspected
;
804 WApplication
*wapp
= wApplicationOf(wwin
->main_window
);
806 char *wm_instance
= NULL
;
807 char *wm_class
= NULL
;
808 int workspace
, level
;
810 if (WMGetButtonSelected(panel
->instRb
) != 0)
811 wm_instance
= wwin
->wm_instance
;
812 else if (WMGetButtonSelected(panel
->clsRb
) != 0)
813 wm_class
= wwin
->wm_class
;
814 else if (WMGetButtonSelected(panel
->bothRb
) != 0) {
815 wm_instance
= wwin
->wm_instance
;
816 wm_class
= wwin
->wm_class
;
818 memset(&wwin
->defined_user_flags
, 0, sizeof(WWindowAttributes
));
819 memset(&wwin
->user_flags
, 0, sizeof(WWindowAttributes
));
820 memset(&wwin
->client_flags
, 0, sizeof(WWindowAttributes
));
822 wWindowSetupInitialAttributes(wwin
, &level
, &workspace
);
824 for (i
=0; i
< 10; i
++) {
829 flag
= WFLAGP(wwin
, no_titlebar
);
832 flag
= WFLAGP(wwin
, no_resizebar
);
835 flag
= WFLAGP(wwin
, no_close_button
);
838 flag
= WFLAGP(wwin
, no_miniaturize_button
);
841 flag
= WFLAGP(wwin
, floating
);
844 flag
= WFLAGP(wwin
, sunken
);
847 flag
= WFLAGP(wwin
, omnipresent
);
850 flag
= WFLAGP(wwin
, start_miniaturized
);
853 flag
= WFLAGP(wwin
, start_maximized
!=0);
856 flag
= WFLAGP(wwin
, skip_window_list
);
859 WMSetButtonSelected(panel
->attrChk
[i
], flag
);
861 for (i
=0; i
< 8; i
++) {
866 flag
= WFLAGP(wwin
, no_hide_others
);
869 flag
= WFLAGP(wwin
, no_bind_keys
);
872 flag
= WFLAGP(wwin
, no_bind_mouse
);
875 flag
= WFLAGP(wwin
, dont_move_off
);
878 flag
= WFLAGP(wwin
, no_focusable
);
881 flag
= WFLAGP(wwin
, dont_save_session
);
884 flag
= WFLAGP(wwin
, emulate_appicon
);
887 flag
= WFLAGP(wwin
, full_maximize
);
890 WMSetButtonSelected(panel
->moreChk
[i
], flag
);
892 if (panel
->appFrm
&& wapp
) {
893 for (i
=0; i
< 2; i
++) {
898 flag
= WFLAGP(wapp
->main_window_desc
, start_hidden
);
901 flag
= WFLAGP(wapp
->main_window_desc
, no_appicon
);
904 WMSetButtonSelected(panel
->appChk
[i
], flag
);
907 WMSetButtonSelected(panel
->alwChk
, WFLAGP(wwin
, always_user_icon
));
909 showIconFor(WMWidgetScreen(panel
->alwChk
), panel
, wm_instance
, wm_class
,
912 n
= wDefaultGetStartWorkspace(wwin
->screen_ptr
, wm_instance
, wm_class
);
914 if (n
>= 0 && n
<= wwin
->screen_ptr
->workspace_count
) {
915 WMPerformButtonClick(panel
->setRb
);
916 WMSetTextFieldText(panel
->wsText
, wwin
->screen_ptr
->workspaces
[n
]->name
);
918 WMPerformButtonClick(panel
->curRb
);
924 chooseIconCallback(WMWidget
*self
, void *clientData
)
927 InspectorPanel
*panel
= (InspectorPanel
*)clientData
;
930 panel
->choosingIcon
= 1;
932 WMSetButtonEnabled(panel
->browseIconBtn
, False
);
934 result
= wIconChooserDialog(panel
->frame
->screen_ptr
, &file
,
935 panel
->inspected
->wm_instance
,
936 panel
->inspected
->wm_class
);
938 panel
->choosingIcon
= 0;
940 if (!panel
->destroyed
) { /* kluge */
942 WMSetTextFieldText(panel
->fileText
, file
);
943 showIconFor(WMWidgetScreen(self
), panel
, NULL
, NULL
,
947 WMSetButtonEnabled(panel
->browseIconBtn
, True
);
949 freeInspector(panel
);
955 textEditedObserver(void *observerData
, WMNotification
*notification
)
957 InspectorPanel
*panel
= (InspectorPanel
*)observerData
;
959 if ((long)WMGetNotificationClientData(notification
) != WMReturnTextMovement
)
962 if (WMGetNotificationObject(notification
) == panel
->fileText
) {
963 showIconFor(WMWidgetScreen(panel
->win
), panel
, NULL
, NULL
,
966 WMPerformButtonClick(panel->updateIconBtn);
969 WMPerformButtonClick(panel
->setRb
);
974 selectSpecification(WMWidget
*bPtr
, void *data
)
976 InspectorPanel
*panel
= (InspectorPanel
*)data
;
978 if (bPtr
== panel
->defaultRb
) {
979 WMSetButtonEnabled(panel
->applyBtn
, False
);
981 WMSetButtonEnabled(panel
->applyBtn
, True
);
986 static InspectorPanel
*
987 createInspectorForWindow(WWindow
*wwin
)
989 WScreen
*scr
= wwin
->screen_ptr
;
990 InspectorPanel
*panel
;
995 int btn_width
, frame_width
;
996 #ifdef wrong_behaviour
999 panel
= wmalloc(sizeof(InspectorPanel
));
1000 memset(panel
, 0, sizeof(InspectorPanel
));
1002 panel
->destroyed
= 0;
1005 panel
->inspected
= wwin
;
1007 panel
->nextPtr
= panelList
;
1011 sprintf(charbuf
, "Inspecting %s.%s",
1012 wwin
->wm_instance
? wwin
->wm_instance
: "?",
1013 wwin
->wm_class
? wwin
->wm_class
: "?");
1015 panel
->win
= WMCreateWindow(scr
->wmscreen
, "windowInspector");
1016 WMResizeWidget(panel
->win
, PWIDTH
, PHEIGHT
);
1019 /**** create common stuff ****/
1021 /* command buttons */
1022 /* (PWIDTH - (left and right margin) - (btn interval)) / 3 */
1023 btn_width
= (PWIDTH
- (2 * 15) - (2 * 10)) / 3;
1024 panel
->saveBtn
= WMCreateCommandButton(panel
->win
);
1025 WMSetButtonAction(panel
->saveBtn
, (WMAction
*)saveSettings
, panel
);
1026 WMMoveWidget(panel
->saveBtn
, (2 * (btn_width
+ 10)) + 15, 310);
1027 WMSetButtonText(panel
->saveBtn
, _("Save"));
1028 WMResizeWidget(panel
->saveBtn
, btn_width
, 28);
1029 if (wPreferences
.flags
.noupdates
|| !(wwin
->wm_class
|| wwin
->wm_instance
))
1030 WMSetButtonEnabled(panel
->saveBtn
, False
);
1032 panel
->applyBtn
= WMCreateCommandButton(panel
->win
);
1033 WMSetButtonAction(panel
->applyBtn
, (WMAction
*)applySettings
, panel
);
1034 WMMoveWidget(panel
->applyBtn
, btn_width
+ 10 + 15, 310);
1035 WMSetButtonText(panel
->applyBtn
, _("Apply"));
1036 WMResizeWidget(panel
->applyBtn
, btn_width
, 28);
1038 panel
->revertBtn
= WMCreateCommandButton(panel
->win
);
1039 WMSetButtonAction(panel
->revertBtn
, (WMAction
*)revertSettings
, panel
);
1040 WMMoveWidget(panel
->revertBtn
, 15, 310);
1041 WMSetButtonText(panel
->revertBtn
, _("Reload"));
1042 WMResizeWidget(panel
->revertBtn
, btn_width
, 28);
1044 /* page selection popup button */
1045 panel
->pagePopUp
= WMCreatePopUpButton(panel
->win
);
1046 WMSetPopUpButtonAction(panel
->pagePopUp
, (WMAction
*)changePage
, panel
);
1047 WMMoveWidget(panel
->pagePopUp
, 25, 15);
1048 WMResizeWidget(panel
->pagePopUp
, PWIDTH
- 50, 20);
1050 WMAddPopUpButtonItem(panel
->pagePopUp
, _("Window Specification"));
1051 WMAddPopUpButtonItem(panel
->pagePopUp
, _("Window Attributes"));
1052 WMAddPopUpButtonItem(panel
->pagePopUp
, _("Advanced Options"));
1053 WMAddPopUpButtonItem(panel
->pagePopUp
, _("Icon and Initial Workspace"));
1054 WMAddPopUpButtonItem(panel
->pagePopUp
, _("Application Specific"));
1056 /**** window spec ****/
1057 frame_width
= PWIDTH
- (2 * 15);
1059 panel
->specFrm
= WMCreateFrame(panel
->win
);
1060 WMSetFrameTitle(panel
->specFrm
, _("Window Specification"));
1061 WMMoveWidget(panel
->specFrm
, 15, 65);
1062 WMResizeWidget(panel
->specFrm
, frame_width
, 105);
1065 panel
->defaultRb
= WMCreateRadioButton(panel
->specFrm
);
1066 WMMoveWidget(panel
->defaultRb
, 10, 78);
1067 WMResizeWidget(panel
->defaultRb
, frame_width
- (2 * 10), 20);
1068 WMSetButtonText(panel
->defaultRb
, _("Defaults for all windows"));
1069 WMSetButtonSelected(panel
->defaultRb
, False
);
1070 WMSetButtonAction(panel
->defaultRb
, selectSpecification
, panel
);
1073 if (wwin
->wm_class
&& wwin
->wm_instance
) {
1074 sprintf(charbuf
, "%s.%s", wwin
->wm_instance
, wwin
->wm_class
);
1075 panel
->bothRb
= WMCreateRadioButton(panel
->specFrm
);
1076 WMMoveWidget(panel
->bothRb
, 10, 18);
1077 WMResizeWidget(panel
->bothRb
, frame_width
- (2 * 10), 20);
1078 WMSetButtonText(panel
->bothRb
, charbuf
);
1079 WMSetButtonSelected(panel
->bothRb
, True
);
1080 WMGroupButtons(panel
->defaultRb
, panel
->bothRb
);
1082 WMSetButtonAction(panel
->bothRb
, selectSpecification
, panel
);
1085 if (wwin
->wm_instance
) {
1086 panel
->instRb
= WMCreateRadioButton(panel
->specFrm
);
1087 WMMoveWidget(panel
->instRb
, 10, 38);
1088 WMResizeWidget(panel
->instRb
, frame_width
- (2 * 10), 20);
1089 WMSetButtonText(panel
->instRb
, wwin
->wm_instance
);
1090 WMSetButtonSelected(panel
->instRb
, False
);
1091 WMGroupButtons(panel
->defaultRb
, panel
->instRb
);
1093 WMSetButtonAction(panel
->instRb
, selectSpecification
, panel
);
1096 if (wwin
->wm_class
) {
1097 panel
->clsRb
= WMCreateRadioButton(panel
->specFrm
);
1098 WMMoveWidget(panel
->clsRb
, 10, 58);
1099 WMResizeWidget(panel
->clsRb
, frame_width
- (2 * 10), 20);
1100 WMSetButtonText(panel
->clsRb
, wwin
->wm_class
);
1101 WMSetButtonSelected(panel
->clsRb
, False
);
1102 WMGroupButtons(panel
->defaultRb
, panel
->clsRb
);
1104 WMSetButtonAction(panel
->clsRb
, selectSpecification
, panel
);
1107 panel
->specLbl
= WMCreateLabel(panel
->win
);
1108 WMMoveWidget(panel
->specLbl
, 15, 170);
1109 WMResizeWidget(panel
->specLbl
, frame_width
, 100);
1110 WMSetLabelText(panel
->specLbl
,
1111 _("The configuration will apply to all\n"
1112 "windows that have their WM_CLASS property"
1113 " set to the above selected\nname, when saved."));
1114 WMSetLabelTextAlignment(panel
->specLbl
, WACenter
);
1116 /**** attributes ****/
1117 panel
->attrFrm
= WMCreateFrame(panel
->win
);
1118 WMSetFrameTitle(panel
->attrFrm
, _("Attributes"));
1119 WMMoveWidget(panel
->attrFrm
, 15, 45);
1120 WMResizeWidget(panel
->attrFrm
, frame_width
, 250);
1122 for (i
=0; i
< 10; i
++) {
1123 char *caption
= NULL
;
1128 caption
= _("Disable Titlebar");
1129 flag
= WFLAGP(wwin
, no_titlebar
);
1132 caption
= _("Disable Resizebar");
1133 flag
= WFLAGP(wwin
, no_resizebar
);
1136 caption
= _("Disable Close Button");
1137 flag
= WFLAGP(wwin
, no_close_button
);
1140 caption
= _("Disable Miniaturize Button");
1141 flag
= WFLAGP(wwin
, no_miniaturize_button
);
1144 caption
= _("Keep on Top / Floating");
1145 flag
= WFLAGP(wwin
, floating
);
1148 caption
= _("Keep at Bottom / Sunken");
1149 flag
= WFLAGP(wwin
, sunken
);
1152 caption
= _("Omnipresent");
1153 flag
= WFLAGP(wwin
, omnipresent
);
1156 caption
= _("Start Miniaturized");
1157 flag
= WFLAGP(wwin
, start_miniaturized
);
1160 caption
= _("Start Maximized");
1161 flag
= WFLAGP(wwin
, start_maximized
!=0);
1164 caption
= _("Skip Window List");
1165 flag
= WFLAGP(wwin
, skip_window_list
);
1168 panel
->attrChk
[i
] = WMCreateSwitchButton(panel
->attrFrm
);
1169 WMMoveWidget(panel
->attrChk
[i
], 10, 20*(i
+1));
1170 WMResizeWidget(panel
->attrChk
[i
], frame_width
-15, 20);
1171 WMSetButtonSelected(panel
->attrChk
[i
], flag
);
1172 WMSetButtonText(panel
->attrChk
[i
], caption
);
1176 /**** more attributes ****/
1177 panel
->moreFrm
= WMCreateFrame(panel
->win
);
1178 WMSetFrameTitle(panel
->moreFrm
, _("Advanced"));
1179 WMMoveWidget(panel
->moreFrm
, 15, 45);
1180 WMResizeWidget(panel
->moreFrm
, frame_width
, 250);
1182 for (i
=0; i
< 8; i
++) {
1183 char *caption
= NULL
;
1188 caption
= _("Ignore HideOthers");
1189 flag
= WFLAGP(wwin
, no_hide_others
);
1192 caption
= _("Don't Bind Keyboard Shortcuts");
1193 flag
= WFLAGP(wwin
, no_bind_keys
);
1196 caption
= _("Don't Bind Mouse Clicks");
1197 flag
= WFLAGP(wwin
, no_bind_mouse
);
1200 caption
= _("Keep Inside Screen");
1201 flag
= WFLAGP(wwin
, dont_move_off
);
1204 caption
= _("Don't Let It Take Focus");
1205 flag
= WFLAGP(wwin
, no_focusable
);
1208 caption
= _("Don't Save Session");
1209 flag
= WFLAGP(wwin
, dont_save_session
);
1212 caption
= _("Emulate Application Icon");
1213 flag
= WFLAGP(wwin
, emulate_appicon
);
1216 caption
= _("Full Screen Maximization");
1217 flag
= WFLAGP(wwin
, full_maximize
);
1220 panel
->moreChk
[i
] = WMCreateSwitchButton(panel
->moreFrm
);
1221 WMMoveWidget(panel
->moreChk
[i
], 10, 20*(i
+1));
1222 WMResizeWidget(panel
->moreChk
[i
], frame_width
-15, 20);
1223 WMSetButtonSelected(panel
->moreChk
[i
], flag
);
1224 WMSetButtonText(panel
->moreChk
[i
], caption
);
1227 panel
->moreLbl
= WMCreateLabel(panel
->moreFrm
);
1228 WMResizeWidget(panel
->moreLbl
, frame_width
- (2 * 5), 60);
1229 WMMoveWidget(panel
->moreLbl
, 5, 180);
1230 WMSetLabelText(panel
->moreLbl
,
1231 _("Enable the \"Don't bind...\" options to allow the "
1232 "application to receive all mouse or keyboard events."));
1234 /* miniwindow/workspace */
1235 panel
->iconFrm
= WMCreateFrame(panel
->win
);
1236 WMMoveWidget(panel
->iconFrm
, 15, 50);
1237 WMResizeWidget(panel
->iconFrm
, PWIDTH
- (2 * 15), 170);
1238 WMSetFrameTitle(panel
->iconFrm
, _("Miniwindow Image"));
1240 panel
->iconLbl
= WMCreateLabel(panel
->iconFrm
);
1241 WMMoveWidget(panel
->iconLbl
, PWIDTH
- (2 * 15) - 22 - 64, 30);
1242 WMResizeWidget(panel
->iconLbl
, 64, 64);
1243 WMSetLabelRelief(panel
->iconLbl
, WRRaised
);
1244 WMSetLabelImagePosition(panel
->iconLbl
, WIPImageOnly
);
1246 panel
->browseIconBtn
= WMCreateCommandButton(panel
->iconFrm
);
1247 WMSetButtonAction(panel
->browseIconBtn
, chooseIconCallback
, panel
);
1248 WMMoveWidget(panel
->browseIconBtn
, 22, 30);
1249 WMResizeWidget(panel
->browseIconBtn
, 100, 26);
1250 WMSetButtonText(panel
->browseIconBtn
, _("Browse..."));
1253 panel
->updateIconBtn
= WMCreateCommandButton(panel
->iconFrm
);
1254 WMSetButtonAction(panel
->updateIconBtn
, (WMAction
*)updateIcon
, panel
);
1255 WMMoveWidget(panel
->updateIconBtn
, 22, 65);
1256 WMResizeWidget(panel
->updateIconBtn
, 100, 26);
1257 WMSetButtonText(panel
->updateIconBtn
, _("Update"));
1259 #ifdef wrong_behaviour
1260 WMSetButtonImagePosition(panel
->updateIconBtn
, WIPRight
);
1261 pixmap
= WMGetSystemPixmap(scr
->wmscreen
, WSIReturnArrow
);
1262 WMSetButtonImage(panel
->updateIconBtn
, pixmap
);
1263 WMReleasePixmap(pixmap
);
1264 pixmap
= WMGetSystemPixmap(scr
->wmscreen
, WSIHighlightedReturnArrow
);
1265 WMSetButtonAltImage(panel
->updateIconBtn
, pixmap
);
1266 WMReleasePixmap(pixmap
);
1269 panel
->fileLbl
= WMCreateLabel(panel
->iconFrm
);
1270 WMMoveWidget(panel
->fileLbl
, 20, 95);
1271 WMResizeWidget(panel
->fileLbl
, PWIDTH
- (2 * 15) - (2 * 20), 14);
1272 WMSetLabelText(panel
->fileLbl
, _("Icon File Name:"));
1274 panel
->fileText
= WMCreateTextField(panel
->iconFrm
);
1275 WMMoveWidget(panel
->fileText
, 20, 115);
1276 WMResizeWidget(panel
->fileText
, PWIDTH
- (2 * 15) - (2 * 15), 20);
1277 WMSetTextFieldText(panel
->fileText
, NULL
);
1278 WMAddNotificationObserver(textEditedObserver
, panel
,
1279 WMTextDidEndEditingNotification
,
1281 panel
->alwChk
= WMCreateSwitchButton(panel
->iconFrm
);
1282 WMMoveWidget(panel
->alwChk
, 20, 140);
1283 WMResizeWidget(panel
->alwChk
, PWIDTH
- (2 * 15) - (2 * 15), 20);
1284 WMSetButtonText(panel
->alwChk
, _("Ignore client supplied icon"));
1285 WMSetButtonSelected(panel
->alwChk
, WFLAGP(wwin
, always_user_icon
));
1288 panel
->wsFrm
= WMCreateFrame(panel
->win
);
1289 WMMoveWidget(panel
->wsFrm
, 15, 225);
1290 WMResizeWidget(panel
->wsFrm
, PWIDTH
- (2 * 15), 70);
1291 WMSetFrameTitle(panel
->wsFrm
, _("Initial Workspace"));
1293 panel
->curRb
= WMCreateRadioButton(panel
->wsFrm
);
1294 WMMoveWidget(panel
->curRb
, 10, 15);
1295 WMResizeWidget(panel
->curRb
, frame_width
- (2 * 10), 20);
1296 WMSetButtonText(panel
->curRb
, _("Nowhere in particular"));
1299 panel
->setRb
= WMCreateRadioButton(panel
->wsFrm
);
1300 WMMoveWidget(panel
->setRb
, 10, 40);
1301 WMResizeWidget(panel
->setRb
, 25, 20);
1302 WMGroupButtons(panel
->curRb
, panel
->setRb
);
1303 WMSetButtonText(panel
->setRb
, NULL
);
1305 panel
->wsText
= WMCreateTextField(panel
->wsFrm
);
1306 WMMoveWidget(panel
->wsText
, 30, 40);
1307 WMResizeWidget(panel
->wsText
, PWIDTH
- (2 * 15) - 25 - 10 - (2 * 5), 20);
1308 WMAddNotificationObserver(textEditedObserver
, panel
,
1309 WMTextDidEndEditingNotification
,
1313 i
= wDefaultGetStartWorkspace(wwin
->screen_ptr
, wwin
->wm_instance
,
1315 if (i
>= 0 && i
<= wwin
->screen_ptr
->workspace_count
) {
1316 WMSetButtonSelected(panel
->curRb
, False
);
1317 WMSetButtonSelected(panel
->setRb
, True
);
1318 WMSetTextFieldText(panel
->wsText
,
1319 wwin
->screen_ptr
->workspaces
[i
]->name
);
1321 WMSetButtonSelected(panel
->curRb
, True
);
1322 WMSetButtonSelected(panel
->setRb
, False
);
1325 /* application wide attributes */
1326 if (wwin
->main_window
!= None
) {
1327 WApplication
*wapp
= wApplicationOf(wwin
->main_window
);
1329 panel
->appFrm
= WMCreateFrame(panel
->win
);
1330 WMSetFrameTitle(panel
->appFrm
, _("Application Wide"));
1331 WMMoveWidget(panel
->appFrm
, 15, 50);
1332 WMResizeWidget(panel
->appFrm
, frame_width
, 240);
1334 for (i
=0; i
< 2; i
++) {
1335 char *caption
= NULL
;
1340 caption
= _("Start Hidden");
1341 flag
= WFLAGP(wapp
->main_window_desc
, start_hidden
);
1344 caption
= _("No Application Icon");
1345 flag
= WFLAGP(wapp
->main_window_desc
, no_appicon
);
1348 panel
->appChk
[i
] = WMCreateSwitchButton(panel
->appFrm
);
1349 WMMoveWidget(panel
->appChk
[i
], 10, 20*(i
+1));
1350 WMResizeWidget(panel
->appChk
[i
], 205, 20);
1351 WMSetButtonSelected(panel
->appChk
[i
], flag
);
1352 WMSetButtonText(panel
->appChk
[i
], caption
);
1355 if (WFLAGP(wwin
, emulate_appicon
)) {
1356 WMSetButtonEnabled(panel
->appChk
[1], False
);
1357 WMSetButtonEnabled(panel
->moreChk
[6], True
);
1359 WMSetButtonEnabled(panel
->appChk
[1], True
);
1360 WMSetButtonEnabled(panel
->moreChk
[6], False
);
1365 if ((wwin
->transient_for
!=None
&& wwin
->transient_for
!=scr
->root_win
)
1366 || !wwin
->wm_class
|| !wwin
->wm_instance
)
1370 WMSetButtonEnabled(panel
->moreChk
[6], tmp
);
1372 WMSetPopUpButtonItemEnabled(panel
->pagePopUp
, 4, False
);
1373 panel
->appFrm
= NULL
;
1376 /* if the window is a transient, don't let it have a miniaturize
1378 if (wWindowFor(wwin
->transient_for
)!=NULL
)
1379 WMSetButtonEnabled(panel
->attrChk
[3], False
);
1381 WMSetButtonEnabled(panel
->attrChk
[3], True
);
1384 if (!wwin
->wm_class
&& !wwin
->wm_instance
) {
1385 WMSetPopUpButtonItemEnabled(panel
->pagePopUp
, 0, False
);
1389 WMRealizeWidget(panel
->win
);
1391 WMMapSubwidgets(panel
->win
);
1392 WMMapSubwidgets(panel
->specFrm
);
1393 WMMapSubwidgets(panel
->attrFrm
);
1394 WMMapSubwidgets(panel
->moreFrm
);
1395 WMMapSubwidgets(panel
->iconFrm
);
1396 WMMapSubwidgets(panel
->wsFrm
);
1398 WMMapSubwidgets(panel
->appFrm
);
1400 WMSetPopUpButtonSelectedItem(panel
->pagePopUp
, 1);
1401 changePage(panel
->pagePopUp
, panel
);
1404 parent
= XCreateSimpleWindow(dpy
, scr
->root_win
, 0, 0, PWIDTH
, PHEIGHT
,
1406 XSelectInput(dpy
, parent
, KeyPressMask
|KeyReleaseMask
);
1407 panel
->parent
= parent
;
1408 XReparentWindow(dpy
, WMWidgetXID(panel
->win
), parent
, 0, 0);
1410 WMMapWidget(panel
->win
);
1412 XSetTransientForHint(dpy
, parent
, wwin
->client_win
);
1414 x
= wwin
->frame_x
+wwin
->frame
->core
->width
/2;
1415 y
= wwin
->frame_y
+wwin
->frame
->top_width
*2;
1416 if (y
+ PHEIGHT
> scr
->scr_height
)
1417 y
= scr
->scr_height
- PHEIGHT
- 30;
1418 if (x
+ PWIDTH
> scr
->scr_width
)
1419 x
= scr
->scr_width
- PWIDTH
;
1420 panel
->frame
= wManageInternalWindow(scr
, parent
, wwin
->client_win
,
1421 charbuf
, x
, y
, PWIDTH
, PHEIGHT
);
1423 /* kluge to know who should get the key events */
1424 panel
->frame
->client_leader
= WMWidgetXID(panel
->win
);
1426 WSETUFLAG(panel
->frame
, no_closable
, 0);
1427 WSETUFLAG(panel
->frame
, no_close_button
, 0);
1428 wWindowUpdateButtonImages(panel
->frame
);
1429 wFrameWindowShowButton(panel
->frame
->frame
, WFF_RIGHT_BUTTON
);
1430 panel
->frame
->frame
->on_click_right
= destroyInspector
;
1432 wWindowMap(panel
->frame
);
1434 showIconFor(WMWidgetScreen(panel
->alwChk
), panel
, wwin
->wm_instance
,
1435 wwin
->wm_class
, UPDATE_TEXT_FIELD
);
1442 wShowInspectorForWindow(WWindow
*wwin
)
1444 if (wwin
->flags
.inspector_open
)
1448 wwin
->flags
.inspector_open
= 1;
1449 wwin
->inspector
= createInspectorForWindow(wwin
);;