2 /* Copyright (C) 2001 Olivier Chapuis */
3 /* This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #include "libs/fvwmlib.h"
26 #include "libs/Parse.h"
27 #include "libs/Strings.h"
30 #include "functions.h"
39 #include "ewmh_intern.h"
40 #include "move_resize.h"
47 void set_state_workaround(void)
51 for (t
= Scr
.FvwmRoot
.next
; t
!= NULL
; t
= t
->next
)
53 if ((t
->Desk
!= Scr
.CurrentDesk
) &&
54 (!is_window_sticky_across_desks(t
) &&
55 !IS_ICON_UNMAPPED(t
)))
57 if (Scr
.bo
.do_enable_ewmh_iconic_state_workaround
)
59 SetMapStateProp(t
, NormalState
);
63 SetMapStateProp(t
, IconicState
);
69 Bool
EWMH_BugOpts(char *opt
, Bool toggle
)
71 Bool save_isw
= Scr
.bo
.do_enable_ewmh_iconic_state_workaround
;
73 if (StrEquals(opt
,"EWMHIconicStateWorkaround"))
78 Scr
.bo
.do_enable_ewmh_iconic_state_workaround
^= 1;
82 Scr
.bo
.do_enable_ewmh_iconic_state_workaround
= toggle
;
85 Scr
.bo
.do_enable_ewmh_iconic_state_workaround
= 0;
88 if (save_isw
!= Scr
.bo
.do_enable_ewmh_iconic_state_workaround
)
90 set_state_workaround();
98 void CMD_EwmhNumberOfDesktops(F_CMD_ARGS
)
103 num
= GetIntegerArguments(action
, NULL
, val
, 2);
104 if ((num
!= 1 && num
!= 2) || val
[0] < 1 ||
105 (num
== 2 && val
[1] < val
[0] && val
[1] != 0))
107 fvwm_msg(ERR
,"EwmhNumberOfDesktops",
108 "Bad arguments to EwmhNumberOfDesktops");
112 if (num
== 2 && ewmhc
.MaxDesktops
!= val
[1])
114 ewmhc
.MaxDesktops
= val
[1];
117 else if (num
== 1 && ewmhc
.MaxDesktops
!= 0)
119 ewmhc
.MaxDesktops
= 0;
123 if (ewmhc
.NumberOfDesktops
!= val
[0])
125 ewmhc
.NumberOfDesktops
= val
[0];
131 ewmhc
.NeedsToCheckDesk
= True
;
132 EWMH_SetNumberOfDesktops();
136 void CMD_EwmhBaseStruts(F_CMD_ARGS
)
140 if (GetIntegerArguments(action
, NULL
, val
, 4) != 4 ||
141 val
[0] < 0 || val
[1] < 0 || val
[2] < 0 || val
[3] < 0)
143 fvwm_msg(ERR
,"CMD_EwmhBaseStruts",
144 "EwmhBaseStruts needs four positive arguments");
148 if (ewmhc
.BaseStrut
.left
!= val
[0] ||
149 ewmhc
.BaseStrut
.right
!= val
[1] ||
150 ewmhc
.BaseStrut
.top
!= val
[2] ||
151 ewmhc
.BaseStrut
.bottom
!= val
[3])
153 ewmhc
.BaseStrut
.left
= val
[0];
154 ewmhc
.BaseStrut
.right
= val
[1];
155 ewmhc
.BaseStrut
.top
= val
[2];
156 ewmhc
.BaseStrut
.bottom
= val
[3];
157 ewmh_ComputeAndSetWorkArea();
158 ewmh_HandleDynamicWorkArea();
165 Bool
EWMH_CMD_Style(char *token
, window_style
*ptmpstyle
, int on
)
169 if (StrEquals(token
, "EWMHDonateIcon"))
172 S_SET_DO_EWMH_DONATE_ICON(SCF(*ptmpstyle
), on
);
173 S_SET_DO_EWMH_DONATE_ICON(SCM(*ptmpstyle
), 1);
174 S_SET_DO_EWMH_DONATE_ICON(SCC(*ptmpstyle
), 1);
176 else if (StrEquals(token
, "EWMHDonateMiniIcon"))
179 S_SET_DO_EWMH_DONATE_MINI_ICON(SCF(*ptmpstyle
), on
);
180 S_SET_DO_EWMH_DONATE_MINI_ICON(SCM(*ptmpstyle
), 1);
181 S_SET_DO_EWMH_DONATE_MINI_ICON(SCC(*ptmpstyle
), 1);
183 else if (StrEquals(token
, "EWMHDontDonateIcon"))
186 S_SET_DO_EWMH_DONATE_ICON(SCF(*ptmpstyle
), !on
);
187 S_SET_DO_EWMH_DONATE_ICON(SCM(*ptmpstyle
), 1);
188 S_SET_DO_EWMH_DONATE_ICON(SCC(*ptmpstyle
), 1);
190 else if (StrEquals(token
, "EWMHDontDonateMiniIcon"))
193 S_SET_DO_EWMH_DONATE_MINI_ICON(SCF(*ptmpstyle
), !on
);
194 S_SET_DO_EWMH_DONATE_MINI_ICON(SCM(*ptmpstyle
), 1);
195 S_SET_DO_EWMH_DONATE_MINI_ICON(SCC(*ptmpstyle
), 1);
197 else if (StrEquals(token
, "EWMHMaximizeIgnoreWorkingArea"))
200 S_SET_EWMH_MAXIMIZE_MODE(
201 SCF(*ptmpstyle
), EWMH_IGNORE_WORKING_AREA
);
202 S_SET_EWMH_MAXIMIZE_MODE(
203 SCM(*ptmpstyle
), EWMH_WORKING_AREA_MASK
);
204 S_SET_EWMH_MAXIMIZE_MODE(
205 SCC(*ptmpstyle
), EWMH_WORKING_AREA_MASK
);
207 else if (StrEquals(token
, "EWMHMaximizeUseWorkingArea"))
210 S_SET_EWMH_MAXIMIZE_MODE(
211 SCF(*ptmpstyle
), EWMH_USE_WORKING_AREA
);
212 S_SET_EWMH_MAXIMIZE_MODE(
213 SCM(*ptmpstyle
), EWMH_WORKING_AREA_MASK
);
214 S_SET_EWMH_MAXIMIZE_MODE(
215 SCC(*ptmpstyle
), EWMH_WORKING_AREA_MASK
);
217 else if (StrEquals(token
, "EWMHMaximizeUseDynamicWorkingArea"))
220 S_SET_EWMH_MAXIMIZE_MODE(
221 SCF(*ptmpstyle
), EWMH_USE_DYNAMIC_WORKING_AREA
);
222 S_SET_EWMH_MAXIMIZE_MODE(
223 SCM(*ptmpstyle
), EWMH_WORKING_AREA_MASK
);
224 S_SET_EWMH_MAXIMIZE_MODE(
225 SCC(*ptmpstyle
), EWMH_WORKING_AREA_MASK
);
227 else if (StrEquals(token
, "EWMHMiniIconOverride"))
230 S_SET_DO_EWMH_MINI_ICON_OVERRIDE(SCF(*ptmpstyle
), on
);
231 S_SET_DO_EWMH_MINI_ICON_OVERRIDE(SCM(*ptmpstyle
), 1);
232 S_SET_DO_EWMH_MINI_ICON_OVERRIDE(SCC(*ptmpstyle
), 1);
234 else if (StrEquals(token
, "EWMHNoMiniIconOverride"))
237 S_SET_DO_EWMH_MINI_ICON_OVERRIDE(SCF(*ptmpstyle
), !on
);
238 S_SET_DO_EWMH_MINI_ICON_OVERRIDE(SCM(*ptmpstyle
), 1);
239 S_SET_DO_EWMH_MINI_ICON_OVERRIDE(SCC(*ptmpstyle
), 1);
241 else if (StrEquals(token
, "EWMHPlacementIgnoreWorkingArea"))
244 ptmpstyle
->flags
.ewmh_placement_mode
=
245 EWMH_IGNORE_WORKING_AREA
;
246 ptmpstyle
->flag_mask
.ewmh_placement_mode
=
247 EWMH_WORKING_AREA_MASK
;
248 ptmpstyle
->change_mask
.ewmh_placement_mode
=
249 EWMH_WORKING_AREA_MASK
;
251 else if (StrEquals(token
, "EWMHPlacementUseWorkingArea"))
254 ptmpstyle
->flags
.ewmh_placement_mode
= EWMH_USE_WORKING_AREA
;
255 ptmpstyle
->flag_mask
.ewmh_placement_mode
=
256 EWMH_WORKING_AREA_MASK
;
257 ptmpstyle
->change_mask
.ewmh_placement_mode
=
258 EWMH_WORKING_AREA_MASK
;
260 else if (StrEquals(token
, "EWMHPlacementUseDynamicWorkingArea"))
263 ptmpstyle
->flags
.ewmh_placement_mode
=
264 EWMH_USE_DYNAMIC_WORKING_AREA
;
265 ptmpstyle
->flag_mask
.ewmh_placement_mode
=
266 EWMH_WORKING_AREA_MASK
;
267 ptmpstyle
->change_mask
.ewmh_placement_mode
=
268 EWMH_WORKING_AREA_MASK
;
270 else if (StrEquals(token
, "EWMHUseStackingOrderHints"))
273 S_SET_DO_EWMH_USE_STACKING_HINTS(SCF(*ptmpstyle
), on
);
274 S_SET_DO_EWMH_USE_STACKING_HINTS(SCM(*ptmpstyle
), 1);
275 S_SET_DO_EWMH_USE_STACKING_HINTS(SCC(*ptmpstyle
), 1);
277 else if (StrEquals(token
, "EWMHIgnoreStackingOrderHints"))
280 S_SET_DO_EWMH_USE_STACKING_HINTS(SCF(*ptmpstyle
), !on
);
281 S_SET_DO_EWMH_USE_STACKING_HINTS(SCM(*ptmpstyle
), 1);
282 S_SET_DO_EWMH_USE_STACKING_HINTS(SCC(*ptmpstyle
), 1);
284 else if (StrEquals(token
, "EWMHUseStateHints"))
287 S_SET_DO_EWMH_IGNORE_STATE_HINTS(SCF(*ptmpstyle
), !on
);
288 S_SET_DO_EWMH_IGNORE_STATE_HINTS(SCM(*ptmpstyle
), 1);
289 S_SET_DO_EWMH_IGNORE_STATE_HINTS(SCC(*ptmpstyle
), 1);
291 else if (StrEquals(token
, "EWMHIgnoreStateHints"))
294 S_SET_DO_EWMH_IGNORE_STATE_HINTS(SCF(*ptmpstyle
), on
);
295 S_SET_DO_EWMH_IGNORE_STATE_HINTS(SCM(*ptmpstyle
), 1);
296 S_SET_DO_EWMH_IGNORE_STATE_HINTS(SCC(*ptmpstyle
), 1);
298 else if (StrEquals(token
, "EWMHUseStrutHints"))
301 S_SET_DO_EWMH_IGNORE_STRUT_HINTS(SCF(*ptmpstyle
), !on
);
302 S_SET_DO_EWMH_IGNORE_STRUT_HINTS(SCM(*ptmpstyle
), 1);
303 S_SET_DO_EWMH_IGNORE_STRUT_HINTS(SCC(*ptmpstyle
), 1);
305 else if (StrEquals(token
, "EWMHIgnoreStrutHints"))
308 S_SET_DO_EWMH_IGNORE_STRUT_HINTS(SCF(*ptmpstyle
), on
);
309 S_SET_DO_EWMH_IGNORE_STRUT_HINTS(SCM(*ptmpstyle
), 1);
310 S_SET_DO_EWMH_IGNORE_STRUT_HINTS(SCC(*ptmpstyle
), 1);
312 else if (StrEquals(token
, "EWMHIgnoreWindowType"))
315 S_SET_DO_EWMH_IGNORE_WINDOW_TYPE(SCF(*ptmpstyle
), on
);
316 S_SET_DO_EWMH_IGNORE_WINDOW_TYPE(SCM(*ptmpstyle
), 1);
317 S_SET_DO_EWMH_IGNORE_WINDOW_TYPE(SCC(*ptmpstyle
), 1);