Newer
Older
Olivier Fourdan
committed
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
Olivier Fourdan
committed
Olivier Fourdan
committed
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Olivier Fourdan
committed
Olivier Fourdan
committed
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Olivier Fourdan
committed
Olivier Fourdan
committed
oroborus - (c) 2001 Ken Lynch
#include <config.h>
#endif
#include <glib.h>
#include <pango/pango.h>
Olivier Fourdan
committed
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <libxfce4util/libxfce4util.h>
#include <libxfcegui4/libxfcegui4.h>
Olivier Fourdan
committed
#include <libxfce4mcs/mcs-client.h>
#include "screen.h"
#include "focus.h"
Olivier Fourdan
committed
#define CHANNEL5 "wm_tweaks"
#define TOINT(x) (x ? atoi(x) : 0)
Olivier Fourdan
committed
#define DEFAULT_KEYTHEME "Default"
#define KEYTHEMERC "keythemerc"
#define THEMERC "themerc"
static void check_for_grabs (ScreenInfo *);
static void set_settings_margin (ScreenInfo *,
int ,
int);
static void notify_cb (const char *,
const char *,
McsAction,
McsSetting *,
void *);
static GdkFilterReturn client_event_filter (GdkXEvent *,
GdkEvent *,
gpointer);
static void watch_cb (Window,
Bool,
long,
void *);
static void loadRcData (ScreenInfo *,
static gboolean loadKeyBindings (ScreenInfo *,
static void unloadTheme (ScreenInfo *);
static void unloadSettings (ScreenInfo *);
static gboolean reloadScreenSettings (ScreenInfo *,
int);
static void
check_for_grabs (ScreenInfo *screen_info)
{
if ((screen_info->params->raise_on_click) || (screen_info->params->click_to_focus))
{
clientGrabMouseButtonForAll (screen_info);
}
else if (!(screen_info->params->raise_on_click) && !(screen_info->params->click_to_focus))
{
clientUngrabMouseButtonForAll (screen_info);
}
}
Olivier Fourdan
committed
set_settings_margin (ScreenInfo *screen_info, int idx, int value)
Olivier Fourdan
committed
{
Olivier Fourdan
committed
case LEFT:
case RIGHT:
if (value < 0)
{
val = 0;
}
else if (value > gdk_screen_get_width (screen_info->gscr) / 4)
Olivier Fourdan
committed
{
val = gdk_screen_get_width (screen_info->gscr) / 4;
Olivier Fourdan
committed
}
else
{
val = value;
}
screen_info->params->xfwm_margins[idx] = val;
Olivier Fourdan
committed
break;
case TOP:
case BOTTOM:
if (value < 0)
{
val = 0;
}
else if (value > gdk_screen_get_height (screen_info->gscr) / 4)
Olivier Fourdan
committed
{
val = gdk_screen_get_height (screen_info->gscr) / 4;
Olivier Fourdan
committed
}
else
{
val = value;
}
screen_info->params->xfwm_margins[idx] = val;
Olivier Fourdan
committed
break;
default:
break;
Olivier Fourdan
committed
notify_cb (const char *name, const char *channel_name, McsAction action, McsSetting * setting, void *data)
ScreenInfo *screen_info = (ScreenInfo *) data;
g_return_if_fail (screen_info != NULL);
if (!g_ascii_strcasecmp (CHANNEL1, channel_name))
Olivier Fourdan
committed
switch (action)
{
case MCS_ACTION_NEW:
/* The following is to reduce initial startup time and reload */
Olivier Fourdan
committed
{
return;
}
case MCS_ACTION_CHANGED:
if (setting->type == MCS_TYPE_INT)
{
if (!strcmp (name, "Xfwm/ClickToFocus"))
{
screen_info->params->click_to_focus = setting->data.v_int;
check_for_grabs (screen_info);
Olivier Fourdan
committed
}
else if (!strcmp (name, "Xfwm/FocusNewWindow"))
{
screen_info->params->focus_new = setting->data.v_int;
Olivier Fourdan
committed
}
else if (!strcmp (name, "Xfwm/FocusRaise"))
{
screen_info->params->raise_on_focus = setting->data.v_int;
Olivier Fourdan
committed
}
else if (!strcmp (name, "Xfwm/RaiseDelay"))
{
screen_info->params->raise_delay = setting->data.v_int;
Olivier Fourdan
committed
}
else if (!strcmp (name, "Xfwm/RaiseOnClick"))
{
screen_info->params->raise_on_click = setting->data.v_int;
check_for_grabs (screen_info);
Olivier Fourdan
committed
}
Olivier Fourdan
committed
else if (!strcmp (name, "Xfwm/SnapToBorder"))
{
screen_info->params->snap_to_border = setting->data.v_int;
Olivier Fourdan
committed
}
else if (!strcmp (name, "Xfwm/SnapToWindows"))
{
screen_info->params->snap_to_windows = setting->data.v_int;
Olivier Fourdan
committed
}
else if (!strcmp (name, "Xfwm/SnapWidth"))
{
screen_info->params->snap_width = setting->data.v_int;
Olivier Fourdan
committed
}
else if (!strcmp (name, "Xfwm/WrapWorkspaces"))
{
screen_info->params->wrap_workspaces = setting->data.v_int;
placeSidewalks (screen_info, screen_info->params->wrap_workspaces);
Olivier Fourdan
committed
}
else if (!strcmp (name, "Xfwm/WrapWindows"))
{
screen_info->params->wrap_windows = setting->data.v_int;
Olivier Fourdan
committed
}
else if (!strcmp (name, "Xfwm/WrapResistance"))
{
screen_info->params->wrap_resistance = setting->data.v_int;
Olivier Fourdan
committed
}
else if (!strcmp (name, "Xfwm/BoxMove"))
{
screen_info->params->box_move = setting->data.v_int;
Olivier Fourdan
committed
}
else if (!strcmp (name, "Xfwm/BoxResize"))
{
screen_info->params->box_resize = setting->data.v_int;
Olivier Fourdan
committed
}
}
else if (setting->type == MCS_TYPE_STRING)
{
if (!strcmp (name, "Xfwm/DblClickAction"))
{
reloadScreenSettings (screen_info, NO_UPDATE_FLAG);
Olivier Fourdan
committed
}
else if (!strcmp (name, "Xfwm/ThemeName"))
{
reloadScreenSettings (screen_info, UPDATE_GRAVITY | UPDATE_CACHE);
Olivier Fourdan
committed
}
else if (!strcmp (name, "Xfwm/ButtonLayout"))
{
reloadScreenSettings (screen_info, UPDATE_FRAME | UPDATE_CACHE);
Olivier Fourdan
committed
}
if (!strcmp (name, "Xfwm/TitleAlign"))
{
reloadScreenSettings (screen_info, UPDATE_FRAME | UPDATE_CACHE);
Olivier Fourdan
committed
}
if (!strcmp (name, "Xfwm/TitleFont"))
{
reloadScreenSettings (screen_info, UPDATE_FRAME | UPDATE_CACHE);
Olivier Fourdan
committed
}
}
break;
case MCS_ACTION_DELETED:
default:
break;
}
else if (!g_ascii_strcasecmp (CHANNEL2, channel_name))
Olivier Fourdan
committed
switch (action)
{
case MCS_ACTION_NEW:
/* The following is to reduce initial startup time and reloads */
Olivier Fourdan
committed
{
return;
}
case MCS_ACTION_CHANGED:
if (setting->type == MCS_TYPE_INT)
{
if (!strcmp (name, "Xfwm/LeftMargin"))
{
set_settings_margin (screen_info, LEFT, setting->data.v_int);
Olivier Fourdan
committed
}
else if (!strcmp (name, "Xfwm/RightMargin"))
{
set_settings_margin (screen_info, RIGHT, setting->data.v_int);
Olivier Fourdan
committed
}
else if (!strcmp (name, "Xfwm/BottomMargin"))
{
set_settings_margin (screen_info, BOTTOM, setting->data.v_int);
Olivier Fourdan
committed
}
else if (!strcmp (name, "Xfwm/TopMargin"))
{
set_settings_margin (screen_info, TOP, setting->data.v_int);
Olivier Fourdan
committed
}
}
break;
case MCS_ACTION_DELETED:
default:
break;
}
Olivier Fourdan
committed
}
Olivier Fourdan
committed
switch (action)
{
case MCS_ACTION_NEW:
/* The following is to reduce initial startup time and reloads */
Olivier Fourdan
committed
{
return;
}
case MCS_ACTION_CHANGED:
if (setting->type == MCS_TYPE_INT)
{
if (!strcmp (name, "Xfwm/WorkspaceCount"))
{
workspaceSetCount(screen_info, setting->data.v_int);
Olivier Fourdan
committed
}
}
break;
case MCS_ACTION_DELETED:
default:
break;
}
else if (!g_ascii_strcasecmp (CHANNEL4, channel_name))
{
switch (action)
{
case MCS_ACTION_NEW:
/* The following is to reduce initial startup time and reloads */
if (!screen_info->mcs_initted)
{
return;
}
case MCS_ACTION_CHANGED:
if (setting->type == MCS_TYPE_STRING)
{
if (!strcmp (name, "Xfwm/KeyThemeName"))
{
reloadScreenSettings (screen_info, UPDATE_KEY_GRABS);
}
}
break;
case MCS_ACTION_DELETED:
default:
break;
}
}
Olivier Fourdan
committed
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
else if (!g_ascii_strcasecmp (CHANNEL5, channel_name))
{
switch (action)
{
case MCS_ACTION_NEW:
/* The following is to reduce initial startup time and reloads */
if (!screen_info->mcs_initted)
{
return;
}
case MCS_ACTION_CHANGED:
if (setting->type == MCS_TYPE_INT)
{
if (!strcmp (name, "Xfwm/CycleMinimum"))
{
screen_info->params->cycle_minimum = setting->data.v_int;
}
else if (!strcmp (name, "Xfwm/CycleHidden"))
{
screen_info->params->cycle_hidden = setting->data.v_int;
}
else if (!strcmp (name, "Xfwm/EasyClick"))
{
screen_info->params->easy_click = setting->data.v_int;
}
else if (!strcmp (name, "Xfwm/FocusHint"))
{
screen_info->params->focus_hint = setting->data.v_int;
}
else if (!strcmp (name, "Xfwm/MoveOpacity"))
{
screen_info->params->move_opacity = setting->data.v_int;
}
else if (!strcmp (name, "Xfwm/ResizeOpacity"))
{
screen_info->params->resize_opacity = setting->data.v_int;
}
Olivier Fourdan
committed
else if (!strcmp (name, "Xfwm/PopupOpacity"))
{
screen_info->params->popup_opacity = setting->data.v_int;
}
Olivier Fourdan
committed
else if (!strcmp (name, "Xfwm/PlacementRatio"))
{
screen_info->params->placement_ratio = setting->data.v_int;
}
else if (!strcmp (name, "Xfwm/ShowFrameShadow"))
{
screen_info->params->show_frame_shadow = setting->data.v_int;
}
Olivier Fourdan
committed
else if (!strcmp (name, "Xfwm/ShowPopupShadow"))
{
screen_info->params->show_popup_shadow = setting->data.v_int;
}
Olivier Fourdan
committed
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
else if (!strcmp (name, "Xfwm/PreventFocusStealing"))
{
screen_info->params->prevent_focus_stealing = setting->data.v_int;
}
else if (!strcmp (name, "Xfwm/RaiseWithAnyButton"))
{
screen_info->params->raise_with_any_button = setting->data.v_int;
check_for_grabs (screen_info);
}
else if (!strcmp (name, "Xfwm/ScrollWorkspaces"))
{
screen_info->params->scroll_workspaces = setting->data.v_int;
}
else if (!strcmp (name, "Xfwm/ToggleWorkspaces"))
{
screen_info->params->toggle_workspaces = setting->data.v_int;
}
else if (!strcmp (name, "Xfwm/WrapLayout"))
{
screen_info->params->wrap_layout = setting->data.v_int;
}
else if (!strcmp (name, "Xfwm/WrapCycle"))
{
screen_info->params->wrap_cycle = setting->data.v_int;
}
}
break;
case MCS_ACTION_DELETED:
default:
break;
}
}
Olivier Fourdan
committed
}
static GdkFilterReturn
client_event_filter (GdkXEvent * xevent, GdkEvent * event, gpointer data)
Olivier Fourdan
committed
{
ScreenInfo *screen_info = (ScreenInfo *) data;
if (mcs_client_process_event (screen_info->mcs_client, (XEvent *) xevent))
{
Olivier Fourdan
committed
return GDK_FILTER_REMOVE;
}
Olivier Fourdan
committed
else
{
Olivier Fourdan
committed
return GDK_FILTER_CONTINUE;
}
Olivier Fourdan
committed
}
static void
watch_cb (Window window, Bool is_start, long mask, void *cb_data)
Olivier Fourdan
committed
{
GdkWindow *gdkwin;
gdkwin = gdk_window_lookup (window);
Olivier Fourdan
committed
Olivier Fourdan
committed
{
Olivier Fourdan
committed
if (!gdkwin)
{
gdkwin = gdk_window_foreign_new (window);
}
else
{
g_object_ref (gdkwin);
}
gdk_window_add_filter (gdkwin, client_event_filter, cb_data);
Olivier Fourdan
committed
}
else
{
Olivier Fourdan
committed
g_assert (gdkwin);
gdk_window_remove_filter (gdkwin, client_event_filter, cb_data);
g_object_unref (gdkwin);
Olivier Fourdan
committed
}
}
Olivier Fourdan
committed
{
Olivier Fourdan
committed
gchar *keytheme;
gchar *system_keytheme;
Olivier Fourdan
committed
if (!parseRc ("defaults", PACKAGE_DATADIR, rc))
Olivier Fourdan
committed
{
Olivier Fourdan
committed
exit (1);
Olivier Fourdan
committed
}
keythemevalue = getValue ("keytheme", rc);
if (keythemevalue)
{
Olivier Fourdan
committed
system_keytheme = getSystemThemeDir ();
parseRc (KEYTHEMERC, system_keytheme, rc);
Olivier Fourdan
committed
keytheme = getThemeDir (keythemevalue, KEYTHEMERC);
Olivier Fourdan
committed
{
/* If there is a custom key theme, merge it with system defaults */
parseRc (KEYTHEMERC, keytheme, rc);
Olivier Fourdan
committed
}
g_free (system_keytheme);
homedir = xfce_resource_save_location (XFCE_RESOURCE_CONFIG,
"xfce4" G_DIR_SEPARATOR_S "xfwm4",
FALSE);
parseRc ("xfwm4rc", homedir, rc);
Olivier Fourdan
committed
}
Olivier Fourdan
committed
{
McsSetting *setting;
Olivier Fourdan
committed
{
Olivier Fourdan
committed
/* "Regular" channel */
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/ClickToFocus", CHANNEL1,
Olivier Fourdan
committed
&setting) == MCS_SUCCESS)
{
setBooleanValueFromInt ("click_to_focus", setting->data.v_int, rc);
check_for_grabs (screen_info);
Olivier Fourdan
committed
mcs_setting_free (setting);
}
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/FocusNewWindow", CHANNEL1,
Olivier Fourdan
committed
&setting) == MCS_SUCCESS)
{
setBooleanValueFromInt ("focus_new", setting->data.v_int, rc);
mcs_setting_free (setting);
}
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/FocusRaise", CHANNEL1,
Olivier Fourdan
committed
&setting) == MCS_SUCCESS)
{
setBooleanValueFromInt ("raise_on_focus", setting->data.v_int, rc);
mcs_setting_free (setting);
}
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/RaiseDelay", CHANNEL1,
Olivier Fourdan
committed
&setting) == MCS_SUCCESS)
{
setIntValueFromInt ("raise_delay", setting->data.v_int, rc);
mcs_setting_free (setting);
}
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/RaiseOnClick", CHANNEL1,
Olivier Fourdan
committed
&setting) == MCS_SUCCESS)
{
setBooleanValueFromInt ("raise_on_click", setting->data.v_int, rc);
check_for_grabs (screen_info);
Olivier Fourdan
committed
mcs_setting_free (setting);
}
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/SnapToBorder", CHANNEL1,
Olivier Fourdan
committed
&setting) == MCS_SUCCESS)
{
setBooleanValueFromInt ("snap_to_border", setting->data.v_int, rc);
mcs_setting_free (setting);
}
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/SnapToWindows", CHANNEL1,
Olivier Fourdan
committed
&setting) == MCS_SUCCESS)
{
setBooleanValueFromInt ("snap_to_windows", setting->data.v_int,
rc);
mcs_setting_free (setting);
}
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/SnapWidth", CHANNEL1,
Olivier Fourdan
committed
&setting) == MCS_SUCCESS)
{
setIntValueFromInt ("snap_width", setting->data.v_int, rc);
mcs_setting_free (setting);
}
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/WrapWorkspaces", CHANNEL1,
Olivier Fourdan
committed
&setting) == MCS_SUCCESS)
{
setBooleanValueFromInt ("wrap_workspaces", setting->data.v_int, rc);
mcs_setting_free (setting);
}
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/WrapWindows", CHANNEL1,
Olivier Fourdan
committed
&setting) == MCS_SUCCESS)
{
setBooleanValueFromInt ("wrap_windows", setting->data.v_int, rc);
mcs_setting_free (setting);
}
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/WrapResistance", CHANNEL1,
Olivier Fourdan
committed
&setting) == MCS_SUCCESS)
{
setIntValueFromInt ("wrap_resistance", setting->data.v_int, rc);
mcs_setting_free (setting);
}
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/BoxMove", CHANNEL1,
Olivier Fourdan
committed
&setting) == MCS_SUCCESS)
{
setBooleanValueFromInt ("box_move", setting->data.v_int, rc);
mcs_setting_free (setting);
}
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/BoxResize", CHANNEL1,
Olivier Fourdan
committed
&setting) == MCS_SUCCESS)
{
setBooleanValueFromInt ("box_resize", setting->data.v_int, rc);
mcs_setting_free (setting);
}
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/DblClickAction", CHANNEL1,
Olivier Fourdan
committed
&setting) == MCS_SUCCESS)
{
setValue ("double_click_action", setting->data.v_string, rc);
mcs_setting_free (setting);
}
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/ThemeName", CHANNEL1,
Olivier Fourdan
committed
&setting) == MCS_SUCCESS)
{
setValue ("theme", setting->data.v_string, rc);
mcs_setting_free (setting);
}
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/ButtonLayout", CHANNEL1,
Olivier Fourdan
committed
&setting) == MCS_SUCCESS)
{
setValue ("button_layout", setting->data.v_string, rc);
mcs_setting_free (setting);
}
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/TitleAlign", CHANNEL1,
Olivier Fourdan
committed
&setting) == MCS_SUCCESS)
{
setValue ("title_alignment", setting->data.v_string, rc);
mcs_setting_free (setting);
}
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/TitleFont", CHANNEL1,
Olivier Fourdan
committed
&setting) == MCS_SUCCESS)
{
setValue ("title_font", setting->data.v_string, rc);
mcs_setting_free (setting);
}
Olivier Fourdan
committed
/* Margins channel */
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/LeftMargin", CHANNEL2,
Olivier Fourdan
committed
&setting) == MCS_SUCCESS)
{
setIntValueFromInt ("margin_left", setting->data.v_int, rc);
mcs_setting_free (setting);
}
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/RightMargin", CHANNEL2,
Olivier Fourdan
committed
&setting) == MCS_SUCCESS)
{
setIntValueFromInt ("margin_right", setting->data.v_int, rc);
mcs_setting_free (setting);
}
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/BottomMargin", CHANNEL2,
Olivier Fourdan
committed
&setting) == MCS_SUCCESS)
{
setIntValueFromInt ("margin_bottom", setting->data.v_int, rc);
mcs_setting_free (setting);
}
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/TopMargin", CHANNEL2,
Olivier Fourdan
committed
&setting) == MCS_SUCCESS)
{
setIntValueFromInt ("margin_top", setting->data.v_int, rc);
mcs_setting_free (setting);
}
Olivier Fourdan
committed
/* Workspaces channel */
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/WorkspaceCount", CHANNEL3,
Olivier Fourdan
committed
&setting) == MCS_SUCCESS)
{
setIntValueFromInt ("workspace_count", setting->data.v_int, rc);
mcs_setting_free (setting);
}
Olivier Fourdan
committed
/* Keyboard theme channel */
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/KeyThemeName", CHANNEL4,
&setting) == MCS_SUCCESS)
{
setValue ("keytheme", setting->data.v_string, rc);
mcs_setting_free (setting);
}
Olivier Fourdan
committed
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
/* Tweaks channel */
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/CycleMinimum", CHANNEL5,
&setting) == MCS_SUCCESS)
{
setBooleanValueFromInt ("cycle_minimum", setting->data.v_int, rc);
mcs_setting_free (setting);
}
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/CycleHidden", CHANNEL5,
&setting) == MCS_SUCCESS)
{
setBooleanValueFromInt ("cycle_hidden", setting->data.v_int, rc);
mcs_setting_free (setting);
}
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/EasyClick", CHANNEL5,
&setting) == MCS_SUCCESS)
{
setBooleanValueFromInt ("easy_click", setting->data.v_int, rc);
mcs_setting_free (setting);
}
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/FocusHint", CHANNEL5,
&setting) == MCS_SUCCESS)
{
setBooleanValueFromInt ("focus_hint", setting->data.v_int, rc);
mcs_setting_free (setting);
}
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/PlacementRatio", CHANNEL5,
&setting) == MCS_SUCCESS)
{
setIntValueFromInt ("placement_ratio", setting->data.v_int, rc);
mcs_setting_free (setting);
}
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/MoveOpacity", CHANNEL5,
&setting) == MCS_SUCCESS)
{
setIntValueFromInt ("move_opacity", setting->data.v_int, rc);
mcs_setting_free (setting);
}
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/ResizeOpacity", CHANNEL5,
&setting) == MCS_SUCCESS)
{
setIntValueFromInt ("resize_opacity", setting->data.v_int, rc);
mcs_setting_free (setting);
}
Olivier Fourdan
committed
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/PopupOpacity", CHANNEL5,
&setting) == MCS_SUCCESS)
{
setIntValueFromInt ("popup_opacity", setting->data.v_int, rc);
mcs_setting_free (setting);
}
Olivier Fourdan
committed
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/ShowFrameShadow", CHANNEL5,
&setting) == MCS_SUCCESS)
{
setBooleanValueFromInt ("show_frame_shadow", setting->data.v_int, rc);
mcs_setting_free (setting);
}
Olivier Fourdan
committed
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/ShowPopupShadow", CHANNEL5,
&setting) == MCS_SUCCESS)
{
setBooleanValueFromInt ("show_popup_shadow", setting->data.v_int, rc);
mcs_setting_free (setting);
}
Olivier Fourdan
committed
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/PreventFocusStealing", CHANNEL5,
&setting) == MCS_SUCCESS)
{
setBooleanValueFromInt ("prevent_focus_stealing", setting->data.v_int, rc);
mcs_setting_free (setting);
}
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/RaiseWithAnyButton", CHANNEL5,
&setting) == MCS_SUCCESS)
{
setBooleanValueFromInt ("raise_with_any_button", setting->data.v_int, rc);
check_for_grabs (screen_info);
mcs_setting_free (setting);
}
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/ScrollWorkspaces", CHANNEL5,
&setting) == MCS_SUCCESS)
{
setBooleanValueFromInt ("scroll_workspaces", setting->data.v_int, rc);
mcs_setting_free (setting);
}
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/ToggleWorkspaces", CHANNEL5,
&setting) == MCS_SUCCESS)
{
setBooleanValueFromInt ("toggle_workspaces", setting->data.v_int, rc);
mcs_setting_free (setting);
}
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/WrapLayout", CHANNEL5,
&setting) == MCS_SUCCESS)
{
setBooleanValueFromInt ("wrap_layout", setting->data.v_int, rc);
mcs_setting_free (setting);
}
if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/WrapCycle", CHANNEL5,
&setting) == MCS_SUCCESS)
{
setBooleanValueFromInt ("wrap_cycle", setting->data.v_int, rc);
mcs_setting_free (setting);
}
Olivier Fourdan
committed
}
}
GtkWidget *widget = NULL;
DisplayInfo *display_info = NULL;
Olivier Fourdan
committed
gchar *theme;
Olivier Fourdan
committed
XpmColorSymbol colsym[20];
Olivier Fourdan
committed
guint i;
Olivier Fourdan
committed
widget = myScreenGetGtkWidget (screen_info);
display_info = screen_info->display_info;
Olivier Fourdan
committed
rc[0].value = get_style (widget, "fg", "selected");
rc[1].value = get_style (widget, "fg", "insensitive");
Olivier Fourdan
committed
rc[2].value = get_style (widget, "fg", "normal");
rc[3].value = get_style (widget, "fg", "normal");
Olivier Fourdan
committed
rc[4].value = get_style (widget, "bg", "selected");
rc[5].value = get_style (widget, "light", "selected");
rc[6].value = get_style (widget, "dark", "selected");
rc[7].value = get_style (widget, "mid", "selected");
rc[8].value = get_style (widget, "bg", "normal");
rc[9].value = get_style (widget, "light", "normal");
rc[10].value = get_style (widget, "dark", "normal");
rc[11].value = get_style (widget, "mid", "normal");
rc[12].value = get_style (widget, "bg", "insensitive");
rc[13].value = get_style (widget, "light", "insensitive");
rc[14].value = get_style (widget, "dark", "insensitive");
rc[15].value = get_style (widget, "mid", "insensitive");
rc[16].value = get_style (widget, "bg", "normal");
rc[17].value = get_style (widget, "light", "normal");
Olivier Fourdan
committed
rc[18].value = get_style (widget, "dark", "normal");
rc[19].value = get_style (widget, "mid", "normal");
Olivier Fourdan
committed
theme = getThemeDir (getValue ("theme", rc), THEMERC);
parseRc (THEMERC, theme, rc);
Olivier Fourdan
committed
screen_info->params->shadow_delta_x =
abs (TOINT (getValue ("shadow_delta_x", rc)));
screen_info->params->shadow_delta_y =
abs (TOINT (getValue ("shadow_delta_y", rc)));
screen_info->params->shadow_delta_width =
abs (TOINT (getValue ("shadow_delta_width", rc)));
screen_info->params->shadow_delta_height =
abs (TOINT (getValue ("shadow_delta_height", rc)));
for (i = 0; i < 20; i++)
Olivier Fourdan
committed
{
Olivier Fourdan
committed
colsym[i].name = rc[i].option;
colsym[i].value = rc[i].value;
Olivier Fourdan
committed
}
Olivier Fourdan
committed
display_info->dbl_click_time = abs (TOINT (getValue ("dbl_click_time", rc)));
Olivier Fourdan
committed
g_value_init (&tmp_val, G_TYPE_INT);
if (gdk_setting_get ("gtk-double-click-time", &tmp_val))
display_info->dbl_click_time = abs (g_value_get_int (&tmp_val));
font = getValue ("title_font", rc);
if (font && strlen (font))
desc = pango_font_description_from_string (font);
if (desc)
Olivier Fourdan
committed
{
pango_font_description_free (desc);
}
}
if (screen_info->title_colors[ACTIVE].allocated)
{
gdk_colormap_free_colors (gdk_screen_get_rgb_colormap (screen_info->gscr),
&screen_info->title_colors[ACTIVE].col, 1);
screen_info->title_colors[ACTIVE].allocated = FALSE;
}
if (gdk_color_parse (rc[0].value, &screen_info->title_colors[ACTIVE].col))
{
if (gdk_colormap_alloc_color (gdk_screen_get_rgb_colormap (screen_info->gscr),
&screen_info->title_colors[ACTIVE].col, FALSE, FALSE))
{
screen_info->title_colors[ACTIVE].allocated = TRUE;
if (screen_info->title_colors[ACTIVE].gc)
Olivier Fourdan
committed
{
g_object_unref (G_OBJECT (screen_info->title_colors[ACTIVE].gc));
Olivier Fourdan
committed
}
screen_info->title_colors[ACTIVE].gc =
gdk_gc_new (myScreenGetGdkWindow (screen_info));
gdk_gc_copy (screen_info->title_colors[ACTIVE].gc, get_style_gc (widget,
Olivier Fourdan
committed
"text", "selected"));
gdk_gc_set_foreground (screen_info->title_colors[ACTIVE].gc,
&screen_info->title_colors[ACTIVE].col);
Olivier Fourdan
committed
}
else
{
gdk_beep ();
g_message (_("%s: Cannot allocate active color %s\n"), g_get_prgname (), rc[0].value);
Olivier Fourdan
committed
}
Olivier Fourdan
committed
gdk_beep ();
g_message (_("%s: Cannot parse active color %s\n"), g_get_prgname (), rc[0].value);
Olivier Fourdan
committed
{
g_object_unref (G_OBJECT (screen_info->black_gc));
Olivier Fourdan
committed
}
screen_info->black_gc = widget->style->black_gc;
g_object_ref (G_OBJECT (widget->style->black_gc));
Olivier Fourdan
committed
Olivier Fourdan
committed
{
g_object_unref (G_OBJECT (screen_info->white_gc));
Olivier Fourdan
committed
}
screen_info->white_gc = widget->style->white_gc;
g_object_ref (G_OBJECT (widget->style->white_gc));
Olivier Fourdan
committed
if (screen_info->title_colors[INACTIVE].allocated)
gdk_colormap_free_colors (gdk_screen_get_rgb_colormap (screen_info->gscr),
&screen_info->title_colors[INACTIVE].col, 1);
screen_info->title_colors[INACTIVE].allocated = FALSE;
if (gdk_color_parse (rc[1].value, &screen_info->title_colors[INACTIVE].col))
if (gdk_colormap_alloc_color (gdk_screen_get_rgb_colormap (screen_info->gscr),
&screen_info->title_colors[INACTIVE].col, FALSE, FALSE))
Olivier Fourdan
committed
{
screen_info->title_colors[INACTIVE].allocated = TRUE;
if (screen_info->title_colors[INACTIVE].gc)
Olivier Fourdan
committed
{
g_object_unref (G_OBJECT (screen_info->title_colors[INACTIVE].gc));
Olivier Fourdan
committed
}
screen_info->title_colors[INACTIVE].gc =
gdk_gc_new (myScreenGetGdkWindow (screen_info));
gdk_gc_copy (screen_info->title_colors[INACTIVE].gc,
Olivier Fourdan
committed
get_style_gc (widget, "text", "normal"));
gdk_gc_set_foreground (screen_info->title_colors[INACTIVE].gc,
&screen_info->title_colors[INACTIVE].col);
Olivier Fourdan
committed
}
else
{
gdk_beep ();
g_message (_("%s: Cannot allocate inactive color %s\n"), g_get_prgname (), rc[1].value);
Olivier Fourdan
committed
}
Olivier Fourdan
committed
gdk_beep ();
g_message (_("%s: Cannot parse inactive color %s\n"), g_get_prgname (), rc[1].value);
xfwmPixmapLoad (screen_info, &screen_info->sides[SIDE_LEFT][ACTIVE], theme,
Olivier Fourdan
committed
"left-active", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->sides[SIDE_LEFT][INACTIVE], theme,
Olivier Fourdan
committed
"left-inactive", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->sides[SIDE_RIGHT][ACTIVE], theme,
Olivier Fourdan
committed
"right-active", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->sides[SIDE_RIGHT][INACTIVE], theme,
Olivier Fourdan
committed
"right-inactive", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->sides[SIDE_BOTTOM][ACTIVE], theme,
Olivier Fourdan
committed
"bottom-active", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->sides[SIDE_BOTTOM][INACTIVE], theme,
Olivier Fourdan
committed
"bottom-inactive", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->corners[CORNER_TOP_LEFT][ACTIVE], theme,
Olivier Fourdan
committed
"top-left-active", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->corners[CORNER_TOP_LEFT][INACTIVE], theme,
Olivier Fourdan
committed
"top-left-inactive", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->corners[CORNER_TOP_RIGHT][ACTIVE], theme,
Olivier Fourdan
committed
"top-right-active", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->corners[CORNER_TOP_RIGHT][INACTIVE], theme,
Olivier Fourdan
committed
"top-right-inactive", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->corners[CORNER_BOTTOM_LEFT][ACTIVE], theme,
Olivier Fourdan
committed
"bottom-left-active", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->corners[CORNER_BOTTOM_LEFT][INACTIVE], theme,
Olivier Fourdan
committed
"bottom-left-inactive", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->corners[CORNER_BOTTOM_RIGHT][ACTIVE], theme,
Olivier Fourdan
committed
"bottom-right-active", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->corners[CORNER_BOTTOM_RIGHT][INACTIVE], theme,
Olivier Fourdan
committed
"bottom-right-inactive", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->buttons[HIDE_BUTTON][ACTIVE], theme,
Olivier Fourdan
committed
"hide-active", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->buttons[HIDE_BUTTON][INACTIVE], theme,
Olivier Fourdan
committed
"hide-inactive", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->buttons[HIDE_BUTTON][PRESSED], theme,
Olivier Fourdan
committed
"hide-pressed", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->buttons[CLOSE_BUTTON][ACTIVE], theme,
Olivier Fourdan
committed
"close-active", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->buttons[CLOSE_BUTTON][INACTIVE], theme,
Olivier Fourdan
committed
"close-inactive", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->buttons[CLOSE_BUTTON][PRESSED], theme,
Olivier Fourdan
committed
"close-pressed", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->buttons[MAXIMIZE_BUTTON][ACTIVE], theme,
Olivier Fourdan
committed
"maximize-active", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->buttons[MAXIMIZE_BUTTON][INACTIVE], theme,
Olivier Fourdan
committed
"maximize-inactive", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->buttons[MAXIMIZE_BUTTON][PRESSED], theme,
Olivier Fourdan
committed
"maximize-pressed", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->buttons[SHADE_BUTTON][ACTIVE], theme,
Olivier Fourdan
committed
"shade-active", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->buttons[SHADE_BUTTON][INACTIVE], theme,
Olivier Fourdan
committed
"shade-inactive", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->buttons[SHADE_BUTTON][PRESSED], theme,
Olivier Fourdan
committed
"shade-pressed", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->buttons[STICK_BUTTON][ACTIVE], theme,
Olivier Fourdan
committed
"stick-active", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->buttons[STICK_BUTTON][INACTIVE], theme,
Olivier Fourdan
committed
"stick-inactive", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->buttons[STICK_BUTTON][PRESSED], theme,
Olivier Fourdan
committed
"stick-pressed", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->buttons[MENU_BUTTON][ACTIVE], theme,
Olivier Fourdan
committed
"menu-active", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->buttons[MENU_BUTTON][INACTIVE], theme,
Olivier Fourdan
committed
"menu-inactive", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->buttons[MENU_BUTTON][PRESSED], theme,
Olivier Fourdan
committed
"menu-pressed", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->buttons[SHADE_BUTTON][T_ACTIVE], theme,
Olivier Fourdan
committed
"shade-toggled-active", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->buttons[SHADE_BUTTON][T_INACTIVE], theme,
Olivier Fourdan
committed
"shade-toggled-inactive", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->buttons[SHADE_BUTTON][T_PRESSED], theme,
Olivier Fourdan
committed
"shade-toggled-pressed", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->buttons[STICK_BUTTON][T_ACTIVE], theme,
Olivier Fourdan
committed
"stick-toggled-active", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->buttons[STICK_BUTTON][T_INACTIVE], theme,
Olivier Fourdan
committed
"stick-toggled-inactive", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->buttons[STICK_BUTTON][T_PRESSED], theme,
Olivier Fourdan
committed
"stick-toggled-pressed", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->buttons[MAXIMIZE_BUTTON][T_ACTIVE], theme,
Olivier Fourdan
committed
"maximize-toggled-active", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->buttons[MAXIMIZE_BUTTON][T_INACTIVE], theme,
Olivier Fourdan
committed
"maximize-toggled-inactive", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->buttons[MAXIMIZE_BUTTON][T_PRESSED], theme,
Olivier Fourdan
committed
"maximize-toggled-pressed", colsym, 20);
xfwmPixmapLoad (screen_info, &screen_info->title[TITLE_1][ACTIVE], theme,
Olivier Fourdan
committed
"title-1-active", colsym, 20);