mirror of
https://github.com/edeproject/ede.git
synced 2023-08-10 21:13:03 +03:00
Added applicator for global settings
This commit is contained in:
parent
99c4913b8c
commit
4705a79876
@ -16,7 +16,8 @@ SOURCE = evoke.cpp
|
|||||||
Xsm.cpp
|
Xsm.cpp
|
||||||
Logout.cpp
|
Logout.cpp
|
||||||
Autostart.cpp
|
Autostart.cpp
|
||||||
Xshutdown.cpp ;
|
Xshutdown.cpp
|
||||||
|
SettingsApplicator.cpp ;
|
||||||
|
|
||||||
CONFIG = ede-settings.conf
|
CONFIG = ede-settings.conf
|
||||||
ede-startup.conf ;
|
ede-startup.conf ;
|
||||||
|
83
evoke/SettingsApplicator.cpp
Normal file
83
evoke/SettingsApplicator.cpp
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Evoke, head honcho of everything
|
||||||
|
* Part of Equinox Desktop Environment (EDE).
|
||||||
|
* Copyright (c) 2007-2009 EDE Authors.
|
||||||
|
*
|
||||||
|
* This program is licensed under terms of the
|
||||||
|
* GNU General Public License version 2 or newer.
|
||||||
|
* See COPYING for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <edelib/XSettingsClient.h>
|
||||||
|
#include <edelib/Debug.h>
|
||||||
|
#include "SettingsApplicator.h"
|
||||||
|
|
||||||
|
EDELIB_NS_USING(XSettingsClient)
|
||||||
|
EDELIB_NS_USING(XSettingsAction)
|
||||||
|
EDELIB_NS_USING(XSettingsSetting)
|
||||||
|
EDELIB_NS_USING(XSETTINGS_ACTION_NEW)
|
||||||
|
EDELIB_NS_USING(XSETTINGS_ACTION_CHANGED)
|
||||||
|
EDELIB_NS_USING(XSETTINGS_ACTION_DELETED)
|
||||||
|
EDELIB_NS_USING(XSETTINGS_TYPE_INT)
|
||||||
|
|
||||||
|
static XSettingsClient* client = NULL;
|
||||||
|
static Display* client_display = NULL;
|
||||||
|
static int client_screen;
|
||||||
|
|
||||||
|
static void xsettings_cb(const char* name, XSettingsAction a, XSettingsSetting* s, void* data) {
|
||||||
|
if(!client)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(strcmp(name, "Bell/Volume") == 0 && s->type == XSETTINGS_TYPE_INT) {
|
||||||
|
XKeyboardControl kc;
|
||||||
|
|
||||||
|
kc.bell_percent = s->data.v_int;
|
||||||
|
XChangeKeyboardControl(client_display, KBBellPercent, &kc);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(strcmp(name, "Bell/Pitch") == 0 && s->type == XSETTINGS_TYPE_INT) {
|
||||||
|
XKeyboardControl kc;
|
||||||
|
|
||||||
|
kc.bell_pitch = s->data.v_int;
|
||||||
|
XChangeKeyboardControl(client_display, KBBellPitch, &kc);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(strcmp(name, "Bell/Duration") == 0 && s->type == XSETTINGS_TYPE_INT) {
|
||||||
|
XKeyboardControl kc;
|
||||||
|
|
||||||
|
kc.bell_duration = s->data.v_int;
|
||||||
|
XChangeKeyboardControl(client_display, KBBellDuration, &kc);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void xsettings_applicator_init(Display* dpy, int scr) {
|
||||||
|
/*
|
||||||
|
* make sure we set display first, because after 'init()' callback
|
||||||
|
* will be imediately called
|
||||||
|
*/
|
||||||
|
client_display = dpy;
|
||||||
|
client_screen = scr;
|
||||||
|
|
||||||
|
client = new XSettingsClient;
|
||||||
|
if(!client->init(dpy, scr, xsettings_cb, NULL)) {
|
||||||
|
delete client;
|
||||||
|
client = NULL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void xsettings_applicator_shutdown(void) {
|
||||||
|
delete client;
|
||||||
|
client = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void xsettings_applicator_process_event(const XEvent* xev) {
|
||||||
|
if(client)
|
||||||
|
client->process_xevent(xev);
|
||||||
|
}
|
26
evoke/SettingsApplicator.h
Normal file
26
evoke/SettingsApplicator.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Evoke, head honcho of everything
|
||||||
|
* Part of Equinox Desktop Environment (EDE).
|
||||||
|
* Copyright (c) 2007-2009 EDE Authors.
|
||||||
|
*
|
||||||
|
* This program is licensed under terms of the
|
||||||
|
* GNU General Public License version 2 or newer.
|
||||||
|
* See COPYING for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __SETTINGSAPPLICATOR_H__
|
||||||
|
#define __SETTINGSAPPLICATOR_H__
|
||||||
|
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Settings applicator are bunch of functions to run XSettingsClient
|
||||||
|
* and apply known settings.
|
||||||
|
*/
|
||||||
|
void xsettings_applicator_init(Display* dpy, int scr);
|
||||||
|
void xsettings_applicator_shutdown(void);
|
||||||
|
void xsettings_applicator_process_event(const XEvent* xev);
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue
Block a user