diff options
Diffstat (limited to 'gnome-settings-daemon')
85 files changed, 0 insertions, 13770 deletions
diff --git a/gnome-settings-daemon/.cvsignore b/gnome-settings-daemon/.cvsignore deleted file mode 100644 index a8958ede6..000000000 --- a/gnome-settings-daemon/.cvsignore +++ /dev/null @@ -1,8 +0,0 @@ -Makefile -Makefile.in -gnome-settings-daemon -GNOME_SettingsDaemon-common.c -GNOME_SettingsDaemon-skels.c -GNOME_SettingsDaemon-stubs.c -GNOME_SettingsDaemon.h -GNOME_SettingsDaemon.server diff --git a/gnome-settings-daemon/.indent.pro b/gnome-settings-daemon/.indent.pro deleted file mode 100644 index bdff07415..000000000 --- a/gnome-settings-daemon/.indent.pro +++ /dev/null @@ -1,2 +0,0 @@ --kr -i8 -pcs -lps -psl - diff --git a/gnome-settings-daemon/ChangeLog b/gnome-settings-daemon/ChangeLog deleted file mode 100644 index 57f3fd216..000000000 --- a/gnome-settings-daemon/ChangeLog +++ /dev/null @@ -1,1166 +0,0 @@ -2005-06-06 Rodrigo Moya <rodrigo@novell.com> - - * GNOME_Settings_Daemon.server.in: added name and description - to the object information. - -2005-06-05 Ronald S. Bultje <rbultje@ronald.bitfreak.net> - - * actions/Makefile.am: - * actions/acme-volume-gstreamer.c: - (acme_volume_gstreamer_set_mute), (update_state), - (acme_volume_gstreamer_get_mute), - (acme_volume_gstreamer_get_volume), - (acme_volume_gstreamer_set_volume): - Fix mute handling, particularly for devices without hardware - mute support or with applications that use volume=0 for mute. - Also fix the fact that we linked against all of ALSA, OSS and - GStreamer if they were all available; default to GStreamer. - Fixes #306036. - -2005-06-03 Anders Carlsson <andersca@imendio.com> - - * Makefile.am: - * clipboard-manager.c: - * clipboard-manager.h: - * list.c: - * list.h: - * xutils.c - * xutils.h: - Add clipboard manager files. - - * gnome-settings-daemon.c: (clipboard_manager_terminate_cb), - (clipboard_manager_event_filter), (clipboard_manager_watch_cb), - (finalize), (gnome_settings_daemon_new): - Use clipboard manager for persistent clipboard storage. - -2005-05-11 Sebastien Bacher <seb128@debian.org> - - * gnome-settings-xsettings.c: list "Gtk/MenuBarAccel", allow to - configure the menubar shortcut (Closes: #120859). - -2005-03-14 Kjartan Maraas <kmaraas@gnome.org> - - * gnome-settings-accessibility-keyboard.c: (set_server_from_gconf), - (set_gconf_from_server): Plug a couple of leaks. - -2005-02-17 Frederic Crozat <fcrozat@mandrakesoft.com> - - * gnome-settings-multimedia-keys.c: (do_www_action): - Don't set any url when starting browser. - -2005-02-09 Sebastien Bacher <seb128@debian.org> - - * gnome-settings-keyboard-xkb.c: (gnome_settings_chk_file_list): - patch by Kjartan Maraas <kmaraas@gnome.org> to fix a leak - (Closes: #166796). - -2005-02-03 Sergey V. Udaltsov <svu@gnome.org> - - * gnome-settings-keyboard-xkb.c: fix #165018 - -2005-02-01 Elijah Newren <newren@gmail.com> - - * gnome-settings-xmodmap.h: - * gnome-settings-xmodmap.c: - - Don't forget to use 'cvs add' in order to add new files to the - repository. :) (See #143487) - -2005-01-29 Shakti Sen <shprasad@novell.com> - - * gnome-settings-keyboard-xkb.c - (gnome_settings_keyboard_xkb_chk_lcl_xmm): Calls the modmap load - dialog. - * gnome-settings-daemon.c (gnome_settings_daemon_new): - Loads the modmap files. - * gnome-settings-xmodmap.h: Added newly - * gnome-settings-xmodmap.c: Also added newly which handles the modmap - settings. - * modmap-dialog.glade: Added newly. - - Solved bug #143487 - -2005-01-12 Sebastien Bacher <seb128@debian.org> - - * gnome-settings-accessibility-keyboard.c: (warning_dialog_post): - patch from John Spray <jcs116@york.ac.uk> to use the style described - in the HIG for the titles (Closes: #163653). - -2005-01-08 Sergey V. Udaltsov <svu@gnome.org> - - * gnome-settings-keyboard-xkb.c: fix #163299 - -2005-01-07 Sebastien Bacher <seb128@debian.org> - - * gnome-settings-mouse.c: (set_locate_pointer): add Mod2Mask and - Mod4Mask to the modifiers, fix the issue with Numlock activated - (Closes: #149383). - -2005-01-07 Sergey V. Udaltsov <svu@gnome.org> - - * gnome-settings-keyboard-xkb.c: optimization - only update the - configuration when necessary - -2005-01-04 Dennis Cranston <dennis_cranston@yahoo.com> - - * gnome-settings-multimedia-keys.c: (execute): use g_spawn_sync() - and g_spawn_async() to define the working directory. - -2004-12-25 Kjartan Maraas <kmaraas@gnome.org> - - * factory.c: (main): NULL vs. 0. - * gnome-settings-default-editor.c: (vfs_change_cb): Fix a test to - use the boolean instead of the return value from a void function. - This has been sitting in bugzilla forever and now other people start - adding comments to the code about it so I'm just going to commit. - * gnome-settings-keybindings.c: (binding_register_keys): ANSIfication. - -2004-12-24 Sergey V. Udaltsov <svu@gnome.org> - - * gnome-settings-keyboard-xkb.c: from now on, the applet only works as - indicator only - all the real stuff is in g-s-d - -2004-12-18 Sergey V. Udaltsov <svu@gnome.org> - - * gnome-settings-keyboard-xkb.c: reflect changes in libgswitchit - -2004-12-16 Bastien Nocera <hadess@hadess.net> - - * actions/acme-volume-alsa.c: (acme_volume_alsa_set_mute): mute - properly when the system has hardware mute, patch from Pierre Ossman - <drzeus-bugzilla@drzeus.cx> (Closes: #144489) - -2004-11-30 Sebastien Bacher <seb128@debian.org> - - * actions/acme-volume-gstreamer.c: - (acme_volume_gstreamer_finalize), (acme_volume_gstreamer_set_mute), - (acme_volume_gstreamer_get_mute), - (acme_volume_gstreamer_get_volume), - (acme_volume_gstreamer_set_volume), - (acme_volume_gstreamer_close_real), (acme_volume_gstreamer_open), - (acme_volume_gstreamer_close), (acme_volume_gstreamer_init): - free the alsa device, after 4 seconds, with gstreamer too. - Patch from Arnaud Patard <Arnaud Patard> (Closes: #141793). - -2004-11-30 Bastien Nocera <hadess@hadess.net> - - * gnome-settings-multimedia-keys.c: (do_exit_action): hack - to get the logout action working (Closes: #141472) - -2004-11-27 Sergey V. Udaltsov <svu@gnome.org> - - * gnome-settings-keyboard-xkb.c: support for xmodmap introduced - -2004-10-28 Kjartan Maraas <kmaraas@gnome.org> - - * gnome-settings-xrdb.c: (append_xresource_file), (apply_settings): - Don't nuke .Xdefaults when restarting g-s-d. Patch from Nick - Welch <mack at incise org>. Closes bug #127050. - -2004-10-21 Sebastien Bacher <seb128@debian.org> - - * gnome-settings-default-editor.c: (vfs_change_cb): - * gnome-settings-font.c: (load_cursor): - * gnome-settings-gtk1theme.c: (apply_settings): - * gnome-settings-keyboard.c: (apply_settings): - * gnome-settings-multimedia-keys.c: (init_kbd): - * gnome-settings-xsettings.c: (gnome_settings_xsettings_load): - patch by Thomas Cataldo <thomas.cataldo@aliacom.fr> to fix a bunch of - memory leaks (Closes: #150145). - -2004-10-14 Jody Goldberg <jody@gnome.org> - - * Release 2.8.1 - -2004-09-29 Bastien Nocera <hadess@hadess.net> - - * gnome-settings-multimedia-keys.c: (dialog_show): rework the - dialog_show so that the dialog is moved before it's shown, and - use gdk_display_sync() instead of a event looping to avoid - "reentrancy" problems when showing/hiding the dialog in fast - successions (Closes: #144490) - -2004-09-29 Bastien Nocera <hadess@hadess.net> - - * actions/acme-volume-gstreamer.c: (acme_volume_gstreamer_init): - better way to look for the volume track (patch by Michal Bukovjan - <bukovjan@mbox.dkm.cz>) (Closes: #153866) - -2004-09-27 Sergey V. Udaltsov <svu@gnome.org> - - * gnome-settings-keyboard-xkb.c: fix one GSwitchItXkbConfig memory - leak, spotted by kmaraas. - -2004-08-30 Carlos Garnacho Parro <carlosg@gnome.org> - - * gnome-settings-multimedia-keys.c: applied patch from Pierre Ossman - <drzeus-bugzilla@drzeus.cx> to display the volume dialog in the - correct place. Fixes #144490 - -2004-08-22 Jeroen Zwartepoorte <jeroen@xs4all.nl> - - * actions/acme-fb-level.c: Use the parent type in the G_DEFINE_TYPE - macro, not its own type (fixes rh #130473). - -2004-07-16 Bastien Nocera <hadess@hadess.net> - - * actions/acme-volume-alsa.c: (acme_volume_alsa_finalize), - (acme_volume_alsa_close_real), (acme_volume_alsa_open), - (acme_volume_alsa_init): fix a crash when there aren't any ALSA mixers - (or soundcards) present on the system - -2004-07-15 Bastien Nocera <hadess@hadess.net> - - * actions/acme-volume-oss.c: fix OSS compilation on NetBSD - -2004-07-15 Bastien Nocera <hadess@hadess.net> - - * actions/acme-volume-alsa.c: (acme_volume_alsa_finalize), - (acme_volume_alsa_set_mute), (acme_volume_alsa_get_mute), - (acme_volume_alsa_get_volume), (acme_volume_alsa_set_volume), - (acme_volume_alsa_close_real), (acme_volume_alsa_open), - (acme_volume_alsa_close), (acme_volume_alsa_init): - rework the ALSA mixer so that: - - the ALSA device isn't kept open at all times, only for 4 seconds - after the last use (Closes: #141793) - - the hardware mute is used if it is available - (Closes: #141404, #144489, #140937) - - lowering the volume doesn't move the balance to the right - - it doesn't leak alsa-lib mixers all around - -2004-06-18 Crispin Flowerday <gnome@flowerday.cx> - - * gnome-settings-xsettings.c: Translate the menus_have_icons - gconf key to the MenuImages xsetting (Closes bug #144201) - -2004-06-18 Bastien Nocera <hadess@hadess.net> - - * actions/acme-volume.c: make AcmeVolume descend of a GObject, not - itself (spotted by Mariano Suárez-Alvarez <mariano@gnome.org>) - -2004-06-15 Bastien Nocera <hadess@hadess.net> - - * actions/acme-fb-level.c: (acme_fblevel_init): - * actions/acme-volume-alsa.c: (acme_volume_alsa_init), - (acme_volume_alsa_class_init): - * actions/acme-volume-gstreamer.c: (acme_volume_gstreamer_init): - * actions/acme-volume-oss.c: (acme_volume_oss_init), - (acme_volume_oss_class_init): - * actions/acme-volume.c: (acme_volume_class_init), - (acme_volume_init): cleanups, and warning fixes - -2004-04-15 Jody Goldberg <jody@gnome.org> - - * Release 2.6.1 - -2004-03-11 Chris Lahey <clahey@rigger.boston.ximian.com> - - * gnome-settings-background.c (applier_idle): Made this delay by a - tenth of a second. This seems to make it not reload the - background more than once. - -2004-04-01 Jody Goldberg <jody@gnome.org> - - * Release 2.6.0.3 - -2004-03-30 Jody Goldberg <jody@gnome.org> - - * Release 2.6.0.1 - -2004-03-23 Jody Goldberg <jody@gnome.org> - - * Release 2.6.0 - -2004-03-16 Jody Goldberg <jody@gnome.org> - - * gnome-settings-multimedia-keys.c (acme_error) : don't run a main - loop in a situation where bonobo main still be initializing. - -Fri Mar 12 20:15:28 2004 Jonathan Blandford <jrb@gnome.org> - - * gnome-settings-xsettings.c: Add the FileChooserBackend as an - xsetting. - -2004-03-11 Jody Goldberg <jody@gnome.org> - - * Release 2.5.4 - -2004-03-01 Bastien Nocera <hadess@hadess.net> - - * actions/acme-volume-gstreamer.c: - (acme_volume_gstreamer_class_init): initialise GStreamer if we - want to use it ;) (Patch by Christophe Fergeau - <teuf@users.sourceforge.net>) (Closes: #131316) - -2004-02-29 Bastien Nocera <hadess@hadess.net> - - * actions/acme-volume-alsa.c: (acme_volume_alsa_get_volume), - (acme_volume_alsa_set_volume): better ALSA volume steps, using - rounding up rather than normal float to int casting - (Closes: #124741) - -2004-02-25 Bastien Nocera <hadess@hadess.net> - - * actions/Makefile.am: - * actions/acme-volume-gstreamer.[ch]: - * actions/acme-volume.c: (acme_volume_class_init), - (acme_volume_new): add GStreamer mixer support - -2004-02-24 Mariano Suárez-Alvarez <mariano@gnome.org> - - * gnome-settings-accessibility-keyboard.c - (ax_slowkeys_warning_dialog_post) : fix a typo in a variable name, bug - #134699. - -2004-02-16 Jody Goldberg <jody@gnome.org> - - * gnome-settings-accessibility-keyboard.c - (ax_slowkeys_warning_dialog_post) : fix cut-n-paste-o in the message - -2004-02-16 Jody Goldberg <jody@gnome.org> - - * gnome-settings-accessibility-keyboard.c : include - libgnome/gnome-help.h to avoid potential crash on 64 bit arches. - (ax_response_callback) : actually display the error message on - failure. - -2004-02-15 Anders Carlsson <andersca@gnome.org> - - * actions/Makefile.am: Link with ALSA_LIBS. - -2004-02-13 Jody Goldberg <jody@gnome.org> - - * Release 2.5.3 - -2004-02-12 Mark McLoughlin <mark@skynet.ie> - - * gnome-settings-accessibility-keyboard.c: (ax_response_callback): Update - help link to point to user-guide.xml - -Mon Jan 19 11:49:03 2004 Jonathan Blandford <jrb@gnome.org> - - * gnome-settings-xsettings.c (gnome_xft_settings_get): Set the - correct default dpi. - -2004-01-16 Christophe Merlet <redfox@redfoxcenter.org> - - * Makefile.am: Add DESTDIR variable in install-data-hook section. - -2004-01-15 Bastien Nocera <hadess@hadess.net> - - * gnome-settings-multimedia-keys.c: fix locating the - pixmaps when compiling with a prefix not ending in '/' - -2004-01-14 Bastien Nocera <hadess@hadess.net> - - * Makefile.am: - * gnome-settings-multimedia-keys.c: fix build on Linux/PPC machines - (the only ones to use the FB-Level code) - -2004-01-14 Jody Goldberg <jody@gnome.org> - - * Release 2.5.2 - -2004-01-14 Bastien Nocera <hadess@hadess.net> - - * Makefile.am: fix compilation with FB Level enabled - * actions/acme.h: fix a stupid typo that made the WWW key not work - * gnome-settings-multimedia-keys.c: (acme_get_screen_from_event), - (acme_filter_events), (gnome_settings_multimedia_keys_init): - only get the current screen if we actually need to, fix locating the - glade file when compiling with a prefix not ending in '/' - -2004-01-13 Bastien Nocera <hadess@hadess.net> - - * gnome-settings-multimedia-keys.c: (acme_filter_events): let's - simplify some code - -Tue Jan 13 10:48:57 2004 Jonathan Blandford <jrb@gnome.org> - - * gnome-settings-daemon: Merge in acme. We now have a variety of - actions for the keybinding capplet. - -2004-01-12 Federico Mena Quintero <federico@ximian.com> - - * gnome-settings-accessibility-keyboard.c - (ax_stickykeys_warning_dialog_post): Fix ; -> , typo. - -2004-01-10 Bill Haneman <billh@gnome.org> - - * gnome-settings-accessibility-keyboard.c: - Removed we_are_changing_xkb_state flag and related logic, since it - didn't work anyway (due to async processing). - (set_bool): Fix a logic error that resulted in set_bool always - returning TRUE. - (ax_warning_dialog_post): New, creates/posts a warning dialog (below). - (ax_stickykeys_warning_dialog_post, ax_slowkeys_warning_dialog_post): - New functions, display warning dialog to user alerting them - when an AccessX feature (StickyKeys or SlowKeys) is turned on via - a keyboard shorcut. See bug #105093. - (ax_slowkeys_response, ax_stickykeys_response, ax_response_callback): - New, these callbacks either dismiss the dialog, post help, or - revert the XKB change and dismiss the dialog(s). - (set_gconf_from_server): - Invoke dialog above if the Xkb setting for SlowKeys or StickyKeys - has changed in isolation, independent of the gconf setting. This - indicates that a keyboard shortcut has been invoked. - - * ../po/POTFILES.in: - Added gnome-settings-accessibility-keyboard.c, since we now - have translatable strings in the warning dialog (above). - -2004-01-09 Jody Goldberg <jody@gnome.org> - - * Makefile.am : simplify and generate the file at the last possible - instant. CLickety Click, no mor eworries about tmp files. - * GNOME_SettingsDaemon.server.in: restore - * GNOME_SettingsDaemon.server.in.in: remove - -2004-01-08 Glynn Foster <glynn.foster@sun.com> - - * GNOME_SettingsDaemon.server.in: Remove from CVS since it's - a generated file. - -2003-12-30 Jody Goldberg <jody@gnome.org> - - * Release 2.5.1.1 - -2003-12-30 Jody Goldberg <jody@gnome.org> - - * Makefile.am (EXTRA_DIST) : don't ship the generated files - -2003-12-30 Jody Goldberg <jody@gnome.org> - - * Release 2.5.1 - -2003-12-19 Diego Gonzalez Gonzalez <diego@pemas.net> - - * Makefile.am: install gnome-settings-daemon in the libexec - directory - * GNOME_SettingsDaemon.server.in.in: new file that contains - the new locations where the gnome-settings-daemon is to be - found. - -2003-11-13 Marco Pesenti Gritti <marco@gnome.org> - - * gnome-settings-xsettings.c: - - Add a setting for gtk icon theme. - -2003-10-28 Jody Goldberg <jody@gnome.org> - - * Release 2.5.0 - -Fri Aug 1 14:51:02 2003 Jonathan Blandford <jrb@redhat.com> - - * gnome-settings-mouse.c (set_locate_pointer): move declarations - around. Patch from Damien Carbery <damien.carbery@sun.com>, - #118860 - -Thu Jul 31 14:22:38 2003 Jonathan Blandford <jrb@redhat.com> - - * gnome-settings-xsettings.c (translate_string_string_toolbar): - Patch from Anders Carlsson to special case "both-horiz". - -Thu Jul 31 14:06:51 2003 Jonathan Blandford <jrb@redhat.com> - - * gnome-settings-mouse.c: Patch from Satyajit Kanungo - <satyajit.kanungo@wipro.com> to make locate pointer work in - a multi-screen environment. - -2003-07-17 Richard Hult <richard@imendio.com> - - * gnome-settings-typing-break.c (setup_typing_break): Start with - -n to avoid the warning about notification area. - (gnome_settings_typing_break_init): Fix a warning. - -2003-07-07 Jody Goldberg <jody@gnome.org> - - * Release 2.3.4 - -2003-07-03 Bastien Nocera <hadess@hadess.net> - - * gnome-settings-keybindings.c: (get_screens_list), - (screen_exec_display_string), (grab_key), (do_grab), - (gnome_settings_keybindings_load): grab keys on all the screens for the - current display - -Thu Jun 26 07:37:20 2003 Jonathan Blandford <jrb@gnome.org> - - * gnome-settings-typing-break.c: new module to handle the - typing-break-monitor. - -2003-06-24 Jody Goldberg <jody@gnome.org> - - * Release 2.3.3 - -2003-06-12 Michael Meeks <michael@ximian.com> - - * Makefile.am: Make IDL compile depend on compiler too. - -Mon Jun 2 13:23:25 2003 Jonathan Blandford <jrb@redhat.com> - - * gnome-settings-xrdb.c (append_xresources): Patch from Jens - Granseuer <jensgr@gmx.net> to fix on non-C99 compilers. - -2003-05-07 Jody Goldberg <jody@gnome.org> - - * Release 2.3.1 - -2003-05-07 Jody Goldberg <jody@gnome.org> - - * xrdb/Makefile.am (EXTRA_DIST) : EXTRA_DIST the data files - -2003-05-02 Ross Burton <ross@burtonini.com> - - * gnome-settings-xrdb.c (scan_for_files): - If ~/.gnome2/xrdb doesn't exist, don't stop. - - * xrdb/.cvsignore: - Added. - -2003-05-02 Ross Burton <ross@burtonini.com> - - * xrdb/Makefile.am (xrdbdir): - $(datadir) is lowercase not uppercase! :( - -2003-05-01 Ross Burton <ross@burtonini.com> - - * gnome-settings-xrdb.[ch]: - Using the current GTK+ theme as a base for colours, set a bunch of - properties in the X resource database. And as if by magic, legacy - apps (Xaw, Tk, Motif) match GNOME! - - * xrdb/*.ad: - Data files for above. - -Thu Feb 6 16:43:33 2003 Jonathan Blandford <jrb@redhat.com> - - * gnome-settings-font.c (load_xcursor_theme): handle xcursor so - that we support Xcursor files. - - * gnome-settings-daemon.c: move - gnome_settings_daemon_spawn_with_input here so multiple modules - can use it. - -Tue Feb 4 17:09:18 2003 Jonathan Blandford <jrb@redhat.com> - - * Release 2.2.0.1 - -Tue Jan 21 01:15:14 2003 Jonathan Blandford <jrb@gnome.org> - - * Release 2.2.0 - -2003-01-19 Alex Duggan <aldug@astrolinux.com> - - * gnome-settings-mouse.c (filter), (set_locate_pointer): - make the right control key also locate the mouse pointer. - Fixes #87426 - -Thu Jan 16 02:41:09 2003 Jonathan Blandford <jrb@gnome.org> - - * Release 2.1.7 - -2003-01-10 Jody Goldberg <jody@gnome.org> - - * Release 2.1.6 - -2002-12-18 Jody Goldberg <jody@gnome.org> - - * Release 2.1.5 - -2002-11-23 Jody Goldberg <jody@gnome.org> - - * Release 2.1.3 - -2002-11-08 Mark McLoughlin <mark@skynet.ie> - - Create a XSettingsManager for every available - screen and apply settings changes to each. - - * gnome-settings-daemon.c: - (manager_event_filter): make this a per-window filter - and ask the appropriate xsettings manager to filter - the event. - (finalize): dispose of every manager. - (gnome_settings_daemon_new): create a settings manager - for each screen. - - * gnome-settings-xsettings.c: - (translate_bool_int), (translate_int_int), - (translate_string_string), (process_value), - (xsettings_callback), (xft_callback), - (gnome_xft_settings_set_xsettings), - (gnome_settings_xsettings_load): apply settings to - every available settings manager. - -2002-11-02 Jody Goldberg <jody@gnome.org> - - * Release 2.1.2 - -2002-10-31 Jody Goldberg <jody@gnome.org> - - * gnome-settings-accessibility-keyboard.c - (gnome_settings_accessibility_keyboard_init) : register the gconf - handler early. - (gnome_settings_accessibility_keyboard_load) : not here where it is - too late. - -2002-10-26 Havoc Pennington <hp@pobox.com> - - * gnome-settings-wm.c, gnome-settings-wm.h: blow this away - - * gnome-settings-daemon.c: don't init WM stuff - -Sun Oct 27 09:00:46 2002 Jonathan Blandford <jrb@gnome.org> - - * gnome-settings-xsettings.c: add Gtk/CanChangeAccels to xsettings - -2002-10-21 Jody Goldberg <jody@gnome.org> - - * Release 2.1.1 - -2002-02-07 Anders Carlsson <andersca@gnu.org> - - * gdk/x11/xsettings-common.c (xsettings_setting_free): Free - the setting name. - -2002-10-20 Mark McLoughlin <mark@skynet.ie> - - * factory.c: (main): don't connect to the session manager. - -2002-10-18 Erwann Chenede - <erwann.chenede@sun.com> - - * gnome-settings-keybindings.c - (screen_exec_display_string) : added function to get display - string from an XEvent. - (keybindings_filter) : set a fully qualified DISPLAY env variable - when spawing a keybinding action. - -2002-10-08 Jody Goldberg <jody@gnome.org> - - http://bugzilla.gnome.org/show_bug.cgi?id=91535 - * gnome-settings-sound.c : as michael points out it is silly to start - the daemon just so that we can stop it. Dunno much about esound - code so the funky logic is left untouched. - -2002-10-08 Jody Goldberg <jody@gnome.org> - - http://bugzilla.gnome.org/show_bug.cgi?id=95179 - * gnome-settings-accessibility-keyboard.c - (gnome_settings_accessibility_keyboard_init) : do nothing here. - (gnome_settings_accessibility_keyboard_load) : install the filter - here, _after_ loading the gconf settings. - (set_gconf_from_server) : check to see if anything has actually - changed before sending off the changeset. - -2002-10-01 Jody Goldberg <jody@gnome.org> - - * Release 2.1.0.1 - -Tue Sep 24 15:47:29 2002 HideToshi Tajima <hidetoshi.tajima@sun.com> - - disable/enable preedit/status in GtkIMContextXIM (#59076) - - * gnome-settings-xsettings.c: added two new xsettings - for GTK+ input method preedit and status styles. - - With the other patch for gtk+, the preedit and status styles of - GTK+ input method are configurable with associated gconf schemas - keys: - "/desktop/gnome/interface/gtk-im-preedit-style" - "/desktop/gnome/interface/gtk-im-status-style" - - Both are set to "callback" by default, and platform's - packging can have different default by changing - libgnome's desktop_gnome_interface.schemas. - -2002-09-11 Jody Goldberg <jody@gnome.org> - - * gnome-settings-accessibility-keyboard.c (set_server_from_gconf) : - set the timeout options fully. - -2002-09-10 Jody Goldberg <jody@gnome.org> - - * gnome-settings-wm.c (gnome_settings_wm_load) : protect against NULL. - -2002-09-09 Jody Goldberg <jody@gnome.org> - - http://bugzilla.gnome.org/show_bug.cgi?id=91223 - * gnome-settings-wm.c (gnome_settings_wm_load) : add some valdation to - ensure that we don't set the number of workspaces to 0 - (which pisses off kde). Also apply fcrozat's patch to restore the - names. - - * gnome-settings-accessibility-keyboard.c (set_server_from_gconf) : - the feature beep is not related the the feature timeout. - -2002-08-21 Jody Goldberg <jody@gnome.org> - - * Release 2.1.0 - -2002-08-15 Jody Goldberg <jody@gnome.org> - - http://bugzilla.gnome.org/show_bug.cgi?id=90778 - * gnome-settings-accessibility-keyboard.c (set_gconf_from_server) : - Add a heuristic so that we do not disable features in gconf just - because they are disabled in the X server. If the master switch is - already disabled in gconf we can guess that most of the time it - means that people want to keep their flags. - -2002-08-14 Jody Goldberg <jody@gnome.org> - - http://bugzilla.gnome.org/show_bug.cgi?id=90778 - * gnome-settings-default-editor.c (vfs_change_cb) : be more careful - -2002-08-07 Michael Meeks <michael@ximian.com> - - * gnome-settings-sound.c (stop_esd): flag that - we scuppered the remote daemon. - (apply_settings): resume it if we killed it, - don't kill it more than once. - Don't iterate over all the sounds and try to - push to the server if we have sound disabled, - saves a chunk of time. - This fixes the 'toggle sound a lot breaks it' bug. - -2002-08-03 Jody Goldberg <jody@gnome.org> - - http://bugzilla.gnome.org/show_bug.cgi?id=88634 - * gnome-settings-mouse.c (set_left_handed) : merge in a variant of the - proposed patch. - -2002-07-27 Mark McLoughlin <mark@skynet.ie> - - Add multiscreen support for background rendering. - - * gnome-settings-background.c: - (background_callback): apply prefs to all screens. - (gnome_settings_background_init): create a BGApplier for - each screen. - (gnome_settings_background_load): apply prefs to all - screens. - -2002-07-22 jacob berkman <jacob@ximian.com> - - * gnome-settings-background.c (gnome_settings_background_load): if - nautilus is drawing the desktop, just return - -2002-06-19 jacob berkman <jacob@ximian.com> - - * Makefile.am: fix build - -2002-06-17 Jody Goldberg <jody@gnome.org> - - * Release 2.0.0 - -2002-06-17 Jody Goldberg <jody@gnome.org> - - http://bugzilla.gnome.org/show_bug.cgi?id=85327 - * gnome-settings-xsettings.c (translate_string_string) : These strings - do look wrong. The capplet is setting the keys from the schema. - we were not mapping them to the write xsettings. It did not really - matter because we were not using xsettings to communicate these - values. - -2002-06-10 Jody Goldberg <jody@gnome.org> - - * gnome-settings-accessibility-keyboard.c (set_server_from_gconf) : - add some bounds checking. - -2002-06-06 Kjartan Maraas <kmaraas@gnome.org> - - * gnome-settings-keybindings.c: Make the last string consistent - with the rest in this file. - -2002-06-06 Erwann Chenede - <erwann.chenede@sun.com> - - * gnome-settings-keybindings.c (keybindings_filter) : - do not quit gnome-settings-daemon when pressing Ok - when the warning dialog appears. fix bug #84364 - Added localization hooks. - -2002-05-30 Jody Goldberg <jody@gnome.org> - - * gnome-settings-keyboard.c (xkb_set_keyboard_autorepeat_rate) : Add - some bounds checking. - -Wed May 29 20:23:13 2002 Jonathan Blandford <jrb@redhat.com> - - * Makefile.am: Add gnome-settings-keybinding - * gnome-settings-daemon.c: (gnome_settings_daemon_new): initialize - keybindings support - * gnome-settings-keybindings.[ch]: Patch to add support for custom - keybindings. Thanks to Erwann Chenede <Erwann.Chenede@sun.com> - for the patch. - -2002-05-22 Jody Goldberg <jody@gnome.org> - - * gnome-settings-accessibility-keyboard.c (set_server_from_gconf) : - disable some debug spew. - (set_gconf_from_server) : ditto. - -2002-05-22 jacob berkman <jacob@ximian.com> - - * gnome-settings-font.c (load_cursor): run the mkfontdir command - synchronously to avoid a possible race. extra precaution for - #78023 - - * gnome-settings-daemon.c (gnome_settings_daemon_new): run - background settings after everything else, as some of those spawn - processes (xscreensaver) and background settings nices itself - - should fix #78742 - - * factory.c (main): quit when we get the die signal from the SM - -2002-05-16 Jody Goldberg <jody@gnome.org> - - http://bugzilla.gnome.org/show_bug.cgi?id=80325 - * gnome-settings-keyboard.c (apply_settings) : although we may not be - able to support the autorepeat rate setting we can enable/disable - autorepeat. - -2002-05-16 jacob berkman <jacob@ximian.com> - - * gnome-settings-keyboard.c (apply_settings): load from the - correct key for whether the bell should be on or not - (apply_settings): pass the right flags to XChangeKeyboardControl() - - fixes #78016 and 78015 - - * Makefile.am: - * gnome-settings-default-editor.[ch]: keep text/plain and text* - using the same mime type (#78037) - - * gnome-settings-daemon.c (gnome_settings_daemon_new): load editor - and keyboard settings (bugs #78037 and #78016) - -Tue May 14 14:50:34 2002 Jonathan Blandford <jrb@redhat.com> - - * gnome-settings-*.c: Remove all debug print statements, #76085 - -Mon May 13 17:05:22 2002 Jonathan Blandford <jrb@redhat.com> - - * gnome-settings-font.c (load_cursor): s/.gnome/.gnome2/g - -2002-05-12 Anders Carlsson <andersca@gnu.org> - - * gnome-settings-xsettings.c: - Watch the dnd threshold xsetting. - -2002-04-30 Kjartan Maraas <kmaraas@gnome.org> - - * factory.c: Add calls to bindtext* for i18n. - * Makefile.am: Add -DGNOMELOCALEDIR="\".....\"" - * gnome-settings-font.c: Mark strings and add #includes. - * gnome-settings-screensaver.c: Same - * gnome-settings-sound.c: Same. - * gnome-settings-xsettings.c: Same. - * gnome-settings-wm.c: Fix a warning. - -2002-04-24 Jody Goldberg <jody@gnome.org> - - * gnome-settings-accessibility-keyboard.c (set_server_from_gconf) : - max speed is in pixels per _event_ not relative to time. double - check that we don't set 0. - -2002-04-24 Jody Goldberg <jody@gnome.org> - - * gnome-settings-accessibility-keyboard.c - (gnome_settings_accessibility_keyboard_init) : we're only interested - in control changes. - (set_gconf_from_server) : set both XkbAccessXKeysMask|XkbAccessXFeedbackMask - when we enable accessX, and fix typo. - -2002-04-23 Jody Goldberg <jody@gnome.org> - - * gnome-settings-accessibility-keyboard.c (get_xkb_desc_rec) : - suppress warning. - -2002-04-17 Rachel Hestilow <hestilow@ximian.com> - - * GNOME_SettingsDaemon.server.in: s/gnome2/gnome - -Tue Apr 16 17:09:02 2002 Jonathan Blandford <jrb@redhat.com> - - * factory.c (main): Patch from Akira Tagoh <tagoh@gnome-db.org> to - change the restart command from gnome2-settings-daemon to - gnome-settings-daemon. - -2002-04-12 Jody Goldberg <jody@gnome.org> - - * gnome-settings-accessibility-keyboard.c (set_server_from_gconf) : - Doh! We need to clear the flags if they are disabled. - -2002-04-11 jacob berkman <jacob@ximian.com> - - * gnome-settings-accessibility-keyboard.c: only do xkb calls if - xkb is present (better fix for previous commit) - -2002-04-11 Jody Goldberg <jody@gnome.org> - - * gnome-settings-accessibility-keyboard.c (set_server_from_gconf) : be - even more anal. - -2002-04-10 Jody Goldberg <jody@gnome.org> - - * Makefile.am (gnome_settings_daemon_LDADD) : remove XF86MISC_LIBS - -2002-04-01 Jody Goldberg <jody@gnome.org> - - http://bugzilla.gnome.org/show_bug.cgi?id=77203 - * gnome-settings-accessibility-keyboard.c (set_gconf_from_server) : be - more anal about server failure. - (set_server_from_gconf) : ditto. - -2002-03-30 Jody Goldberg <jody@gnome.org> - - * gnome-settings-xsettings.c (translations) : reorder to match gdk. - This simplifies maintenance. - -Tue Apr 9 11:58:10 2002 Jonathan Blandford <jrb@gnome.org> - - * Makefile.am: Add commented out disk support until I finish the code. - -2002-04-04 jacob berkman <jacob@ximian.com> - - * gnome-settings-accessibility-keyboard.c (set_server_from_gconf): - prefer gdk_flush() to XFlush() (fixes bug #77208) - -2002-03-29 Jody Goldberg <jody@gnome.org> - - * gnome-settings-accessibility-keyboard.c - (gnome_settings_accessibility_keyboard_init) : get really anal about - potential X errors. - (set_gconf_from_server) : ditto. - -2002-03-29 Jody Goldberg <jody@gnome.org> - - * gnome-settings-accessibility-keyboard.c (set_server_from_gconf) : - Add a gdk_error_trap just in case. - - * gnome-settings-keyboard.c (apply_settings) : don't init things to - bogus values unless it is ncessary. Add a gdk_error_trap around the - X settings to avoid causing the server to exit if something goes - wrong. Be sure to flush before we pop the handler. - - * gnome-settings-accessibility-keyboard.c (set_server_from_gconf) : - fix spelling error in schema. - - * gnome-settings-font.c (load_cursor) : add missing NULL terminator. - - * gnome-settings-keyboard.c (apply_settings) : click volume is an - integer from 0..100, schema is an int too. Remove float and double - and add some bounds checking. - - * gnome-settings-accessibility-keyboard.c : make the debug spew optional - (set_server_from_gconf) : typo that only applied settings when we - shouldn't. - (set_server_from_gconf) : set the mouse key accel flag when mk is - enabled so that we can actually set the accel parms. How did this - work in X11R6 ? - (set_server_from_gconf) : scale mk_time_to_max by mk_interval so that - it is actually in msec. - (set_gconf_from_server) : do the inverse here. - -2002-03-28 jacob berkman <jacob@ximian.com> - - * gnome-settings-accessibility-keyboard.c (set_server_from_gconf): - fix a typo - -Thu Mar 28 09:18:40 2002 Jonathan Blandford <jrb@redhat.com> - - * gnome-settings-daemon.c: somehow the font settings were - removed. Re add. - -2002-03-26 jacob berkman <jacob@ximian.com> - - * gnome-settings-screensaver.[ch] - (gnome_settings_screensaver_load): start xscreensaver, and display - an error dialog if it failed - - * gnome-settings-daemon.c (gnome_settings_daemon_new): init/load - screensaver - -2002-03-25 jacob berkman <jacob@ximian.com> - - * factory.c (main): tell the SM to restart us only after we know - we're unique with bonobo-activation - -2002-03-17 Jonathan Blandford <jrb@redhat.com> - - * gnome-settings-xsettings.c: Add keybindingtheme - -2002-03-17 Kjartan Maraas <kmaraas@gnome.org> - - * factory.c: Move include <config.h> to the top. - -2002-03-13 jacob berkman <jacob@ximian.com> - - * gnome-settings-daemon.c (_GnomeSettingsDaemonPrivate): add a - dummy field - (gnome_settings_daemon_register_callback): cast functions to - gpointers as forte does not like this (bug #74349) - -2002-03-07 Lauris Kaplinski <lauris@ximian.com> - - * gnome-settings-keyboard.c (apply_settings): Use correct GConf keys, - click volume is of type float, not int - -2002-03-10 Seth Nickell <snickell@stanford.edu> - - * GNOME_SettingsDaemon.server.in: - - Dum de dum. Forgot to cvs add. - -2002-03-10 Seth Nickell <snickell@stanford.edu> - - Make the settings daemon a singleton BonoboObject so capplets - can detect whether its running and activate it if its not. - - * Makefile.am: - * factory.c: (main): - * gnome-settings-daemon.c: (awake_impl), (finalize), - (gnome_settings_daemon_class_init), (gnome_settings_daemon_init), - (gnome_settings_daemon_new): - * gnome-settings-daemon.h: - - Convert the settings-daemon into a BonoboObject and add code to - register it with bonobo-activation. Still has a main loop that can - be run normally to launch the settings daemon. - -2002-03-06 Miles Lane <miles@megapathdsl.net> - - * gnome-settings-daemon.c -- Correct the gnome_program_init() - call to specify the correct program name. Specify the - restart command, so that the session manager knows how - to restart the daemon if it is killed for any reason. - -2002-03-04 Anders Carlsson <andersca@gnu.org> - - * Makefile.am: - * gnome-settings-daemon.c: (main): - * gnome-settings-wm.c: (set_number_of_workspaces), - (set_workspace_names), (wm_callback), (gnome_settings_wm_init), - (gnome_settings_wm_load): - * gnome-settings-wm.h: - Add support for bridging WM settings, currently supports - _NET_NUMBER_OF_DESKTOPS and _NET_DESKTOP_NAMES. - -Tue Feb 19 23:53:06 2002 Jonathan Blandford <jrb@redhat.com> - - * gnome-settings-font.c: set the font path and handle cursors. - -2002-02-13 Lauris Kaplinski <lauris@ximian.com> - - * gnome-settings-xsettings.c: #include <string.h> to kill warning - -Tue Feb 12 01:34:19 2002 Jonathan Blandford <jrb@redhat.com> - - * gnome-settings-daemon.c (main): add session management. - -2002-02-10 Richard Hestilow <hestilow@ximian.com> - - * gnome-settings-xsettings.c: Added font setting. - -2002-02-04 Lauris Kaplinski <lauris@ximian.com> - - * gnome-settings-locate-pointer.c (locate_pointer_expose): Return - FALSE on default case, instead of nothing - (setup_window): Replace deprecated methods - - * gnome-settings-sound.c (reload_foreach_cb): Replace deprecated - methods - -2002-01-13 Seth Nickell <snickell@stanford.edu> - - reviewed by: <delete if not using a buddy> - - * Makefile.am: - -2002-01-28 Richard Hestilow <hestilow@ximian.com> - - * Link to libbackground.la. - -2002-01-21 Anders Carlsson <andersca@gnu.org> - - * gnome-settings-xsettings.c: Add support for changing themes. - -Mon Jan 21 01:29:57 2002 Jonathan Blandford <jrb@redhat.com> - - * gnome-settings-keyboard.c: Move locate_pointer out. - - * gnome-settings-mouse.c: Move locate_pointer in. Clean up code. - Remove print statements. - -2002-01-14 Bradford Hovinen <hovinen@ximian.com> - - * Makefile.am (INCLUDES): Added missing -I$(top_srcdir) - (bin_PROGRAMS): Rename binary gnome2-settings-daemon - - * gnome-settings-daemon.c (main): Enable code to load settings; - call gnome_settings_background_load too - - * gnome-settings-background.c (gnome_settings_background_init): - Use the correct key to register the callback - -Wed Jan 9 21:22:30 2002 Jonathan Blandford <jrb@redhat.com> - - * gnome-settings-keyboard.c (filter): weee! locate_cursor works - now!!!! - * gnome-settings-locate-pointer: speed up animation. - -2002-01-09 Anders Carlsson <andersca@gnu.org> - - * gnome-settings-daemon.c (main): Call gconf_client_add_dir. - -Tue Jan 8 15:50:59 2002 Jonathan Blandford <jrb@redhat.com> - - * Makefile.am: Add locate-pointer. - * gnome-settings-keyboard.c: Initial attempt at locate-pointer. - Don't understand XKB enough to figure it out. - * gnome-settings-locate-pointer.[ch]: Draw the locate pointer - box. Pretty snazzy for a useless (but fun) feature. - * gnome-settings-mouse.c: Move locate pointer to it's own file. - -2002-01-08 Richard Hestilow <hestilow@ximian.com> - - * gnome-settings-daemon.c (main): Initialize libgnomeui, - and load sounds. - - * gnome-settings-sound.c (stop_esd): Just tell esd to let go - of /dev/dsp. - -2002-01-04 Bradford Hovinen <hovinen@ximian.com> - - * all: Convert from GConfEngine to GConfClient - -2001-01-04 Richard Hestilow <hestilow@ximian.com> - - * gnome-settings-sound.[ch]: Added. - - * Makefile.am: Add gnome-settings-sound sources, link to libsounds. - - * gnome-settings-daemon.c: Call gnome_settings_sound_init. - -2001-12-20 Bradford Hovinen <hovinen@ximian.com> - - * All: Eliminate compiler warnings - - * gnome-settings-daemon.h: Use __GNOME_SETTINGS_DAEMON_H for the - enclosing macro - - * gnome-settings-background.c: Update - -2001-12-19 Bradford Hovinen <hovinen@ximian.com> - - * Makefile.am - (gnome_settings_daemon_SOURCES): Add - gnome-settings-{keyboard|background}.[ch] - (INCLUDES): Add -I$(top_srcdir)/libbackground - (gnome_settings_daemon_LDADD): Add - $(top_builddir)/libbackground/libbackground.a - - * gnome-settings-daemon.c (main): Initialize keyboard and - background subsystems diff --git a/gnome-settings-daemon/GNOME_SettingsDaemon.server.in b/gnome-settings-daemon/GNOME_SettingsDaemon.server.in deleted file mode 100644 index f2af5307d..000000000 --- a/gnome-settings-daemon/GNOME_SettingsDaemon.server.in +++ /dev/null @@ -1,11 +0,0 @@ -<oaf_info> - <oaf_server iid="OAFIID:GNOME_SettingsDaemon" - type="exe" location="@LIBEXECDIR@/gnome-settings-daemon"> - <oaf_attribute name="name" type="string" value="Settings Daemon"/> - <oaf_attribute name="description" type="string" value="GNOME Settings Daemon"/> - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:Bonobo/Unknown:1.0"/> - <item value="IDL:GNOME/SettingsDaemon:1.0"/> - </oaf_attribute> - </oaf_server> -</oaf_info> diff --git a/gnome-settings-daemon/Makefile.am b/gnome-settings-daemon/Makefile.am deleted file mode 100644 index a105a392b..000000000 --- a/gnome-settings-daemon/Makefile.am +++ /dev/null @@ -1,116 +0,0 @@ -SUBDIRS = xrdb actions - -INCLUDES=$(LIBXKLAVIER_CFLAGS) $(GNOME_SETTINGS_DAEMON_CFLAGS) -I$(top_srcdir)/libbackground -I$(top_srcdir) \ - -DGNOMELOCALEDIR="\"$(datadir)/locale\"" \ - -DESD_SERVER="\"$(ESD_SERVER)\"" \ - -DDATADIR="\"$(datadir)\"" \ - -DPIXMAPSDIR="\"$(GNOMECC_PIXMAPS_DIR)\"" \ - $(FB_CFLAGS) - -libexec_PROGRAMS=gnome-settings-daemon - -gnome_settings_daemon_SOURCES = \ - factory.c \ - eggaccelerators.h \ - eggaccelerators.c \ - gnome-settings-daemon.h \ - gnome-settings-daemon.c \ - gnome-settings-font.h \ - gnome-settings-font.c \ - gnome-settings-mouse.h \ - gnome-settings-mouse.c \ - gnome-settings-multimedia-keys.h \ - gnome-settings-multimedia-keys.c \ - gnome-settings-keyboard-xkb.h \ - gnome-settings-keyboard-xkb.c \ - gnome-settings-keyboard.h \ - gnome-settings-keyboard.c \ - gnome-settings-background.h \ - gnome-settings-background.c \ - gnome-settings-xsettings.c \ - gnome-settings-xsettings.h \ - gnome-settings-locate-pointer.c \ - gnome-settings-locate-pointer.h \ - gnome-settings-sound.c \ - gnome-settings-sound.h \ - gnome-settings-accessibility-keyboard.h \ - gnome-settings-accessibility-keyboard.c \ - gnome-settings-screensaver.h \ - gnome-settings-screensaver.c \ - gnome-settings-default-editor.c \ - gnome-settings-default-editor.h \ - gnome-settings-gtk1theme.c \ - gnome-settings-gtk1theme.h \ - gnome-settings-xrdb.c \ - gnome-settings-xrdb.h \ - xsettings-common.c \ - xsettings-manager.c \ - xsettings-common.h \ - xsettings-manager.h \ - gnome-settings-keybindings.c \ - gnome-settings-keybindings.h \ - gnome-settings-typing-break.c \ - gnome-settings-typing-break.h \ - reaper.c \ - reaper.h \ - gnome-settings-xmodmap.c \ - gnome-settings-xmodmap.h \ - list.c \ - list.h \ - xutils.c \ - xutils.h \ - clipboard-manager.c \ - clipboard-manager.h \ - $(CORBA_GENERATED) - -# $(AccessX_files) - -gnome_settings_daemon_LDADD = \ - $(LIBXKLAVIER_LIBS) \ - $(top_builddir)/libbackground/libbackground.la \ - $(top_builddir)/libsounds/libsounds.a \ - $(top_builddir)/libgswitchit/libgswitchit.a \ - $(top_builddir)/libwindow-settings/libgnome-window-settings.la \ - $(top_builddir)/gnome-settings-daemon/actions/libacme.la \ - $(GNOME_SETTINGS_DAEMON_LIBS) \ - $(XF86MISC_LIBS) - -#AccessX_files = \ -# AccessXcomm.c \ -# extutil.h \ -# AccessXproto.h \ -# AccessXlibint.h - -CORBA_GENERATED_HEADER_FILES = GNOME_SettingsDaemon.h - -CORBA_GENERATED = \ - $(CORBA_GENERATED_HEADER_FILES) \ - GNOME_SettingsDaemon-common.c \ - GNOME_SettingsDaemon-stubs.c \ - GNOME_SettingsDaemon-skels.c - -BUILT_SOURCES=$(CORBA_GENERATED) - -idl_dir = $(top_srcdir)/idl - -IDL_FLAGS = -D__GNOME_SettingsDaemon_COMPILATION -I $(idl_dir) -I $(datadir)/idl \ - -I $(LIBBONOBO_IDL_DIR) \ - -I $(BONOBO_ACTIVATION_IDL_DIR) - -$(CORBA_GENERATED): $(idl_dir)/GNOME_SettingsDaemon.idl $(ORBIT_IDL) - $(ORBIT_IDL) $(IDL_FLAGS) $(idl_dir)/GNOME_SettingsDaemon.idl - -Gladedir = $(GNOMECC_GLADE_DIR) -Glade_DATA = modmap-dialog.glade - -serverfile = GNOME_SettingsDaemon.server.in -serverdir = $(libdir)/bonobo/servers -install-data-hook : - $(mkinstalldirs) $(DESTDIR)$(serverdir) - sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" $(srcdir)/$(serverfile) > $(DESTDIR)$(serverdir)/$(serverfile:.in=) - -EXTRA_DIST = $(serverfile) $(Glade_DATA) -CLEANFILES = $(BUILT_SOURCES) - -uninstall-local: - rm -f $(DESTDIR)$(serverdir)/$(serverfile:.in=) diff --git a/gnome-settings-daemon/actions/.cvsignore b/gnome-settings-daemon/actions/.cvsignore deleted file mode 100644 index 282522db0..000000000 --- a/gnome-settings-daemon/actions/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/gnome-settings-daemon/actions/Makefile.am b/gnome-settings-daemon/actions/Makefile.am deleted file mode 100644 index c882b7bb8..000000000 --- a/gnome-settings-daemon/actions/Makefile.am +++ /dev/null @@ -1,54 +0,0 @@ -INCLUDES = $(GNOME_CFLAGS) -I$(top_srcdir) $(GST_CFLAGS) - -noinst_LTLIBRARIES = libacme.la - -libacme_la_SOURCES = \ - acme-volume.c acme-volume.h - -libacme_la_LIBADD = - -if HAVE_GSTREAMER -INCLUDES += -DHAVE_GSTREAMER -libacme_la_SOURCES += acme-volume-gstreamer.c acme-volume-gstreamer.h -libacme_la_LIBADD += $(GST_LIBS) -else # HAVE_GSTREAMER -if HAVE_ALSA -INCLUDES += -DHAVE_ALSA -libacme_la_SOURCES += acme-volume-alsa.c acme-volume-alsa.h -libacme_la_LIBADD += $(ALSA_LIBS) -else # HAVE_ALSA -if HAVE_OSS -INCLUDES += -DHAVE_OSS -libacme_la_SOURCES += acme-volume-oss.c acme-volume-oss.h -else # HAVE_OSS -libacme_la_SOURCES += acme-volume-dummy.c acme-volume-dummy.h -endif # HAVE_OSS -endif # HAVE_ALSA -endif # HAVE_GSTREAMER - -if HAVE_FB -INCLUDES += -DHAVE_FB -libacme_la_SOURCES += acme-fb-level.c acme-fb-level.h -endif - -if HAVE_GSTREAMER -INCLUDES += -DHAVE_GSTREAMER -libacme_la_SOURCES += acme-volume-gstreamer.c acme-volume-gstreamer.h -libacme_la_LIBADD += $(GST_LIBS) -endif - -Datadir = $(datadir)/control-center-2.0/interfaces/ -Data_DATA = acme.glade - -pixmapsdir = $(GNOMECC_PIXMAPS_DIR) -pixmaps_DATA = acme-brightness.png acme-eject.png gnome-speakernotes-muted.png gnome-speakernotes.png - -EXTRA_DIST = \ - acme-volume-alsa.c acme-volume-alsa.h \ - acme-volume-gstreamer.c acme-volume-gstreamer.h \ - acme-volume-oss.c acme-volume-oss.h \ - acme-volume-dummy.c acme-volume-dummy.h \ - acme-fb-level.c acme-fb-level.h \ - acme.h \ - acme.glade \ - $(pixmaps_DATA) diff --git a/gnome-settings-daemon/actions/acme-brightness.png b/gnome-settings-daemon/actions/acme-brightness.png Binary files differdeleted file mode 100644 index 19577b1b7..000000000 --- a/gnome-settings-daemon/actions/acme-brightness.png +++ /dev/null diff --git a/gnome-settings-daemon/actions/acme-eject.png b/gnome-settings-daemon/actions/acme-eject.png Binary files differdeleted file mode 100644 index 33ca8a4d7..000000000 --- a/gnome-settings-daemon/actions/acme-eject.png +++ /dev/null diff --git a/gnome-settings-daemon/actions/acme-fb-level.c b/gnome-settings-daemon/actions/acme-fb-level.c deleted file mode 100644 index 85e715988..000000000 --- a/gnome-settings-daemon/actions/acme-fb-level.c +++ /dev/null @@ -1,177 +0,0 @@ -/* acme-fb-level.c - - Copyright (C) 2002, 2003 Bastien Nocera - - The Gnome Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The Gnome Library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the Gnome Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. - - Author: Bastien Nocera <hadess@hadess.net> - */ - -#include "config.h" -#include "acme-fb-level.h" - -#include <fcntl.h> -#include <stdio.h> -#include <unistd.h> -#include <string.h> -#include <sys/ioctl.h> -#include <linux/fb.h> -#include <linux/pmu.h> -#include <errno.h> - -#ifndef FBIOBLANK -#define FBIOBLANK 0x4611 /* 0 or vesa-level+1 */ -#endif - -#ifndef PMU_IOC_GRAB_BACKLIGHT -#define PMU_IOC_GRAB_BACKLIGHT _IOR('B', 6, 0) -#endif - -G_DEFINE_TYPE (AcmeFblevel, acme_fblevel, G_TYPE_OBJECT) - -struct AcmeFblevelPrivate { - int pmu_fd; - int saved_level; -}; - -static GObjectClass *parent_class = NULL; - -static void -acme_fblevel_finalize (GObject *obj_self) -{ - AcmeFblevel *self = ACME_FBLEVEL (obj_self); - gpointer priv = self->_priv; - - if (G_OBJECT_CLASS(parent_class)->finalize) - (* G_OBJECT_CLASS(parent_class)->finalize)(obj_self); - g_free (priv); - - return; -} - -static void -acme_fblevel_class_init (AcmeFblevelClass *klass) -{ - GObjectClass *g_object_class = (GObjectClass*) klass; - parent_class = g_type_class_ref (G_TYPE_OBJECT); - g_object_class->finalize = acme_fblevel_finalize; - - return; -} - -static void -acme_fblevel_init (AcmeFblevel *fblevel) -{ - fblevel->_priv = g_new0 (AcmeFblevelPrivate, 1); - fblevel->level = 0; - fblevel->dim = FALSE; - fblevel->_priv->pmu_fd = -1; - fblevel->_priv->saved_level = 0; - - return; -} - -int -acme_fblevel_get_level (AcmeFblevel *self) -{ - int level; - ioctl (self->_priv->pmu_fd, - PMU_IOC_GET_BACKLIGHT, &level); - return level; -} - -void -acme_fblevel_set_level (AcmeFblevel *self, int val) -{ - int level; - - level = CLAMP (val, 0, 15); - - ioctl (self->_priv->pmu_fd, - PMU_IOC_SET_BACKLIGHT, &level); - self->level = level; -} - -gboolean -acme_fblevel_get_dim (AcmeFblevel *self) -{ - return self->dim; -} - -void -acme_fblevel_set_dim (AcmeFblevel *self, gboolean val) -{ - if (self->dim == FALSE && val == TRUE) - { - self->_priv->saved_level = acme_fblevel_get_level(self); - acme_fblevel_set_level (self, 1); - self->dim = TRUE; - } else if (self->dim == TRUE && val == FALSE) { - acme_fblevel_set_level (self, self->_priv->saved_level); - self->dim = FALSE; - } -} - -AcmeFblevel * -acme_fblevel_new (void) -{ - AcmeFblevel *self; - int fd, foo; - - if (g_file_test ("/dev/pmu", G_FILE_TEST_EXISTS) == FALSE) - return NULL; - - if (acme_fblevel_is_powerbook () == FALSE) - return NULL; - - self = ACME_FBLEVEL (g_object_new (ACME_TYPE_FBLEVEL, NULL)); - /* This function switches the kernel backlight control off. - * This is part of the PPC kernel branch since version - * 2.4.18-rc2-benh. It does nothing with older kernels. - * For those kernels a separate kernel patch is nessecary to - * get backlight control in user space. - * - * Notice nicked from pbbuttons*/ - fd = open ("/dev/pmu", O_RDWR); - /* We can't emit the signal yet, the signal isn't connected! */ - if (fd < 0) - return NULL; - - foo = ioctl(fd, PMU_IOC_GRAB_BACKLIGHT, 0); - self->_priv->pmu_fd = fd; - return self; -} - -gboolean -acme_fblevel_is_powerbook (void) -{ - FILE *fd; - char str[2048]; - gboolean found = FALSE; - - fd = fopen ("/proc/cpuinfo", "r"); - while (!feof (fd) && found == FALSE) - { - fread (str, 1, 2048, fd); - if (strstr (str, "PowerBook") != NULL) - found = TRUE; - } - - fclose (fd); - - return found; -} - diff --git a/gnome-settings-daemon/actions/acme-fb-level.h b/gnome-settings-daemon/actions/acme-fb-level.h deleted file mode 100644 index a9525e9e3..000000000 --- a/gnome-settings-daemon/actions/acme-fb-level.h +++ /dev/null @@ -1,55 +0,0 @@ -/* acme-fb-level.c - - Copyright (C) 2002, 2003 Bastien Nocera - - The Gnome Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The Gnome Library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the Gnome Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. - - Author: Bastien Nocera <hadess@hadess.net> - */ - -#include <glib.h> -#include <glib-object.h> - -#define ACME_TYPE_FBLEVEL (acme_fblevel_get_type ()) -#define ACME_FBLEVEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ACME_TYPE_FBLEVEL, AcmeFblevel)) -#define ACME_FBLEVEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ACME_TYPE_FBLEVEL, AcmeFblevelClass)) -#define ACME_IS_FBLEVEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ACME_TYPE_FBLEVEL)) -#define ACME_FBLEVEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ACME_TYPE_FBLEVEL, AcmeFblevelClass)) - -typedef struct AcmeFblevelPrivate AcmeFblevelPrivate; -typedef struct AcmeFblevel AcmeFblevel; -typedef struct AcmeFblevelClass AcmeFblevelClass; - -struct AcmeFblevel { - GObject parent; - int level; - gboolean dim; - AcmeFblevelPrivate *_priv; -}; - -struct AcmeFblevelClass { - GObjectClass parent; -}; - -GType acme_fblevel_get_type (void); -int acme_fblevel_get_level (AcmeFblevel *self); -void acme_fblevel_set_level (AcmeFblevel *self, int val); -gboolean acme_fblevel_get_dim (AcmeFblevel *self); -void acme_fblevel_set_dim (AcmeFblevel *self, - gboolean val); -AcmeFblevel *acme_fblevel_new (void); -gboolean acme_fblevel_is_powerbook (void); - diff --git a/gnome-settings-daemon/actions/acme-volume-alsa.c b/gnome-settings-daemon/actions/acme-volume-alsa.c deleted file mode 100644 index bb7096955..000000000 --- a/gnome-settings-daemon/actions/acme-volume-alsa.c +++ /dev/null @@ -1,314 +0,0 @@ -/* acme-volume-alsa.c - - Copyright (C) 2002, 2003 Bastien Nocera - - The Gnome Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The Gnome Library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the Gnome Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. - - Author: Bastien Nocera <hadess@hadess.net> - */ - -#include "config.h" -#include "acme-volume-alsa.h" - -#include <alsa/asoundlib.h> - -#ifndef DEFAULT_CARD -#define DEFAULT_CARD "default" -#endif - -#undef LOG -#ifdef LOG -#define D(x...) g_message (x) -#else -#define D(x...) -#endif - -#define ROUND(x) ((x - (int)x > 0.5) ? x+1 : x) - -struct AcmeVolumeAlsaPrivate -{ - long pmin, pmax; - gboolean has_mute, has_master; - snd_mixer_t *handle; - snd_mixer_elem_t *elem; - int saved_volume; - guint timer_id; -}; - -static GObjectClass *parent_class = NULL; - -static int acme_volume_alsa_get_volume (AcmeVolume *self); -static void acme_volume_alsa_set_volume (AcmeVolume *self, int val); -static gboolean acme_volume_alsa_open (AcmeVolumeAlsa *self); -static void acme_volume_alsa_close (AcmeVolumeAlsa *self); -static gboolean acme_volume_alsa_close_real (AcmeVolumeAlsa *self); - -G_DEFINE_TYPE (AcmeVolumeAlsa, acme_volume_alsa, ACME_TYPE_VOLUME) - -static void -acme_volume_alsa_finalize (GObject *object) -{ - AcmeVolumeAlsa *self; - - self = ACME_VOLUME_ALSA (object); - - if (self->_priv) - { - if (self->_priv->timer_id != 0) - { - g_source_remove (self->_priv->timer_id); - self->_priv->timer_id = 0; - } - - acme_volume_alsa_close_real (self); - g_free (self->_priv); - self->_priv = NULL; - } - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static void -acme_volume_alsa_set_mute (AcmeVolume *vol, gboolean val) -{ - AcmeVolumeAlsa *self = (AcmeVolumeAlsa *) vol; - - if (acme_volume_alsa_open (self) == FALSE) - return; - - /* If we have a hardware mute */ - if (self->_priv->has_mute) - { - snd_mixer_selem_set_playback_switch_all - (self->_priv->elem, !val); - acme_volume_alsa_close (self); - return; - } - - acme_volume_alsa_close (self); - - /* If we don't */ - if (val == TRUE) - { - self->_priv->saved_volume = acme_volume_alsa_get_volume (vol); - acme_volume_alsa_set_volume (vol, 0); - } else { - if (self->_priv->saved_volume != -1) - acme_volume_alsa_set_volume (vol, - self->_priv->saved_volume); - } -} - -static gboolean -acme_volume_alsa_get_mute (AcmeVolume *vol) -{ - AcmeVolumeAlsa *self = (AcmeVolumeAlsa *) vol; - int ival; - - if (acme_volume_alsa_open (self) == FALSE) - return FALSE; - - if (self->_priv->has_mute) - { - snd_mixer_selem_get_playback_switch(self->_priv->elem, - SND_MIXER_SCHN_FRONT_LEFT, &ival); - - acme_volume_alsa_close (self); - - return !ival; - } else { - acme_volume_alsa_close (self); - - return (acme_volume_alsa_get_volume (vol) == 0); - } -} - -static int -acme_volume_alsa_get_volume (AcmeVolume *vol) -{ - AcmeVolumeAlsa *self = (AcmeVolumeAlsa *) vol; - long lval, rval; - int tmp; - float alsa_vol; - - if (acme_volume_alsa_open (self) == FALSE) - return 0; - - snd_mixer_selem_get_playback_volume(self->_priv->elem, - SND_MIXER_SCHN_FRONT_LEFT, &lval); - snd_mixer_selem_get_playback_volume(self->_priv->elem, - SND_MIXER_SCHN_FRONT_RIGHT, &rval); - - acme_volume_alsa_close (self); - - alsa_vol = (lval + rval) / 2; - alsa_vol = alsa_vol * 100 / (self->_priv->pmax - self->_priv->pmin); - tmp = ROUND (alsa_vol); - - return tmp; -} - -static void -acme_volume_alsa_set_volume (AcmeVolume *vol, int val) -{ - AcmeVolumeAlsa *self = (AcmeVolumeAlsa *) vol; - float volume; - int tmp; - - if (acme_volume_alsa_open (self) == FALSE) - return; - - volume = (float) val / 100 * (self->_priv->pmax - self->_priv->pmin); - volume = CLAMP (volume, self->_priv->pmin, self->_priv->pmax); - tmp = ROUND (volume); - - snd_mixer_selem_set_playback_volume_all (self->_priv->elem, tmp); - - acme_volume_alsa_close (self); -} - -static gboolean -acme_volume_alsa_close_real (AcmeVolumeAlsa *self) -{ - if (self->_priv == NULL) - return FALSE; - - if (self->_priv->handle != NULL) - { - snd_mixer_detach (self->_priv->handle, DEFAULT_CARD); - snd_mixer_free (self->_priv->handle); - self->_priv->handle = NULL; - self->_priv->elem = NULL; - } - - self->_priv->timer_id = 0; - - return FALSE; -} - -static gboolean -acme_volume_alsa_open (AcmeVolumeAlsa *self) -{ - snd_mixer_selem_id_t *sid; - snd_mixer_t *handle; - snd_mixer_elem_t *elem; - - if (self->_priv->timer_id != 0) - { - g_source_remove (self->_priv->timer_id); - self->_priv->timer_id = 0; - return TRUE; - } - - /* open the mixer */ - if (snd_mixer_open (&handle, 0) < 0) - { - D("snd_mixer_open"); - return FALSE; - } - /* attach the handle to the default card */ - if (snd_mixer_attach (handle, DEFAULT_CARD) <0) - { - D("snd_mixer_attach"); - goto bail; - } - /* ? */ - if (snd_mixer_selem_register (handle, NULL, NULL) < 0) - { - D("snd_mixer_selem_register"); - goto bail; - } - if (snd_mixer_load (handle) < 0) - { - D("snd_mixer_load"); - goto bail; - } - - snd_mixer_selem_id_alloca (&sid); - snd_mixer_selem_id_set_name (sid, "Master"); - elem = snd_mixer_find_selem (handle, sid); - if (!elem) - { - snd_mixer_selem_id_alloca (&sid); - snd_mixer_selem_id_set_name (sid, "PCM"); - elem = snd_mixer_find_selem (handle, sid); - if (!elem) - { - D("snd_mixer_find_selem"); - goto bail; - } - } - - if (!snd_mixer_selem_has_playback_volume (elem)) - { - D("snd_mixer_selem_has_playback_volume"); - goto bail; - } - - snd_mixer_selem_get_playback_volume_range (elem, - &(self->_priv->pmin), - &(self->_priv->pmax)); - - self->_priv->has_mute = snd_mixer_selem_has_playback_switch (elem); - self->_priv->handle = handle; - self->_priv->elem = elem; - - return TRUE; - -bail: - acme_volume_alsa_close_real (self); - return FALSE; -} - -static void -acme_volume_alsa_close (AcmeVolumeAlsa *self) -{ - self->_priv->timer_id = g_timeout_add (4000, - (GSourceFunc) acme_volume_alsa_close_real, self); -} - -static void -acme_volume_alsa_init (AcmeVolumeAlsa *self) -{ - self->_priv = g_new0 (AcmeVolumeAlsaPrivate, 1); - - if (acme_volume_alsa_open (self) == FALSE) - { - g_free (self->_priv); - self->_priv = NULL; - return; - } - - if (self->_priv->handle != NULL) { - acme_volume_alsa_close_real (self); - return; - } -} - -static void -acme_volume_alsa_class_init (AcmeVolumeAlsaClass *klass) -{ - AcmeVolumeClass *volume_class = ACME_VOLUME_CLASS (klass); - G_OBJECT_CLASS (klass)->finalize = acme_volume_alsa_finalize; - - parent_class = g_type_class_peek_parent (klass); - - volume_class->set_volume = acme_volume_alsa_set_volume; - volume_class->get_volume = acme_volume_alsa_get_volume; - volume_class->set_mute = acme_volume_alsa_set_mute; - volume_class->get_mute = acme_volume_alsa_get_mute; -} - diff --git a/gnome-settings-daemon/actions/acme-volume-alsa.h b/gnome-settings-daemon/actions/acme-volume-alsa.h deleted file mode 100644 index 83746ffee..000000000 --- a/gnome-settings-daemon/actions/acme-volume-alsa.h +++ /dev/null @@ -1,47 +0,0 @@ -/* acme-volume-alsa.h - - Copyright (C) 2002, 2003 Bastien Nocera - - The Gnome Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The Gnome Library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the Gnome Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. - - Author: Bastien Nocera <hadess@hadess.net> - */ - -#include <glib.h> -#include <glib-object.h> -#include "acme-volume.h" - -#define ACME_TYPE_VOLUME_ALSA (acme_volume_get_type ()) -#define ACME_VOLUME_ALSA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ACME_TYPE_VOLUME_ALSA, AcmeVolumeAlsa)) -#define ACME_VOLUME_ALSA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ACME_TYPE_VOLUME_ALSA, AcmeVolumeAlsaClass)) -#define ACME_IS_VOLUME_ALSA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ACME_TYPE_VOLUME_ALSA)) -#define ACME_VOLUME_ALSA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ACME_TYPE_VOLUME_ALSA, AcmeVolumeAlsaClass)) - -typedef struct AcmeVolumeAlsa AcmeVolumeAlsa; -typedef struct AcmeVolumeAlsaClass AcmeVolumeAlsaClass; -typedef struct AcmeVolumeAlsaPrivate AcmeVolumeAlsaPrivate; - -struct AcmeVolumeAlsa { - AcmeVolume parent; - AcmeVolumeAlsaPrivate *_priv; -}; - -struct AcmeVolumeAlsaClass { - AcmeVolumeClass parent; -}; - -GType acme_volume_alsa_get_type (void); - diff --git a/gnome-settings-daemon/actions/acme-volume-dummy.c b/gnome-settings-daemon/actions/acme-volume-dummy.c deleted file mode 100644 index bd2f87924..000000000 --- a/gnome-settings-daemon/actions/acme-volume-dummy.c +++ /dev/null @@ -1,110 +0,0 @@ -/* acme-volume-dummy.c - - Copyright (C) 2002, 2003 Bastien Nocera - - The Gnome Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The Gnome Library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the Gnome Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. - - Author: Bastien Nocera <hadess@hadess.net> - */ - -#include "config.h" -#include "acme-volume-dummy.h" - -static GObjectClass *parent_class = NULL; - -static int acme_volume_dummy_get_volume (AcmeVolume *self); -static void acme_volume_dummy_set_volume (AcmeVolume *self, int val); - -static void -acme_volume_dummy_finalize (GObject *object) -{ - AcmeVolumeDummy *self; - - g_return_if_fail (object != NULL); - g_return_if_fail (ACME_IS_VOLUME_DUMMY (object)); - - self = ACME_VOLUME_DUMMY (object); - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static void -acme_volume_dummy_set_mute (AcmeVolume *vol, gboolean val) -{ -} - -static gboolean -acme_volume_dummy_get_mute (AcmeVolume *vol) -{ - return FALSE; -} - -static int -acme_volume_dummy_get_volume (AcmeVolume *vol) -{ - return 0; -} - -static void -acme_volume_dummy_set_volume (AcmeVolume *vol, int val) -{ -} - -static void -acme_volume_dummy_init (AcmeVolume *vol) -{ -} - -static void -acme_volume_dummy_class_init (AcmeVolumeDummyClass *klass) -{ - AcmeVolumeClass *volume_class = ACME_VOLUME_CLASS (klass); - G_OBJECT_CLASS (klass)->finalize = acme_volume_dummy_finalize; - - parent_class = g_type_class_peek_parent (klass); - - volume_class->set_volume = acme_volume_dummy_set_volume; - volume_class->get_volume = acme_volume_dummy_get_volume; - volume_class->set_mute = acme_volume_dummy_set_mute; - volume_class->get_mute = acme_volume_dummy_get_mute; -} - -GType acme_volume_dummy_get_type (void) -{ - static GType object_type = 0; - - if (!object_type) - { - static const GTypeInfo object_info = - { - sizeof (AcmeVolumeDummyClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) acme_volume_dummy_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (AcmeVolumeDummy), - 0, /* n_preallocs */ - (GInstanceInitFunc) acme_volume_dummy_init - }; - - object_type = g_type_register_static (ACME_TYPE_VOLUME, - "AcmeVolumeDummy", &object_info, 0); - } - - return object_type; -} - diff --git a/gnome-settings-daemon/actions/acme-volume-dummy.h b/gnome-settings-daemon/actions/acme-volume-dummy.h deleted file mode 100644 index 23bda10f5..000000000 --- a/gnome-settings-daemon/actions/acme-volume-dummy.h +++ /dev/null @@ -1,46 +0,0 @@ -/* acme-volume-dummy.h - - Copyright (C) 2002, 2003 Bastien Nocera - - The Gnome Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The Gnome Library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the Gnome Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. - - Author: Bastien Nocera <hadess@hadess.net> - */ - -#include <glib.h> -#include <glib-object.h> -#include "acme-volume.h" - -#define ACME_TYPE_VOLUME_DUMMY (acme_volume_get_type ()) -#define ACME_VOLUME_DUMMY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ACME_TYPE_VOLUME_DUMMY, AcmeVolumeDummy)) -#define ACME_VOLUME_DUMMY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ACME_TYPE_VOLUME_DUMMY, AcmeVolumeDummyClass)) -#define ACME_IS_VOLUME_DUMMY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ACME_TYPE_VOLUME_DUMMY)) -#define ACME_VOLUME_DUMMY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ACME_TYPE_VOLUME_DUMMY, AcmeVolumeDummyClass)) - -typedef struct AcmeVolumeDummy AcmeVolumeDummy; -typedef struct AcmeVolumeDummyClass AcmeVolumeDummyClass; - -struct AcmeVolumeDummy { - AcmeVolume parent; -}; - -struct AcmeVolumeDummyClass { - AcmeVolumeClass parent; -}; - -GType acme_volume_dummy_get_type (void); -AcmeVolume* acme_volume_dummy_new (void); - diff --git a/gnome-settings-daemon/actions/acme-volume-gstreamer.c b/gnome-settings-daemon/actions/acme-volume-gstreamer.c deleted file mode 100644 index dbe652234..000000000 --- a/gnome-settings-daemon/actions/acme-volume-gstreamer.c +++ /dev/null @@ -1,367 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* acme-volume-gstreamer.c - - Copyright (C) 2002, 2003 Bastien Nocera - Copyright (C) 2004 Novell, Inc. - - The Gnome Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The Gnome Library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the Gnome Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. - - Author: Bastien Nocera <hadess@hadess.net> - Jon Trowbridge <trow@ximian.com> - */ - -#include "config.h" -#include "acme-volume-gstreamer.h" - -#include <gst/gst.h> -#include <gst/mixer/mixer.h> -#include <gst/propertyprobe/propertyprobe.h> - -#include <string.h> - -#define TIMEOUT 4000 - -struct AcmeVolumeGStreamerPrivate -{ - GstMixer *mixer; - GstMixerTrack *track; - guint timer_id; - gint state; -}; - -static GObjectClass *parent_class = NULL; - -G_DEFINE_TYPE (AcmeVolumeGStreamer, acme_volume_gstreamer, ACME_TYPE_VOLUME) - -static int acme_volume_gstreamer_get_volume (AcmeVolume *self); -static void acme_volume_gstreamer_set_volume (AcmeVolume *self, int val); -static gboolean acme_volume_gstreamer_open (AcmeVolumeGStreamer *self); -static void acme_volume_gstreamer_close (AcmeVolumeGStreamer *self); -static gboolean acme_volume_gstreamer_close_real (AcmeVolumeGStreamer *self); - -static void -acme_volume_gstreamer_finalize (GObject *object) -{ - AcmeVolumeGStreamer *self; - - g_return_if_fail (object != NULL); - g_return_if_fail (ACME_IS_VOLUME_GSTREAMER (object)); - - self = ACME_VOLUME_GSTREAMER (object); - - g_return_if_fail (self->_priv != NULL); - - if (self->_priv->timer_id != 0) - { - g_source_remove (self->_priv->timer_id); - self->_priv->timer_id = 0; - } - acme_volume_gstreamer_close_real (self); - - g_free (self->_priv); - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static void -acme_volume_gstreamer_set_mute (AcmeVolume *vol, gboolean val) -{ - AcmeVolumeGStreamer *self = (AcmeVolumeGStreamer *) vol; - - if (acme_volume_gstreamer_open (self) == FALSE) - return; - - gst_mixer_set_mute (self->_priv->mixer, - self->_priv->track, - val); - - if (val) - self->_priv->state |= 1; - else { - GstMixerTrack *track = self->_priv->track; - gint *volumes, n; - - self->_priv->state &= ~1; - volumes = g_new0 (gint, track->num_channels); - for (n = 0; n < track->num_channels; n++) - volumes[n] = (self->_priv->state >> 1) / - track->num_channels; - gst_mixer_set_volume (self->_priv->mixer, track, volumes); - g_free (volumes); - } - - acme_volume_gstreamer_close (self); -} - -static void -update_state (AcmeVolumeGStreamer * self) -{ - gint *volumes, vol = 0, n; - GstMixerTrack *track = self->_priv->track; - - /* update mixer by getting volume */ - volumes = g_new0 (gint, track->num_channels); - gst_mixer_get_volume (self->_priv->mixer, track, volumes); - for (n = 0; n < track->num_channels; n++) - vol += volumes[n]; - g_free (volumes); - - /* update mute flag, and volume if not muted */ - if (GST_MIXER_TRACK_HAS_FLAG (track, GST_MIXER_TRACK_MUTE) || - (vol == 0 && (self->_priv->state >> 1) != 0)) - self->_priv->state |= 1; - else - self->_priv->state = vol << 1; -} - -static gboolean -acme_volume_gstreamer_get_mute (AcmeVolume *vol) -{ - AcmeVolumeGStreamer *self = (AcmeVolumeGStreamer *) vol; - - if (acme_volume_gstreamer_open (self) == FALSE) - return FALSE; - - update_state (self); - acme_volume_gstreamer_close (self); - - return (self->_priv->state & 1); -} - -static int -acme_volume_gstreamer_get_volume (AcmeVolume *vol) -{ - double volume; - AcmeVolumeGStreamer *self = (AcmeVolumeGStreamer *) vol; - GstMixerTrack *track = self->_priv->track; - - if (acme_volume_gstreamer_open (self) == FALSE) - return 0; - - update_state (self); - - /* normalize to [0,100] scale that acme wants */ - volume = (self->_priv->state >> 1) / (double) track->num_channels; - volume = 100 * (volume - track->min_volume) / - (track->max_volume - track->min_volume); - - acme_volume_gstreamer_close (self); - - return (gint) volume; -} - -static void -acme_volume_gstreamer_set_volume (AcmeVolume *vol, int val) -{ - gint i, *volumes, volume; - AcmeVolumeGStreamer *self = (AcmeVolumeGStreamer *) vol; - GstMixerTrack *track; - - if (acme_volume_gstreamer_open (self) == FALSE) - return; - - track = self->_priv->track; - val = CLAMP (val, 0, 100); - - /* Rescale the volume from [0, 100] to [track min, track max]. */ - volume = (val / 100.0) * (track->max_volume - track->min_volume) + - track->min_volume; - - volumes = g_new (gint, track->num_channels); - for (i = 0; i < track->num_channels; ++i) - volumes[i] = (gint) volume; - gst_mixer_set_volume (self->_priv->mixer, track, volumes); - g_free (volumes); - - /* update state */ - self->_priv->state = (self->_priv->state & 1) | - ((volume * track->num_channels) << 1); - - acme_volume_gstreamer_close (self); -} - -static gboolean -acme_volume_gstreamer_close_real (AcmeVolumeGStreamer *self) -{ - if (self->_priv == NULL) - return FALSE; - - if (self->_priv->mixer != NULL) - { - gst_element_set_state (GST_ELEMENT(self->_priv->mixer), GST_STATE_NULL); - gst_object_unref (GST_OBJECT (self->_priv->mixer)); - g_object_unref (G_OBJECT (self->_priv->track)); - self->_priv->mixer=NULL; - self->_priv->track=NULL; - } - - self->_priv->timer_id = 0; - return FALSE; -} - -/* This is a modified version of code from gnome-media's gst-mixer */ -static gboolean -acme_volume_gstreamer_open (AcmeVolumeGStreamer *vol) -{ - AcmeVolumeGStreamer *self = (AcmeVolumeGStreamer *) vol; - const GList *elements; - gint num = 0; - - if (self->_priv == NULL) - return FALSE; - - if (self->_priv->timer_id != 0) - { - g_source_remove (self->_priv->timer_id); - self->_priv->timer_id = 0; - return TRUE; - } - - /* Go through all elements of a certain class and check whether - * they implement a mixer. If so, walk through the tracks and look - * for first one named "volume". - * - * We should probably do something intelligent if we don't find an - * appropriate mixer/track. But now we do something stupid... everything - * just becomes a no-op. - */ - elements = gst_registry_pool_feature_list (GST_TYPE_ELEMENT_FACTORY); - for ( ; elements != NULL && self->_priv->mixer == NULL; elements = elements->next) { - GstElementFactory *factory = GST_ELEMENT_FACTORY (elements->data); - gchar *title = NULL; - const gchar *klass; - GstElement *element = NULL; - const GParamSpec *devspec; - GstPropertyProbe *probe; - GValueArray *array = NULL; - gint n; - const GList *tracks; - - /* check category */ - klass = gst_element_factory_get_klass (factory); - if (strcmp (klass, "Generic/Audio")) - goto next; - - /* create element */ - title = g_strdup_printf ("gst-mixer-%d", num); - element = gst_element_factory_create (factory, title); - if (!element) - goto next; - - if (!GST_IS_PROPERTY_PROBE (element)) - goto next; - - probe = GST_PROPERTY_PROBE (element); - devspec = gst_property_probe_get_property (probe, "device"); - if (devspec == NULL) - goto next; - array = gst_property_probe_probe_and_get_values (probe, devspec); - if (array == NULL) - goto next; - - /* set all devices and test for mixer */ - for (n = 0; n < array->n_values; n++) { - GValue *device = g_value_array_get_nth (array, n); - - /* set this device */ - g_object_set_property (G_OBJECT (element), "device", device); - if (gst_element_set_state (element, - GST_STATE_READY) == GST_STATE_FAILURE) - continue; - - /* Is this device a mixer? If so, add it to the list. */ - if (!GST_IS_MIXER (element)) { - gst_element_set_state (element, GST_STATE_NULL); - continue; - } - - tracks = gst_mixer_list_tracks (GST_MIXER (element)); - for (; tracks != NULL; tracks = tracks->next) { - GstMixerTrack *track = tracks->data; - - if (GST_MIXER_TRACK_HAS_FLAG (track, GST_MIXER_TRACK_MASTER)) { - self->_priv->mixer = GST_MIXER (element); - self->_priv->track = track; - - g_object_ref (self->_priv->mixer); - g_object_ref (self->_priv->track); - if (array) - g_value_array_free (array); - return TRUE; - } - } - - num++; - - /* and recreate this object, since we give it to the mixer */ - title = g_strdup_printf ("gst-mixer-%d", num); - element = gst_element_factory_create (factory, title); - } - - next: - if (element) - gst_object_unref (GST_OBJECT (element)); - if (array) - g_value_array_free (array); - g_free (title); - } - return FALSE; -} - -static void -acme_volume_gstreamer_close (AcmeVolumeGStreamer *self) -{ - self->_priv->timer_id = g_timeout_add (TIMEOUT, - (GSourceFunc) acme_volume_gstreamer_close_real, self); -} - -static void -acme_volume_gstreamer_init (AcmeVolumeGStreamer *self) -{ - - self->_priv = g_new0 (AcmeVolumeGStreamerPrivate, 1); - - if (acme_volume_gstreamer_open (self) == FALSE) - { - g_free (self->_priv); - self->_priv = NULL; - return; - } - - if (self->_priv->mixer != NULL) { - acme_volume_gstreamer_close_real (self); - return; - } -} - - -static void -acme_volume_gstreamer_class_init (AcmeVolumeGStreamerClass *klass) -{ - AcmeVolumeClass *volume_class = ACME_VOLUME_CLASS (klass); - G_OBJECT_CLASS (klass)->finalize = acme_volume_gstreamer_finalize; - - gst_init (NULL, NULL); - - parent_class = g_type_class_peek_parent (klass); - - volume_class->set_volume = acme_volume_gstreamer_set_volume; - volume_class->get_volume = acme_volume_gstreamer_get_volume; - volume_class->set_mute = acme_volume_gstreamer_set_mute; - volume_class->get_mute = acme_volume_gstreamer_get_mute; -} - diff --git a/gnome-settings-daemon/actions/acme-volume-gstreamer.h b/gnome-settings-daemon/actions/acme-volume-gstreamer.h deleted file mode 100644 index b7dd59a11..000000000 --- a/gnome-settings-daemon/actions/acme-volume-gstreamer.h +++ /dev/null @@ -1,49 +0,0 @@ -/* acme-volume-gstreamer.h - - Copyright (C) 2002, 2003 Bastien Nocera - Copyright (C) 2004 Novell, Inc. - - The Gnome Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The Gnome Library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the Gnome Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. - - Author: Bastien Nocera <hadess@hadess.net> - Jon Trowbridge <trow@ximian.com> - */ - -#include <glib.h> -#include <glib-object.h> -#include "acme-volume.h" - -#define ACME_TYPE_VOLUME_GSTREAMER (acme_volume_get_type ()) -#define ACME_VOLUME_GSTREAMER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ACME_TYPE_VOLUME_GSTREAMER, AcmeVolumeGStreamer)) -#define ACME_VOLUME_GSTREAMER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ACME_TYPE_VOLUME_GSTREAMER, AcmeVolumeGStreamerClass)) -#define ACME_IS_VOLUME_GSTREAMER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ACME_TYPE_VOLUME_GSTREAMER)) -#define ACME_VOLUME_GSTREAMER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ACME_TYPE_VOLUME_GSTREAMER, AcmeVolumeGStreamerClass)) - -typedef struct AcmeVolumeGStreamer AcmeVolumeGStreamer; -typedef struct AcmeVolumeGStreamerClass AcmeVolumeGStreamerClass; -typedef struct AcmeVolumeGStreamerPrivate AcmeVolumeGStreamerPrivate; - -struct AcmeVolumeGStreamer { - AcmeVolume parent; - AcmeVolumeGStreamerPrivate *_priv; -}; - -struct AcmeVolumeGStreamerClass { - AcmeVolumeClass parent; -}; - -GType acme_volume_gstreamer_get_type (void); - diff --git a/gnome-settings-daemon/actions/acme-volume-oss.c b/gnome-settings-daemon/actions/acme-volume-oss.c deleted file mode 100644 index 8c18c97ac..000000000 --- a/gnome-settings-daemon/actions/acme-volume-oss.c +++ /dev/null @@ -1,213 +0,0 @@ -/* acme-volume-oss.c - - Copyright (C) 2002, 2003 Bastien Nocera - - The Gnome Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The Gnome Library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the Gnome Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. - - Author: Bastien Nocera <hadess@hadess.net> - */ - -#include "config.h" -#include "acme-volume-oss.h" - -#include <fcntl.h> -#include <unistd.h> -#include <sys/ioctl.h> - -#ifdef __NetBSD__ -#include <sys/param.h> -#include <sys/sysctl.h> -#include <soundcard.h> -#else -#include <sys/soundcard.h> -#endif /* __NetBSD__ */ - -struct AcmeVolumeOssPrivate -{ - gboolean use_pcm; - gboolean mixerpb; - int volume; - int saved_volume; - gboolean pcm_avail; - gboolean mute; -}; - -static GObjectClass *parent_class = NULL; - -static int acme_volume_oss_get_volume (AcmeVolume *self); -static void acme_volume_oss_set_volume (AcmeVolume *self, int val); -static gboolean acme_volume_oss_mixer_check (AcmeVolumeOss *self, int fd); - -G_DEFINE_TYPE (AcmeVolumeOss, acme_volume_oss, ACME_TYPE_VOLUME) - -static void -acme_volume_oss_finalize (GObject *object) -{ - AcmeVolumeOss *self; - - g_return_if_fail (object != NULL); - g_return_if_fail (ACME_IS_VOLUME_OSS (object)); - - self = ACME_VOLUME_OSS (object); - - g_return_if_fail (self->_priv != NULL); - g_free (self->_priv); - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static int -acme_volume_oss_vol_check (int volume) -{ - return CLAMP (volume, 0, 100); -} - -static void -acme_volume_oss_set_mute (AcmeVolume *vol, gboolean val) -{ - AcmeVolumeOss *self = (AcmeVolumeOss *) vol; - - if (self->_priv->mute == FALSE) - { - self->_priv->saved_volume = - acme_volume_oss_get_volume (vol); - acme_volume_oss_set_volume (vol, 0); - self->_priv->mute = TRUE; - } else { - acme_volume_oss_set_volume (vol, self->_priv->saved_volume); - self->_priv->mute = FALSE; - } -} - -static gboolean -acme_volume_oss_get_mute (AcmeVolume *vol) -{ - AcmeVolumeOss *self = (AcmeVolumeOss *) vol; - - /* somebody else might have changed the volume */ - if ((self->_priv->mute == TRUE) && (self->_priv->volume != 0)) - { - self->_priv->mute = FALSE; - } - - return self->_priv->mute; -} - -static int -acme_volume_oss_get_volume (AcmeVolume *vol) -{ - gint volume, r, l, fd; - AcmeVolumeOss *self = (AcmeVolumeOss *) vol; - - fd = open ("/dev/mixer", O_RDONLY); - if (acme_volume_oss_mixer_check(self, fd) == FALSE) - { - volume = 0; - } else { - if (self->_priv->use_pcm && self->_priv->pcm_avail) - ioctl (fd, MIXER_READ (SOUND_MIXER_PCM), &volume); - else - ioctl (fd, MIXER_READ (SOUND_MIXER_VOLUME), &volume); - close (fd); - - r = (volume & 0xff); - l = (volume & 0xff00) >> 8; - volume = (r + l) / 2; - volume = acme_volume_oss_vol_check (volume); - } - - return volume; -} - -static void -acme_volume_oss_set_volume (AcmeVolume *vol, int val) -{ - int fd, tvol, volume; - AcmeVolumeOss *self = (AcmeVolumeOss *) vol; - - volume = acme_volume_oss_vol_check (val); - - fd = open ("/dev/mixer", O_RDONLY); - if (acme_volume_oss_mixer_check (self, fd) == FALSE) - { - return; - } else { - tvol = (volume << 8) + volume; - if (self->_priv->use_pcm && self->_priv->pcm_avail) - ioctl (fd, MIXER_WRITE (SOUND_MIXER_PCM), &tvol); - else - ioctl (fd, MIXER_WRITE (SOUND_MIXER_VOLUME), &tvol); - close (fd); - self->_priv->volume = volume; - } -} - -static void -acme_volume_oss_init (AcmeVolumeOss *self) -{ - int fd; - - self->_priv = g_new0 (AcmeVolumeOssPrivate, 1); - - fd = open ("/dev/mixer", O_RDONLY); - if (acme_volume_oss_mixer_check(self, fd) == FALSE) - { - self->_priv->pcm_avail = FALSE; - } else { - int mask = 0; - - ioctl (fd, SOUND_MIXER_READ_DEVMASK, &mask); - if (mask & ( 1 << SOUND_MIXER_PCM)) - self->_priv->pcm_avail = TRUE; - else - self->_priv->pcm_avail = FALSE; - if (!(mask & ( 1 << SOUND_MIXER_VOLUME))) - self->_priv->use_pcm = TRUE; - - close (fd); - } -} - -static void -acme_volume_oss_class_init (AcmeVolumeOssClass *klass) -{ - AcmeVolumeClass *volume_class = ACME_VOLUME_CLASS (klass); - G_OBJECT_CLASS (klass)->finalize = acme_volume_oss_finalize; - - parent_class = g_type_class_peek_parent (klass); - - volume_class->set_volume = acme_volume_oss_set_volume; - volume_class->get_volume = acme_volume_oss_get_volume; - volume_class->set_mute = acme_volume_oss_set_mute; - volume_class->get_mute = acme_volume_oss_get_mute; -} - -static gboolean -acme_volume_oss_mixer_check (AcmeVolumeOss *self, int fd) -{ - gboolean retval; - - if (fd <0) { - if (self->_priv->mixerpb == FALSE) { - self->_priv->mixerpb = TRUE; - //FIXME - //volume_oss_fd_problem(self); - } - } - retval = (!self->_priv->mixerpb); - return retval; -} - diff --git a/gnome-settings-daemon/actions/acme-volume-oss.h b/gnome-settings-daemon/actions/acme-volume-oss.h deleted file mode 100644 index b8805afa5..000000000 --- a/gnome-settings-daemon/actions/acme-volume-oss.h +++ /dev/null @@ -1,47 +0,0 @@ -/* acme-volume-oss.h - - Copyright (C) 2002, 2003 Bastien Nocera - - The Gnome Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The Gnome Library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the Gnome Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. - - Author: Bastien Nocera <hadess@hadess.net> - */ - -#include <glib.h> -#include <glib-object.h> -#include "acme-volume.h" - -#define ACME_TYPE_VOLUME_OSS (acme_volume_get_type ()) -#define ACME_VOLUME_OSS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ACME_TYPE_VOLUME_OSS, AcmeVolumeOss)) -#define ACME_VOLUME_OSS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ACME_TYPE_VOLUME_OSS, AcmeVolumeOssClass)) -#define ACME_IS_VOLUME_OSS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ACME_TYPE_VOLUME_OSS)) -#define ACME_VOLUME_OSS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ACME_TYPE_VOLUME_OSS, AcmeVolumeOssClass)) - -typedef struct AcmeVolumeOss AcmeVolumeOss; -typedef struct AcmeVolumeOssClass AcmeVolumeOssClass; -typedef struct AcmeVolumeOssPrivate AcmeVolumeOssPrivate; - -struct AcmeVolumeOss { - AcmeVolume parent; - AcmeVolumeOssPrivate *_priv; -}; - -struct AcmeVolumeOssClass { - AcmeVolumeClass parent; -}; - -GType acme_volume_oss_get_type (void); - diff --git a/gnome-settings-daemon/actions/acme-volume.c b/gnome-settings-daemon/actions/acme-volume.c deleted file mode 100644 index 88cd1eab2..000000000 --- a/gnome-settings-daemon/actions/acme-volume.c +++ /dev/null @@ -1,120 +0,0 @@ -/* acme-volume.c - - Copyright (C) 2002, 2003 Bastien Nocera - - The Gnome Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The Gnome Library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the Gnome Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. - - Author: Bastien Nocera <hadess@hadess.net> - */ - -#include "config.h" -#include "acme-volume.h" -#ifdef HAVE_OSS -#include "acme-volume-oss.h" -#endif -#ifdef HAVE_ALSA -#include "acme-volume-alsa.h" -#endif -#ifdef HAVE_GSTREAMER -#include "acme-volume-gstreamer.h" -#endif -#include "acme-volume-dummy.h" - -static GObjectClass *parent_class = NULL; - -G_DEFINE_TYPE (AcmeVolume, acme_volume, G_TYPE_OBJECT) - -static void -acme_volume_class_init (AcmeVolumeClass *klass) -{ - parent_class = g_type_class_peek_parent (klass); -}; - -static void -acme_volume_init (AcmeVolume *vol) -{ -} - -int -acme_volume_get_volume (AcmeVolume *self) -{ - g_return_val_if_fail (self != NULL, 0); - g_return_val_if_fail (ACME_IS_VOLUME (self), 0); - - return ACME_VOLUME_GET_CLASS (self)->get_volume (self); -} - -void -acme_volume_set_volume (AcmeVolume *self, int val) -{ - g_return_if_fail (self != NULL); - g_return_if_fail (ACME_IS_VOLUME (self)); - - ACME_VOLUME_GET_CLASS (self)->set_volume (self, val); -} - -gboolean -acme_volume_get_mute (AcmeVolume *self) -{ - g_return_val_if_fail (self != NULL, FALSE); - g_return_val_if_fail (ACME_IS_VOLUME (self), FALSE); - - return ACME_VOLUME_GET_CLASS (self)->get_mute (self); -} - -void -acme_volume_set_mute (AcmeVolume *self, gboolean val) -{ - g_return_if_fail (self != NULL); - g_return_if_fail (ACME_IS_VOLUME (self)); - - ACME_VOLUME_GET_CLASS (self)->set_mute (self, val); -} - -void -acme_volume_mute_toggle (AcmeVolume * self) -{ - gboolean muted; - - g_return_if_fail (self != NULL); - g_return_if_fail (ACME_IS_VOLUME (self)); - - muted = ACME_VOLUME_GET_CLASS (self)->get_mute (self); - ACME_VOLUME_GET_CLASS (self)->set_mute (self, !muted); -} - -AcmeVolume *acme_volume_new (void) -{ - AcmeVolume *vol; - -#ifdef HAVE_GSTREAMER - vol = ACME_VOLUME (g_object_new (acme_volume_gstreamer_get_type (), NULL)); - return vol; -#endif -#ifdef HAVE_ALSA - vol = ACME_VOLUME (g_object_new (acme_volume_alsa_get_type (), NULL)); - if (vol != NULL && ACME_VOLUME_ALSA (vol)->_priv != NULL) - return vol; - if (ACME_VOLUME_ALSA (vol)->_priv == NULL) - g_object_unref (vol); -#endif -#ifdef HAVE_OSS - vol = ACME_VOLUME (g_object_new (acme_volume_oss_get_type (), NULL)); - return vol; -#endif - return ACME_VOLUME (g_object_new (acme_volume_dummy_get_type (), NULL)); -} - diff --git a/gnome-settings-daemon/actions/acme-volume.h b/gnome-settings-daemon/actions/acme-volume.h deleted file mode 100644 index 00445b652..000000000 --- a/gnome-settings-daemon/actions/acme-volume.h +++ /dev/null @@ -1,61 +0,0 @@ -/* acme-volume.h - - Copyright (C) 2002, 2003 Bastien Nocera - - The Gnome Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The Gnome Library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the Gnome Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. - - Author: Bastien Nocera <hadess@hadess.net> - */ - -#ifndef _ACME_VOLUME_H -#define _ACME_VOLUME_H - -#include <glib.h> -#include <glib-object.h> - -G_BEGIN_DECLS - -#define ACME_TYPE_VOLUME (acme_volume_get_type ()) -#define ACME_VOLUME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ACME_TYPE_VOLUME, AcmeVolume)) -#define ACME_VOLUME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ACME_TYPE_VOLUME, AcmeVolumeClass)) -#define ACME_IS_VOLUME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ACME_TYPE_VOLUME)) -#define ACME_VOLUME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ACME_TYPE_VOLUME, AcmeVolumeClass)) - -typedef struct { - GObject parent; -} AcmeVolume; - -typedef struct { - GObjectClass parent; - - void (* set_volume) (AcmeVolume *self, int val); - int (* get_volume) (AcmeVolume *self); - void (* set_mute) (AcmeVolume *self, gboolean val); - int (* get_mute) (AcmeVolume *self); -} AcmeVolumeClass; - -GType acme_volume_get_type (void); -int acme_volume_get_volume (AcmeVolume *self); -void acme_volume_set_volume (AcmeVolume *self, int val); -gboolean acme_volume_get_mute (AcmeVolume *self); -void acme_volume_set_mute (AcmeVolume *self, - gboolean val); -void acme_volume_mute_toggle (AcmeVolume * self); -AcmeVolume *acme_volume_new (void); - -G_END_DECLS - -#endif /* _ACME_VOLUME_H */ diff --git a/gnome-settings-daemon/actions/acme.glade b/gnome-settings-daemon/actions/acme.glade deleted file mode 100644 index d6a1545af..000000000 --- a/gnome-settings-daemon/actions/acme.glade +++ /dev/null @@ -1,66 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> -<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> - -<glade-interface> - -<widget class="GtkWindow" id="dialog"> - <property name="title" translatable="yes">Volume</property> - <property name="type">GTK_WINDOW_POPUP</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - - <child> - <widget class="GtkFrame" id="frame1"> - <property name="visible">True</property> - <property name="label_xalign">0</property> - <property name="label_yalign">0.5</property> - <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property> - - <child> - <widget class="GtkVBox" id="vbox2"> - <property name="border_width">5</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkImage" id="image1"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkProgressBar" id="progressbar"> - <property name="visible">True</property> - <property name="orientation">GTK_PROGRESS_LEFT_TO_RIGHT</property> - <property name="fraction">0</property> - <property name="pulse_step">0.1</property> - <property name="activity_mode">False</property> - <property name="show_text">False</property> - <property name="text_xalign">0.5</property> - <property name="text_yalign">0.5</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - </child> - </widget> - </child> -</widget> - -</glade-interface> diff --git a/gnome-settings-daemon/actions/acme.h b/gnome-settings-daemon/actions/acme.h deleted file mode 100644 index 05a5e2182..000000000 --- a/gnome-settings-daemon/actions/acme.h +++ /dev/null @@ -1,88 +0,0 @@ -/* ACME - * Copyright (C) 2001 Bastien Nocera <hadess@hadess.net> - * - * acme.h - * - * 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 of the License, or - * (at your option) any later version. - * - * 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. - * - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, - * USA. - */ - -#ifndef __ACME_H__ -#define __ACME_H__ - -#define GCONF_BINDING_DIR "/apps/gnome_settings_daemon/keybindings" -#define GCONF_MISC_DIR "/apps/gnome_settings_daemon" - -enum { - MUTE_KEY, - VOLUME_DOWN_KEY, - VOLUME_UP_KEY, - POWER_KEY, - EJECT_KEY, - HOME_KEY, - SEARCH_KEY, - EMAIL_KEY, - SLEEP_KEY, - SCREENSAVER_KEY, - HELP_KEY, - WWW_KEY, -#ifdef USE_FBLEVEL - BRIGHT_DOWN_KEY, - BRIGHT_UP_KEY, -#endif - PLAY_KEY, - PAUSE_KEY, - STOP_KEY, - PREVIOUS_KEY, - NEXT_KEY, - HANDLED_KEYS -}; - -typedef struct { - guint keysym; - guint state; - guint keycode; -} Key; - -static struct { - int key_type; - const char *gconf_key; - Key *key; -} keys[HANDLED_KEYS] = { - { MUTE_KEY, GCONF_BINDING_DIR "/volume_mute",NULL }, - { VOLUME_DOWN_KEY, GCONF_BINDING_DIR "/volume_down", NULL }, - { VOLUME_UP_KEY, GCONF_BINDING_DIR "/volume_up", NULL }, - { POWER_KEY, GCONF_BINDING_DIR "/power", NULL }, - { EJECT_KEY, GCONF_BINDING_DIR "/eject", NULL }, - { HOME_KEY, GCONF_BINDING_DIR "/home", NULL }, - { SEARCH_KEY, GCONF_BINDING_DIR "/search", NULL }, - { EMAIL_KEY, GCONF_BINDING_DIR "/email", NULL }, - { SLEEP_KEY, GCONF_BINDING_DIR "/sleep", NULL }, - { SCREENSAVER_KEY, GCONF_BINDING_DIR "/screensaver", NULL }, - { HELP_KEY, GCONF_BINDING_DIR "/help", NULL }, - { WWW_KEY, GCONF_BINDING_DIR "/www", NULL }, -#ifdef USE_FBLEVEL - { BRIGHT_DOWN_KEY, GCONF_BINDING_DIR "/brightness_down", NULL }, - { BRIGHT_UP_KEY, GCONF_BINDING_DIR "/brightness_up", NULL }, -#endif - { PLAY_KEY, GCONF_BINDING_DIR "/play", NULL }, - { PAUSE_KEY, GCONF_BINDING_DIR "/pause", NULL }, - { STOP_KEY, GCONF_BINDING_DIR "/stop", NULL }, - { PREVIOUS_KEY, GCONF_BINDING_DIR "/previous", NULL }, - { NEXT_KEY, GCONF_BINDING_DIR "/next", NULL }, -}; - -#endif /* __ACME_H__ */ - diff --git a/gnome-settings-daemon/actions/gnome-speakernotes-muted.png b/gnome-settings-daemon/actions/gnome-speakernotes-muted.png Binary files differdeleted file mode 100644 index 91f97ca08..000000000 --- a/gnome-settings-daemon/actions/gnome-speakernotes-muted.png +++ /dev/null diff --git a/gnome-settings-daemon/actions/gnome-speakernotes.png b/gnome-settings-daemon/actions/gnome-speakernotes.png Binary files differdeleted file mode 100644 index 12a18763b..000000000 --- a/gnome-settings-daemon/actions/gnome-speakernotes.png +++ /dev/null diff --git a/gnome-settings-daemon/clipboard-manager.c b/gnome-settings-daemon/clipboard-manager.c deleted file mode 100644 index 6dd269179..000000000 --- a/gnome-settings-daemon/clipboard-manager.c +++ /dev/null @@ -1,923 +0,0 @@ -/* - * Copyright © 2004 Red Hat, Inc. - * Copyright © 2004 Nokia Corporation - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Red Hat not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. Red Hat makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Authors: Matthias Clasen, Red Hat, Inc. - * Anders Carlsson, Imendio AB - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include <X11/Xlib.h> -#include <X11/Xatom.h> - -#include "clipboard-manager.h" -#include "xutils.h" -#include "list.h" - - -struct _ClipboardManager -{ - Display *display; - Window window; - Time timestamp; - - ClipboardTerminateFunc terminate; - ClipboardWatchFunc watch; - void *cb_data; - - ClipboardErrorTrapPushFunc error_trap_push; - ClipboardErrorTrapPopFunc error_trap_pop; - - List *contents; - List *conversions; - - Window requestor; - Atom property; - Time time; -}; - -typedef struct -{ - unsigned char *data; - int length; - Atom target; - Atom type; - int format; - int refcount; -} TargetData; - -typedef struct -{ - Atom target; - TargetData *data; - Atom property; - Window requestor; - int offset; -} IncrConversion; - - -/* We need to use reference counting for the target data, since we may - * need to keep the data around after loosing the CLIPBOARD ownership - * to complete incremental transfers. - */ -static TargetData * -target_data_ref (TargetData *data) -{ - data->refcount++; - return data; -} - -static void -target_data_unref (TargetData *data) -{ - data->refcount--; - if (data->refcount == 0) - { - free (data->data); - free (data); - } -} - -static void -conversion_free (IncrConversion *rdata) -{ - if (rdata->data) - target_data_unref (rdata->data); - free (rdata); -} - -static void -send_selection_notify (ClipboardManager *manager, - Bool success) -{ - XSelectionEvent notify; - - notify.type = SelectionNotify; - notify.serial = 0; - notify.send_event = True; - notify.display = manager->display; - notify.requestor = manager->requestor; - notify.selection = XA_CLIPBOARD_MANAGER; - notify.target = XA_SAVE_TARGETS; - notify.property = success ? manager->property : None; - notify.time = manager->time; - - manager->error_trap_push (); - - XSendEvent (manager->display, manager->requestor, - False, NoEventMask, (XEvent *)¬ify); - XSync (manager->display, False); - - manager->error_trap_pop (); -} - -static void -finish_selection_request (ClipboardManager *manager, - XEvent *xev, - Bool success) -{ - XSelectionEvent notify; - - notify.type = SelectionNotify; - notify.serial = 0; - notify.send_event = True; - notify.display = xev->xselectionrequest.display; - notify.requestor = xev->xselectionrequest.requestor; - notify.selection = xev->xselectionrequest.selection; - notify.target = xev->xselectionrequest.target; - notify.property = success ? xev->xselectionrequest.property : None; - notify.time = xev->xselectionrequest.time; - - manager->error_trap_push (); - - XSendEvent (xev->xselectionrequest.display, - xev->xselectionrequest.requestor, - False, NoEventMask, (XEvent *)¬ify); - XSync (manager->display, False); - - manager->error_trap_pop (); -} - -static int -clipboard_bytes_per_item (int format) -{ - switch (format) - { - case 8: - return sizeof (char); - break; - case 16: - return sizeof (short); - break; - case 32: - return sizeof (long); - break; - default: ; - } - return 0; -} - -static void -save_targets (ClipboardManager *manager, - Atom *save_targets, - int nitems) -{ - int nout, i; - Atom *multiple; - TargetData *tdata; - - multiple = (Atom *) malloc (2 * nitems * sizeof (Atom)); - - nout = 0; - for (i = 0; i < nitems; i++) - { - if (save_targets[i] != XA_TARGETS && - save_targets[i] != XA_MULTIPLE && - save_targets[i] != XA_DELETE && - save_targets[i] != XA_INSERT_PROPERTY && - save_targets[i] != XA_INSERT_SELECTION && - save_targets[i] != XA_PIXMAP) - { - - tdata = (TargetData *) malloc (sizeof (TargetData)); - tdata->data = NULL; - tdata->length = 0; - tdata->target = save_targets[i]; - tdata->type = None; - tdata->format = 0; - tdata->refcount = 1; - manager->contents = list_prepend (manager->contents, tdata); - - multiple[nout++] = save_targets[i]; - multiple[nout++] = save_targets[i]; - } - } - - XFree (save_targets); - - XChangeProperty (manager->display, manager->window, - XA_MULTIPLE, XA_ATOM_PAIR, - 32, PropModeReplace, (char *)multiple, nout); - free (multiple); - - XConvertSelection (manager->display, XA_CLIPBOARD, - XA_MULTIPLE, XA_MULTIPLE, - manager->window, manager->time); -} - -static int -find_content_target (TargetData *tdata, - Atom target) -{ - return tdata->target == target; -} - -static int -find_content_type (TargetData *tdata, - Atom type) -{ - return tdata->type == type; -} - -static int -find_conversion_requestor (IncrConversion *rdata, - XEvent *xev) -{ - return (rdata->requestor == xev->xproperty.window && - rdata->property == xev->xproperty.atom); -} - -static void -get_property (TargetData *tdata, - ClipboardManager *manager) -{ - Atom type; - int format; - unsigned long length; - unsigned long remaining; - unsigned char *data; - - XGetWindowProperty (manager->display, - manager->window, - tdata->target, - 0, 0x1FFFFFFF, True, AnyPropertyType, - &type, &format, &length, &remaining, - &data); - - if (type == None) - { - manager->contents = list_remove (manager->contents, tdata); - free (tdata); - } - else if (type == XA_INCR) - { - tdata->type = type; - tdata->length = 0; - XFree (data); - } - else - { - tdata->type = type; - tdata->data = data; - tdata->length = length * clipboard_bytes_per_item (format); - tdata->format = format; - } -} - -static Bool -receive_incrementally (ClipboardManager *manager, - XEvent *xev) -{ - List *list; - TargetData *tdata; - Atom type; - int format; - unsigned long length, nitems, remaining; - unsigned char *data; - - if (xev->xproperty.window != manager->window) - return False; - - list = list_find (manager->contents, - (ListFindFunc)find_content_target, (void *)xev->xproperty.atom); - - if (!list) - return False; - - tdata = (TargetData *)list->data; - - if (tdata->type != XA_INCR) - return False; - - XGetWindowProperty (xev->xproperty.display, - xev->xproperty.window, - xev->xproperty.atom, - 0, 0x1FFFFFFF, True, AnyPropertyType, - &type, &format, &nitems, &remaining, &data); - - length = nitems * clipboard_bytes_per_item (format); - - if (length == 0) - { - tdata->type = type; - tdata->format = format; - - if (!list_find (manager->contents, - (ListFindFunc)find_content_type, (void *)XA_INCR)) - { - /* all incremental transfers done */ - send_selection_notify (manager, True); - manager->requestor = None; - } - - XFree (data); - } - else - { - if (!tdata->data) - { - tdata->data = data; - tdata->length = length; - } - else - { - tdata->data = realloc (tdata->data, tdata->length + length + 1); - memcpy (tdata->data + tdata->length, data, length + 1); - tdata->length += length; - XFree (data); - } - } - - return True; -} - -static Bool -send_incrementally (ClipboardManager *manager, - XEvent *xev) -{ - List *list; - IncrConversion *rdata; - unsigned long length, items; - unsigned char *data; - - list = list_find (manager->conversions, - (ListFindFunc)find_conversion_requestor, xev); - - if (list == NULL) - return False; - - rdata = (IncrConversion *)list->data; - - data = rdata->data->data + rdata->offset; - length = rdata->data->length - rdata->offset; - if (length > SELECTION_MAX_SIZE) - length = SELECTION_MAX_SIZE; - - rdata->offset += length; - - items = length / clipboard_bytes_per_item (rdata->data->format); - XChangeProperty (manager->display, rdata->requestor, - rdata->property, rdata->data->type, - rdata->data->format, PropModeAppend, - data, items); - - if (length == 0) - { - manager->conversions = list_remove (manager->conversions, rdata); - conversion_free (rdata); - } - - return True; -} - -static void -convert_clipboard_manager (ClipboardManager *manager, - XEvent *xev) -{ - Atom type = None; - int format; - unsigned long nitems, remaining; - Atom *targets = NULL; - - if (xev->xselectionrequest.target == XA_SAVE_TARGETS) - { - if (manager->requestor != None || manager->contents != NULL) - { - /* We're in the middle of a conversion request, or own - * the CLIPBOARD already - */ - finish_selection_request (manager, xev, False); - } - else - { - manager->error_trap_push (); - - manager->watch (xev->xselectionrequest.requestor, True, StructureNotifyMask, manager->cb_data); - XSelectInput (manager->display, xev->xselectionrequest.requestor, - StructureNotifyMask); - XSync (manager->display, False); - - if (manager->error_trap_pop () != Success) - return; - - manager->error_trap_push (); - - if (xev->xselectionrequest.property != None) - { - XGetWindowProperty (manager->display, xev->xselectionrequest.requestor, - xev->xselectionrequest.property, - 0, 0x1FFFFFFF, False, XA_ATOM, - &type, &format, &nitems, &remaining, - (unsigned char **)&targets); - - if (manager->error_trap_pop () != Success) - { - if (targets) - XFree (targets); - - return; - } - } - - manager->requestor = xev->xselectionrequest.requestor; - manager->property = xev->xselectionrequest.property; - manager->time = xev->xselectionrequest.time; - - if (type == None) - XConvertSelection (manager->display, XA_CLIPBOARD, - XA_TARGETS, XA_TARGETS, - manager->window, manager->time); - else - save_targets (manager, targets, nitems); - } - } - else if (xev->xselectionrequest.target == XA_TIMESTAMP) - { - XChangeProperty (manager->display, - xev->xselectionrequest.requestor, - xev->xselectionrequest.property, - XA_INTEGER, 32, PropModeReplace, - (unsigned char *)&manager->timestamp, 1); - - finish_selection_request (manager, xev, True); - } - else if (xev->xselectionrequest.target == XA_TARGETS) - { - int n_targets = 0; - Atom targets[3]; - - targets[n_targets++] = XA_TARGETS; - targets[n_targets++] = XA_TIMESTAMP; - targets[n_targets++] = XA_SAVE_TARGETS; - - XChangeProperty (manager->display, - xev->xselectionrequest.requestor, - xev->xselectionrequest.property, - XA_ATOM, 32, PropModeReplace, - (unsigned char *)targets, n_targets); - - finish_selection_request (manager, xev, True); - } - else - { - finish_selection_request (manager, xev, False); - } -} - -static void -convert_clipboard_target (IncrConversion *rdata, - ClipboardManager *manager) -{ - TargetData *tdata; - Atom *targets; - int n_targets; - List *list; - unsigned long items; - XWindowAttributes atts; - - if (rdata->target == XA_TARGETS) - { - n_targets = list_length (manager->contents) + 2; - targets = (Atom *) malloc (n_targets * sizeof (Atom)); - - n_targets = 0; - - targets[n_targets++] = XA_TARGETS; - targets[n_targets++] = XA_MULTIPLE; - - for (list = manager->contents; list; list = list->next) - { - tdata = (TargetData *)list->data; - targets[n_targets++] = tdata->target; - } - - XChangeProperty (manager->display, rdata->requestor, - rdata->property, - XA_ATOM, 32, PropModeReplace, - (unsigned char *)targets, n_targets); - free (targets); - } - else - { - /* Convert from stored CLIPBOARD data */ - list = list_find (manager->contents, - (ListFindFunc)find_content_target, (void *)rdata->target); - - /* We got a target that we don't support */ - if (!list) - return; - - tdata = (TargetData *)list->data; - - if (tdata->type == XA_INCR) - { - /* we haven't completely received this target yet - */ - rdata->property = None; - return; - } - - rdata->data = target_data_ref (tdata); - items = tdata->length / clipboard_bytes_per_item (tdata->format); - if (tdata->length <= SELECTION_MAX_SIZE) - XChangeProperty (manager->display, rdata->requestor, - rdata->property, - tdata->type, tdata->format, PropModeReplace, - tdata->data, items); - else - { - /* start incremental transfer - */ - rdata->offset = 0; - - manager->error_trap_push (); - - XGetWindowAttributes (manager->display, rdata->requestor, &atts); - XSelectInput (manager->display, rdata->requestor, - atts.your_event_mask | PropertyChangeMask); - - XChangeProperty (manager->display, rdata->requestor, - rdata->property, - XA_INCR, 32, PropModeReplace, - (unsigned char *)&items, 1); - - XSync (manager->display, False); - - manager->error_trap_pop (); - } - } -} - -static void -collect_incremental (IncrConversion *rdata, - ClipboardManager *manager) -{ - if (rdata->offset >= 0) - manager->conversions = list_prepend (manager->conversions, rdata); - else - { - if (rdata->data) - { - target_data_unref (rdata->data); - rdata->data = NULL; - } - free (rdata); - } -} - -static void -convert_clipboard (ClipboardManager *manager, - XEvent *xev) -{ - List *list, *conversions; - IncrConversion *rdata; - Atom type; - int i, format; - unsigned long nitems, remaining; - Atom *multiple; - - conversions = NULL; - type = None; - - if (xev->xselectionrequest.target == XA_MULTIPLE) - { - - XGetWindowProperty (xev->xselectionrequest.display, - xev->xselectionrequest.requestor, - xev->xselectionrequest.property, - 0, 0x1FFFFFFF, False, XA_ATOM_PAIR, - &type, &format, &nitems, &remaining, - (unsigned char **)&multiple); - - - - if (type != XA_ATOM_PAIR) - return; - - for (i = 0; i < nitems; i += 2) - { - rdata = (IncrConversion *) malloc (sizeof (IncrConversion)); - rdata->requestor = xev->xselectionrequest.requestor; - rdata->target = multiple[i]; - rdata->property = multiple[i+1]; - rdata->data = NULL; - rdata->offset = -1; - conversions = list_prepend (conversions, rdata); - } - } - else - { - multiple = NULL; - - rdata = (IncrConversion *) malloc (sizeof (IncrConversion)); - rdata->requestor = xev->xselectionrequest.requestor; - rdata->target = xev->xselectionrequest.target; - rdata->property = xev->xselectionrequest.property; - rdata->data = NULL; - rdata->offset = -1; - conversions = list_prepend (conversions, rdata); - } - - list_foreach (conversions, (Callback)convert_clipboard_target, manager); - - if (conversions->next == NULL && - ((IncrConversion *)conversions->data)->property == None) - { - finish_selection_request (manager, xev, False); - } - else - { - if (multiple) - { - i = 0; - for (list = conversions; list; list = list->next) - { - rdata = (IncrConversion *)list->data; - multiple[i++] = rdata->target; - multiple[i++] = rdata->property; - } - XChangeProperty (xev->xselectionrequest.display, - xev->xselectionrequest.requestor, - xev->xselectionrequest.property, - XA_ATOM_PAIR, 32, PropModeReplace, - (unsigned char *)multiple, nitems); - } - finish_selection_request (manager, xev, True); - } - - list_foreach (conversions, (Callback)collect_incremental, manager); - list_free (conversions); - - if (multiple) - free (multiple); -} - -Bool -clipboard_manager_process_event (ClipboardManager *manager, - XEvent *xev) -{ - Atom type; - int format; - unsigned long nitems; - unsigned long remaining; - Atom *targets; - - targets = NULL; - - switch (xev->xany.type) - { - case DestroyNotify: - if (xev->xdestroywindow.window == manager->requestor) - { - list_foreach (manager->contents, (Callback)target_data_unref, NULL); - list_free (manager->contents); - manager->contents = NULL; - - manager->watch (manager->requestor, False, 0, manager->cb_data); - manager->requestor = None; - } - break; - case PropertyNotify: - - if (xev->xproperty.state == PropertyNewValue) - return receive_incrementally (manager, xev); - else - return send_incrementally (manager, xev); - break; - - case SelectionClear: - if (xev->xany.window != manager->window) - return False; - - if (xev->xselectionclear.selection == XA_CLIPBOARD_MANAGER) - { - /* We lost the manager selection */ - if (manager->contents) - { - list_foreach (manager->contents, (Callback)target_data_unref, NULL); - list_free (manager->contents); - manager->contents = NULL; - - XSetSelectionOwner (manager->display, - XA_CLIPBOARD, - None, manager->time); - } - manager->terminate (manager->cb_data); - - return True; - } - if (xev->xselectionclear.selection == XA_CLIPBOARD) - { - /* We lost the clipboard selection */ - list_foreach (manager->contents, (Callback)target_data_unref, NULL); - list_free (manager->contents); - manager->contents = NULL; - manager->watch (manager->requestor, False, 0, manager->cb_data); - manager->requestor = None; - - return True; - } - break; - - case SelectionNotify: - if (xev->xany.window != manager->window) - return False; - - if (xev->xselection.selection == XA_CLIPBOARD) - { - /* a CLIPBOARD conversion is done */ - if (xev->xselection.property == XA_TARGETS) - { - XGetWindowProperty (xev->xselection.display, - xev->xselection.requestor, - xev->xselection.property, - 0, 0x1FFFFFFF, True, XA_ATOM, - &type, &format, &nitems, &remaining, - (unsigned char **)&targets); - - save_targets (manager, targets, nitems); - } - else if (xev->xselection.property == XA_MULTIPLE) - { - List *tmp; - - tmp = list_copy (manager->contents); - list_foreach (tmp, (Callback)get_property, manager); - list_free (tmp); - - manager->time = xev->xselection.time; - XSetSelectionOwner (manager->display, XA_CLIPBOARD, - manager->window, manager->time); - - if (manager->property != None) - XChangeProperty (manager->display, manager->requestor, - manager->property, - XA_ATOM, 32, PropModeReplace, - (unsigned char *)&XA_NULL, 1); - - if (!list_find (manager->contents, - (ListFindFunc)find_content_type, (void *)XA_INCR)) - { - /* all transfers done */ - send_selection_notify (manager, True); - manager->watch (manager->requestor, False, 0, manager->cb_data); - manager->requestor = None; - } - } - else if (xev->xselection.property == None) - { - send_selection_notify (manager, False); - manager->watch (manager->requestor, False, 0, manager->cb_data); - manager->requestor = None; - } - - return True; - } - break; - - case SelectionRequest: - if (xev->xany.window != manager->window) - return False; - - if (xev->xselectionrequest.selection == XA_CLIPBOARD_MANAGER) - { - convert_clipboard_manager (manager, xev); - return True; - } - else if (xev->xselectionrequest.selection == XA_CLIPBOARD) - { - convert_clipboard (manager, xev); - return True; - } - break; - - default: ; - } - - return False; -} - -Bool -clipboard_manager_check_running (Display *display) -{ - init_atoms (display); - - if (XGetSelectionOwner (display, XA_CLIPBOARD_MANAGER)) - return True; - else - return False; -} - -ClipboardManager * -clipboard_manager_new (Display *display, - ClipboardErrorTrapPushFunc error_trap_push_cb, - ClipboardErrorTrapPopFunc error_trap_pop_cb, - ClipboardTerminateFunc terminate, - ClipboardWatchFunc watch, - void *cb_data) -{ - ClipboardManager *manager; - XClientMessageEvent xev; - - init_atoms (display); - - manager = malloc (sizeof *manager); - if (!manager) - return NULL; - - manager->display = display; - - manager->error_trap_push = error_trap_push_cb; - manager->error_trap_pop = error_trap_pop_cb; - - manager->terminate = terminate; - manager->watch = watch; - manager->cb_data = cb_data; - - manager->contents = NULL; - manager->conversions = NULL; - - manager->requestor = None; - - manager->window = XCreateSimpleWindow (display, - DefaultRootWindow (display), - 0, 0, 10, 10, 0, - WhitePixel (display, DefaultScreen (display)), - WhitePixel (display, DefaultScreen (display))); - - manager->watch (manager->window, True, PropertyChangeMask, manager->cb_data); - XSelectInput (display, manager->window, PropertyChangeMask); - manager->timestamp = get_server_time (display, manager->window); - - XSetSelectionOwner (display, XA_CLIPBOARD_MANAGER, - manager->window, manager->timestamp); - - /* Check to see if we managed to claim the selection. If not, - * we treat it as if we got it then immediately lost it - */ - - if (XGetSelectionOwner (display, XA_CLIPBOARD_MANAGER) == manager->window) - { - xev.type = ClientMessage; - xev.window = DefaultRootWindow (display); - xev.message_type = XA_MANAGER; - xev.format = 32; - xev.data.l[0] = manager->timestamp; - xev.data.l[1] = XA_CLIPBOARD_MANAGER; - xev.data.l[2] = manager->window; - xev.data.l[3] = 0; /* manager specific data */ - xev.data.l[4] = 0; /* manager specific data */ - - XSendEvent (display, DefaultRootWindow (display), - False, StructureNotifyMask, (XEvent *)&xev); - } - else - { - manager->watch (manager->window, False, 0, manager->cb_data); - manager->terminate (manager->cb_data); - free (manager); - manager = NULL; - } - - return manager; -} - -void -clipboard_manager_destroy (ClipboardManager *manager) -{ - if (manager) - { - manager->watch (manager->window, False, 0, manager->cb_data); - XDestroyWindow (manager->display, manager->window); - - list_foreach (manager->conversions, (Callback)conversion_free, NULL); - list_free (manager->conversions); - - list_foreach (manager->contents, (Callback)target_data_unref, NULL); - list_free (manager->contents); - - free (manager); - manager = NULL; - } -} - diff --git a/gnome-settings-daemon/clipboard-manager.h b/gnome-settings-daemon/clipboard-manager.h deleted file mode 100644 index 77ae12708..000000000 --- a/gnome-settings-daemon/clipboard-manager.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright © 2004 Red Hat, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Red Hat not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. Red Hat makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Matthias Clasen, Red Hat, Inc. - */ -#ifndef CLIPBOARD_MANAGER_H -#define CLIPBOARD_MANAGER_H - -#include <X11/Xlib.h> - -typedef struct _ClipboardManager ClipboardManager; -typedef void (*ClipboardTerminateFunc) (void *data); -typedef void (*ClipboardWatchFunc) (Window window, - Bool is_start, - long mask, - void *cb_data); - -typedef void (*ClipboardErrorTrapPushFunc) (void); -typedef int (*ClipboardErrorTrapPopFunc) (void); - -ClipboardManager *clipboard_manager_new (Display *display, - ClipboardErrorTrapPushFunc error_trap_push_cb, - ClipboardErrorTrapPopFunc error_trap_pop_cb, - ClipboardTerminateFunc terminate_cb, - ClipboardWatchFunc watch_cb, - void *cb_data); - -void clipboard_manager_destroy (ClipboardManager *manager); -Bool clipboard_manager_process_event (ClipboardManager *manager, - XEvent *xev); -Bool clipboard_manager_check_running (Display *display); - - -#endif /* CLIPBOARD_MANAGER_H */ diff --git a/gnome-settings-daemon/eggaccelerators.c b/gnome-settings-daemon/eggaccelerators.c deleted file mode 100644 index 0a39d519e..000000000 --- a/gnome-settings-daemon/eggaccelerators.c +++ /dev/null @@ -1,702 +0,0 @@ -/* eggaccelerators.c - * Copyright (C) 2002 Red Hat, Inc.; Copyright 1998, 2001 Tim Janik - * Developed by Havoc Pennington, Tim Janik - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include "eggaccelerators.h" - -#include <stdlib.h> -#include <string.h> -#include <gdk/gdkx.h> -#include <gdk/gdkkeysyms.h> - -enum -{ - EGG_MODMAP_ENTRY_SHIFT = 0, - EGG_MODMAP_ENTRY_LOCK = 1, - EGG_MODMAP_ENTRY_CONTROL = 2, - EGG_MODMAP_ENTRY_MOD1 = 3, - EGG_MODMAP_ENTRY_MOD2 = 4, - EGG_MODMAP_ENTRY_MOD3 = 5, - EGG_MODMAP_ENTRY_MOD4 = 6, - EGG_MODMAP_ENTRY_MOD5 = 7, - EGG_MODMAP_ENTRY_LAST = 8 -}; - -#define MODMAP_ENTRY_TO_MODIFIER(x) (1 << (x)) - -typedef struct -{ - EggVirtualModifierType mapping[EGG_MODMAP_ENTRY_LAST]; - -} EggModmap; - -const EggModmap* egg_keymap_get_modmap (GdkKeymap *keymap); - -static inline gboolean -is_alt (const gchar *string) -{ - return ((string[0] == '<') && - (string[1] == 'a' || string[1] == 'A') && - (string[2] == 'l' || string[2] == 'L') && - (string[3] == 't' || string[3] == 'T') && - (string[4] == '>')); -} - -static inline gboolean -is_ctl (const gchar *string) -{ - return ((string[0] == '<') && - (string[1] == 'c' || string[1] == 'C') && - (string[2] == 't' || string[2] == 'T') && - (string[3] == 'l' || string[3] == 'L') && - (string[4] == '>')); -} - -static inline gboolean -is_modx (const gchar *string) -{ - return ((string[0] == '<') && - (string[1] == 'm' || string[1] == 'M') && - (string[2] == 'o' || string[2] == 'O') && - (string[3] == 'd' || string[3] == 'D') && - (string[4] >= '1' && string[4] <= '5') && - (string[5] == '>')); -} - -static inline gboolean -is_ctrl (const gchar *string) -{ - return ((string[0] == '<') && - (string[1] == 'c' || string[1] == 'C') && - (string[2] == 't' || string[2] == 'T') && - (string[3] == 'r' || string[3] == 'R') && - (string[4] == 'l' || string[4] == 'L') && - (string[5] == '>')); -} - -static inline gboolean -is_shft (const gchar *string) -{ - return ((string[0] == '<') && - (string[1] == 's' || string[1] == 'S') && - (string[2] == 'h' || string[2] == 'H') && - (string[3] == 'f' || string[3] == 'F') && - (string[4] == 't' || string[4] == 'T') && - (string[5] == '>')); -} - -static inline gboolean -is_shift (const gchar *string) -{ - return ((string[0] == '<') && - (string[1] == 's' || string[1] == 'S') && - (string[2] == 'h' || string[2] == 'H') && - (string[3] == 'i' || string[3] == 'I') && - (string[4] == 'f' || string[4] == 'F') && - (string[5] == 't' || string[5] == 'T') && - (string[6] == '>')); -} - -static inline gboolean -is_control (const gchar *string) -{ - return ((string[0] == '<') && - (string[1] == 'c' || string[1] == 'C') && - (string[2] == 'o' || string[2] == 'O') && - (string[3] == 'n' || string[3] == 'N') && - (string[4] == 't' || string[4] == 'T') && - (string[5] == 'r' || string[5] == 'R') && - (string[6] == 'o' || string[6] == 'O') && - (string[7] == 'l' || string[7] == 'L') && - (string[8] == '>')); -} - -static inline gboolean -is_release (const gchar *string) -{ - return ((string[0] == '<') && - (string[1] == 'r' || string[1] == 'R') && - (string[2] == 'e' || string[2] == 'E') && - (string[3] == 'l' || string[3] == 'L') && - (string[4] == 'e' || string[4] == 'E') && - (string[5] == 'a' || string[5] == 'A') && - (string[6] == 's' || string[6] == 'S') && - (string[7] == 'e' || string[7] == 'E') && - (string[8] == '>')); -} - -static inline gboolean -is_meta (const gchar *string) -{ - return ((string[0] == '<') && - (string[1] == 'm' || string[1] == 'M') && - (string[2] == 'e' || string[2] == 'E') && - (string[3] == 't' || string[3] == 'T') && - (string[4] == 'a' || string[4] == 'A') && - (string[5] == '>')); -} - -static inline gboolean -is_super (const gchar *string) -{ - return ((string[0] == '<') && - (string[1] == 's' || string[1] == 'S') && - (string[2] == 'u' || string[2] == 'U') && - (string[3] == 'p' || string[3] == 'P') && - (string[4] == 'e' || string[4] == 'E') && - (string[5] == 'r' || string[5] == 'R') && - (string[6] == '>')); -} - -static inline gboolean -is_hyper (const gchar *string) -{ - return ((string[0] == '<') && - (string[1] == 'h' || string[1] == 'H') && - (string[2] == 'y' || string[2] == 'Y') && - (string[3] == 'p' || string[3] == 'P') && - (string[4] == 'e' || string[4] == 'E') && - (string[5] == 'r' || string[5] == 'R') && - (string[6] == '>')); -} - -static inline gboolean -is_keycode (const gchar *string) -{ - return ((string[0] == '0') && - (string[1] == 'x')); -} - -/** - * egg_accelerator_parse_virtual: - * @accelerator: string representing an accelerator - * @accelerator_key: return location for accelerator keyval - * @accelerator_mods: return location for accelerator modifier mask - * - * Parses a string representing a virtual accelerator. The format - * looks like "<Control>a" or "<Shift><Alt>F1" or - * "<Release>z" (the last one is for key release). The parser - * is fairly liberal and allows lower or upper case, and also - * abbreviations such as "<Ctl>" and "<Ctrl>". - * - * If the parse fails, @accelerator_key and @accelerator_mods will - * be set to 0 (zero) and %FALSE will be returned. If the string contains - * only modifiers, @accelerator_key will be set to 0 but %TRUE will be - * returned. - * - * The virtual vs. concrete accelerator distinction is a relic of - * how the X Window System works; there are modifiers Mod2-Mod5 that - * can represent various keyboard keys (numlock, meta, hyper, etc.), - * the virtual modifier represents the keyboard key, the concrete - * modifier the actual Mod2-Mod5 bits in the key press event. - * - * Returns: %TRUE on success. - */ -gboolean -egg_accelerator_parse_virtual (const gchar *accelerator, - guint *accelerator_key, - guint *keycode, - EggVirtualModifierType *accelerator_mods) -{ - guint keyval; - GdkModifierType mods; - gint len; - gboolean bad_keyval; - - if (accelerator_key) - *accelerator_key = 0; - if (accelerator_mods) - *accelerator_mods = 0; - if (keycode) - *keycode = 0; - - g_return_val_if_fail (accelerator != NULL, FALSE); - - bad_keyval = FALSE; - - keyval = 0; - mods = 0; - len = strlen (accelerator); - while (len) - { - if (*accelerator == '<') - { - if (len >= 9 && is_release (accelerator)) - { - accelerator += 9; - len -= 9; - mods |= EGG_VIRTUAL_RELEASE_MASK; - } - else if (len >= 9 && is_control (accelerator)) - { - accelerator += 9; - len -= 9; - mods |= EGG_VIRTUAL_CONTROL_MASK; - } - else if (len >= 7 && is_shift (accelerator)) - { - accelerator += 7; - len -= 7; - mods |= EGG_VIRTUAL_SHIFT_MASK; - } - else if (len >= 6 && is_shft (accelerator)) - { - accelerator += 6; - len -= 6; - mods |= EGG_VIRTUAL_SHIFT_MASK; - } - else if (len >= 6 && is_ctrl (accelerator)) - { - accelerator += 6; - len -= 6; - mods |= EGG_VIRTUAL_CONTROL_MASK; - } - else if (len >= 6 && is_modx (accelerator)) - { - static const guint mod_vals[] = { - EGG_VIRTUAL_ALT_MASK, EGG_VIRTUAL_MOD2_MASK, EGG_VIRTUAL_MOD3_MASK, - EGG_VIRTUAL_MOD4_MASK, EGG_VIRTUAL_MOD5_MASK - }; - - len -= 6; - accelerator += 4; - mods |= mod_vals[*accelerator - '1']; - accelerator += 2; - } - else if (len >= 5 && is_ctl (accelerator)) - { - accelerator += 5; - len -= 5; - mods |= EGG_VIRTUAL_CONTROL_MASK; - } - else if (len >= 5 && is_alt (accelerator)) - { - accelerator += 5; - len -= 5; - mods |= EGG_VIRTUAL_ALT_MASK; - } - else if (len >= 6 && is_meta (accelerator)) - { - accelerator += 6; - len -= 6; - mods |= EGG_VIRTUAL_META_MASK; - } - else if (len >= 7 && is_hyper (accelerator)) - { - accelerator += 7; - len -= 7; - mods |= EGG_VIRTUAL_HYPER_MASK; - } - else if (len >= 7 && is_super (accelerator)) - { - accelerator += 7; - len -= 7; - mods |= EGG_VIRTUAL_SUPER_MASK; - } - else - { - gchar last_ch; - - last_ch = *accelerator; - while (last_ch && last_ch != '>') - { - last_ch = *accelerator; - accelerator += 1; - len -= 1; - } - } - } - else - { - keyval = gdk_keyval_from_name (accelerator); - - if (keyval == 0) - { - /* If keyval is 0, than maybe it's a keycode. Check for 0x## */ - if (len >= 4 && is_keycode (accelerator)) - { - char keystring[5]; - gchar *endptr; - gint tmp_keycode; - - memcpy (keystring, accelerator, 4); - keystring [4] = '\000'; - - tmp_keycode = strtol (keystring, &endptr, 16); - - if (endptr == NULL || *endptr != '\000') - { - bad_keyval = TRUE; - } - else if (keycode != NULL) - { - *keycode = tmp_keycode; - /* 0x00 is an invalid keycode too. */ - if (*keycode == 0) - bad_keyval = TRUE; - } - } - } else if (keycode != NULL) - *keycode = XKeysymToKeycode (GDK_DISPLAY(), keyval); - - accelerator += len; - len -= len; - } - } - - if (accelerator_key) - *accelerator_key = gdk_keyval_to_lower (keyval); - if (accelerator_mods) - *accelerator_mods = mods; - - return !bad_keyval; -} - - -/** - * egg_virtual_accelerator_name: - * @accelerator_key: accelerator keyval - * @accelerator_mods: accelerator modifier mask - * @returns: a newly-allocated accelerator name - * - * Converts an accelerator keyval and modifier mask - * into a string parseable by egg_accelerator_parse_virtual(). - * For example, if you pass in #GDK_q and #EGG_VIRTUAL_CONTROL_MASK, - * this function returns "<Control>q". - * - * The caller of this function must free the returned string. - */ -gchar* -egg_virtual_accelerator_name (guint accelerator_key, - guint keycode, - EggVirtualModifierType accelerator_mods) -{ - static const gchar text_release[] = "<Release>"; - static const gchar text_shift[] = "<Shift>"; - static const gchar text_control[] = "<Control>"; - static const gchar text_mod1[] = "<Alt>"; - static const gchar text_mod2[] = "<Mod2>"; - static const gchar text_mod3[] = "<Mod3>"; - static const gchar text_mod4[] = "<Mod4>"; - static const gchar text_mod5[] = "<Mod5>"; - static const gchar text_meta[] = "<Meta>"; - static const gchar text_super[] = "<Super>"; - static const gchar text_hyper[] = "<Hyper>"; - guint l; - gchar *keyval_name; - gchar *accelerator; - - accelerator_mods &= EGG_VIRTUAL_MODIFIER_MASK; - - if (!accelerator_key) - { - keyval_name = g_strdup_printf ("0x%02x", keycode); - } - else - { - keyval_name = gdk_keyval_name (gdk_keyval_to_lower (accelerator_key)); - if (!keyval_name) - keyval_name = ""; - } - - l = 0; - if (accelerator_mods & EGG_VIRTUAL_RELEASE_MASK) - l += sizeof (text_release) - 1; - if (accelerator_mods & EGG_VIRTUAL_SHIFT_MASK) - l += sizeof (text_shift) - 1; - if (accelerator_mods & EGG_VIRTUAL_CONTROL_MASK) - l += sizeof (text_control) - 1; - if (accelerator_mods & EGG_VIRTUAL_ALT_MASK) - l += sizeof (text_mod1) - 1; - if (accelerator_mods & EGG_VIRTUAL_MOD2_MASK) - l += sizeof (text_mod2) - 1; - if (accelerator_mods & EGG_VIRTUAL_MOD3_MASK) - l += sizeof (text_mod3) - 1; - if (accelerator_mods & EGG_VIRTUAL_MOD4_MASK) - l += sizeof (text_mod4) - 1; - if (accelerator_mods & EGG_VIRTUAL_MOD5_MASK) - l += sizeof (text_mod5) - 1; - if (accelerator_mods & EGG_VIRTUAL_META_MASK) - l += sizeof (text_meta) - 1; - if (accelerator_mods & EGG_VIRTUAL_HYPER_MASK) - l += sizeof (text_hyper) - 1; - if (accelerator_mods & EGG_VIRTUAL_SUPER_MASK) - l += sizeof (text_super) - 1; - l += strlen (keyval_name); - - accelerator = g_new (gchar, l + 1); - - l = 0; - accelerator[l] = 0; - if (accelerator_mods & EGG_VIRTUAL_RELEASE_MASK) - { - strcpy (accelerator + l, text_release); - l += sizeof (text_release) - 1; - } - if (accelerator_mods & EGG_VIRTUAL_SHIFT_MASK) - { - strcpy (accelerator + l, text_shift); - l += sizeof (text_shift) - 1; - } - if (accelerator_mods & EGG_VIRTUAL_CONTROL_MASK) - { - strcpy (accelerator + l, text_control); - l += sizeof (text_control) - 1; - } - if (accelerator_mods & EGG_VIRTUAL_ALT_MASK) - { - strcpy (accelerator + l, text_mod1); - l += sizeof (text_mod1) - 1; - } - if (accelerator_mods & EGG_VIRTUAL_MOD2_MASK) - { - strcpy (accelerator + l, text_mod2); - l += sizeof (text_mod2) - 1; - } - if (accelerator_mods & EGG_VIRTUAL_MOD3_MASK) - { - strcpy (accelerator + l, text_mod3); - l += sizeof (text_mod3) - 1; - } - if (accelerator_mods & EGG_VIRTUAL_MOD4_MASK) - { - strcpy (accelerator + l, text_mod4); - l += sizeof (text_mod4) - 1; - } - if (accelerator_mods & EGG_VIRTUAL_MOD5_MASK) - { - strcpy (accelerator + l, text_mod5); - l += sizeof (text_mod5) - 1; - } - if (accelerator_mods & EGG_VIRTUAL_META_MASK) - { - strcpy (accelerator + l, text_meta); - l += sizeof (text_meta) - 1; - } - if (accelerator_mods & EGG_VIRTUAL_HYPER_MASK) - { - strcpy (accelerator + l, text_hyper); - l += sizeof (text_hyper) - 1; - } - if (accelerator_mods & EGG_VIRTUAL_SUPER_MASK) - { - strcpy (accelerator + l, text_super); - l += sizeof (text_super) - 1; - } - - strcpy (accelerator + l, keyval_name); - - return accelerator; -} - -void -egg_keymap_resolve_virtual_modifiers (GdkKeymap *keymap, - EggVirtualModifierType virtual_mods, - GdkModifierType *concrete_mods) -{ - GdkModifierType concrete; - int i; - const EggModmap *modmap; - - g_return_if_fail (GDK_IS_KEYMAP (keymap)); - g_return_if_fail (concrete_mods != NULL); - - modmap = egg_keymap_get_modmap (keymap); - - /* Not so sure about this algorithm. */ - - concrete = 0; - i = 0; - while (i < EGG_MODMAP_ENTRY_LAST) - { - if (modmap->mapping[i] & virtual_mods) - concrete |= (1 << i); - - ++i; - } - - *concrete_mods = concrete; -} - -void -egg_keymap_virtualize_modifiers (GdkKeymap *keymap, - GdkModifierType concrete_mods, - EggVirtualModifierType *virtual_mods) -{ - GdkModifierType virtual; - int i; - const EggModmap *modmap; - - g_return_if_fail (GDK_IS_KEYMAP (keymap)); - g_return_if_fail (virtual_mods != NULL); - - modmap = egg_keymap_get_modmap (keymap); - - /* Not so sure about this algorithm. */ - - virtual = 0; - i = 0; - while (i < EGG_MODMAP_ENTRY_LAST) - { - if ((1 << i) & concrete_mods) - { - EggVirtualModifierType cleaned; - - cleaned = modmap->mapping[i] & ~(EGG_VIRTUAL_MOD2_MASK | - EGG_VIRTUAL_MOD3_MASK | - EGG_VIRTUAL_MOD4_MASK | - EGG_VIRTUAL_MOD5_MASK); - - if (cleaned != 0) - { - virtual |= cleaned; - } - else - { - /* Rather than dropping mod2->mod5 if not bound, - * go ahead and use the concrete names - */ - virtual |= modmap->mapping[i]; - } - } - - ++i; - } - - *virtual_mods = virtual; -} - -static void -reload_modmap (GdkKeymap *keymap, - EggModmap *modmap) -{ - XModifierKeymap *xmodmap; - int map_size; - int i; - - /* FIXME multihead */ - xmodmap = XGetModifierMapping (gdk_x11_get_default_xdisplay ()); - - memset (modmap->mapping, 0, sizeof (modmap->mapping)); - - /* there are 8 modifiers, and the first 3 are shift, shift lock, - * and control - */ - map_size = 8 * xmodmap->max_keypermod; - i = 3 * xmodmap->max_keypermod; - while (i < map_size) - { - /* get the key code at this point in the map, - * see if its keysym is one we're interested in - */ - int keycode = xmodmap->modifiermap[i]; - GdkKeymapKey *keys; - guint *keyvals; - int n_entries; - int j; - EggVirtualModifierType mask; - - keys = NULL; - keyvals = NULL; - n_entries = 0; - - gdk_keymap_get_entries_for_keycode (keymap, - keycode, - &keys, &keyvals, &n_entries); - - mask = 0; - j = 0; - while (j < n_entries) - { - if (keyvals[j] == GDK_Num_Lock) - mask |= EGG_VIRTUAL_NUM_LOCK_MASK; - else if (keyvals[j] == GDK_Scroll_Lock) - mask |= EGG_VIRTUAL_SCROLL_LOCK_MASK; - else if (keyvals[j] == GDK_Meta_L || - keyvals[j] == GDK_Meta_R) - mask |= EGG_VIRTUAL_META_MASK; - else if (keyvals[j] == GDK_Hyper_L || - keyvals[j] == GDK_Hyper_R) - mask |= EGG_VIRTUAL_HYPER_MASK; - else if (keyvals[j] == GDK_Super_L || - keyvals[j] == GDK_Super_R) - mask |= EGG_VIRTUAL_SUPER_MASK; - else if (keyvals[j] == GDK_Mode_switch) - mask |= EGG_VIRTUAL_MODE_SWITCH_MASK; - - ++j; - } - - /* Mod1Mask is 1 << 3 for example, i.e. the - * fourth modifier, i / keyspermod is the modifier - * index - */ - modmap->mapping[i/xmodmap->max_keypermod] |= mask; - - g_free (keyvals); - g_free (keys); - - ++i; - } - - /* Add in the not-really-virtual fixed entries */ - modmap->mapping[EGG_MODMAP_ENTRY_SHIFT] |= EGG_VIRTUAL_SHIFT_MASK; - modmap->mapping[EGG_MODMAP_ENTRY_CONTROL] |= EGG_VIRTUAL_CONTROL_MASK; - modmap->mapping[EGG_MODMAP_ENTRY_LOCK] |= EGG_VIRTUAL_LOCK_MASK; - modmap->mapping[EGG_MODMAP_ENTRY_MOD1] |= EGG_VIRTUAL_ALT_MASK; - modmap->mapping[EGG_MODMAP_ENTRY_MOD2] |= EGG_VIRTUAL_MOD2_MASK; - modmap->mapping[EGG_MODMAP_ENTRY_MOD3] |= EGG_VIRTUAL_MOD3_MASK; - modmap->mapping[EGG_MODMAP_ENTRY_MOD4] |= EGG_VIRTUAL_MOD4_MASK; - modmap->mapping[EGG_MODMAP_ENTRY_MOD5] |= EGG_VIRTUAL_MOD5_MASK; - - XFreeModifiermap (xmodmap); -} - -const EggModmap* -egg_keymap_get_modmap (GdkKeymap *keymap) -{ - EggModmap *modmap; - - /* This is all a hack, much simpler when we can just - * modify GDK directly. - */ - - modmap = g_object_get_data (G_OBJECT (keymap), - "egg-modmap"); - - if (modmap == NULL) - { - modmap = g_new0 (EggModmap, 1); - - /* FIXME modify keymap change events with an event filter - * and force a reload if we get one - */ - - reload_modmap (keymap, modmap); - - g_object_set_data_full (G_OBJECT (keymap), - "egg-modmap", - modmap, - g_free); - } - - g_assert (modmap != NULL); - - return modmap; -} diff --git a/gnome-settings-daemon/eggaccelerators.h b/gnome-settings-daemon/eggaccelerators.h deleted file mode 100644 index d2276d2b2..000000000 --- a/gnome-settings-daemon/eggaccelerators.h +++ /dev/null @@ -1,89 +0,0 @@ -/* eggaccelerators.h - * Copyright (C) 2002 Red Hat, Inc. - * Developed by Havoc Pennington - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __EGG_ACCELERATORS_H__ -#define __EGG_ACCELERATORS_H__ - -#include <gtk/gtkaccelgroup.h> -#include <gdk/gdk.h> - -G_BEGIN_DECLS - -/* Where a value is also in GdkModifierType we coincide, - * otherwise we don't overlap. - */ -typedef enum -{ - EGG_VIRTUAL_SHIFT_MASK = 1 << 0, - EGG_VIRTUAL_LOCK_MASK = 1 << 1, - EGG_VIRTUAL_CONTROL_MASK = 1 << 2, - - EGG_VIRTUAL_ALT_MASK = 1 << 3, /* fixed as Mod1 */ - - EGG_VIRTUAL_MOD2_MASK = 1 << 4, - EGG_VIRTUAL_MOD3_MASK = 1 << 5, - EGG_VIRTUAL_MOD4_MASK = 1 << 6, - EGG_VIRTUAL_MOD5_MASK = 1 << 7, - -#if 0 - GDK_BUTTON1_MASK = 1 << 8, - GDK_BUTTON2_MASK = 1 << 9, - GDK_BUTTON3_MASK = 1 << 10, - GDK_BUTTON4_MASK = 1 << 11, - GDK_BUTTON5_MASK = 1 << 12, - /* 13, 14 are used by Xkb for the keyboard group */ -#endif - - EGG_VIRTUAL_META_MASK = 1 << 24, - EGG_VIRTUAL_SUPER_MASK = 1 << 25, - EGG_VIRTUAL_HYPER_MASK = 1 << 26, - EGG_VIRTUAL_MODE_SWITCH_MASK = 1 << 27, - EGG_VIRTUAL_NUM_LOCK_MASK = 1 << 28, - EGG_VIRTUAL_SCROLL_LOCK_MASK = 1 << 29, - - /* Also in GdkModifierType */ - EGG_VIRTUAL_RELEASE_MASK = 1 << 30, - - /* 28-31 24-27 20-23 16-19 12-15 8-11 4-7 0-3 - * 7 f 0 0 0 0 f f - */ - EGG_VIRTUAL_MODIFIER_MASK = 0x7f0000ff - -} EggVirtualModifierType; - -gboolean egg_accelerator_parse_virtual (const gchar *accelerator, - guint *accelerator_key, - guint *keycode, - EggVirtualModifierType *accelerator_mods); -void egg_keymap_resolve_virtual_modifiers (GdkKeymap *keymap, - EggVirtualModifierType virtual_mods, - GdkModifierType *concrete_mods); -void egg_keymap_virtualize_modifiers (GdkKeymap *keymap, - GdkModifierType concrete_mods, - EggVirtualModifierType *virtual_mods); - -gchar* egg_virtual_accelerator_name (guint accelerator_key, - guint keycode, - EggVirtualModifierType accelerator_mods); - -G_END_DECLS - - -#endif /* __EGG_ACCELERATORS_H__ */ diff --git a/gnome-settings-daemon/factory.c b/gnome-settings-daemon/factory.c deleted file mode 100644 index 20948e626..000000000 --- a/gnome-settings-daemon/factory.c +++ /dev/null @@ -1,61 +0,0 @@ -#include <config.h> - -#include "gnome-settings-daemon.h" - -#include <bonobo.h> -#include <bonobo/bonobo-object.h> -#include <bonobo/bonobo-generic-factory.h> - -#include <gconf/gconf.h> - -#include <libgnome/gnome-init.h> -#include <libgnomeui/gnome-ui-init.h> -#include <libgnomeui/gnome-client.h> - -static BonoboObject *services_server = NULL; - -int main (int argc, char *argv []) -{ - GnomeClient *session; - Bonobo_RegistrationResult ret; - gchar *restart_argv[] = { "gnome-settings-daemon", NULL, NULL }; - - restart_argv[1] = *argv; - - bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); - bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); - textdomain (GETTEXT_PACKAGE); - - gnome_program_init ("gnome-settings-daemon", VERSION, - LIBGNOMEUI_MODULE, - argc, argv, - GNOME_CLIENT_PARAM_SM_CONNECT, FALSE, - NULL); - - if (!bonobo_init (&argc, argv)) { - g_error (_("Could not initialize Bonobo")); - } - - gconf_init (argc, argv, NULL); /* exits w/ message on failure */ - - /* start the settings daemon */ - services_server = BONOBO_OBJECT (gnome_settings_daemon_new ()); - - ret = bonobo_activation_active_server_register ("OAFIID:GNOME_SettingsDaemon", - BONOBO_OBJREF (services_server)); - if (ret != Bonobo_ACTIVATION_REG_SUCCESS) { - g_warning ("Encountered problems registering the settings daemon with bonobo-activation. " - "Clients may not detect that the settings daemon is already running."); - } - - session = gnome_master_client (); - gnome_client_set_restart_command (session, 2, restart_argv); - gnome_client_set_restart_style (session, GNOME_RESTART_IMMEDIATELY); - gnome_client_set_priority (session, 5); - g_signal_connect (session, "die", - G_CALLBACK (gtk_main_quit), NULL); - - gtk_main(); - - return -1; -} diff --git a/gnome-settings-daemon/gnome-settings-accessibility-keyboard.c b/gnome-settings-daemon/gnome-settings-accessibility-keyboard.c deleted file mode 100644 index b89ea528d..000000000 --- a/gnome-settings-daemon/gnome-settings-accessibility-keyboard.c +++ /dev/null @@ -1,624 +0,0 @@ -/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* gnome-settings-keyboard.c - * - * Copyright © 2001 Ximian, Inc. - * - * Written by Jody Goldberg <jody@gnome.org> - * - * 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. - * - * 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. - * - * 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., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include "config.h" - -#include <glib/gi18n.h> -#include <gdk/gdk.h> -#include <gdk/gdkx.h> -#include <gtk/gtk.h> - -#include <gconf/gconf-client.h> -#include <libgnome/gnome-help.h> - -#include "gnome-settings-accessibility-keyboard.h" -#include "gnome-settings-daemon.h" - -#ifdef HAVE_X11_EXTENSIONS_XKB_H -# include <X11/XKBlib.h> -# include <X11/extensions/XKBstr.h> - -#define CONFIG_ROOT "/desktop/gnome/accessibility/keyboard" - -#undef DEBUG_ACCESSIBILITY -#ifdef DEBUG_ACCESSIBILITY -#define d(str) fprintf (stderr, str) -#else -#define d(str) do { } while (0) -#endif - -static int xkbEventBase; -static GtkWidget *ax_slowkeys_dialog = NULL; -static GtkWidget *ax_slowkeys_dialog_hbox = NULL; -static GtkWidget *ax_stickykeys_dialog = NULL; -static GtkWidget *ax_stickykeys_dialog_hbox = NULL; -static gboolean stickykeys_shortcut_val; -static gboolean slowkeys_shortcut_val; - -static gboolean -xkb_enabled (void) -{ - static gboolean initialized = 0; - static gboolean have_xkb = 0; - - int opcode, errorBase, major, minor; - - if (initialized) - return have_xkb; - - gdk_error_trap_push (); - have_xkb = XkbQueryExtension (GDK_DISPLAY (), - &opcode, &xkbEventBase, &errorBase, &major, &minor) - && XkbUseExtension (GDK_DISPLAY (), &major, &minor); - XSync (GDK_DISPLAY (), FALSE); - gdk_error_trap_pop (); - - return have_xkb; -} - -static XkbDescRec * -get_xkb_desc_rec (void) -{ - XkbDescRec *desc; - Status status = Success; /* Any bogus value, to suppress warning */ - - if (!xkb_enabled ()) - return NULL; - - gdk_error_trap_push (); - desc = XkbGetMap (GDK_DISPLAY (), XkbAllMapComponentsMask, XkbUseCoreKbd); - if (desc != NULL) { - desc->ctrls = NULL; - status = XkbGetControls (GDK_DISPLAY (), XkbAllControlsMask, desc); - } - XSync (GDK_DISPLAY (), FALSE); - gdk_error_trap_pop (); - - g_return_val_if_fail (desc != NULL, NULL); - g_return_val_if_fail (desc->ctrls != NULL, NULL); - g_return_val_if_fail (status == Success, NULL); - - return desc; -} - -static int -get_int (GConfClient *client, char const *key) -{ - int res = gconf_client_get_int (client, key, NULL); - if (res <= 0) - res = 1; - return res; -} - -static gboolean -set_int (GConfClient *client, GConfChangeSet *cs, - char const *key, int val) -{ - gconf_change_set_set_int (cs, key, val); -#ifdef DEBUG_ACCESSIBILITY - if (val != gconf_client_get_int (client, key, NULL)) { - g_warning ("%s changed", key); - } -#endif - return val != gconf_client_get_int (client, key, NULL); -} - -static gboolean -set_bool (GConfClient *client, GConfChangeSet *cs, - gboolean in_gconf, char const *key, int val) -{ - gboolean bval = (val != 0); - if (in_gconf || bval) { - gconf_change_set_set_bool (cs, key, bval ? TRUE : FALSE); -#ifdef DEBUG_ACCESSIBILITY - if (bval != gconf_client_get_bool (client, key, NULL)) { - d ("%s changed", key); - return TRUE; - } -#endif - return (bval != gconf_client_get_bool (client, key, NULL)); - } - return FALSE; -} - -static unsigned long -set_clear (gboolean flag, unsigned long value, unsigned long mask) -{ - if (flag) - return value | mask; - return value & ~mask; -} - -static gboolean -set_ctrl_from_gconf (XkbDescRec *desc, GConfClient *client, - char const *key, unsigned long mask, gboolean flag) -{ - gboolean result = flag && gconf_client_get_bool (client, key, NULL); - desc->ctrls->enabled_ctrls = - set_clear (result, desc->ctrls->enabled_ctrls, mask); - return result; -} - -static void -set_server_from_gconf (GConfEntry *ignored) -{ - GConfClient *client = gconf_client_get_default (); - XkbDescRec *desc; - gboolean enable_accessX; - - desc = get_xkb_desc_rec (); - if (!desc) { - d ("No XKB present\n"); - return; - } - - /* general */ - enable_accessX = gconf_client_get_bool (client, CONFIG_ROOT "/enable", NULL); - - desc->ctrls->enabled_ctrls = set_clear (enable_accessX, - desc->ctrls->enabled_ctrls, - XkbAccessXKeysMask | XkbAccessXFeedbackMask); - - if (set_ctrl_from_gconf (desc, client, CONFIG_ROOT "/timeout_enable", - XkbAccessXTimeoutMask, enable_accessX)) { - desc->ctrls->ax_timeout = get_int (client, - CONFIG_ROOT "/timeout"); - /* disable only the master flag via the server we will disable - * the rest on the rebound without affecting gconf state - * don't change the option flags at all. - */ - desc->ctrls->axt_ctrls_mask = \ - XkbAccessXKeysMask | - XkbAccessXFeedbackMask; - desc->ctrls->axt_ctrls_values = 0; - desc->ctrls->axt_opts_mask = 0; - } - - desc->ctrls->ax_options = set_clear (enable_accessX && - gconf_client_get_bool (client, CONFIG_ROOT "/feature_state_change_beep", NULL), - desc->ctrls->ax_options, XkbAX_FeatureFBMask | XkbAX_SlowWarnFBMask); - - /* bounce keys */ - if (set_ctrl_from_gconf (desc, client, CONFIG_ROOT "/bouncekeys_enable", - XkbBounceKeysMask, enable_accessX)) { - desc->ctrls->debounce_delay = get_int (client, - CONFIG_ROOT "/bouncekeys_delay"); - desc->ctrls->ax_options = set_clear ( - gconf_client_get_bool (client, CONFIG_ROOT "/bouncekeys_beep_reject", NULL), - desc->ctrls->ax_options, XkbAX_BKRejectFBMask); - } - - /* mouse keys */ - if (set_ctrl_from_gconf (desc, client, CONFIG_ROOT "/mousekeys_enable", - XkbMouseKeysMask | XkbMouseKeysAccelMask, enable_accessX)) { - desc->ctrls->mk_interval = 100; /* msec between mousekey events */ - desc->ctrls->mk_curve = 50; - - /* We store pixels / sec, XKB wants pixels / event */ - desc->ctrls->mk_max_speed = get_int (client, - CONFIG_ROOT "/mousekeys_max_speed") / (1000 / desc->ctrls->mk_interval); - if (desc->ctrls->mk_max_speed <= 0) - desc->ctrls->mk_max_speed = 1; - - desc->ctrls->mk_time_to_max = get_int (client, /* events before max */ - CONFIG_ROOT "/mousekeys_accel_time") / desc->ctrls->mk_interval; - if (desc->ctrls->mk_time_to_max <= 0) - desc->ctrls->mk_time_to_max = 1; - - desc->ctrls->mk_delay = get_int (client, /* ms before 1st event */ - CONFIG_ROOT "/mousekeys_init_delay"); - } - - /* slow keys */ - if (set_ctrl_from_gconf (desc, client, CONFIG_ROOT "/slowkeys_enable", - XkbSlowKeysMask, enable_accessX)) { - desc->ctrls->ax_options = set_clear ( - gconf_client_get_bool (client, CONFIG_ROOT "/slowkeys_beep_press", NULL), - desc->ctrls->ax_options, XkbAX_SKPressFBMask); - desc->ctrls->ax_options = set_clear ( - gconf_client_get_bool (client, CONFIG_ROOT "/slowkeys_beep_accept", NULL), - desc->ctrls->ax_options, XkbAX_SKAcceptFBMask); - desc->ctrls->ax_options = set_clear ( - gconf_client_get_bool (client, CONFIG_ROOT "/slowkeys_beep_reject", NULL), - desc->ctrls->ax_options, XkbAX_SKRejectFBMask); - desc->ctrls->slow_keys_delay = get_int (client, - CONFIG_ROOT "/slowkeys_delay"); - /* anything larger than 500 seems to loose all keyboard input */ - if (desc->ctrls->slow_keys_delay > 500) - desc->ctrls->slow_keys_delay = 500; - } - - /* sticky keys */ - if (set_ctrl_from_gconf (desc, client, CONFIG_ROOT "/stickykeys_enable", - XkbStickyKeysMask, enable_accessX)) { - desc->ctrls->ax_options |= XkbAX_LatchToLockMask; - desc->ctrls->ax_options = set_clear ( - gconf_client_get_bool (client, CONFIG_ROOT "/stickykeys_two_key_off", NULL), - desc->ctrls->ax_options, XkbAX_TwoKeysMask); - desc->ctrls->ax_options = set_clear ( - gconf_client_get_bool (client, CONFIG_ROOT "/stickykeys_modifier_beep", NULL), - desc->ctrls->ax_options, XkbAX_StickyKeysFBMask); - } - - /* toggle keys */ - desc->ctrls->ax_options = set_clear (enable_accessX && - gconf_client_get_bool (client, CONFIG_ROOT "/togglekeys_enable", NULL), - desc->ctrls->ax_options, XkbAX_IndicatorFBMask); - - /* - fprintf (stderr, "CHANGE to : 0x%x\n", desc->ctrls->enabled_ctrls); - fprintf (stderr, "CHANGE to : 0x%x (2)\n", desc->ctrls->ax_options); - */ - - gdk_error_trap_push (); - XkbSetControls (GDK_DISPLAY (), - XkbSlowKeysMask | - XkbBounceKeysMask | - XkbStickyKeysMask | - XkbMouseKeysMask | - XkbMouseKeysAccelMask | - XkbAccessXKeysMask | - XkbAccessXTimeoutMask | - XkbAccessXFeedbackMask | - XkbControlsEnabledMask, - desc); - - XkbFreeKeyboard (desc, XkbAllComponentsMask, True); - - XSync (GDK_DISPLAY (), FALSE); - gdk_error_trap_pop (); - - g_object_unref (client); -} - -static gboolean -ax_response_callback (gint response_id, guint revert_controls_mask, gboolean enabled) -{ - GError *err = NULL; - gboolean success; - - switch (response_id) - { - case GTK_RESPONSE_REJECT: - case GTK_RESPONSE_CANCEL: - { - GConfClient *client = gconf_client_get_default (); - - /* we're reverting, so we invert sense of 'enabled' flag */ - d ("cancelling AccessX request"); - if (revert_controls_mask == XkbStickyKeysMask) - { - success = gconf_client_set_bool (client, CONFIG_ROOT "/stickykeys_enable", !enabled, &err); - if (err != NULL) - g_error_free (err); - } - if (revert_controls_mask == XkbSlowKeysMask) - { - success = gconf_client_set_bool (client, CONFIG_ROOT "/slowkeys_enable", !enabled, &err); - if (err != NULL) - g_error_free (err); - } - gconf_client_suggest_sync (client, NULL); - set_server_from_gconf (NULL); - break; - } - case GTK_RESPONSE_HELP: - gnome_help_display_desktop (NULL, - "user-guide", - "user-guide.xml", - "goscustaccess-6", - &err); - if (err != NULL) { - GtkWidget *error_dialog = gtk_message_dialog_new (NULL, - 0, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_CLOSE, - _("There was an error displaying help: %s"), - err->message); - g_signal_connect (G_OBJECT (error_dialog), - "response", - G_CALLBACK (gtk_widget_destroy), NULL); - gtk_window_set_resizable (GTK_WINDOW (error_dialog), FALSE); - gtk_widget_show (error_dialog); - g_error_free (err); - } - return FALSE; - default: - break; - } - return TRUE; -} - -static void -ax_stickykeys_response (GtkDialog *dialog, gint response_id, gpointer data) -{ - gboolean *enabled = data; - if (ax_response_callback (response_id, XkbStickyKeysMask, *enabled)) - { - gtk_widget_destroy (ax_stickykeys_dialog); - ax_stickykeys_dialog = NULL; - } -} - -static void -ax_slowkeys_response (GtkDialog *dialog, gint response_id, gpointer data) -{ - gboolean *enabled = data; - if (ax_response_callback (response_id, XkbSlowKeysMask, *enabled)) - { - gtk_widget_destroy (ax_slowkeys_dialog); - ax_slowkeys_dialog = NULL; - } -} - -static GtkWidget* -warning_dialog_post (GtkWidget *dialog, GtkWidget **hbox, GCallback response, - gboolean *enabled, gchar *title, gchar *user_action_string, gchar *query) -{ - GtkWidget *label; - gchar *label_markup_string = g_strconcat ("<span weight=\"bold\" size=\"larger\">", - query, "</span>\n\n", user_action_string, NULL); - - if (!dialog) - { - dialog = gtk_dialog_new_with_buttons (title, NULL, 0, - GTK_STOCK_CANCEL, - GTK_RESPONSE_REJECT, - GTK_STOCK_HELP, - GTK_RESPONSE_HELP, - GTK_STOCK_OK, - GTK_RESPONSE_OK, - NULL); - g_signal_connect (G_OBJECT (dialog), - "response", - G_CALLBACK (response), - enabled); - } - else - { - gtk_widget_destroy (*hbox); - } - *hbox = gtk_hbox_new (FALSE, 10); - gtk_container_add (GTK_CONTAINER (*hbox), gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG)); - label = gtk_label_new (NULL); - gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); - gtk_label_set_markup (GTK_LABEL (label), label_markup_string); - g_free (label_markup_string); - gtk_container_add (GTK_CONTAINER (*hbox), label); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), *hbox); - gtk_widget_show_all (dialog); - - return dialog; -} - -static void -ax_slowkeys_warning_dialog_post (gboolean enabled) -{ - slowkeys_shortcut_val = enabled; - ax_slowkeys_dialog = warning_dialog_post (ax_slowkeys_dialog, - &ax_slowkeys_dialog_hbox, - (GCallback) ax_slowkeys_response, - &slowkeys_shortcut_val, - _("Slow Keys Alert"), - _("You just held down the Shift key for 8 seconds. This is the shortcut for the Slow Keys feature, which affects the way your keyboard works."), - enabled ? _("Do you want to activate Slow Keys?") : - _("Do you want to deactivate Slow Keys?")); -} - -static void -ax_stickykeys_warning_dialog_post (gboolean enabled) -{ - stickykeys_shortcut_val = enabled; - ax_stickykeys_dialog = warning_dialog_post (ax_stickykeys_dialog, - &ax_stickykeys_dialog_hbox, - (GCallback) ax_stickykeys_response, - &stickykeys_shortcut_val, - _("Sticky Keys Alert"), - enabled ? _("You just pressed the Shift key 5 times in a row. This is the shortcut for the Sticky Keys feature, which affects the way your keyboard works.") : - _("You just pressed two keys at once, or pressed the Shift key 5 times in a row. This turns off the Sticky Keys feature, which affects the way your keyboard works."), - enabled ? _("Do you want to activate Sticky Keys?") : - _("Do you want to deactivate Sticky Keys?")); -} - -static void -set_gconf_from_server (GConfEntry *ignored) -{ - gboolean in_gconf; - GConfClient *client = gconf_client_get_default (); - GConfChangeSet *cs = gconf_change_set_new (); - XkbDescRec *desc = get_xkb_desc_rec (); - gboolean changed = FALSE, slowkeys_changed, stickykeys_changed; - - if (!desc) { - d ("No XKB present\n"); - return; - } - - /* - fprintf (stderr, "changed to : 0x%x\n", desc->ctrls->enabled_ctrls); - fprintf (stderr, "changed to : 0x%x (2)\n", desc->ctrls->ax_options); - */ - - /* always toggle this irrespective of the state */ - changed |= set_bool (client, cs, TRUE, CONFIG_ROOT "/enable", - desc->ctrls->enabled_ctrls & (XkbAccessXKeysMask | XkbAccessXFeedbackMask)); - - /* if master is disabled in gconf do not change gconf state of subordinates - * to match the server. However, we should enable the master if one of the subordinates - * get enabled. - */ - in_gconf = gconf_client_get_bool (client, CONFIG_ROOT "/enable", NULL); - - changed |= set_bool (client, cs, in_gconf, CONFIG_ROOT "/feature_state_change_beep", - desc->ctrls->ax_options & (XkbAX_FeatureFBMask | XkbAX_SlowWarnFBMask)); - changed |= set_bool (client, cs, in_gconf, CONFIG_ROOT "/timeout_enable", - desc->ctrls->enabled_ctrls & XkbAccessXTimeoutMask); - changed |= set_int (client, cs, CONFIG_ROOT "/timeout", - desc->ctrls->ax_timeout); - - changed |= set_bool (client, cs, in_gconf, CONFIG_ROOT "/bouncekeys_enable", - desc->ctrls->enabled_ctrls & XkbBounceKeysMask); - changed |= set_int (client, cs, CONFIG_ROOT "/bouncekeys_delay", - desc->ctrls->debounce_delay); - changed |= set_bool (client, cs, TRUE, CONFIG_ROOT "/bouncekeys_beep_reject", - desc->ctrls->ax_options & XkbAX_BKRejectFBMask); - - changed |= set_bool (client, cs, in_gconf, CONFIG_ROOT "/mousekeys_enable", - desc->ctrls->enabled_ctrls & XkbMouseKeysMask); - changed |= set_int (client, cs, CONFIG_ROOT "/mousekeys_max_speed", - desc->ctrls->mk_max_speed * (1000 / desc->ctrls->mk_interval)); - /* NOTE : mk_time_to_max is measured in events not time */ - changed |= set_int (client, cs, CONFIG_ROOT "/mousekeys_accel_time", - desc->ctrls->mk_time_to_max * desc->ctrls->mk_interval); - changed |= set_int (client, cs, CONFIG_ROOT "/mousekeys_init_delay", - desc->ctrls->mk_delay); - - slowkeys_changed = set_bool (client, cs, in_gconf, CONFIG_ROOT "/slowkeys_enable", - desc->ctrls->enabled_ctrls & XkbSlowKeysMask); - changed |= set_bool (client, cs, TRUE, CONFIG_ROOT "/slowkeys_beep_press", - desc->ctrls->ax_options & XkbAX_SKPressFBMask); - changed |= set_bool (client, cs, TRUE, CONFIG_ROOT "/slowkeys_beep_accept", - desc->ctrls->ax_options & XkbAX_SKAcceptFBMask); - changed |= set_bool (client, cs, TRUE, CONFIG_ROOT "/slowkeys_beep_reject", - desc->ctrls->ax_options & XkbAX_SKRejectFBMask); - changed |= set_int (client, cs, CONFIG_ROOT "/slowkeys_delay", - desc->ctrls->slow_keys_delay); - - stickykeys_changed = set_bool (client, cs, in_gconf, CONFIG_ROOT "/stickykeys_enable", - desc->ctrls->enabled_ctrls & XkbStickyKeysMask); - changed |= set_bool (client, cs, TRUE, CONFIG_ROOT "/stickykeys_two_key_off", - desc->ctrls->ax_options & XkbAX_TwoKeysMask); - changed |= set_bool (client, cs, TRUE, CONFIG_ROOT "/stickykeys_modifier_beep", - desc->ctrls->ax_options & XkbAX_StickyKeysFBMask); - - changed |= set_bool (client, cs, in_gconf, CONFIG_ROOT "/togglekeys_enable", - desc->ctrls->ax_options & XkbAX_IndicatorFBMask); - - if (!changed && stickykeys_changed^slowkeys_changed) - { - /* - * sticky or slowkeys has changed, singly, without our intervention. - * 99% chance this is due to a keyboard shortcut being used. - * we need to detect via this hack until we get - * XkbAXN_AXKWarning notifications working (probable XKB bug), - * at which time we can directly intercept such shortcuts instead. - * See cb_xkb_event_filter () below. - */ - - /* sanity check: are keyboard shortcuts available? */ - if (desc->ctrls->enabled_ctrls & XkbAccessXKeysMask) - { - if (slowkeys_changed) - ax_slowkeys_warning_dialog_post (desc->ctrls->enabled_ctrls & XkbSlowKeysMask); - else - ax_stickykeys_warning_dialog_post (desc->ctrls->enabled_ctrls & XkbStickyKeysMask); - } - } - - XkbFreeKeyboard (desc, XkbAllComponentsMask, True); - - changed |= (stickykeys_changed | slowkeys_changed); - - if (changed) { - gconf_client_commit_change_set (client, cs, FALSE, NULL); - gconf_client_suggest_sync (client, NULL); - } - gconf_change_set_unref (cs); - g_object_unref (client); -} - -static GdkFilterReturn -cb_xkb_event_filter (GdkXEvent *xevent, GdkEvent *ignored1, gpointer ignored2) -{ - XEvent *xev = (XEvent *) xevent; - XkbEvent *xkbEv = (XkbEvent *) xevent; - - if (xev->xany.type == (xkbEventBase + XkbEventCode) && - xkbEv->any.xkb_type == XkbControlsNotify) { - d ("Someone changed XKB state\n"); - set_gconf_from_server (NULL); - } - else if (xev->xany.type == (xkbEventBase + XkbEventCode) && - xkbEv->any.xkb_type == XkbAccessXNotify) { - if (xkbEv->accessx.detail == XkbAXN_AXKWarning) { - d ("About to turn on an AccessX feature from the keyboard!"); - /* - * TODO: when XkbAXN_AXKWarnings start working, we need to - * invoke ax_keys_warning_dialog_run here instead of in - * set_gconf_from_server(). - */ - } - } - - return GDK_FILTER_CONTINUE; -} - -void -gnome_settings_accessibility_keyboard_load (GConfClient *client) -{ - static gboolean has_filter = FALSE; - guint event_mask = XkbControlsNotifyMask; -#ifdef DEBUG_ACCESSIBILITY - event_mask = XkbControlsNotifyMask | XkbAccessXNotifyMask); /* make default when AXN_AXKWarning works */ -#endif - if (!xkb_enabled ()) - return; - - /* be sure to init before starting to monitor the server */ - set_server_from_gconf (NULL); - - /* be careful not to install multipled filters */ - if (has_filter) - return; - - gdk_error_trap_push (); - XkbSelectEvents (GDK_DISPLAY (), - XkbUseCoreKbd, - event_mask, - event_mask); - - XSync (GDK_DISPLAY (), FALSE); - gdk_error_trap_pop (); - - gdk_window_add_filter (NULL, - &cb_xkb_event_filter, NULL); -} - - -void -gnome_settings_accessibility_keyboard_init (GConfClient *client) -{ - gnome_settings_daemon_register_callback (CONFIG_ROOT, &set_server_from_gconf); -} -#else - -void -gnome_settings_accessibility_keyboard_load (GConfClient *client) -{ - g_warning ("Unsupported in this build"); -} -void -gnome_settings_accessibility_keyboard_init (GConfClient *client) -{ -} -#endif diff --git a/gnome-settings-daemon/gnome-settings-accessibility-keyboard.h b/gnome-settings-daemon/gnome-settings-accessibility-keyboard.h deleted file mode 100644 index e38cb7ba8..000000000 --- a/gnome-settings-daemon/gnome-settings-accessibility-keyboard.h +++ /dev/null @@ -1,32 +0,0 @@ -/* gnome-settings-accessibility-keyboard.h - * - * Copyright © 2002 Ximian, Inc. - * - * Written by Jody Goldberg <jody@gnome.org> - * - * 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. - * - * 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. - * - * 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., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef __GNOME_SETTINGS_ACCESSIBILITY_KEYBOARD_H -#define __GNOME_SETTINGS_ACCESSIBILITY_KEYBOARD_H - -#include <gconf/gconf.h> -#include <gconf/gconf-client.h> - -void gnome_settings_accessibility_keyboard_init (GConfClient *client); -void gnome_settings_accessibility_keyboard_load (GConfClient *client); - -#endif /* __GNOME_SETTINGS_ACCESSIBILITY_KEYBOARD_H */ diff --git a/gnome-settings-daemon/gnome-settings-background.c b/gnome-settings-daemon/gnome-settings-background.c deleted file mode 100644 index f695a4ed4..000000000 --- a/gnome-settings-daemon/gnome-settings-background.c +++ /dev/null @@ -1,112 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* -*- mode: c; style: linux -*- */ - -/* gnome-settings-background.c - * - * Copyright © 2001 Ximian, Inc. - * - * Written by Bradford Hovinen <hovinen@ximian.com> - * - * 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. - * - * 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. - * - * 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., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include <gdk/gdk.h> -#include <gdk/gdkx.h> -#include <gconf/gconf.h> - -#include "gnome-settings-keyboard.h" -#include "gnome-settings-daemon.h" - -#include "preferences.h" -#include "applier.h" - -static BGApplier **bg_appliers; -static BGPreferences *prefs; - -static guint applier_idle_id = 0; - -static gboolean -applier_idle (gpointer data) -{ - int i; - for (i = 0; bg_appliers [i]; i++) - bg_applier_apply_prefs (bg_appliers [i], prefs); - applier_idle_id = 0; - return FALSE; -} - -static void -background_callback (GConfEntry *entry) -{ - bg_preferences_merge_entry (prefs, entry); - - if (applier_idle_id != 0) { - g_source_remove (applier_idle_id); - } - - applier_idle_id = g_timeout_add (100, applier_idle, NULL); -} - -void -gnome_settings_background_init (GConfClient *client) -{ - GdkDisplay *display; - int n_screens; - int i; - - display = gdk_display_get_default (); - n_screens = gdk_display_get_n_screens (display); - - bg_appliers = g_new (BGApplier *, n_screens + 1); - - for (i = 0; i < n_screens; i++) { - GdkScreen *screen; - - screen = gdk_display_get_screen (display, i); - - bg_appliers [i] = BG_APPLIER (bg_applier_new_for_screen (BG_APPLIER_ROOT, screen)); - } - bg_appliers [i] = NULL; - - prefs = BG_PREFERENCES (bg_preferences_new ()); - bg_preferences_load (prefs); - - gnome_settings_daemon_register_callback ("/desktop/gnome/background", background_callback); -} - -void -gnome_settings_background_load (GConfClient *client) -{ - int i; - - /* If this is set, nautilus will draw the background and is - * almost definitely in our session. however, it may not be - * running yet (so is_nautilus_running() will fail). so, on - * startup, just don't do anything if this key is set so we - * don't waste time setting the background only to have - * nautilus overwrite it. - */ - - if (gconf_client_get_bool (client, "/apps/nautilus/preferences/show_desktop", NULL)) - return; - - for (i = 0; bg_appliers [i]; i++) - bg_applier_apply_prefs (bg_appliers [i], prefs); -} diff --git a/gnome-settings-daemon/gnome-settings-background.h b/gnome-settings-daemon/gnome-settings-background.h deleted file mode 100644 index 74aead612..000000000 --- a/gnome-settings-daemon/gnome-settings-background.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- mode: c; style: linux -*- */ - -/* gnome-settings-background.h - * - * Copyright © 2001 Ximian, Inc. - * - * Written by Bradford Hovinen <hovinen@ximian.com> - * - * 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. - * - * 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. - * - * 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., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef __GNOME_SETTINGS_BACKGROUND_H -#define __GNOME_SETTINGS_BACKGROUND_H - -#include <gconf/gconf.h> - -void gnome_settings_background_init (GConfClient *client); -void gnome_settings_background_load (GConfClient *client); - -#endif diff --git a/gnome-settings-daemon/gnome-settings-daemon.c b/gnome-settings-daemon/gnome-settings-daemon.c deleted file mode 100644 index cc22c9ba2..000000000 --- a/gnome-settings-daemon/gnome-settings-daemon.c +++ /dev/null @@ -1,532 +0,0 @@ -/* - * Copyright © 2001 Red Hat, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Red Hat not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. Red Hat makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Authors: Owen Taylor, Havoc Pennington - */ -#include <config.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> - -#include <gdk/gdkx.h> -#include <gtk/gtk.h> - - -#include <gconf/gconf.h> -#include <libgnome/gnome-init.h> -#include <libgnomeui/gnome-ui-init.h> - -#include <errno.h> -#include <sys/types.h> -#include <sys/wait.h> -#include <unistd.h> - -#include "xsettings-manager.h" -#include "gnome-settings-daemon.h" -#include "gnome-settings-xmodmap.h" - -/*#include "gnome-settings-disk.h"*/ -#include "gnome-settings-font.h" -#include "gnome-settings-xsettings.h" -#include "gnome-settings-mouse.h" -#include "gnome-settings-keyboard-xkb.h" -#include "gnome-settings-keyboard.h" -#include "gnome-settings-background.h" -#include "gnome-settings-sound.h" -#include "gnome-settings-accessibility-keyboard.h" -#include "gnome-settings-screensaver.h" -#include "gnome-settings-default-editor.h" -#include "gnome-settings-keybindings.h" -#include "gnome-settings-multimedia-keys.h" -#include "gnome-settings-gtk1theme.h" -#include "gnome-settings-xrdb.h" -#include "gnome-settings-typing-break.h" - -#include "GNOME_SettingsDaemon.h" - -#include "clipboard-manager.h" - -static GObjectClass *parent_class = NULL; - -struct _GnomeSettingsDaemonPrivate { - int dummy; -}; - -static GSList *directories = NULL; -XSettingsManager **managers = NULL; -static ClipboardManager *clipboard_manager; - -typedef struct DirElement -{ - char *dir; - GSList *callbacks; -} DirElement; - -void -gnome_settings_daemon_register_callback (const char *dir, - KeyCallbackFunc func) -{ - GSList *list; - gboolean dir_found = FALSE; - - for (list = directories; list; list = list->next) - { - DirElement *dir_element = list->data; - - if (! strcmp (dir_element->dir, dir)) - { - dir_element->callbacks = g_slist_prepend (dir_element->callbacks, (gpointer)func); - dir_found = TRUE; - break; - } - } - if (! dir_found) - { - DirElement *dir_element = g_new0 (DirElement, 1); - - dir_element->dir = g_strdup (dir); - dir_element->callbacks = g_slist_prepend (dir_element->callbacks, (gpointer)func); - directories = g_slist_prepend (directories, dir_element); - } -} - -GtkWidget * -gnome_settings_daemon_get_invisible (void) -{ - static GtkWidget *invisible = NULL; - if (invisible == NULL) - invisible = gtk_invisible_new (); - return invisible; -} - -static void -config_notify (GConfClient *client, - guint cnxn_id, - GConfEntry *entry, - gpointer user_data) -{ - GSList *list; - - for (list = directories; list; list = list->next) - { - DirElement *dir_element = list->data; - - if (! strncmp (dir_element->dir, entry->key, strlen (dir_element->dir))) - { - GSList *func_list; - for (func_list = dir_element->callbacks; func_list; func_list = func_list->next) - { - ((KeyCallbackFunc) func_list->data) (entry); - } - } - } -} - -static void -clipboard_manager_terminate_cb (void *data) -{ - /* Do nothing */ -} - -static GdkFilterReturn -clipboard_manager_event_filter (GdkXEvent *xevent, - GdkEvent *event, - gpointer data) -{ - if (clipboard_manager_process_event (clipboard_manager, - (XEvent *)xevent)) - return GDK_FILTER_REMOVE; - else - return GDK_FILTER_CONTINUE; -} - -static void -clipboard_manager_watch_cb (Window window, - Bool is_start, - long mask, - void *cb_data) -{ - GdkWindow *gdkwin; - GdkDisplay *display; - - display = gdk_display_get_default (); - gdkwin = gdk_window_lookup_for_display (display, window); - - if (is_start) - { - if (!gdkwin) - gdkwin = gdk_window_foreign_new_for_display (display, window); - else - g_object_ref (gdkwin); - - gdk_window_add_filter (gdkwin, clipboard_manager_event_filter, NULL); - } - else - { - g_assert (gdkwin); - gdk_window_remove_filter (gdkwin, clipboard_manager_event_filter, NULL); - g_object_unref (gdkwin); - } -} - -static void -terminate_cb (void *data) -{ - gboolean *terminated = data; - - if (*terminated) - return; - - *terminated = TRUE; - gtk_main_quit (); -} - -static GdkFilterReturn -manager_event_filter (GdkXEvent *xevent, - GdkEvent *event, - gpointer data) -{ - int screen_num = GPOINTER_TO_INT (data); - - g_return_val_if_fail (managers != NULL, GDK_FILTER_CONTINUE); - - if (xsettings_manager_process_event (managers [screen_num], (XEvent *)xevent)) - return GDK_FILTER_REMOVE; - else - return GDK_FILTER_CONTINUE; -} - -CORBA_boolean -awake_impl (PortableServer_Servant servant, - const CORBA_char *service, - CORBA_Environment *ev) -{ -#if 0 - printf ("I received an activate request for %s\n", service); -#endif - return TRUE; -} - - -static void -finalize (GObject *object) -{ - GnomeSettingsDaemon *daemon; - int i; - - daemon = GNOME_SETTINGS_DAEMON (object); - if (daemon->private == NULL) { - return; - } - - for (i = 0; managers && managers [i]; i++) - xsettings_manager_destroy (managers [i]); - - clipboard_manager_destroy (clipboard_manager); - - g_free (daemon->private); - daemon->private = NULL; - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static void -gnome_settings_daemon_class_init (GnomeSettingsDaemonClass *klass) -{ - GObjectClass *object_class; - - object_class = G_OBJECT_CLASS (klass); - - object_class->finalize = finalize; - - klass->epv.awake = awake_impl; - - parent_class = g_type_class_peek_parent (klass); -} - -static void -gnome_settings_daemon_init (GnomeSettingsDaemon *settings) -{ - settings->private = g_new (GnomeSettingsDaemonPrivate, 1); -} - -BONOBO_TYPE_FUNC_FULL(GnomeSettingsDaemon, GNOME_SettingsDaemon, - BONOBO_TYPE_OBJECT, gnome_settings_daemon) - -GObject * -gnome_settings_daemon_new (void) -{ - gboolean terminated = FALSE; - GConfClient *client; - GSList *list; - GnomeSettingsDaemon *daemon; - GdkDisplay *display; - int i; - int n_screens; - - display = gdk_display_get_default (); - n_screens = gdk_display_get_n_screens (display); - - daemon = g_object_new (gnome_settings_daemon_get_type (), NULL); - - if (xsettings_manager_check_running ( - gdk_x11_display_get_xdisplay (display), - gdk_screen_get_number (gdk_screen_get_default ()))) - { - fprintf (stderr, "You can only run one xsettings manager at a time; exiting\n"); - exit (1); - } - - - if (!terminated) - { - managers = g_new (XSettingsManager *, n_screens + 1); - - for (i = 0; i < n_screens; i++) - { - GdkScreen *screen; - - screen = gdk_display_get_screen (display, i); - - managers [i] = xsettings_manager_new ( - gdk_x11_display_get_xdisplay (display), - gdk_screen_get_number (screen), - terminate_cb, &terminated); - if (!managers [i]) - { - fprintf (stderr, "Could not create xsettings manager for screen %d!\n", i); - exit (1); - } - } - - g_assert (i == n_screens); - managers [i] = NULL; - } - - if (!clipboard_manager_check_running (GDK_DISPLAY_XDISPLAY (display))) - { - clipboard_manager = clipboard_manager_new (GDK_DISPLAY_XDISPLAY (display), - gdk_error_trap_push, - gdk_error_trap_pop, - clipboard_manager_terminate_cb, - clipboard_manager_watch_cb, - NULL); - } - - /* We use GConfClient not GConfClient because a cache isn't useful - * for us - */ - client = gconf_client_get_default (); - -/* gnome_settings_disk_init (client);*/ - gnome_settings_font_init (client); - gnome_settings_xsettings_init (client); - gnome_settings_mouse_init (client); -/* Essential - xkb initialization should happen before */ - gnome_settings_keyboard_xkb_set_post_activation_callback ((PostActivationCallback)gnome_settings_load_modmap_files, NULL); - gnome_settings_keyboard_xkb_init (client); - gnome_settings_keyboard_init (client); - gnome_settings_multimedia_keys_init (client); -/* */ - gnome_settings_sound_init (client); - gnome_settings_accessibility_keyboard_init (client); - gnome_settings_screensaver_init (client); - gnome_settings_default_editor_init (client); - gnome_settings_background_init (client); - gnome_settings_keybindings_init (client); - gnome_settings_gtk1_theme_init (client); - gnome_settings_xrdb_init (client); - gnome_settings_typing_break_init (client); - - for (list = directories; list; list = list->next) - { - GError *error = NULL; - DirElement *dir_element = list->data; - - gconf_client_add_dir (client, - dir_element->dir, - GCONF_CLIENT_PRELOAD_ONELEVEL, - NULL); - - gconf_client_notify_add (client, - dir_element->dir, - config_notify, - NULL, - NULL, - &error); - - if (error) - { - fprintf (stderr, "Could not listen for changes to configuration in '%s': %s\n", - dir_element->dir, error->message); - g_error_free (error); - } - } - - for (i = 0; i < n_screens; i++) - { - GdkScreen *screen; - - screen = gdk_display_get_screen (display, i); - gdk_window_add_filter ( - gdk_screen_get_root_window (screen), - manager_event_filter, GINT_TO_POINTER (i)); - } - -/* gnome_settings_disk_load (client);*/ - gnome_settings_font_load (client); - gnome_settings_xsettings_load (client); - gnome_settings_mouse_load (client); -/* Essential - xkb initialization should happen before */ - gnome_settings_keyboard_xkb_load (client); - gnome_settings_keyboard_load (client); - gnome_settings_multimedia_keys_load (client); -/* */ - gnome_settings_sound_load (client); - gnome_settings_accessibility_keyboard_load (client); - gnome_settings_screensaver_load (client); - gnome_settings_default_editor_load (client); - gnome_settings_background_load (client); - gnome_settings_keybindings_load (client); - gnome_settings_gtk1_theme_load (client); - gnome_settings_xrdb_load (client); - gnome_settings_typing_break_load (client); - - g_object_unref (client); - - return G_OBJECT (daemon); -} - - -/* Helper functions */ - -/* - * Helper function for spawn_with_input() - wait for a child - * to exit. - */ -gboolean -wait_for_child (int pid, - int *status) -{ - gint ret; - - again: - ret = waitpid (pid, status, 0); - - if (ret < 0) - { - if (errno == EINTR) - goto again; - else - { - g_warning ("Unexpected error in waitpid() (%s)", - g_strerror (errno)); - return FALSE; - } - } - - return TRUE; -} - - -/* - * Helper function for spawn_with_input() - write an entire - * string to a fd. - */ -static gboolean -write_all (int fd, - const char *buf, - gsize to_write) -{ - while (to_write > 0) - { - gssize count = write (fd, buf, to_write); - if (count < 0) - { - if (errno != EINTR) - return FALSE; - } - else - { - to_write -= count; - buf += count; - } - } - - return TRUE; -} - -/** - * gnome_settings_daemon-spawn_with_input: - * @argv: command line to run - * @input: string to write to the child process. - * - * Spawns a child process specified by @argv, writes the text in - * @input to it, then waits for the child to exit. Any failures - * are output through g_warning(); if you wanted to use this in - * cases where errors need to be presented to the user, some - * modification would be needed. - **/ -void -gnome_settings_daemon_spawn_with_input (char **argv, - const char *input) -{ - int exit_status; - int child_pid; - int inpipe; - GError *err = NULL; - - if (!g_spawn_async_with_pipes (NULL /* working directory */, argv, NULL /* envp */, - G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD, - NULL, NULL, /* child setup and data */ - &child_pid, - &inpipe, NULL, NULL, /* stdin, stdout, stderr */ - &err)) - { - gchar *command = g_strjoinv (" ", argv); - g_warning ("Could not execute %s: %s", command, err->message); - g_error_free (err); - g_free (command); - - return; - } - - if (input) - { - if (!write_all (inpipe, input, strlen (input))) - { - gchar *command = g_strjoinv (" ", argv); - g_warning ("Could not write input to %s", command); - g_free (command); - } - - close (inpipe); - } - - wait_for_child (child_pid, &exit_status); - - if (!WIFEXITED (exit_status) || WEXITSTATUS (exit_status)) - { - gchar *command = g_strjoinv (" ", argv); - g_warning ("Command %s failed", command); - g_free (command); - } - -} diff --git a/gnome-settings-daemon/gnome-settings-daemon.h b/gnome-settings-daemon/gnome-settings-daemon.h deleted file mode 100644 index 9621640d0..000000000 --- a/gnome-settings-daemon/gnome-settings-daemon.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2001 Red Hat, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Red Hat not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. Red Hat makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Authors: Jonathan Blandford - */ - -#ifndef __GNOME_SETTINGS_DAEMON_H -#define __GNOME_SETTINGS_DAEMON_H - -#include <gtk/gtk.h> -#include <gconf/gconf.h> -#include <gconf/gconf-client.h> - -#include <bonobo/bonobo-object.h> - -#include "GNOME_SettingsDaemon.h" - -typedef void (* KeyCallbackFunc) (GConfEntry *entry); - -void gnome_settings_daemon_register_callback (const char *dir, - KeyCallbackFunc func); -GtkWidget *gnome_settings_daemon_get_invisible (void); - - -G_BEGIN_DECLS - -#define GNOME_SETTINGS_DAEMON_TYPE (gnome_settings_daemon_get_type ()) -#define GNOME_SETTINGS_DAEMON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_SETTINGS_DAEMON_TYPE, GnomeSettingsDaemon)) -#define GNOME_SETTINGS_DAEMON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_SETTINGS_DAEMON_TYPE, GnomeSettingsDaemonClass)) -#define IS_GNOME_SETTINGS_DAEMON(obj) (GTK_TYPE_CHECK_INSTANCE_TYPE ((obj), GNOME_SETTINGS_DAEMON_TYPE)) -#define IS_GNOME_SETTINGS_DAEMON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_SETTINGS_DAEMON_TYPE)) -#define GNOME_SETTINGS_DAEMON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_SETTINGS_DAEMON_TYPE, GnomeSettingsDaemonClass)) - -typedef struct _GnomeSettingsDaemon GnomeSettingsDaemon; -typedef struct _GnomeSettingsDaemonClass GnomeSettingsDaemonClass; -typedef struct _GnomeSettingsDaemonPrivate GnomeSettingsDaemonPrivate; - -struct _GnomeSettingsDaemon -{ - BonoboObject parent_instance; - GnomeSettingsDaemonPrivate *private; -}; - -struct _GnomeSettingsDaemonClass -{ - BonoboObjectClass parent_class; - POA_GNOME_SettingsDaemon__epv epv; -}; - -GType gnome_settings_daemon_get_type (void); -GObject *gnome_settings_daemon_new (void); -void gnome_settings_daemon_spawn_with_input (char **argv, - const char *input); - -G_END_DECLS - -#endif /* __GNOME_SETTINGS_DAEMON_H */ diff --git a/gnome-settings-daemon/gnome-settings-default-editor.c b/gnome-settings-daemon/gnome-settings-default-editor.c deleted file mode 100644 index a257fe246..000000000 --- a/gnome-settings-daemon/gnome-settings-default-editor.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - * gnome-settings-default-editor.h: sync default editor changes to mime database - * - * Copyright 2002 Sun Microsystems, Inc. - * - * Author: jacob berkman <jacob@ximian.com> - * - */ - -/* - * WARNING: This is a hack. - * - * All it does is keep the "text / *" and "text/plain" mime type - * handlers in sync with each other. The reason we do this is because - * there is no UI for editing the text / * handler, and this is probably - * what the user actually wants to do. - */ - -#include <config.h> - -#include "gnome-settings-daemon.h" -#include "gnome-settings-default-editor.h" - -#include <libgnomevfs/gnome-vfs-mime-handlers.h> -#include <libgnomevfs/gnome-vfs-mime-monitor.h> - -#include <string.h> - -/* #define DE_DEBUG */ - -#define SYNC_CHANGES_KEY "/apps/gnome_settings_daemon/default_editor/sync_text_types" - -static gboolean sync_changes; - -#if DE_DEBUG -static void -print_mime_app (const char *mime_type) -{ - GnomeVFSMimeApplication *mime_app; - - mime_app = gnome_vfs_mime_get_default_application (mime_type); - - g_message ("Default info for %s (%p):\n" - "\t id: %s\n" - "\t name: %s\n" - "\t command: %s\n" - "\tneeds term: %s\n", - mime_type, mime_app, - mime_app->id, - mime_app->name, - mime_app->command, - mime_app->requires_terminal ? "Yes" : "No"); -} - -static void -print_state (void) -{ - if (sync_changes) - g_message ("Synching changes."); - else - g_message ("Not synching changes."); - - print_mime_app ("text/*"); - print_mime_app ("text/plain"); -} -#define PRINT_STATE print_state() -#else -#define PRINT_STATE -#endif - -static void -sync_changes_cb (GConfEntry *entry) -{ - GConfValue *value = gconf_entry_get_value (entry); - sync_changes = gconf_value_get_bool (value); - - PRINT_STATE; -} - -static void -vfs_change_cb (GnomeVFSMIMEMonitor *monitor, GConfClient *client) -{ - GnomeVFSMimeApplication *star_app, *plain_app; - GnomeVFSMimeActionType action; - - PRINT_STATE; - - if (!sync_changes) - return; - - star_app = gnome_vfs_mime_get_default_application ("text/*"); - plain_app = gnome_vfs_mime_get_default_application ("text/plain"); - - if (star_app == NULL || plain_app == NULL) { - if (star_app != NULL) { - gnome_vfs_mime_application_free (star_app); - } - if (plain_app != NULL) { - gnome_vfs_mime_application_free (plain_app); - } - return; - } - if (!strcmp (star_app->id, plain_app->id)) { - gnome_vfs_mime_application_free (star_app); - gnome_vfs_mime_application_free (plain_app); - return; - } - -#if DE_DEBUG - g_message ("Synching text/plain to text/*..."); -#endif - - action = gnome_vfs_mime_get_default_action_type ("text/plain"); - - gnome_vfs_mime_set_default_application ("text/*", plain_app->id); - gnome_vfs_mime_application_free (plain_app); - - gnome_vfs_mime_set_default_action_type ("text/*", action); - - PRINT_STATE; -} - -void -gnome_settings_default_editor_init (GConfClient *client) -{ - sync_changes = gconf_client_get_bool (client, SYNC_CHANGES_KEY, NULL); - - gnome_settings_daemon_register_callback (SYNC_CHANGES_KEY, sync_changes_cb); - - g_signal_connect (gnome_vfs_mime_monitor_get (), "data_changed", - G_CALLBACK (vfs_change_cb), client); -} - -void -gnome_settings_default_editor_load (GConfClient *client) -{ - vfs_change_cb (NULL, client); -} diff --git a/gnome-settings-daemon/gnome-settings-default-editor.h b/gnome-settings-daemon/gnome-settings-default-editor.h deleted file mode 100644 index fd510fa94..000000000 --- a/gnome-settings-daemon/gnome-settings-default-editor.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * gnome-settings-default-editor.h: sync default editor changes to mime database - * - * Copyright 2002 Sun Microsystems, Inc. - * - * Author: jacob berkman <jacob@ximian.com> - * - */ - -#ifndef GNOME_SETTINGS_DEFAULT_EDITOR_H -#define GNOME_SETTINGS_DEFAULT_EDITOR_H - -#include <gconf/gconf-client.h> - -void gnome_settings_default_editor_init (GConfClient *client); -void gnome_settings_default_editor_load (GConfClient *client); - -#endif /* GNOME_SETTINGS_DEFAULT_EDITOR_H */ diff --git a/gnome-settings-daemon/gnome-settings-font.c b/gnome-settings-daemon/gnome-settings-font.c deleted file mode 100644 index ee4ee7ff7..000000000 --- a/gnome-settings-daemon/gnome-settings-font.c +++ /dev/null @@ -1,213 +0,0 @@ -#include <config.h> - -#include "gnome-settings-daemon.h" - -#include <dirent.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> -#include <dirent.h> -#include <string.h> - -#include <glib/gi18n.h> -#include <gdk/gdkx.h> -#include <gtk/gtk.h> - -#include <gconf/gconf.h> - -static void -load_xcursor_theme (GConfClient *client) -{ - gchar *cursor_theme; - gint size; - char *add[] = { "xrdb", "-merge", NULL }; - GString *add_string = g_string_new (NULL); - - cursor_theme = gconf_client_get_string (client, - "/desktop/gnome/peripherals/mouse/cursor_theme", - NULL); - size = gconf_client_get_int (client, - "/desktop/gnome/peripherals/mouse/cursor_size", - NULL); - if (cursor_theme == NULL || size <= 0) - return; - - g_string_append_printf (add_string, - "Xcursor.theme: %s\n", cursor_theme); - g_string_append (add_string, "Xcursor.theme_core: true\n"); - g_string_append_printf (add_string, - "Xcursor.size: %d\n", size); - - gnome_settings_daemon_spawn_with_input (add, add_string->str); - - g_string_free (add_string, TRUE); -} - -static void -load_cursor (GConfClient *client) -{ - DIR *dir; - gchar *font_dir_name; - gchar *dir_name; - struct dirent *file_dirent; - gchar *cursor_font; - gchar **font_path; - gchar **new_font_path; - gint n_fonts; - gint new_n_fonts; - gint i; - gchar *mkfontdir_cmd; - - /* setting up the dir */ - font_dir_name = g_build_path (G_DIR_SEPARATOR_S, g_get_home_dir (), ".gnome2", NULL); - if (! g_file_test (font_dir_name, G_FILE_TEST_EXISTS)) - mkdir (font_dir_name, 0755); - g_free (font_dir_name); - - font_dir_name = g_build_path (G_DIR_SEPARATOR_S, g_get_home_dir (), ".gnome2/share", NULL); - if (! g_file_test (font_dir_name, G_FILE_TEST_EXISTS)) - mkdir (font_dir_name, 0755); - g_free (font_dir_name); - - font_dir_name = g_build_path (G_DIR_SEPARATOR_S, g_get_home_dir (), ".gnome2/share/fonts", NULL); - if (! g_file_test (font_dir_name, G_FILE_TEST_EXISTS)) - mkdir (font_dir_name, 0755); - - if (! g_file_test (font_dir_name, G_FILE_TEST_IS_DIR)) - { - GtkWidget *dialog; - - dialog = gtk_message_dialog_new (NULL, - 0, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_CLOSE, - "Cannot create the directory \"%s\".\n"\ - "This is needed to allow changing cursors.", - font_dir_name); - gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (dialog); - g_free (font_dir_name); - - return; - } - - dir_name = g_build_path (G_DIR_SEPARATOR_S, g_get_home_dir (), ".gnome2/share/cursor-fonts", NULL); - if (! g_file_test (dir_name, G_FILE_TEST_EXISTS)) - mkdir (dir_name, 0755); - - if (! g_file_test (dir_name, G_FILE_TEST_IS_DIR)) - { - GtkWidget *dialog; - - dialog = gtk_message_dialog_new (NULL, - 0, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_CLOSE, - (_("Cannot create the directory \"%s\".\n"\ - "This is needed to allow changing cursors.")), - dir_name); - gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (dialog); - g_free (dir_name); - - return; - } - - dir = opendir (dir_name); - - while ((file_dirent = readdir (dir)) != NULL) - { - struct stat st; - gchar *link_name; - - link_name = g_build_filename (dir_name, file_dirent->d_name, NULL); - if (lstat (link_name, &st)) - { - g_free (link_name); - continue; - } - g_free (link_name); - - if (S_ISLNK (st.st_mode)) - unlink (link_name); - } - - closedir (dir); - - cursor_font = gconf_client_get_string (client, - "/desktop/gnome/peripherals/mouse/cursor_font", - NULL); - - if ((cursor_font != NULL) && - (g_file_test (cursor_font, G_FILE_TEST_IS_REGULAR)) && - (g_path_is_absolute (cursor_font))) - { - gchar *newpath; - gchar *font_name; - - font_name = strrchr (cursor_font, G_DIR_SEPARATOR); - newpath = g_build_filename (dir_name, font_name, NULL); - symlink (cursor_font, newpath); - g_free (newpath); - } - g_free (cursor_font); - - - /* run mkfontdir */ - mkfontdir_cmd = g_strdup_printf ("mkfontdir %s %s", dir_name, font_dir_name); - /* maybe check for error... - * also, it's not going to like that if there are spaces in dir_name/font_dir_name. - */ - g_spawn_command_line_sync (mkfontdir_cmd, NULL, NULL, NULL, NULL); - g_free (mkfontdir_cmd); - - /* Set the font path */ - font_path = XGetFontPath (gdk_x11_get_default_xdisplay (), &n_fonts); - new_n_fonts = n_fonts; - if (n_fonts == 0 || strcmp (font_path[0], dir_name)) - new_n_fonts++; - if (n_fonts == 0 || strcmp (font_path[n_fonts-1], font_dir_name)) - new_n_fonts++; - - new_font_path = g_new0 (gchar*, new_n_fonts); - if (n_fonts == 0 || strcmp (font_path[0], dir_name)) - { - new_font_path[0] = dir_name; - for (i = 0; i < n_fonts; i++) - new_font_path [i+1] = font_path [i]; - } - else - { - for (i = 0; i < n_fonts; i++) - new_font_path [i] = font_path [i]; - } - - if (n_fonts == 0 || strcmp (font_path[n_fonts-1], font_dir_name)) - { - new_font_path[new_n_fonts-1] = font_dir_name; - } - - gdk_error_trap_push (); - XSetFontPath (gdk_display, new_font_path, new_n_fonts); - gdk_flush (); - gdk_error_trap_pop (); - - XFreeFontPath (font_path); - - g_free (new_font_path); - g_free (font_dir_name); - g_free (dir_name); -} - -void -gnome_settings_font_init (GConfClient *client) -{ - load_xcursor_theme (client); - load_cursor (client); -} - -void -gnome_settings_font_load (GConfClient *client) -{ - -} diff --git a/gnome-settings-daemon/gnome-settings-font.h b/gnome-settings-daemon/gnome-settings-font.h deleted file mode 100644 index 330e6c734..000000000 --- a/gnome-settings-daemon/gnome-settings-font.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright © 2001 Jonathan Blandford <jrb@gnome.org> - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Red Hat not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. Red Hat makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * Authors: Jonathan Blandford - */ - -#ifndef FONT_SETTINGS_H -#define FONT_SETTINGS_H - -#include <gconf/gconf.h> - -void gnome_settings_font_init (GConfClient *client); -void gnome_settings_font_load (GConfClient *client); - -#endif diff --git a/gnome-settings-daemon/gnome-settings-gtk1theme.c b/gnome-settings-daemon/gnome-settings-gtk1theme.c deleted file mode 100644 index 9bc1f65ad..000000000 --- a/gnome-settings-daemon/gnome-settings-gtk1theme.c +++ /dev/null @@ -1,222 +0,0 @@ -/* -*- mode: c; style: linux -*- */ - -/* gnome-settings-gtk1theme.c - * - * Copyright © 2002 Red Hat, Inc. - * - * Written by Owen Taylor <otaylor@redhat.com> - * - * 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. - * - * 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. - * - * 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., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include <errno.h> -#include <stdio.h> -#include <string.h> -#include <unistd.h> - -#include "gnome-settings-daemon.h" -#include "gnome-settings-gtk1theme.h" - -#define GTK_THEME_KEY "/desktop/gnome/interface/gtk_theme" - -/* Given the theme filename, return the needed contents for the RC file - * in the user's home directory - */ -static char * -make_contents (const char *filename) -{ - GString *result = g_string_new (NULL); - - g_string_append (result, - "# Autowritten by gnome-settings-daemon. Do not edit\n" - "\n"); - if (filename) - g_string_append_printf (result, - "include \"%s\"\n" - "\n", - filename); - g_string_append_printf (result, - "include \"%s/.gtkrc.mine\"\n", - g_get_home_dir ()); - - return g_string_free (result, FALSE); -} - -/* Writes @contents to @rc_filename atomically (using rename); returns - * %TRUE on sucess - */ -static gboolean -write_contents (const char *rc_filename, - const char *contents) -{ - char *tmp_filename = g_strconcat (rc_filename, ".new", NULL); - GIOChannel *channel; - GError *err = NULL; - - channel = g_io_channel_new_file (tmp_filename, "w", &err); - if (!channel) { - g_warning ("Cannot open %s: %s", tmp_filename, err->message); - goto bail2; - } - - if (g_io_channel_write_chars (channel, contents, -1, NULL, &err) != G_IO_STATUS_NORMAL) { - g_warning ("Cannot open %s: %s", tmp_filename, err->message); - goto bail0; - } - - if (g_io_channel_flush (channel, &err) != G_IO_STATUS_NORMAL) { - g_warning ("Error flushing %s: %s", tmp_filename, err->message); - goto bail0; - } - - if (g_io_channel_shutdown (channel, TRUE, &err) != G_IO_STATUS_NORMAL) { - g_warning ("Error closing %s: %s", tmp_filename, err->message); - goto bail1; - } - - if (rename (tmp_filename, rc_filename) < 0) { - g_warning ("Cannot move %s to %s: %s", tmp_filename, rc_filename, g_strerror (errno)); - goto bail1; - - } - - g_free (tmp_filename); - - return TRUE; - - bail0: - g_io_channel_shutdown (channel, FALSE, NULL); - bail1: - unlink (tmp_filename); - bail2: - g_clear_error (&err); - g_free (tmp_filename); - - return FALSE; -} - -/* Send a client message telling GTK+-1.2 apps to reread their RC files - */ -static void -send_change_message (void) -{ - GdkEventClient sev; - int i; - - for(i = 0; i < 5; i++) - sev.data.l[i] = 0; - - sev.data_format = 32; - sev.message_type = gdk_atom_intern("_GTK_READ_RCFILES", FALSE); - - gdk_event_send_clientmessage_toall ((GdkEvent *) &sev); -} - -/* See if a theme called @theme exists in @base_dir. Takes ownership of @base_dir - */ -static char * -check_filename (char *base_dir, - const char *theme) -{ - char *theme_filename = g_build_filename (base_dir, theme, "gtk", "gtkrc", NULL); - - if (!g_file_test (theme_filename, G_FILE_TEST_EXISTS)) { - g_free (theme_filename); - theme_filename = NULL; - } - - g_free (base_dir); - - return theme_filename; -} - -static void -apply_settings (void) -{ - GConfClient *client = gconf_client_get_default (); - gchar *current_theme; - gchar *theme_filename; - gchar *rc_filename; - gchar *current_contents; - gsize current_length; - gchar *new_contents; - GError *err = NULL; - - current_theme = gconf_client_get_string (client, GTK_THEME_KEY, NULL); - if (!current_theme) - current_theme = g_strdup ("Default"); - - /* Translate Default into Raleigh, since it's a better - * match than the default gtk1 theme. - */ - if (strcmp (current_theme, "Default") == 0) { - g_free (current_theme); - current_theme = g_strdup ("Raleigh"); - } - - /* Now look for a gtk1 theme with the name - */ - theme_filename = check_filename (g_build_filename (g_get_home_dir (),".themes", NULL), - current_theme); - - if (!theme_filename) { - theme_filename = check_filename (g_build_filename (DATADIR, "themes", NULL), - current_theme); - } - g_free (current_theme); - - /* If we don't find a match, use Raleigh - */ - if (!theme_filename) { - theme_filename = check_filename (g_build_filename (DATADIR, "themes", NULL), - "Raleigh"); - } - - rc_filename = g_build_filename (g_get_home_dir(), ".gtkrc-1.2-gnome2", NULL); - - if (!g_file_get_contents (rc_filename, ¤t_contents, ¤t_length, &err) && - !g_error_matches (err, G_FILE_ERROR, G_FILE_ERROR_NOENT)) { - g_warning ("Can't get contents of %s: %s", rc_filename, err->message); - g_clear_error (&err); - } - - new_contents = make_contents (theme_filename); - g_free (theme_filename); - - if (!current_contents || - current_length != strlen (new_contents) || - memcmp (current_contents, new_contents, current_length) != 0) { - if (write_contents (rc_filename, new_contents)) - send_change_message (); - } - - g_object_unref (client); - g_free (new_contents); - g_free (current_contents); - g_free (rc_filename); -} - -void -gnome_settings_gtk1_theme_init (GConfClient *client) -{ - gnome_settings_daemon_register_callback (GTK_THEME_KEY, (KeyCallbackFunc) apply_settings); -} - -void -gnome_settings_gtk1_theme_load (GConfClient *client) -{ - apply_settings (); -} diff --git a/gnome-settings-daemon/gnome-settings-gtk1theme.h b/gnome-settings-daemon/gnome-settings-gtk1theme.h deleted file mode 100644 index 36cd2354c..000000000 --- a/gnome-settings-daemon/gnome-settings-gtk1theme.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- mode: c; style: linux -*- */ - -/* gnome-settings-keyboard.h - * - * Copyright © 2002 Red Hat, Inc. - * - * Written by Owen Taylor <otaylor@redhat.com> - * - * 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. - * - * 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. - * - * 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., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef __GNOME_SETTINGS_GTK1THEME_H -#define __GNOME_SETTINGS_GTK1THEME_H - -#include <gconf/gconf.h> -#include <gconf/gconf-client.h> - -void gnome_settings_gtk1_theme_init (GConfClient *client); -void gnome_settings_gtk1_theme_load (GConfClient *client); - -#endif diff --git a/gnome-settings-daemon/gnome-settings-keybindings.c b/gnome-settings-daemon/gnome-settings-keybindings.c deleted file mode 100644 index a6c9ce8e4..000000000 --- a/gnome-settings-daemon/gnome-settings-keybindings.c +++ /dev/null @@ -1,488 +0,0 @@ -#include <config.h> - -#include <string.h> -#include <X11/keysym.h> -#include <glib/gi18n.h> -#include <gdk/gdk.h> -#include <gtk/gtk.h> -#include <gdk/gdkx.h> -#include "gnome-settings-daemon.h" -#include "gnome-settings-keybindings.h" -#include "eggaccelerators.h" - -/* we exclude shift, GDK_CONTROL_MASK and GDK_MOD1_MASK since we know what - these modifiers mean - these are the mods whose combinations are bound by the keygrabbing code */ -#define IGNORED_MODS (0x2000 /*Xkb modifier*/ | GDK_LOCK_MASK | \ - GDK_MOD2_MASK | GDK_MOD3_MASK | GDK_MOD4_MASK | GDK_MOD5_MASK) -/* these are the ones we actually use for global keys, we always only check - * for these set */ -#define USED_MODS (GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK) - -#define GCONF_BINDING_DIR "/desktop/gnome/keybindings" - -typedef struct { - guint keysym; - guint state; - guint keycode; -} Key; - -typedef struct { - char *binding_str; - char *action; - char *gconf_key; - Key key; - Key previous_key; -} Binding; - -static GSList *binding_list = NULL; -static GSList *screens = NULL; - -static GSList * -get_screens_list (void) -{ - GdkDisplay *display = gdk_display_get_default(); - GSList *list = NULL; - int i; - - if (gdk_display_get_n_screens (display) == 1) { - list = g_slist_append (list, gdk_screen_get_default ()); - } else { - for (i = 0; i < gdk_display_get_n_screens (display); i++) { - GdkScreen *screen; - - screen = gdk_display_get_screen (display, i); - if (screen != NULL) { - list = g_slist_append (list, screen); - } - } - } - - return list; -} - -extern char **environ; - -static char * -screen_exec_display_string (GdkScreen *screen) -{ - GString *str; - const char *old_display; - char *retval; - char *p; - - g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); - - old_display = gdk_display_get_name (gdk_screen_get_display (screen)); - - str = g_string_new ("DISPLAY="); - g_string_append (str, old_display); - - p = strrchr (str->str, '.'); - if (p && p > strchr (str->str, ':')) - g_string_truncate (str, p - str->str); - - g_string_append_printf (str, ".%d", gdk_screen_get_number (screen)); - - retval = str->str; - - g_string_free (str, FALSE); - - return retval; -} - -/** - * get_exec_environment: - * - * Description: Modifies the current program environment to - * ensure that $DISPLAY is set such that a launched application - * inheriting this environment would appear on screen. - * - * Returns: a newly-allocated %NULL-terminated array of strings or - * %NULL on error. Use g_strfreev() to free it. - * - * mainly ripped from egg_screen_exec_display_string in - * gnome-panel/egg-screen-exec.c - **/ -char ** -get_exec_environment (XEvent *xevent) -{ - char **retval = NULL; - int i; - int display_index = -1; - - GdkScreen *screen = NULL; - - GdkWindow *window = gdk_xid_table_lookup (xevent->xkey.root); - - if (window) - screen = gdk_drawable_get_screen (GDK_DRAWABLE (window)); - - g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); - - for (i = 0; environ [i]; i++) - if (!strncmp (environ [i], "DISPLAY", 7)) - display_index = i; - - if (display_index == -1) - display_index = i++; - - retval = g_new (char *, i + 1); - - for (i = 0; environ [i]; i++) - if (i == display_index) - retval [i] = screen_exec_display_string (screen); - else - retval [i] = g_strdup (environ [i]); - - retval [i] = NULL; - - return retval; -} - - -static gint -compare_bindings (gconstpointer a, gconstpointer b) -{ - Binding *key_a = (Binding*) a; - char *key_b = (char*) b; - - return strcmp (key_b, key_a->gconf_key); -} - -static gboolean -parse_binding (Binding *binding) -{ - g_return_val_if_fail (binding != NULL, FALSE); - - binding->key.keysym = 0; - binding->key.state = 0; - - if (binding->binding_str == NULL || - binding->binding_str[0] == '\0' || - strcmp (binding->binding_str, "Disabled") == 0) - return FALSE; - - if (egg_accelerator_parse_virtual (binding->binding_str, &binding->key.keysym, &binding->key.keycode, &binding->key.state) == FALSE) - return FALSE; - - return TRUE; -} - -gboolean -bindings_get_entry (char *subdir) -{ - GConfValue *value; - Binding *new_binding; - GSList *tmp_elem = NULL, *list = NULL, *li; - char *gconf_key; - char *action = NULL; - char *key = NULL; - GConfClient *client = gconf_client_get_default(); - - g_return_val_if_fail (subdir != NULL, FALSE); - - /* value = gconf_entry_get_value (entry); */ - gconf_key = g_path_get_basename (subdir); - - if (!gconf_key) - return FALSE; - - /* Get entries for this binding */ - list = gconf_client_all_entries (client, subdir, NULL); - g_object_unref (client); - - for (li = list; li != NULL; li = li->next) - { - GConfEntry *entry = li->data; - char *key_name = g_path_get_basename (gconf_entry_get_key (entry)); - if (strcmp (key_name, "action") == 0) - { - if (!action) - { - value = gconf_entry_get_value (entry); - if (value->type != GCONF_VALUE_STRING) - return FALSE; - action = g_strdup (gconf_value_get_string (value)); - } - else - g_warning (_("Key Binding (%s) has its action defined multiple times\n"), - gconf_key); - } - if (strcmp (key_name, "binding") == 0) - { - if (!key) - { - value = gconf_entry_get_value (entry); - if (value->type != GCONF_VALUE_STRING) - return FALSE; - key = g_strdup (gconf_value_get_string (value)); - } - else - g_warning (_("Key Binding (%s) has its binding defined multiple times\n"), - gconf_key); - } - } - if (!action || !key) - { - g_warning (_("Key Binding (%s) is incomplete\n"), gconf_key); - return FALSE; - } - - tmp_elem = g_slist_find_custom (binding_list, gconf_key, - compare_bindings); - - if (!tmp_elem) - new_binding = g_new0 (Binding, 1); - else - { - new_binding = (Binding*) tmp_elem->data; - g_free (new_binding->binding_str); - g_free (new_binding->action); - } - - new_binding->binding_str = key; - new_binding->action = action; - new_binding->gconf_key = gconf_key; - - new_binding->previous_key.keysym = new_binding->key.keysym; - new_binding->previous_key.state = new_binding->key.state; - new_binding->previous_key.keycode = new_binding->key.keycode; - - if (parse_binding (new_binding)) - binding_list = g_slist_append (binding_list, new_binding); - else - { - g_warning (_("Key Binding (%s) is invalid\n"), gconf_key); - g_free (new_binding->binding_str); - g_free (new_binding->action); - return FALSE; - } - return TRUE; -} - -static gboolean -key_already_used (Binding *binding) -{ - GSList *li; - - for (li = binding_list; li != NULL; li = li->next) - { - Binding *tmp_binding = (Binding*) li->data; - - if (tmp_binding != binding && tmp_binding->key.keycode == binding->key.keycode && - tmp_binding->key.state == binding->key.state) - return TRUE; - } - return FALSE; -} - -static void -grab_key (GdkWindow *root, Key *key, int result, gboolean grab) -{ - gdk_error_trap_push (); - if (grab) - XGrabKey (GDK_DISPLAY(), key->keycode, (result | key->state), - GDK_WINDOW_XID (root), True, GrabModeAsync, GrabModeAsync); - else - XUngrabKey(GDK_DISPLAY(), key->keycode, (result | key->state), - GDK_WINDOW_XID (root)); - gdk_flush (); - if (gdk_error_trap_pop ()) { - g_warning (_("It seems that another application already has" - " access to key '%d'."), key->keycode); - } -} - -/* inspired from all_combinations from gnome-panel/gnome-panel/global-keys.c */ -#define N_BITS 32 -static void -do_grab (gboolean grab, - Key *key) -{ - int indexes[N_BITS];/*indexes of bits we need to flip*/ - int i, bit, bits_set_cnt; - int uppervalue; - guint mask_to_traverse = IGNORED_MODS & ~ key->state; - - bit = 0; - for (i = 0; i < N_BITS; i++) { - if (mask_to_traverse & (1<<i)) - indexes[bit++]=i; - } - - bits_set_cnt = bit; - - uppervalue = 1<<bits_set_cnt; - for (i = 0; i < uppervalue; i++) { - GSList *l; - int j, result = 0; - - for (j = 0; j < bits_set_cnt; j++) { - if (i & (1<<j)) - result |= (1<<indexes[j]); - } - - for (l = screens; l ; l = l->next) { - GdkScreen *screen = l->data; - grab_key (gdk_screen_get_root_window (screen), key, result, - grab); - } - } -} - -void -binding_register_keys (void) -{ - GSList *li; - - gdk_error_trap_push(); - - /* Now check for changes and grab new key if not already used */ - for (li = binding_list ; li != NULL; li = li->next) - { - Binding *binding = (Binding *) li->data; - - if (binding->previous_key.keycode != binding->key.keycode || - binding->previous_key.state != binding->key.state) - { - /* Ungrab key if it changed and not clashing with previously set binding */ - if (!key_already_used (binding)) - { - if (binding->previous_key.keycode) - do_grab (FALSE, &binding->previous_key); - do_grab (TRUE, &binding->key); - - binding->previous_key.keysym = binding->key.keysym; - binding->previous_key.state = binding->key.state; - binding->previous_key.keycode = binding->key.keycode; - } - else - g_warning (_("Key Binding (%s) is already in use\n"), binding->binding_str); - } - } - gdk_flush (); - gdk_error_trap_pop(); -} - -static void -bindings_callback (GConfEntry *entry) -{ - /* ensure we get binding dir not a sub component */ - gchar** key_elems = g_strsplit (gconf_entry_get_key (entry), "/", 15); - gchar* binding_entry = g_strdup_printf ("/%s/%s/%s/%s", key_elems[1], - key_elems[2], key_elems[3], - key_elems[4]); - g_strfreev (key_elems); - - bindings_get_entry (binding_entry); - g_free (binding_entry); - - binding_register_keys (); -} - -GdkFilterReturn -keybindings_filter (GdkXEvent *gdk_xevent, - GdkEvent *event, - gpointer data) -{ - XEvent *xevent = (XEvent *)gdk_xevent; - guint keycode, state; - GSList *li; - - if(xevent->type != KeyPress) - return GDK_FILTER_CONTINUE; - - keycode = xevent->xkey.keycode; - state = xevent->xkey.state; - - for (li = binding_list; li != NULL; li = li->next) - { - Binding *binding = (Binding*) li->data; - - if (keycode == binding->key.keycode && - (state & USED_MODS) == binding->key.state) - { - GError* error = NULL; - gboolean retval; - gchar **argv = NULL; - gchar **envp = NULL; - - g_return_val_if_fail (binding->action != NULL, GDK_FILTER_CONTINUE); - - if (!g_shell_parse_argv (binding->action, - NULL, &argv, - &error)) - return GDK_FILTER_CONTINUE; - - envp = get_exec_environment (xevent); - - - retval = g_spawn_async (NULL, - argv, - envp, - G_SPAWN_SEARCH_PATH, - NULL, - NULL, - NULL, - &error); - g_strfreev (argv); - g_strfreev (envp); - - if (!retval) - { - GtkWidget *dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_WARNING, - GTK_BUTTONS_CLOSE, - _("Error while trying to run (%s)\n"\ - "which is linked to the key (%s)"), - binding->action, - binding->binding_str); - g_signal_connect (dialog, "response", - G_CALLBACK (gtk_widget_destroy), - NULL); - gtk_widget_show (dialog); - } - return GDK_FILTER_REMOVE; - } - } - return GDK_FILTER_CONTINUE; -} - -void -gnome_settings_keybindings_init (GConfClient *client) -{ - GdkDisplay *dpy = gdk_display_get_default (); - GdkScreen *screen; - int screen_num = gdk_display_get_n_screens (dpy); - int i; - - gnome_settings_daemon_register_callback (GCONF_BINDING_DIR, bindings_callback); - - gdk_window_add_filter (gdk_get_default_root_window (), - keybindings_filter, - NULL); - for (i = 0; i < screen_num; i++) - { - screen = gdk_display_get_screen (dpy, i); - gdk_window_add_filter (gdk_screen_get_root_window (screen), - keybindings_filter, NULL); - } -} - -void -gnome_settings_keybindings_load (GConfClient *client) -{ - GSList *list, *li; - - list = gconf_client_all_dirs (client, GCONF_BINDING_DIR, NULL); - screens = get_screens_list (); - - for (li = list; li != NULL; li = li->next) - { - char *subdir = li->data; - li->data = NULL; - bindings_get_entry (subdir); - } - binding_register_keys (); -} - diff --git a/gnome-settings-daemon/gnome-settings-keybindings.h b/gnome-settings-daemon/gnome-settings-keybindings.h deleted file mode 100644 index eadd4ae91..000000000 --- a/gnome-settings-daemon/gnome-settings-keybindings.h +++ /dev/null @@ -1,33 +0,0 @@ -/* gnome-settings-keybindings.h - * - * Copyright (C) 2002 Sun Microsystems Inc. - * - * 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. - * - * 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. - * - * 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., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - * Author: Erwann Chénedé <erwann.chenede@sun.com> - */ - - -#ifndef __GNOME_SETTINGS_KEYBINDINGS_H__ -#define __GNOME_SETTINGS_KEYBINDINGS_H__ - -#include <gconf/gconf.h> -#include <gconf/gconf-client.h> - -void gnome_settings_keybindings_init (GConfClient *client); -void gnome_settings_keybindings_load (GConfClient *client); - -#endif /*__GNOME_SETTINGS_KEYBINDINGS_H__*/ diff --git a/gnome-settings-daemon/gnome-settings-keyboard-xkb.c b/gnome-settings-daemon/gnome-settings-keyboard-xkb.c deleted file mode 100644 index 703390797..000000000 --- a/gnome-settings-daemon/gnome-settings-keyboard-xkb.c +++ /dev/null @@ -1,399 +0,0 @@ -/* -*- mode: c; style: linux -*- */ - -/* gnome-settings-keyboard-xkb.c - * - * Copyright © 2001 Udaltsoft - * - * Written by Sergey V. Oudaltsov <svu@users.sourceforge.net> - * - * 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. - * - * 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. - * - * 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., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include <glib/gi18n.h> -#include <gdk/gdk.h> -#include <gdk/gdkx.h> -#include <gconf/gconf-client.h> -#include "gnome-settings-xmodmap.h" - -#include <string.h> -#include <time.h> - -#include <libxklavier/xklavier.h> -#include <libxklavier/xklavier_config.h> -#include <libgswitchit/gswitchit_config.h> - -#include "gnome-settings-keyboard-xkb.h" -#include "gnome-settings-daemon.h" - -static GSwitchItConfig currentConfig; -static GSwitchItKbdConfig currentKbdConfig; - -/* never terminated */ -static GSwitchItKbdConfig initialSysKbdConfig; - -static gboolean initedOk; - -static PostActivationCallback paCallback = NULL; -static void *paCallbackUserData = NULL; - -static const char KNOWN_FILES_KEY[] = - "/desktop/gnome/peripherals/keyboard/general/known_file_list"; -static const char DISABLE_SYSCONF_CHANGED_WARNING_KEY[] = - "/desktop/gnome/peripherals/keyboard/general/disable_sysconfig_changed_warning"; - -typedef enum { - RESPONSE_USE_X, - RESPONSE_USE_GNOME -} SysConfigChangedMsgResponse; - -#define noGSDKX - -#ifdef GSDKX -static FILE *logfile; - -static void -gnome_settings_keyboard_log_appender (const char file[], const char function[], - int level, const char format[], va_list args) -{ - time_t now = time (NULL); - fprintf (logfile, "[%08ld,%03d,%s:%s/] \t", now, - level, file, function); - vfprintf (logfile, format, args); - fflush(logfile); -} -#endif - -static void -activation_error (void) -{ - char const *vendor = ServerVendor (GDK_DISPLAY ()); - int release = VendorRelease (GDK_DISPLAY ()); - gboolean badXFree430Release = (vendor != NULL) - && (0 == strcmp (vendor, "The XFree86 Project, Inc")) - && (release / 100000 == 403); - - GtkWidget *dialog; - - /* VNC viewers will not work, do not barrage them with warnings */ - if (NULL != vendor && NULL != strstr (vendor, "VNC")) - return; - - dialog = gtk_message_dialog_new_with_markup (NULL, - 0, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_CLOSE, - _ - ("Error activating XKB configuration.\n" - "It can happen under various circumstances:\n" - "- a bug in libxklavier library\n" - "- a bug in X server (xkbcomp, xmodmap utilities)\n" - "- X server with incompatible libxkbfile implementation\n\n" - "X server version data:\n%s\n%d\n%s\n" - "If you report this situation as a bug, please include:\n" - "- The result of %s\n" - "- The result of %s"), - vendor, - release, - badXFree430Release - ? - _ - ("You are using XFree 4.3.0.\n" - "There are known problems with complex XKB configurations.\n" - "Try using simpler configuration or taking more fresh version of XFree software.") - : "", - "<b>xprop -root | grep XKB</b>", - "<b>gconftool-2 -R /desktop/gnome/peripherals/keyboard/kbd</b>"); - g_signal_connect (dialog, "response", - G_CALLBACK (gtk_widget_destroy), NULL); - gtk_widget_show (dialog); -} - -static void -apply_settings (void) -{ - if (!initedOk) - return; - - GSwitchItConfigLoadFromGConf (¤tConfig); - /* again, probably it would be nice to compare things - before activating them */ - GSwitchItConfigActivate (¤tConfig); -} - -static void -apply_xkb_settings (void) -{ - GConfClient *confClient; - GSwitchItKbdConfig currentSysKbdConfig; - - if (!initedOk) - return; - - confClient = gconf_client_get_default (); - GSwitchItKbdConfigInit (¤tSysKbdConfig, confClient); - g_object_unref (confClient); - - GSwitchItKbdConfigLoadFromGConf (¤tKbdConfig); - - if (currentKbdConfig.overrideSettings) { - /* initialization - from the system settings */ - GSwitchItKbdConfigSaveToGConf (&initialSysKbdConfig); - } else { - GSwitchItKbdConfigLoadFromXCurrent (¤tSysKbdConfig); - /* Activate - only if different! */ - if (!GSwitchItKbdConfigEquals (¤tKbdConfig, ¤tSysKbdConfig)) - { - if (GSwitchItKbdConfigActivate (¤tKbdConfig)) { - if (paCallback != NULL) { - (*paCallback) (paCallbackUserData); - } - } else { - g_warning - ("Could not activate the XKB configuration"); - activation_error (); - } - } else - XklDebug (100, "Actual KBD configuration was not changed: redundant notification\n"); - } - - GSwitchItKbdConfigTerm (¤tSysKbdConfig); -} - -static void -gnome_settings_keyboard_xkb_sysconfig_changed_response (GtkDialog * dialog, - SysConfigChangedMsgResponse - what2do) -{ - gboolean dontShowAgain = gtk_toggle_button_get_active ( - GTK_TOGGLE_BUTTON (g_object_get_data (G_OBJECT (dialog), "chkDontShowAgain"))); - - switch (what2do) { - case RESPONSE_USE_X: - GSwitchItKbdConfigSaveToGConf (&initialSysKbdConfig); - break; - case RESPONSE_USE_GNOME: - /* Do absolutely nothing - just keep things the way they are */ - break; - } - - if (dontShowAgain) { - GConfClient *confClient; - confClient = gconf_client_get_default (); - gconf_client_set_bool (confClient, DISABLE_SYSCONF_CHANGED_WARNING_KEY, TRUE, NULL); - g_object_unref (confClient); - } - gtk_widget_destroy (GTK_WIDGET (dialog)); -} - -static void -gnome_settings_keyboard_xkb_analyze_sysconfig (void) -{ - GConfClient *confClient; - GSwitchItKbdConfig backupGConfKbdConfig; - gboolean isConfigChanged, dontShow; - - if (!initedOk) - return; - confClient = gconf_client_get_default (); - GSwitchItKbdConfigInit (&backupGConfKbdConfig, confClient); - GSwitchItKbdConfigInit (&initialSysKbdConfig, confClient); - dontShow = gconf_client_get_bool (confClient, DISABLE_SYSCONF_CHANGED_WARNING_KEY, NULL); - g_object_unref (confClient); - GSwitchItKbdConfigLoadFromGConfBackup (&backupGConfKbdConfig); - GSwitchItKbdConfigLoadFromXInitial (&initialSysKbdConfig); - initialSysKbdConfig.overrideSettings = FALSE; - - isConfigChanged = g_slist_length (backupGConfKbdConfig.layouts) && - !GSwitchItKbdConfigEquals (&initialSysKbdConfig, &backupGConfKbdConfig); - /* config was changed!!! */ - if (isConfigChanged) { - if (dontShow) { - g_warning ("The system configuration changed - but we remain silent\n"); - } else { - GtkWidget *chkDontShowAgain = gtk_check_button_new_with_mnemonic (_ ("Do _not show this warning again")); - GtkWidget *alignDontShowAgain = gtk_alignment_new (0.5, - 0.5, - 0, - 0); - GtkWidget *msg = gtk_message_dialog_new_with_markup (NULL, - 0, - GTK_MESSAGE_INFO, - GTK_BUTTONS_NONE, -/* !! temporary one */ - _ - ("The X system keyboard settings differ from your current GNOME " - "keyboard settings. Which set would you like to use?")); - gtk_container_set_border_width (GTK_CONTAINER (alignDontShowAgain), - 12); - gtk_container_add (GTK_CONTAINER (alignDontShowAgain), - chkDontShowAgain); - gtk_container_add (GTK_CONTAINER ((GTK_DIALOG (msg))->vbox), - alignDontShowAgain); - - gtk_dialog_add_buttons (GTK_DIALOG (msg), - _("Use X settings"), - RESPONSE_USE_X, - _("Use GNOME settings"), - RESPONSE_USE_GNOME, NULL); - gtk_dialog_set_default_response (GTK_DIALOG (msg), - RESPONSE_USE_GNOME); - g_object_set_data (G_OBJECT (msg), "chkDontShowAgain", chkDontShowAgain); - g_signal_connect (msg, "response", - G_CALLBACK - (gnome_settings_keyboard_xkb_sysconfig_changed_response), - NULL); - gtk_widget_show_all (msg); - } - } - GSwitchItKbdConfigSaveToGConfBackup (&initialSysKbdConfig); - GSwitchItKbdConfigTerm (&backupGConfKbdConfig); -} - -static gboolean -gnome_settings_chk_file_list (void) -{ - GDir *homeDir; - G_CONST_RETURN gchar *fname; - GSList *file_list = NULL; - GSList *last_login_file_list = NULL; - GSList *tmp = NULL; - GSList *tmp_l = NULL; - gboolean new_file_exist = FALSE; - GConfClient *confClient = gconf_client_get_default (); - - homeDir = g_dir_open (g_get_home_dir (), 0, NULL); - while ((fname = g_dir_read_name (homeDir)) != NULL) { - if (g_strrstr (fname, "modmap")) { - file_list = g_slist_append (file_list, g_strdup (fname)); - } - } - g_dir_close (homeDir); - - last_login_file_list = gconf_client_get_list (confClient, KNOWN_FILES_KEY, GCONF_VALUE_STRING, NULL); - - /* Compare between the two file list, currently available modmap files - and the files available in the last log in */ - tmp = file_list; - while (tmp != NULL) { - tmp_l = last_login_file_list; - new_file_exist = TRUE; - while (tmp_l != NULL) { - if (strcmp (tmp->data, tmp_l->data) == 0) { - new_file_exist = FALSE; - break; - } - else - tmp_l = tmp_l->next; - } - if (new_file_exist) - break; - else - tmp = tmp->next; - } - - if (new_file_exist) - gconf_client_set_list (confClient, KNOWN_FILES_KEY, GCONF_VALUE_STRING, file_list, NULL); - - g_slist_foreach (file_list, (GFunc) g_free, NULL); - g_slist_free (file_list); - - g_slist_foreach (last_login_file_list, (GFunc) g_free, NULL); - g_slist_free (last_login_file_list); - - g_object_unref (G_OBJECT (confClient)); - - return new_file_exist; - -} - -static void -gnome_settings_keyboard_xkb_chk_lcl_xmm (void) -{ - if (gnome_settings_chk_file_list ()) - gnome_settings_modmap_dialog_call (); - gnome_settings_load_modmap_files (); - - -} - -void -gnome_settings_keyboard_xkb_set_post_activation_callback - (PostActivationCallback fun, void *userData) -{ - paCallback = fun; - paCallbackUserData = userData; -} - -static GdkFilterReturn -gnome_settings_keyboard_xkb_evt_filter (GdkXEvent * xev, - GdkEvent * event) -{ - XEvent *xevent = (XEvent *) xev; - XklFilterEvents (xevent); - return GDK_FILTER_CONTINUE; -} - -void -gnome_settings_keyboard_xkb_init (GConfClient * client) -{ -#ifdef GSDKX - XklSetDebugLevel (200); - logfile = fopen ("/tmp/gsdkx.log", "a"); - XklSetLogAppender (gnome_settings_keyboard_log_appender); -#endif - - if (!XklInit (GDK_DISPLAY ())) { - initedOk = TRUE; - XklBackupNamesProp (); - gnome_settings_keyboard_xkb_analyze_sysconfig (); - gnome_settings_keyboard_xkb_chk_lcl_xmm (); - - gnome_settings_daemon_register_callback - (GSWITCHIT_CONFIG_DIR, - (KeyCallbackFunc) apply_settings); - - gnome_settings_daemon_register_callback - (GSWITCHIT_KBD_CONFIG_DIR, - (KeyCallbackFunc) apply_xkb_settings); - - gdk_window_add_filter (NULL, - (GdkFilterFunc) gnome_settings_keyboard_xkb_evt_filter, - NULL); - gdk_window_add_filter (gdk_get_default_root_window(), - (GdkFilterFunc) gnome_settings_keyboard_xkb_evt_filter, - NULL); - XklStartListen (XKLL_MANAGE_LAYOUTS | XKLL_MANAGE_WINDOW_STATES); - } -} - -void -gnome_settings_keyboard_xkb_load (GConfClient * client) -{ - GConfClient *confClient; - confClient = gconf_client_get_default (); - - GSwitchItConfigInit (¤tConfig, confClient); - apply_settings (); - - GSwitchItKbdConfigInit (¤tKbdConfig, confClient); - apply_xkb_settings (); - - g_object_unref (confClient); -} diff --git a/gnome-settings-daemon/gnome-settings-keyboard-xkb.h b/gnome-settings-daemon/gnome-settings-keyboard-xkb.h deleted file mode 100644 index d0c15ff48..000000000 --- a/gnome-settings-daemon/gnome-settings-keyboard-xkb.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- mode: c; style: linux -*- */ - -/* gnome-settings-keyboard-xkb.h - * - * Copyright © 2001 Udaltsoft - * - * Written by Sergey V. Oudaltsov <svu@users.sourceforge.net> - * - * 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. - * - * 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. - * - * 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., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef __GNOME_SETTINGS_KEYBOARD_XKB_H -#define __GNOME_SETTINGS_KEYBOARD_XKB_H - -#include <gconf/gconf.h> -#include <gconf/gconf-client.h> - -void gnome_settings_keyboard_xkb_init (GConfClient * client); -void gnome_settings_keyboard_xkb_load (GConfClient * client); - -typedef void ( *PostActivationCallback ) ( void *userData ); - -void gnome_settings_keyboard_xkb_set_post_activation_callback( - PostActivationCallback fun, - void *userData ); - -#endif diff --git a/gnome-settings-daemon/gnome-settings-keyboard.c b/gnome-settings-daemon/gnome-settings-keyboard.c deleted file mode 100644 index bdad73b79..000000000 --- a/gnome-settings-daemon/gnome-settings-keyboard.c +++ /dev/null @@ -1,159 +0,0 @@ -/* -*- mode: c; style: linux -*- */ - -/* gnome-settings-keyboard.c - * - * Copyright © 2001 Ximian, Inc. - * - * Written by Bradford Hovinen <hovinen@ximian.com> - * - * 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. - * - * 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. - * - * 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., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include <gdk/gdk.h> -#include <gdk/gdkx.h> -#include <gconf/gconf-client.h> - -#include "gnome-settings-keyboard.h" -#include "gnome-settings-daemon.h" - -#ifdef HAVE_X11_EXTENSIONS_XF86MISC_H -# include <X11/extensions/xf86misc.h> -#endif -#ifdef HAVE_X11_EXTENSIONS_XKB_H -#include <X11/XKBlib.h> -#endif - -#include <string.h> - -#ifdef HAVE_X11_EXTENSIONS_XF86MISC_H -static gboolean -xfree86_set_keyboard_autorepeat_rate (int delay, int rate) -{ - gboolean res = FALSE; - int event_base_return, error_base_return; - - if (XF86MiscQueryExtension (GDK_DISPLAY (), - &event_base_return, - &error_base_return) == True) - { - /* load the current settings */ - XF86MiscKbdSettings kbdsettings; - XF86MiscGetKbdSettings (GDK_DISPLAY (), &kbdsettings); - - /* assign the new values */ - kbdsettings.delay = delay; - kbdsettings.rate = rate; - XF86MiscSetKbdSettings (GDK_DISPLAY (), &kbdsettings); - res = TRUE; - } - - return res; -} -#endif /* HAVE_X11_EXTENSIONS_XF86MISC_H */ -#ifdef HAVE_X11_EXTENSIONS_XKB_H -static gboolean -xkb_set_keyboard_autorepeat_rate (int delay, int rate) -{ - int interval = (rate <= 0) ? 1000000 : 1000/rate; - if (delay <= 0) delay = 1; - return XkbSetAutoRepeatRate (GDK_DISPLAY (), XkbUseCoreKbd, - delay, interval); -} -#endif - -static void -apply_settings (void) -{ - GConfClient *client; - - gboolean repeat, click; - int rate, delay; - int click_volume, bell_volume, bell_pitch, bell_duration; - char *volume_string; - - XKeyboardControl kbdcontrol; - - client = gconf_client_get_default (); - - repeat = gconf_client_get_bool (client, "/desktop/gnome/peripherals/keyboard/repeat", NULL); - click = gconf_client_get_bool (client, "/desktop/gnome/peripherals/keyboard/click", NULL); - rate = gconf_client_get_int (client, "/desktop/gnome/peripherals/keyboard/rate", NULL); - delay = gconf_client_get_int (client, "/desktop/gnome/peripherals/keyboard/delay", NULL); - click_volume = gconf_client_get_int (client, "/desktop/gnome/peripherals/keyboard/click_volume", NULL); -#if 0 - bell_volume = gconf_client_get_int (client, "/desktop/gnome/peripherals/keyboard/bell_volume", NULL); -#endif - bell_pitch = gconf_client_get_int (client, "/desktop/gnome/peripherals/keyboard/bell_pitch", NULL); - bell_duration = gconf_client_get_int (client, "/desktop/gnome/peripherals/keyboard/bell_duration", NULL); - - volume_string = gconf_client_get_string (client, "/desktop/gnome/peripherals/keyboard/bell_mode", NULL); - bell_volume = (volume_string && !strcmp (volume_string, "on")) ? 50 : 0; - g_free (volume_string); - g_object_unref (client); - - gdk_error_trap_push (); - if (repeat) { - gboolean rate_set = FALSE; - - XAutoRepeatOn (GDK_DISPLAY ()); - /* Use XKB in preference */ -#if defined (HAVE_X11_EXTENSIONS_XKB_H) - rate_set = xkb_set_keyboard_autorepeat_rate (delay, rate); -#endif -#ifdef HAVE_X11_EXTENSIONS_XF86MISC_H - if (!rate_set) - rate_set = xfree86_set_keyboard_autorepeat_rate (delay, rate); -#endif - if (!rate_set) - g_warning ("Neither XKeyboard not Xfree86's keyboard extensions are available,\n" - "no way to support keyboard autorepeat rate settings"); - } else - XAutoRepeatOff (GDK_DISPLAY ()); - - /* as percentage from 0..100 inclusive */ - if (click_volume < 0) - click_volume = 0; - else if (click_volume > 100) - click_volume = 100; - kbdcontrol.key_click_percent = click ? click_volume : 0; - kbdcontrol.bell_percent = bell_volume; - kbdcontrol.bell_pitch = bell_pitch; - kbdcontrol.bell_duration = bell_duration; - XChangeKeyboardControl (GDK_DISPLAY (), - KBKeyClickPercent | KBBellPercent | KBBellPitch | KBBellDuration, - &kbdcontrol); - - XSync (GDK_DISPLAY (), FALSE); - gdk_error_trap_pop (); -} - - -void -gnome_settings_keyboard_init (GConfClient *client) -{ - gnome_settings_daemon_register_callback ("/desktop/gnome/peripherals/keyboard", (KeyCallbackFunc) apply_settings); -} - -void -gnome_settings_keyboard_load (GConfClient *client) -{ - apply_settings (); -} - diff --git a/gnome-settings-daemon/gnome-settings-keyboard.h b/gnome-settings-daemon/gnome-settings-keyboard.h deleted file mode 100644 index 503081bea..000000000 --- a/gnome-settings-daemon/gnome-settings-keyboard.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- mode: c; style: linux -*- */ - -/* gnome-settings-keyboard.h - * - * Copyright © 2001 Ximian, Inc. - * - * Written by Bradford Hovinen <hovinen@ximian.com> - * - * 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. - * - * 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. - * - * 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., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef __GNOME_SETTINGS_KEYBOARD_H -#define __GNOME_SETTINGS_KEYBOARD_H - -#include <gconf/gconf.h> -#include <gconf/gconf-client.h> - -void gnome_settings_keyboard_init (GConfClient *client); -void gnome_settings_keyboard_load (GConfClient *client); - -#endif diff --git a/gnome-settings-daemon/gnome-settings-locate-pointer.c b/gnome-settings-daemon/gnome-settings-locate-pointer.c deleted file mode 100644 index 0ae80eb99..000000000 --- a/gnome-settings-daemon/gnome-settings-locate-pointer.c +++ /dev/null @@ -1,227 +0,0 @@ -#include <gtk/gtk.h> - -#include "gnome-settings-locate-pointer.h" -#include "gnome-settings-daemon.h" - -#define LARGE_SIZE 101 -#define SMALL_SIZE 51 - -typedef enum { - STAGE_ONE, - STAGE_TWO, - STAGE_THREE, - STAGE_FOUR, - STAGE_DONE -} LocatePointerStage; - -static LocatePointerStage stage; -static GdkWindow *window = NULL; -static gint cursor_x, cursor_y; -static guint locate_pointer_id = 0; - -static gint -locate_pointer_expose (GtkWidget *widget, - GdkEventExpose *event, - gpointer data) -{ - gint size; - GdkPoint points[4]; - - if (event->window != window) - return FALSE; - - switch (stage) - { - case STAGE_ONE: - case STAGE_TWO: - size = LARGE_SIZE; - break; - case STAGE_THREE: - case STAGE_FOUR: - size = SMALL_SIZE; - break; - default: - return FALSE; - } - - gdk_draw_rectangle (event->window, - widget->style->black_gc, - TRUE, - 0, 0, size, size); - switch (stage) - { - case STAGE_ONE: - case STAGE_THREE: - gdk_draw_rectangle (event->window, - widget->style->white_gc, - FALSE, - 1, 1, size - 3, size - 3); - break; - case STAGE_TWO: - case STAGE_FOUR: - points[0].x = size/2; - points[0].y = 0 + 1; - points[1].x = size - 2; - points[1].y = size/2; - points[2].x = size/2; - points[2].y = size - 2; - points[3].x = 0 + 1; - points[3].y = size/2; - gdk_draw_polygon (event->window, - widget->style->white_gc, - FALSE, points, 4); - break; - default: - g_assert_not_reached (); - } - - return TRUE; -} - -static void -setup_window (void) -{ - gint size; - GdkBitmap *mask; - GdkGC *gc; - GdkColor col; - GdkPoint points[4]; - - gdk_window_hide (window); - switch (stage) - { - case STAGE_ONE: - case STAGE_TWO: - size = LARGE_SIZE; - break; - case STAGE_THREE: - case STAGE_FOUR: - size = SMALL_SIZE; - break; - default: - return; - } - - gdk_window_move_resize (window, - cursor_x - size/2, - cursor_y - size/2, - size, size); - mask = gdk_pixmap_new (window, size, size, 1); - gc = gdk_gc_new (mask); - switch (stage) - { - case STAGE_ONE: - case STAGE_THREE: - col.pixel = 1; - gdk_gc_set_foreground (gc, &col); - gdk_draw_rectangle (mask, gc, TRUE, 0, 0, size, size); - col.pixel = 0; - gdk_gc_set_foreground (gc, &col); - gdk_draw_rectangle (mask, gc, TRUE, 3, 3, size - 6, size - 6); - break; - case STAGE_TWO: - case STAGE_FOUR: - col.pixel = 0; - gdk_gc_set_foreground (gc, &col); - gdk_draw_rectangle (mask, gc, TRUE, 0, 0, size, size); - col.pixel = 1; - gdk_gc_set_foreground (gc, &col); - points[0].x = size/2; - points[0].y = 0; - points[1].x = size - 1; - points[1].y = size/2; - points[2].x = size/2; - points[2].y = size - 1; - points[3].x = 0; - points[3].y = size/2; - gdk_draw_polygon (mask, gc, FALSE, points, 4); - points[0].x = size/2; - points[0].y = 0 + 1; - points[1].x = size - 2; - points[1].y = size/2; - points[2].x = size/2; - points[2].y = size - 2; - points[3].x = 0 + 1; - points[3].y = size/2; - gdk_draw_polygon (mask, gc, FALSE, points, 4); - points[0].x = size/2; - points[0].y = 0 + 2; - points[1].x = size - 3; - points[1].y = size/2; - points[2].x = size/2; - points[2].y = size - 3; - points[3].x = 0 + 2; - points[3].y = size/2; - gdk_draw_polygon (mask, gc, FALSE, points, 4); - break; - default: - g_assert_not_reached (); - } - - gdk_window_shape_combine_mask (window, mask, 0, 0); - g_object_unref (G_OBJECT (gc)); - g_object_unref (G_OBJECT (mask)); - gdk_window_show (window); -} - -static void -create_window (GdkScreen *screen) -{ - GdkWindowAttr attributes; - GtkWidget *invisible; - - invisible = gtk_invisible_new_for_screen (screen); - - attributes.window_type = GDK_WINDOW_TEMP; - attributes.wclass = GDK_INPUT_OUTPUT; - attributes.visual = gtk_widget_get_visual (invisible); - attributes.colormap = gtk_widget_get_colormap (invisible); - attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK | GDK_EXPOSURE_MASK; - attributes.width = 1; - attributes.height = 1; - window = gdk_window_new (gdk_screen_get_root_window (screen), - &attributes, - GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP); - gdk_window_set_user_data (window, invisible); - g_signal_connect (G_OBJECT (invisible), - "expose_event", - (GCallback) locate_pointer_expose, - NULL); -} - -static gboolean -locate_pointer_timeout (gpointer data) -{ - stage++; - if (stage == STAGE_DONE) - { - gdk_window_hide (window); - locate_pointer_id = 0; - return FALSE; - } - setup_window (); - return TRUE; -} - -void -gnome_settings_locate_pointer (GdkScreen *screen) -{ - gdk_window_get_pointer (gdk_screen_get_root_window (screen), &cursor_x, &cursor_y, NULL); - - if (locate_pointer_id) - gtk_timeout_remove (locate_pointer_id); - - /* Create the window if it is not created OR if it is not for the - * current screen. - */ - - if (window == NULL) - create_window (screen); - else if( gdk_screen_get_number (screen) != gdk_screen_get_number (gdk_drawable_get_screen (window))) - create_window (screen); - - stage = STAGE_ONE; - setup_window (); - gdk_window_show (window); - locate_pointer_id = gtk_timeout_add (100, locate_pointer_timeout, NULL); -} diff --git a/gnome-settings-daemon/gnome-settings-locate-pointer.h b/gnome-settings-daemon/gnome-settings-locate-pointer.h deleted file mode 100644 index e5924ac79..000000000 --- a/gnome-settings-daemon/gnome-settings-locate-pointer.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright © 2001 Jonathan Blandford <jrb@gnome.org> - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Red Hat not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. Red Hat makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * Authors: Jonathan Blandford - */ - -#ifndef LOCATE_POINTER_H -#define LOCATE_POINTER_H - -#include <gdk/gdkscreen.h> - -void gnome_settings_locate_pointer (GdkScreen *screen); - -#endif diff --git a/gnome-settings-daemon/gnome-settings-mouse.c b/gnome-settings-daemon/gnome-settings-mouse.c deleted file mode 100644 index 825674571..000000000 --- a/gnome-settings-daemon/gnome-settings-mouse.c +++ /dev/null @@ -1,307 +0,0 @@ -#include <string.h> -#include <math.h> - -#include <gdk/gdk.h> -#include <gdk/gdkx.h> -#include <gdk/gdkkeysyms.h> -#include <X11/keysym.h> - -#include <gconf/gconf.h> - -#include "gnome-settings-locate-pointer.h" -#include "gnome-settings-daemon.h" - -#define DEFAULT_PTR_MAP_SIZE 128 - -static void -set_left_handed (gboolean left_handed) -{ - unsigned char *buttons; - gint n_buttons, i; - gint idx_1 = 0, idx_3 = 1; - - buttons = g_alloca (DEFAULT_PTR_MAP_SIZE); - n_buttons = XGetPointerMapping (GDK_DISPLAY (), buttons, DEFAULT_PTR_MAP_SIZE); - if (n_buttons > DEFAULT_PTR_MAP_SIZE) { - buttons = g_alloca (n_buttons); - n_buttons = XGetPointerMapping (GDK_DISPLAY (), buttons, n_buttons); - } - - for (i = 0; i < n_buttons; i++) - { - if (buttons[i] == 1) - idx_1 = i; - else if (buttons[i] == ((n_buttons < 3) ? 2 : 3)) - idx_3 = i; - } - - if ((left_handed && idx_1 < idx_3) || - (!left_handed && idx_1 > idx_3)) - { - buttons[idx_1] = ((n_buttons < 3) ? 2 : 3); - buttons[idx_3] = 1; - } - - XSetPointerMapping (GDK_DISPLAY (), buttons, n_buttons); -} - -static void -set_motion_acceleration (gfloat motion_acceleration) -{ - gint numerator, denominator; - - if (motion_acceleration >= 1.0) - { - /* we want to get the acceleration, with a resolution of 0.5 - */ - if ((motion_acceleration - floor (motion_acceleration)) < 0.25) - { - numerator = floor (motion_acceleration); - denominator = 1; - } - else if ((motion_acceleration - floor (motion_acceleration)) < 0.5) - { - numerator = ceil (2.0 * motion_acceleration); - denominator = 2; - } - else if ((motion_acceleration - floor (motion_acceleration)) < 0.75) - { - numerator = floor (2.0 *motion_acceleration); - denominator = 2; - } - else - { - numerator = ceil (motion_acceleration); - denominator = 1; - } - } - else if (motion_acceleration < 1.0 && motion_acceleration > 0) - { - /* This we do to 1/10ths */ - numerator = floor (motion_acceleration * 10) + 1; - denominator= 10; - } - else - { - numerator = -1; - denominator = -1; - } - - XChangePointerControl (GDK_DISPLAY (), True, False, - numerator, denominator, - 0); -} - -static void -set_motion_threshold (gint motion_threshold) -{ - XChangePointerControl (GDK_DISPLAY (), False, True, - 0, 0, motion_threshold); -} - - -#define KEYBOARD_GROUP_SHIFT 13 -#define KEYBOARD_GROUP_MASK ((1 << 13) | (1 << 14)) - -/* Owen magic */ -static GdkFilterReturn -filter (GdkXEvent *xevent, - GdkEvent *event, - gpointer data) -{ - XEvent *xev = (XEvent *) xevent; - guint keyval; - gint group; - - GdkScreen *screen = (GdkScreen *)data; - - if (xev->type == KeyPress || - xev->type == KeyRelease) - { - /* get the keysym */ - group = (xev->xkey.state & KEYBOARD_GROUP_MASK) >> KEYBOARD_GROUP_SHIFT; - gdk_keymap_translate_keyboard_state (gdk_keymap_get_default (), - xev->xkey.keycode, - xev->xkey.state, - group, - &keyval, - NULL, NULL, NULL); - if (keyval == GDK_Control_L || keyval == GDK_Control_R) - { - if (xev->type == KeyPress) - { - XAllowEvents (gdk_x11_get_default_xdisplay (), - SyncKeyboard, - xev->xkey.time); - } - else - { - XAllowEvents (gdk_x11_get_default_xdisplay (), - AsyncKeyboard, - xev->xkey.time); - gnome_settings_locate_pointer (screen); - } - } - else - { - XAllowEvents (gdk_x11_get_default_xdisplay (), - ReplayKeyboard, - xev->xkey.time); - XUngrabKeyboard (gdk_x11_get_default_xdisplay (), - xev->xkey.time); - } - - return GDK_FILTER_REMOVE; - } - return GDK_FILTER_CONTINUE; -} - -static void -set_locate_pointer (gboolean locate_pointer) -{ - GdkKeymapKey *keys; - GdkDisplay *display; - int n_screens; - int n_keys; - gboolean has_entries; - static const guint keyvals[] = { GDK_Control_L, GDK_Control_R }; - unsigned j; - - display = gdk_display_get_default (); - n_screens = gdk_display_get_n_screens (display); - - for (j = 0 ; j < G_N_ELEMENTS (keyvals) ; j++) { - has_entries = gdk_keymap_get_entries_for_keyval (gdk_keymap_get_default (), - keyvals[j], - &keys, - &n_keys); - if (has_entries) - { - gint i, j; - - for (i = 0; i < n_keys; i++) - { - for(j=0; j< n_screens; j++) - { - GdkScreen *screen = gdk_display_get_screen (display, j); - Window xroot = gdk_x11_drawable_get_xid (gdk_screen_get_root_window (screen)); - - if (locate_pointer) - { - XGrabKey (GDK_DISPLAY_XDISPLAY (display), - keys[i].keycode, - 0, - xroot, - False, - GrabModeAsync, - GrabModeSync); - XGrabKey (GDK_DISPLAY_XDISPLAY (display), - keys[i].keycode, - LockMask, - xroot, - False, - GrabModeAsync, - GrabModeSync); - XGrabKey (GDK_DISPLAY_XDISPLAY (display), - keys[i].keycode, - Mod2Mask, - xroot, - False, - GrabModeAsync, - GrabModeSync); - XGrabKey (GDK_DISPLAY_XDISPLAY (display), - keys[i].keycode, - Mod4Mask, - xroot, - False, - GrabModeAsync, - GrabModeSync); - } - else - { - XUngrabKey (GDK_DISPLAY_XDISPLAY (display), - keys[i].keycode, - Mod4Mask, - xroot); - XUngrabKey (GDK_DISPLAY_XDISPLAY (display), - keys[i].keycode, - Mod2Mask, - xroot); - XUngrabKey (GDK_DISPLAY_XDISPLAY (display), - keys[i].keycode, - LockMask, - xroot); - XUngrabKey (GDK_DISPLAY_XDISPLAY (display), - keys[i].keycode, - 0, - xroot); - } - } - } - g_free (keys); - if (locate_pointer) - { - for (i = 0; i < n_screens; i++) - { - GdkScreen *screen; - screen = gdk_display_get_screen (display, i); - gdk_window_add_filter (gdk_screen_get_root_window (screen), - filter, - screen); - } - } - else - { - for (i = 0; i < n_screens; i++) - { - GdkScreen *screen; - screen = gdk_display_get_screen (display, i); - gdk_window_remove_filter (gdk_screen_get_root_window (screen), - filter, - screen); - } - } - } - } -} - -static void -mouse_callback (GConfEntry *entry) -{ - if (! strcmp (entry->key, "/desktop/gnome/peripherals/mouse/left_handed")) - { - if (entry->value->type == GCONF_VALUE_BOOL) - set_left_handed (gconf_value_get_bool (entry->value)); - } - else if (! strcmp (entry->key, "/desktop/gnome/peripherals/mouse/motion_acceleration")) - { - if (entry->value->type == GCONF_VALUE_FLOAT) - set_motion_acceleration (gconf_value_get_float (entry->value)); - } - else if (! strcmp (entry->key, "/desktop/gnome/peripherals/mouse/motion_threshold")) - { - if (entry->value->type == GCONF_VALUE_INT) - set_motion_threshold (gconf_value_get_int (entry->value)); - } - else if (! strcmp (entry->key, "/desktop/gnome/peripherals/mouse/locate_pointer")) - { - if (entry->value->type == GCONF_VALUE_BOOL) - set_locate_pointer (gconf_value_get_bool (entry->value)); - } -} - -void -gnome_settings_mouse_init (GConfClient *client) -{ - gnome_settings_daemon_register_callback ("/desktop/gnome/peripherals/mouse", mouse_callback); -} - - -void -gnome_settings_mouse_load (GConfClient *client) -{ - set_left_handed (gconf_client_get_bool (client, "/desktop/gnome/peripherals/mouse/left_handed", NULL)); - set_motion_acceleration (gconf_client_get_float (client, "/desktop/gnome/peripherals/mouse/motion_acceleration", NULL)); - set_motion_threshold (gconf_client_get_int (client, "/desktop/gnome/peripherals/mouse/motion_threshold", NULL)); - set_locate_pointer (gconf_client_get_bool (client, "/desktop/gnome/peripherals/mouse/locate_pointer", NULL)); -} diff --git a/gnome-settings-daemon/gnome-settings-mouse.h b/gnome-settings-daemon/gnome-settings-mouse.h deleted file mode 100644 index 5974a6090..000000000 --- a/gnome-settings-daemon/gnome-settings-mouse.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright © 2001 Jonathan Blandford <jrb@gnome.org> - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Red Hat not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. Red Hat makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * Authors: Jonathan Blandford - */ - -#ifndef MOUSE_SETTINGS_H -#define MOUSE_SETTINGS_H - -#include <gconf/gconf.h> - -void gnome_settings_mouse_init (GConfClient *client); -void gnome_settings_mouse_load (GConfClient *client); - -#endif diff --git a/gnome-settings-daemon/gnome-settings-multimedia-keys.c b/gnome-settings-daemon/gnome-settings-multimedia-keys.c deleted file mode 100644 index 42f7abdf7..000000000 --- a/gnome-settings-daemon/gnome-settings-multimedia-keys.c +++ /dev/null @@ -1,961 +0,0 @@ -/* - * Copyright (C) 2001,2002,2003 Bastien Nocera <hadess@hadess.net> - * - * gnome-settings-multimedia-keys.c - * - * 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 of the License, or - * (at your option) any later version. - * - * 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. - * - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, - * USA. - */ - -#include <config.h> - -#include <string.h> -#include <sys/file.h> -#include <X11/X.h> - -/* Gnome headers */ -#include <glib/gi18n.h> -#include <gdk/gdkx.h> -#include <gtk/gtk.h> - -#include <glade/glade.h> -#include <gconf/gconf-client.h> - -#include "eggaccelerators.h" - -#if defined(__powerpc__) && defined (__linux__) -#define USE_FBLEVEL -#include "actions/acme-fb-level.h" -#else -#undef USE_FBLEVEL -#endif - -#include "actions/acme.h" -#include "actions/acme-volume.h" - -#define DIALOG_TIMEOUT 1000 /* dialog timeout in ms */ -#define VOLUME_STEP 6 /* percents for one volume button press */ - -/* we exclude shift, GDK_CONTROL_MASK and GDK_MOD1_MASK since we know what - these modifiers mean - these are the mods whose combinations are bound by the keygrabbing code */ -#define IGNORED_MODS (0x2000 /*Xkb modifier*/ | GDK_LOCK_MASK | \ - GDK_MOD2_MASK | GDK_MOD3_MASK | GDK_MOD4_MASK | GDK_MOD5_MASK) -/* these are the ones we actually use for global keys, we always only check - * for these set */ -#define USED_MODS (GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK) - -typedef struct { - AcmeVolume *volobj; -#ifdef USE_FBLEVEL - AcmeFblevel *levobj; -#endif - GladeXML *xml; - GtkWidget *dialog; - GConfClient *conf_client; - guint dialog_timeout; - - /* Multihead stuff */ - GdkScreen *current_screen; - GSList *screens; -} Acme; - -enum { - ICON_MUTED, - ICON_LOUD, - ICON_BRIGHT, - ICON_EJECT, -}; - -static void -acme_error (char * msg) -{ - GtkWidget *error_dialog; - - error_dialog = - gtk_message_dialog_new (NULL, - GTK_DIALOG_MODAL, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_OK, - "%s", msg); - gtk_dialog_set_default_response (GTK_DIALOG (error_dialog), - GTK_RESPONSE_OK); - gtk_widget_show (error_dialog); - g_signal_connect (G_OBJECT (error_dialog), - "response", - G_CALLBACK (gtk_widget_destroy), NULL); -} - -static void -execute (char *cmd, gboolean sync) -{ - gboolean retval; - gchar **argv; - gint argc; - - retval = FALSE; - - if (g_shell_parse_argv (cmd, &argc, &argv, NULL)) { - if (sync != FALSE) { - retval = g_spawn_sync (g_get_home_dir (), - argv, NULL, G_SPAWN_SEARCH_PATH, - NULL, NULL, NULL, NULL, NULL, NULL); - } - else { - retval = g_spawn_async (g_get_home_dir (), - argv, NULL, G_SPAWN_SEARCH_PATH, - NULL, NULL, NULL, NULL); - } - g_strfreev (argv); - } - - if (retval == FALSE) - { - char *msg; - - msg = g_strdup_printf - (_("Couldn't execute command: %s\n" - "Verify that this command exists."), - cmd); - - acme_error (msg); - g_free (msg); - } -} - -static void -do_sleep_action (char *cmd1, char *cmd2) -{ - if (g_spawn_command_line_async (cmd1, NULL) == FALSE) - { - if (g_spawn_command_line_async (cmd2, NULL) == FALSE) - { - acme_error (_("Couldn't put the machine to sleep.\n" - "Verify that the machine is correctly configured.")); - } - } -} - -#ifdef USE_FBLEVEL -static char* -permission_problem_string (const char *file) -{ - return g_strdup_printf (_("Permissions on the file %s are broken\n"), file); -} - -static void -fblevel_problem_cb (void) -{ - char *msg; - - msg = permission_problem_string ("/dev/pmu"); - acme_error (msg); - g_free (msg); - - return; -} -#endif - -static char *images[] = { - PIXMAPSDIR "/gnome-speakernotes-muted.png", - PIXMAPSDIR "/gnome-speakernotes.png", - PIXMAPSDIR "/acme-brightness.png", - PIXMAPSDIR "/acme-eject.png", -}; - -static void -acme_image_set (Acme *acme, int icon) -{ - GtkWidget *image; - - image = glade_xml_get_widget (acme->xml, "image1"); - g_return_if_fail (image != NULL); - - if (icon > ICON_EJECT) - g_assert_not_reached (); - - gtk_image_set_from_file (GTK_IMAGE(image), images[icon]); -} - -static void -dialog_init (Acme *acme) -{ - if (acme->xml == NULL) { - glade_gnome_init (); - acme->xml = glade_xml_new (DATADIR "/control-center-2.0/interfaces/acme.glade", NULL, NULL); - - if (acme->xml == NULL) { - acme_error (_("Couldn't load the Glade file.\n" - "Make sure that this daemon is properly installed.")); - return; - } - acme->dialog = glade_xml_get_widget (acme->xml, "dialog"); - acme_image_set (acme, ICON_LOUD); - } -} - -static gboolean -grab_key_real (Key *key, GdkWindow *root, gboolean grab, int result) -{ - gdk_error_trap_push (); - if (grab) - XGrabKey (GDK_DISPLAY(), key->keycode, (result | key->state), - GDK_WINDOW_XID (root), True, GrabModeAsync, GrabModeAsync); - else - XUngrabKey(GDK_DISPLAY(), key->keycode, (result | key->state), - GDK_WINDOW_XID (root)); - gdk_flush (); - - gdk_error_trap_pop (); - - return TRUE; -} - -/* inspired from all_combinations from gnome-panel/gnome-panel/global-keys.c */ -#define N_BITS 32 -static void -grab_key (Acme *acme, Key *key, gboolean grab) -{ - int indexes[N_BITS];/*indexes of bits we need to flip*/ - int i, bit, bits_set_cnt; - int uppervalue; - guint mask_to_traverse = IGNORED_MODS & ~ key->state; - - bit = 0; - for (i = 0; i < N_BITS; i++) { - if (mask_to_traverse & (1<<i)) - indexes[bit++]=i; - } - - bits_set_cnt = bit; - - uppervalue = 1<<bits_set_cnt; - for (i = 0; i < uppervalue; i++) { - GSList *l; - int j, result = 0; - - for (j = 0; j < bits_set_cnt; j++) { - if (i & (1<<j)) - result |= (1<<indexes[j]); - } - - for (l = acme->screens; l ; l = l->next) { - GdkScreen *screen = l->data; - if (grab_key_real (key, gdk_screen_get_root_window (screen), grab, result) == FALSE) - return; - } - } -} - -static void -unhookup_keysym (int keycode) -{ - char *command; - - if (keycode <= 0) - return; - - command = g_strdup_printf ("xmodmap -e \"keycode %d = \"", keycode); - - g_spawn_command_line_sync (command, NULL, NULL, NULL, NULL); - g_free (command); -} - -static gboolean -hookup_keysym (int keycode, const char *keysym) -{ - char *command; - - if (keycode <= 0) - return TRUE; - - command = g_strdup_printf ("xmodmap -e \"keycode %d = %s\"", - keycode, keysym); - - g_spawn_command_line_sync (command, NULL, NULL, NULL, NULL); - g_free (command); - - return FALSE; -} - -static gboolean -is_valid_shortcut (const char *string) -{ - if (string == NULL || string[0] == '\0') - return FALSE; - if (strcmp (string, "disabled") == 0) - return FALSE; - - return TRUE; -} - -static void -update_kbd_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data) -{ - Acme *acme = (Acme *) data; - int i; - gboolean found = FALSE; - - g_return_if_fail (entry->key != NULL); - - /* Find the key that was modified */ - for (i = 0; i < PLAY_KEY; i++) - { - if (strcmp (entry->key, keys[i].gconf_key) == 0) - { - const char *tmp; - Key *key; - - found = TRUE; - - if (keys[i].key != NULL) - grab_key (acme, keys[i].key, FALSE); - - g_free (keys[i].key); - keys[i].key = NULL; - - tmp = gconf_client_get_string (acme->conf_client, - keys[i].gconf_key, NULL); - - if (is_valid_shortcut (tmp) == FALSE) - break; - - key = g_new0 (Key, 1); - if (egg_accelerator_parse_virtual (tmp, &key->keysym, &key->keycode, &key->state) == FALSE) - { - g_free (key); - break; - } - - grab_key (acme, key, TRUE); - keys[i].key = key; - - break; - } - } - - if (found != FALSE) - return; - - for (i = PLAY_KEY; i < HANDLED_KEYS; i++) - { - if (strcmp (entry->key, keys[i].gconf_key) == 0) - { - const char *tmp; - Key *key; - - if (keys[i].key != NULL) - unhookup_keysym (keys[i].key->keycode); - - g_free (keys[i].key); - keys[i].key = NULL; - - tmp = gconf_client_get_string (acme->conf_client, - keys[i].gconf_key, NULL); - - if (is_valid_shortcut (tmp) == FALSE) - break; - - key = g_new0 (Key, 1); - if (egg_accelerator_parse_virtual (tmp, &key->keysym, &key->keycode, &key->state) == FALSE) - { - g_free (key); - break; - } - - switch (keys[i].key_type) { - case PLAY_KEY: - hookup_keysym (key->keycode, "XF86AudioPlay"); - break; - case PAUSE_KEY: - hookup_keysym (key->keycode, "XF86AudioPause"); - break; - case STOP_KEY: - hookup_keysym (key->keycode, "XF86AudioStop"); - break; - case PREVIOUS_KEY: - hookup_keysym (key->keycode, "XF86AudioPrev"); - break; - case NEXT_KEY: - hookup_keysym (key->keycode, "XF86AudioNext"); - break; - } - - keys[i].key = key; - } - } -} - -static void -init_screens (Acme *acme) -{ - GdkDisplay *display = gdk_display_get_default (); - int i; - - if (gdk_display_get_n_screens (display) == 1) { - GdkScreen *screen = gdk_screen_get_default (); - acme->screens = g_slist_append (acme->screens, screen); - acme->current_screen = screen; - return; - } - - for (i = 0; i < gdk_display_get_n_screens (display); i++) - { - GdkScreen *screen; - - screen = gdk_display_get_screen (display, i); - if (screen == NULL) - continue; - acme->screens = g_slist_append (acme->screens, screen); - } - - acme->current_screen = (GdkScreen *)acme->screens->data; -} - -static void -init_kbd (Acme *acme) -{ - int i; - - for (i = 0; i < PLAY_KEY; i++) - { - char *tmp; - Key *key; - - gconf_client_notify_add (acme->conf_client, - keys[i].gconf_key, update_kbd_cb, - acme, NULL, NULL); - - tmp = gconf_client_get_string (acme->conf_client, - keys[i].gconf_key, NULL); - if (!is_valid_shortcut (tmp)) { - g_free (tmp); - continue; - } - - key = g_new0 (Key, 1); - if (!egg_accelerator_parse_virtual (tmp, &key->keysym, &key->keycode, &key->state)) - { - g_free (tmp); - g_free (key); - continue; - } - g_free (tmp); - - keys[i].key = key; - - grab_key (acme, key, TRUE); - } - - for (i = PLAY_KEY; i < HANDLED_KEYS; i++) - { - char *tmp; - Key *key; - - gconf_client_notify_add (acme->conf_client, - keys[i].gconf_key, update_kbd_cb, - acme, NULL, NULL); - - tmp = gconf_client_get_string (acme->conf_client, - keys[i].gconf_key, NULL); - if (!is_valid_shortcut (tmp)) { - g_free (tmp); - continue; - } - - key = g_new0 (Key, 1); - if (egg_accelerator_parse_virtual (tmp, &key->keysym, &key->keycode, &key->state) == FALSE) - { - g_free (tmp); - g_free (key); - continue; - } - g_free (tmp); - - keys[i].key = key; - - switch (keys[i].key_type) { - case PLAY_KEY: - hookup_keysym (keys[i].key->keycode, - "XF86AudioPlay"); - break; - case PAUSE_KEY: - hookup_keysym (keys[i].key->keycode, - "XF86AudioPause"); - break; - case STOP_KEY: - hookup_keysym (keys[i].key->keycode, - "XF86AudioStop"); - break; - case PREVIOUS_KEY: - hookup_keysym (keys[i].key->keycode, - "XF86AudioPrev"); - break; - case NEXT_KEY: - hookup_keysym (keys[i].key->keycode, - "XF86AudioNext"); - break; - } - } - - return; -} - -static gboolean -dialog_hide (Acme *acme) -{ - gtk_widget_hide (acme->dialog); - acme->dialog_timeout = 0; - return FALSE; -} - -static void -dialog_show (Acme *acme) -{ - int orig_x, orig_y, orig_w, orig_h, orig_d; - int screen_w, screen_h; - int x, y; - int pointer_x, pointer_y; - GdkScreen *pointer_screen; - GdkRectangle geometry; - int monitor; - - gtk_window_set_screen (GTK_WINDOW (acme->dialog), acme->current_screen); - gtk_widget_realize (GTK_WIDGET (acme->dialog)); - - gdk_window_get_geometry (GTK_WIDGET (acme->dialog)->window, - &orig_x, &orig_y, - &orig_w, &orig_h, &orig_d); - - pointer_screen = NULL; - gdk_display_get_pointer (gdk_screen_get_display (acme->current_screen), - &pointer_screen, &pointer_x, - &pointer_y, NULL); - if (pointer_screen != acme->current_screen) { - /* The pointer isn't on the current screen, so just - * assume the default monitor - */ - monitor = 0; - } else { - monitor = gdk_screen_get_monitor_at_point (acme->current_screen, - pointer_x, pointer_y); - } - - gdk_screen_get_monitor_geometry (acme->current_screen, monitor, - &geometry); - - screen_w = geometry.width; - screen_h = geometry.height; - - x = ((screen_w - orig_w) / 2) + geometry.x; - y = geometry.y + (screen_h / 2) + (screen_h / 2 - orig_h) / 2; - - gtk_window_move (GTK_WINDOW (acme->dialog), x, y); - - gtk_widget_show (acme->dialog); - - gdk_display_sync (gdk_screen_get_display (acme->current_screen)); - - acme->dialog_timeout = gtk_timeout_add (DIALOG_TIMEOUT, - (GtkFunction) dialog_hide, acme); -} - -static void -do_unknown_action (Acme *acme, const char *url) -{ - char *string, *command; - - g_return_if_fail (url != NULL); - - string = gconf_client_get_string (acme->conf_client, - "/desktop/gnome/url-handlers/unknown/command", - NULL); - - if (string == NULL || strcmp (string, "") == 0) - return; - - command = g_strdup_printf (string, url); - - execute (command, FALSE); - - g_free (command); - g_free (string); -} - -static void -do_help_action (Acme *acme) -{ - char *string, *command; - - string = gconf_client_get_string (acme->conf_client, - "/desktop/gnome/url-handlers/ghelp/command", - NULL); - - if (string == NULL && strcmp (string, "") == 0) - { - do_unknown_action (acme, "ghelp:"); - return; - } - - command = g_strdup_printf (string, ""); - - execute (command, FALSE); - - g_free (command); - g_free (string); -} - -static void -do_mail_action (Acme *acme) -{ - char *string, *command; - - string = gconf_client_get_string (acme->conf_client, - "/desktop/gnome/url-handlers/mailto/command", - NULL); - - if (string == NULL || strcmp (string, "") == 0) - return; - - command = g_strdup_printf (string, ""); - - execute (command, FALSE); - - g_free (command); - g_free (string); -} - -static void -do_www_action (Acme *acme, const char *url) -{ - char *string, *command; - - string = gconf_client_get_string (acme->conf_client, - "/desktop/gnome/url-handlers/http/command", - NULL); - - if (string == NULL || strcmp (string, "") == 0) - { - do_unknown_action (acme, url ? url : ""); - return; - } - - if (url == NULL) - command = g_strdup_printf (string, ""); - else - command = g_strdup_printf (string, url); - - execute (command, FALSE); - - g_free (command); - g_free (string); -} - -static void -do_exit_action (Acme *acme) -{ - execute ("gnome-session-save --kill", FALSE); -} - -static void -do_eject_action (Acme *acme) -{ - GtkWidget *progress; - char *command; - - if (acme->dialog_timeout != 0) - { - gtk_timeout_remove (acme->dialog_timeout); - acme->dialog_timeout = 0; - } - - dialog_init (acme); - progress = glade_xml_get_widget (acme->xml, "progressbar"); - gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress), - (double) 0); - gtk_widget_set_sensitive (progress, FALSE); - - acme_image_set (acme, ICON_EJECT); - dialog_show (acme); - - command = gconf_client_get_string (acme->conf_client, - GCONF_MISC_DIR "/eject_command", NULL); - if ((command != NULL) && (strcmp (command, "") != 0)) - execute (command, TRUE); - else - execute ("eject", TRUE); - - gtk_widget_set_sensitive (progress, TRUE); -} - -#ifdef USE_FBLEVEL -static void -do_brightness_action (Acme *acme, int type) -{ - GtkWidget *progress; - int level; - - if (acme->levobj == NULL) - return; - - if (acme->dialog_timeout != 0) - { - gtk_timeout_remove (acme->dialog_timeout); - acme->dialog_timeout = 0; - } - - level = acme_fblevel_get_level (acme->levobj); - - dialog_init (acme); - acme_image_set (acme, ICON_BRIGHT); - - switch (type) { - case BRIGHT_DOWN_KEY: - acme_fblevel_set_level (acme->levobj, level - 1); - break; - case BRIGHT_UP_KEY: - acme_fblevel_set_level (acme->levobj, level + 1); - break; - } - - level = acme_fblevel_get_level (acme->levobj); - - progress = glade_xml_get_widget (acme->xml, "progressbar"); - gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress), - (double) level / 15); - - dialog_show (acme); -} -#endif - -static void -do_sound_action (Acme *acme, int type) -{ - GtkWidget *progress; - gboolean muted; - int vol; - int vol_step; - - if (acme->volobj == NULL) - return; - - vol_step = gconf_client_get_int (acme->conf_client, - GCONF_MISC_DIR "/volume_step", NULL); - - if (vol_step == 0) - vol_step = VOLUME_STEP; - - if (acme->dialog_timeout != 0) - { - gtk_timeout_remove (acme->dialog_timeout); - acme->dialog_timeout = 0; - } - - vol = acme_volume_get_volume (acme->volobj); - muted = acme_volume_get_mute (acme->volobj); - - switch (type) { - case MUTE_KEY: - acme_volume_mute_toggle(acme->volobj); - break; - case VOLUME_DOWN_KEY: - if (muted) - { - acme_volume_mute_toggle(acme->volobj); - } else { - acme_volume_set_volume (acme->volobj, vol - vol_step); - } - break; - case VOLUME_UP_KEY: - if (muted) - { - acme_volume_mute_toggle(acme->volobj); - } else { - acme_volume_set_volume (acme->volobj, vol + vol_step); - } - break; - } - - muted = acme_volume_get_mute(acme->volobj); - dialog_init (acme); - acme_image_set (acme, muted ? ICON_MUTED : ICON_LOUD); - - vol = acme_volume_get_volume (acme->volobj); - - progress = glade_xml_get_widget (acme->xml, "progressbar"); - gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress), - (double) vol / 100); - - dialog_show (acme); -} - -static void -do_action (Acme *acme, int type) -{ - switch (type) { - case MUTE_KEY: - case VOLUME_DOWN_KEY: - case VOLUME_UP_KEY: - do_sound_action (acme, type); - break; - case POWER_KEY: - do_exit_action (acme); - break; - case EJECT_KEY: - do_eject_action (acme); - break; - case HOME_KEY: - execute ("nautilus", FALSE); - break; - case SEARCH_KEY: - execute ("gnome-search-tool", FALSE); - break; - case EMAIL_KEY: - do_mail_action (acme); - break; - case SLEEP_KEY: - do_sleep_action ("apm", "xset dpms force off"); - break; - case SCREENSAVER_KEY: - execute ("xscreensaver-command -lock", FALSE); - break; - case HELP_KEY: - do_help_action (acme); - break; - case WWW_KEY: - do_www_action (acme, NULL); - break; -#ifdef USE_FBLEVEL - case BRIGHT_DOWN_KEY: - case BRIGHT_UP_KEY: - do_brightness_action (acme, type); - break; -#endif - default: - g_assert_not_reached (); - } -} - -static GdkScreen * -acme_get_screen_from_event (Acme *acme, XAnyEvent *xanyev) -{ - GdkWindow *window; - GdkScreen *screen; - GSList *l; - - /* Look for which screen we're receiving events */ - for (l = acme->screens; l != NULL; l = l->next) - { - screen = (GdkScreen *) l->data; - window = gdk_screen_get_root_window (screen); - - if (GDK_WINDOW_XID (window) == xanyev->window) - { - return screen; - } - } - - return NULL; -} - -static GdkFilterReturn -acme_filter_events (GdkXEvent *xevent, GdkEvent *event, gpointer data) -{ - Acme *acme = (Acme *) data; - XEvent *xev = (XEvent *) xevent; - XAnyEvent *xanyev = (XAnyEvent *) xevent; - guint keycode, state; - int i; - - keycode = xev->xkey.keycode; - state = xev->xkey.state; - - for (i = 0; i < PLAY_KEY; i++) - { - if (keys[i].key == NULL) - continue; - - if (keys[i].key->keycode == keycode && - (state & USED_MODS) == keys[i].key->state) - { - switch (keys[i].key_type) { - case VOLUME_DOWN_KEY: - case VOLUME_UP_KEY: -#ifdef USE_FBLEVEL - case BRIGHT_DOWN_KEY: - case BRIGHT_UP_KEY: -#endif - /* auto-repeatable keys */ - if (xev->type != KeyPress) - return GDK_FILTER_CONTINUE; - break; - default: - if (xev->type != KeyRelease) - return GDK_FILTER_CONTINUE; - } - - acme->current_screen = acme_get_screen_from_event - (acme, xanyev); - - do_action (acme, keys[i].key_type); - return GDK_FILTER_REMOVE; - } - } - - return GDK_FILTER_CONTINUE; -} - -void -gnome_settings_multimedia_keys_init (GConfClient *client) -{ -} -void -gnome_settings_multimedia_keys_load (GConfClient *client) -{ - GSList *l; - Acme *acme; - - acme = g_new0 (Acme, 1); - acme->xml = NULL; - - acme->conf_client = client; - gconf_client_add_dir (acme->conf_client, - GCONF_BINDING_DIR, - GCONF_CLIENT_PRELOAD_ONELEVEL, - NULL); - - init_screens (acme); - init_kbd (acme); - acme->dialog_timeout = 0; - - /* initialise Volume handler */ - acme->volobj = acme_volume_new(); - -#ifdef USE_FBLEVEL - /* initialise Frame Buffer level handler */ - if (acme_fblevel_is_powerbook () != FALSE) - { - acme->levobj = acme_fblevel_new(); - if (acme->levobj == NULL) - fblevel_problem_cb (); - } -#endif - - /* Start filtering the events */ - for (l = acme->screens; l != NULL; l = l->next) - gdk_window_add_filter (gdk_screen_get_root_window (l->data), - acme_filter_events, (gpointer) acme); -} - diff --git a/gnome-settings-daemon/gnome-settings-multimedia-keys.h b/gnome-settings-daemon/gnome-settings-multimedia-keys.h deleted file mode 100644 index 6ef45837b..000000000 --- a/gnome-settings-daemon/gnome-settings-multimedia-keys.h +++ /dev/null @@ -1,31 +0,0 @@ -/* gnome-settings-multimedia_keys.h - * - * Copyright (C) 2002 Sun Microsystems Inc. - * - * 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. - * - * 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. - * - * 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., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - * Author: Erwann Chénedé <erwann.chenede@sun.com> - */ - - -#ifndef __GNOME_SETTINGS_MULTIMEDIA_KEYS_H__ -#define __GNOME_SETTINGS_MULTIMEDIA_KEYS_H__ - -#include <gconf/gconf.h> -void gnome_settings_multimedia_keys_init (GConfClient *client); -void gnome_settings_multimedia_keys_load (GConfClient *client); - -#endif /*__GNOME_SETTINGS_MULTIMEDIA_KEYS_H__*/ diff --git a/gnome-settings-daemon/gnome-settings-screensaver.c b/gnome-settings-daemon/gnome-settings-screensaver.c deleted file mode 100644 index 75f8cbd45..000000000 --- a/gnome-settings-daemon/gnome-settings-screensaver.c +++ /dev/null @@ -1,122 +0,0 @@ -/* -*- mode: c; style: linux -*- */ - -/* gnome-settings-screensaver.c - * - * Copyright (C) 2002 Sun Microsystems, Inc. - * - * Written by Jacob Berkman <jacob@ximian.com> - * - * 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. - * - * 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. - * - * 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., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include <config.h> - -#include "gnome-settings-screensaver.h" - -#include <glib/gi18n.h> - -#include <gtk/gtkcheckbutton.h> -#include <gtk/gtkbox.h> -#include <gtk/gtkmessagedialog.h> - -#define START_SCREENSAVER_KEY "/apps/gnome_settings_daemon/screensaver/start_screensaver" -#define SHOW_STARTUP_ERRORS_KEY "/apps/gnome_settings_daemon/screensaver/show_startup_errors" -#define XSCREENSAVER_COMMAND "xscreensaver -nosplash" - -void -gnome_settings_screensaver_init (GConfClient *client) -{ - /* - * do nothing. - * - * our settings only apply to startup, and the screensaver - * settings are all in xscreensaver and not gconf. - * - * we could have xscreensaver-demo run gconftool-2 directly, - * and start / stop xscreensaver here - * - */ -} - -static void -key_toggled_cb (GtkWidget *toggle, gpointer data) -{ - GConfClient *client; - - client = gconf_client_get_default (); - gconf_client_set_bool (client, - SHOW_STARTUP_ERRORS_KEY, - gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle)) - ? 0 : 1, - NULL); - g_object_unref (client); -} - -void -gnome_settings_screensaver_load (GConfClient *client) -{ - GError *gerr = NULL; - gboolean start_screensaver; - gboolean show_error; - GtkWidget *dialog, *toggle; - - start_screensaver = gconf_client_get_bool (client, START_SCREENSAVER_KEY, NULL); - - if (!start_screensaver) - return; - - if (g_spawn_command_line_async (XSCREENSAVER_COMMAND, &gerr)) - return; - - show_error = gconf_client_get_bool (client, SHOW_STARTUP_ERRORS_KEY, NULL); - if (!show_error) { - g_error_free (gerr); - return; - } - - dialog = gtk_message_dialog_new (NULL, - 0, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_OK, - _("There was an error starting up the screensaver:\n\n" - "%s\n\n" - "Screensaver functionality will not work in this session."), - gerr->message); - - g_signal_connect (dialog, "response", - G_CALLBACK (gtk_widget_destroy), - NULL); - - toggle = gtk_check_button_new_with_mnemonic ( - _("_Do not show this message again")); - gtk_widget_show (toggle); - - if (gconf_client_key_is_writable (client, SHOW_STARTUP_ERRORS_KEY, NULL)) - g_signal_connect (toggle, "toggled", - G_CALLBACK (key_toggled_cb), - NULL); - else - gtk_widget_set_sensitive (toggle, FALSE); - - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), - toggle, - FALSE, FALSE, 0); - - gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); - - gtk_widget_show (dialog); -} - diff --git a/gnome-settings-daemon/gnome-settings-screensaver.h b/gnome-settings-daemon/gnome-settings-screensaver.h deleted file mode 100644 index 2b8846506..000000000 --- a/gnome-settings-daemon/gnome-settings-screensaver.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- mode: c; style: linux -*- */ - -/* gnome-settings-screensaver.h - * - * Copyright (C) 2002 Sun Microsystems, Inc. - * - * Written by Jacob Berkman <jacob@ximian.com> - * - * 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. - * - * 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. - * - * 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., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef GNOME_SETTINGS_SCREENSAVER_H -#define GNOME_SETTINGS_SCREENSAVER_H - -#include <gconf/gconf-client.h> - -void gnome_settings_screensaver_init (GConfClient *client); -void gnome_settings_screensaver_load (GConfClient *client); - -#endif diff --git a/gnome-settings-daemon/gnome-settings-sound.c b/gnome-settings-daemon/gnome-settings-sound.c deleted file mode 100644 index 51410263e..000000000 --- a/gnome-settings-daemon/gnome-settings-sound.c +++ /dev/null @@ -1,192 +0,0 @@ -/* -*- mode: c; style: linux -*- */ - -/* gnome-settings-sound.c - * - * Copyright © 2001 Ximian, Inc. - * - * Written by Rachel Hestilow <hestilow@ximian.com> - * - * 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. - * - * 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. - * - * 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., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include <string.h> -#include <stdlib.h> -#include <time.h> -#include <sys/types.h> - -#include <glib/gi18n.h> - -#include <esd.h> - -#include <gconf/gconf-client.h> -#include <libgnome/gnome-sound.h> -#include <libgnome/gnome-exec.h> -#include <libgnomeui/gnome-client.h> -#include "libsounds/sound-properties.h" -#include "gnome-settings-sound.h" -#include "gnome-settings-daemon.h" - -/* start_esd - * - * Start the Enlightenment Sound Daemon. - */ -static void -start_esd (void) -{ - int esdpid; - static const char *esd_cmdline[] = {ESD_SERVER, "-nobeeps", NULL}; - char *tmpargv[3]; - char argbuf[32]; - time_t starttime; - GnomeClient *client = gnome_master_client (); - - esdpid = gnome_execute_async (NULL, 2, (char **)esd_cmdline); - g_snprintf (argbuf, sizeof (argbuf), "%d", esdpid); - tmpargv[0] = "kill"; tmpargv[1] = argbuf; tmpargv[2] = NULL; - gnome_client_set_shutdown_command (client, 2, tmpargv); - starttime = time (NULL); - gnome_sound_init (NULL); - - while (gnome_sound_connection_get () < 0 - && ((time(NULL) - starttime) < 4)) - { -#ifdef HAVE_USLEEP - usleep(1000); -#endif - gnome_sound_init(NULL); - } -} - -static gboolean set_standby = TRUE; - -/* stop_esd - * - * Stop the Enlightenment Sound Daemon. - */ -static void -stop_esd (void) -{ - /* Can't think of a way to do this reliably, so we fake it for now */ - esd_standby (gnome_sound_connection_get ()); - set_standby = TRUE; -} - -/* reload_foreach_cb - * - * For a given SoundEvent, reload the sound file associate with the event. - */ -static void -reload_foreach_cb (SoundEvent *event, gpointer data) -{ - gchar *file, *tmp, *key; - int sid; - - key = sound_event_compose_key (event); - /* We need to free up the old sample, because - * esd allows multiple samples with the same name, - * putting memory to waste. */ - sid = esd_sample_getid(gnome_sound_connection_get (), key); - if (sid >= 0) - esd_sample_free(gnome_sound_connection_get (), sid); - - if (!event->file || !strcmp (event->file, "")) - return; - - file = g_strdup (event->file); - if (file[0] != '/') - { - tmp = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_SOUND, file, TRUE, NULL); - g_free (file); - file = tmp; - } - - if (!file) - { - g_free (key); - return; - } - - sid = gnome_sound_sample_load (key, file); - - if (sid < 0) - g_warning (_("Couldn't load sound file %s as sample %s"), - file, key); - - g_free (key); -} - - -static void -apply_settings (void) -{ - GConfClient *client; - static gboolean inited = FALSE; - static int event_changed_old = 0; - int event_changed_new; - - gboolean enable_esd; - gboolean event_sounds; - - client = gconf_client_get_default (); - - enable_esd = gconf_client_get_bool (client, "/desktop/gnome/sound/enable_esd", NULL); - event_sounds = gconf_client_get_bool (client, "/desktop/gnome/sound/event_sounds", NULL); - event_changed_new = gconf_client_get_int (client, "/desktop/gnome/sound/event_changed", NULL); - - if (enable_esd) { - if (gnome_sound_connection_get () < 0) - start_esd (); - - else if (set_standby) { - esd_resume (gnome_sound_connection_get ()); - set_standby = FALSE; - } - - } else if (!enable_esd && !set_standby) - stop_esd (); - - if ((enable_esd && event_sounds) && - (!inited || event_changed_old != event_changed_new)) - { - SoundProperties *props; - - inited = TRUE; - event_changed_old = event_changed_new; - - props = sound_properties_new (); - sound_properties_add_defaults (props, NULL); - sound_properties_foreach (props, reload_foreach_cb, NULL); - gtk_object_destroy (GTK_OBJECT (props)); - } - - g_object_unref (client); -} - -void -gnome_settings_sound_init (GConfClient *client) -{ - gnome_settings_daemon_register_callback ("/desktop/gnome/sound", (KeyCallbackFunc) apply_settings); -} - -void -gnome_settings_sound_load (GConfClient *client) -{ - apply_settings (); -} diff --git a/gnome-settings-daemon/gnome-settings-sound.h b/gnome-settings-daemon/gnome-settings-sound.h deleted file mode 100644 index 0c81962bf..000000000 --- a/gnome-settings-daemon/gnome-settings-sound.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- mode: c; style: linux -*- */ - -/* gnome-settings-sound.h - * - * Copyright © 2001 Ximian, Inc. - * - * Written by Rachel Hestilow <hestilow@ximian.com> - * - * 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. - * - * 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. - * - * 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., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef __GNOME_SETTINGS_SOUND_H__ -#define __GNOME_SETTINGS_SOUND_H__ - -#include <gconf/gconf.h> - -void gnome_settings_sound_init (GConfClient *client); -void gnome_settings_sound_load (GConfClient *client); - -#endif /* __GNOME_SETTINGS_SOUND_H__ */ diff --git a/gnome-settings-daemon/gnome-settings-typing-break.c b/gnome-settings-daemon/gnome-settings-typing-break.c deleted file mode 100644 index fbb9ec9c8..000000000 --- a/gnome-settings-daemon/gnome-settings-typing-break.c +++ /dev/null @@ -1,97 +0,0 @@ -#include "gnome-settings-daemon.h" -#include "gnome-settings-typing-break.h" -#include <unistd.h> -#include <sys/types.h> -#include <signal.h> -#include "reaper.h" -#include <string.h> - -pid_t typing_monitor_pid = 0; -guint typing_monitor_idle_id = 0; - -static gboolean -typing_break_timeout (gpointer data) -{ - if (typing_monitor_pid > 0) - kill (typing_monitor_pid, SIGKILL); - - typing_monitor_idle_id = 0; - - return FALSE; -} - -static void -setup_typing_break (gboolean enabled) -{ - if (enabled) - { - if (typing_monitor_idle_id != 0) - g_source_remove (typing_monitor_idle_id); - if (typing_monitor_pid == 0) - { - GError *error = NULL; - gchar *argv[] = { "gnome-typing-monitor", "-n", NULL }; - - if (! g_spawn_async ("/", - argv, NULL, - G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL | - G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD, - NULL, NULL, - &typing_monitor_pid, - &error)) - { - /* FIXME: put up a warning */ - g_print ("failed: %s\n", error->message); - g_error_free (error); - typing_monitor_pid = 0; - } - } - } - else - { - if (typing_monitor_pid != 0) - { - typing_monitor_idle_id = g_timeout_add (3000, typing_break_timeout, NULL); - } - } -} - -static void -child_exited_callback (VteReaper *reaper, - gint pid, - gint exit_status, - gpointer user_data) -{ - if (pid == typing_monitor_pid) - { - typing_monitor_pid = 0; - } -} - -static void -typing_break_callback (GConfEntry *entry) -{ - if (! strcmp (entry->key, "/desktop/gnome/typing_break/enabled")) - { - if (entry->value->type == GCONF_VALUE_BOOL) - setup_typing_break (gconf_value_get_bool (entry->value)); - } -} - -void -gnome_settings_typing_break_init (GConfClient *client) -{ - VteReaper *reaper; - - reaper = vte_reaper_get(); - g_signal_connect (reaper, "child_exited", G_CALLBACK (child_exited_callback), NULL); - gnome_settings_daemon_register_callback ("/desktop/gnome/typing_break", typing_break_callback); -} - - -void -gnome_settings_typing_break_load (GConfClient *client) -{ - if (gconf_client_get_bool (client, "/desktop/gnome/typing_break/enabled", NULL)) - setup_typing_break (TRUE); -} diff --git a/gnome-settings-daemon/gnome-settings-typing-break.h b/gnome-settings-daemon/gnome-settings-typing-break.h deleted file mode 100644 index 92f8feaf2..000000000 --- a/gnome-settings-daemon/gnome-settings-typing-break.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright © 2003 Jonathan Blandford <jrb@gnome.org> - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Red Hat not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. Red Hat makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * Authors: Jonathan Blandford - */ - -#ifndef TYPING_BREAK_SETTINGS_H -#define TYPING_BREAK_SETTINGS_H - -#include <gconf/gconf.h> - -void gnome_settings_typing_break_init (GConfClient *client); -void gnome_settings_typing_break_load (GConfClient *client); - -#endif diff --git a/gnome-settings-daemon/gnome-settings-xmodmap.c b/gnome-settings-daemon/gnome-settings-xmodmap.c deleted file mode 100644 index a9098d316..000000000 --- a/gnome-settings-daemon/gnome-settings-xmodmap.c +++ /dev/null @@ -1,370 +0,0 @@ -/* gnome-settings-xmodmap.c - * - * Copyright © 2005 Novell Inc. - * - * Written by Shakti Sen <shprasad@novell.com> - * - * 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. - * - * 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. - * - * 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., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include <config.h> - -#include "gnome-settings-xmodmap.h" - -#include <string.h> - -#include <glib.h> -#include <gtk/gtk.h> -#include <gconf/gconf-client.h> - -#include <glade/glade.h> - -static const char DISABLE_XMM_WARNING_KEY[] = - "/desktop/gnome/peripherals/keyboard/disable_xmm_and_xkb_warning"; - -static const char LOADED_FILES_KEY[] = - "/desktop/gnome/peripherals/keyboard/general/update_handlers"; - - -static void -check_button_callback (GtkWidget *chk_button, - gpointer data) -{ - GConfClient *confClient = gconf_client_get_default (); - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (chk_button))) { - gconf_client_set_bool (confClient, DISABLE_XMM_WARNING_KEY, TRUE, - NULL); - } - else { - gconf_client_set_bool (confClient, DISABLE_XMM_WARNING_KEY, FALSE, - NULL); - } - g_object_unref (confClient); -} - -void -gnome_settings_load_modmap_files () -{ - GConfClient *confClient = gconf_client_get_default (); - GSList *tmp = NULL; - GSList *loaded_file_list = gconf_client_get_list (confClient, LOADED_FILES_KEY, GCONF_VALUE_STRING, NULL); - tmp = loaded_file_list; - while (tmp != NULL) { - gchar *command = NULL; - command = g_strdup_printf ("xmodmap %s", g_build_filename (g_get_home_dir (), (gchar *)tmp->data, NULL)); - g_spawn_command_line_async (command, NULL); - tmp = tmp->next; - g_free (command); - } - g_object_unref (confClient); -} - -static void -response_callback (GtkWidget *dialog, - int id, - void *data) -{ - if (id == GTK_RESPONSE_OK) { - GtkWidget *chk_button = g_object_get_data (G_OBJECT (dialog), "check_button"); - check_button_callback (chk_button, NULL); - gnome_settings_load_modmap_files (); - } - gtk_widget_destroy (GTK_WIDGET (dialog)); -} - -static void -get_selected_files_func (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, - gpointer data) -{ - GSList **list = data; - gchar *filename; - - filename = NULL; - gtk_tree_model_get (model, - iter, - 0, - &filename, - -1); - - *list = g_slist_prepend (*list, filename); -} - -static GSList* -remove_string_from_list (GSList *list, - const char *str) -{ - GSList *tmp; - - tmp = list; - while (tmp != NULL) { - if (strcmp (tmp->data, str) == 0) - break; - - tmp = tmp->next; - } - - if (tmp != NULL) { - g_free (tmp->data); - list = g_slist_remove (list, tmp->data); - } - - return list; -} - - -static void -remove_button_clicked_callback (GtkWidget *button, - void *data) -{ - GladeXML *xml; - GtkWidget *dialog; - GtkListStore *tree = NULL; - GtkTreeSelection *selection; - GtkWidget *treeview; - GConfClient *confClient; - GSList *filenames = NULL; - GSList *tmp = NULL; - GSList *loaded_files = NULL; - - dialog = data; - - xml = g_object_get_data (G_OBJECT (dialog), "treeview1"); - treeview = glade_xml_get_widget (xml, "treeview1"); - - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)); - gtk_tree_selection_selected_foreach (selection, - get_selected_files_func, - &filenames); - - if (!filenames) - return; - - /* Remove the selected file */ - confClient = gconf_client_get_default (); - loaded_files = gconf_client_get_list (confClient, LOADED_FILES_KEY, GCONF_VALUE_STRING, NULL); - loaded_files = remove_string_from_list (loaded_files, (char *)filenames->data); - - gconf_client_set_list (confClient, LOADED_FILES_KEY, GCONF_VALUE_STRING, loaded_files, - NULL); - tree = g_object_get_data (G_OBJECT (dialog), "tree"); - - gtk_list_store_clear (tree); - tmp = loaded_files; - while (tmp != NULL) { - GtkTreeIter iter; - gtk_list_store_append (tree, &iter); - gtk_list_store_set (tree, &iter, - 0, - (char *)tmp->data, - -1); - tmp = tmp->next; - } - - g_slist_foreach (loaded_files, (GFunc) g_free, NULL); - g_slist_free (loaded_files); - - g_object_unref (G_OBJECT (confClient)); -} - -static void -load_button_clicked_callback (GtkWidget *button, - void *data) -{ - GtkWidget *dialog; - GtkListStore *tree = NULL; - GtkTreeSelection *selection; - GtkWidget *treeview; - GSList *filenames = NULL; - GSList *tmp = NULL; - GSList *loaded_files = NULL; - GConfClient *confClient; - - dialog = data; - - treeview = g_object_get_data (G_OBJECT (dialog), - "loaded-treeview"); - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)); - gtk_tree_selection_selected_foreach (selection, - get_selected_files_func, - &filenames); - - if (!filenames) - return; - - /* Add the files to left-tree-view */ - - confClient = gconf_client_get_default (); - loaded_files = gconf_client_get_list (confClient, LOADED_FILES_KEY, GCONF_VALUE_STRING, NULL); - tmp = loaded_files; - while (tmp != NULL) { - if (strcmp (tmp->data, (char *)filenames->data) == 0) - return;; - - tmp = tmp->next; - - } - - loaded_files = g_slist_append (loaded_files, (char *)filenames->data); - gconf_client_set_list (confClient, LOADED_FILES_KEY, - GCONF_VALUE_STRING, loaded_files, - NULL); - tree = g_object_get_data (G_OBJECT (dialog), "tree"); - - gtk_list_store_clear (tree); - tmp = loaded_files; - while (tmp != NULL) { - GtkTreeIter iter; - gtk_list_store_append (tree, &iter); - gtk_list_store_set (tree, &iter, - 0, - (char *)tmp->data, - -1); - tmp = tmp->next; - } - g_slist_foreach (loaded_files, (GFunc) g_free, NULL); - g_slist_free (loaded_files); - - g_object_unref (G_OBJECT (confClient)); -} - -void -gnome_settings_modmap_dialog_call (void) -{ - GladeXML *xml; - GtkWidget *load_dialog; - GtkListStore *tree; - GtkCellRenderer *cell_renderer; - GtkTreeIter parent_iter; - GtkTreeIter iter; - GtkTreeModel *sort_model; - GtkTreeSelection *selection; - GtkWidget *treeview; - GtkWidget *treeview1; - GtkTreeViewColumn *column; - GtkWidget *add_button; - GtkWidget *remove_button; - GtkWidget *chk_button; - GSList *tmp = NULL; - GDir *homeDir; - GSList *loaded_files = NULL; - G_CONST_RETURN gchar *fname; - GConfClient *confClient = gconf_client_get_default (); - homeDir = g_dir_open (g_get_home_dir (), 0, NULL); - if (homeDir == NULL) - return; - xml = glade_xml_new (GNOMECC_DATA_DIR "/interfaces/modmap-dialog.glade", "dialog1", NULL); - - if (! xml) { - g_warning ("Could not find GLADE_FILE \n"); - return; - } - - load_dialog = glade_xml_get_widget (xml, "dialog1"); - gtk_window_set_modal (GTK_WINDOW (load_dialog), TRUE); - g_signal_connect (G_OBJECT (load_dialog), "response", - G_CALLBACK (response_callback), - xml); - add_button = glade_xml_get_widget (xml, "button7"); - g_signal_connect (G_OBJECT (add_button), "clicked", - G_CALLBACK (load_button_clicked_callback), - load_dialog); - remove_button = glade_xml_get_widget (xml, "button6"); - g_signal_connect (G_OBJECT (remove_button), "clicked", - G_CALLBACK (remove_button_clicked_callback), - load_dialog); - chk_button = glade_xml_get_widget (xml, "checkbutton1"); - g_signal_connect (G_OBJECT (chk_button), "toggled", - G_CALLBACK (check_button_callback), - NULL); - g_object_set_data (G_OBJECT (load_dialog), "check_button", chk_button); - g_object_set_data (G_OBJECT (load_dialog), "treeview1", xml); - treeview = glade_xml_get_widget (xml, "treeview2"); - g_object_set_data (G_OBJECT (load_dialog), - "loaded-treeview", - treeview); - tree = gtk_list_store_new (1, G_TYPE_STRING); - cell_renderer = gtk_cell_renderer_text_new (); - column = gtk_tree_view_column_new_with_attributes ("modmap", - cell_renderer, - "text", 0, - NULL); - gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column); - gtk_tree_view_column_set_sort_column_id (column, 0); - - /* Add the data */ - while ((fname = g_dir_read_name (homeDir)) != NULL) { - if (g_strrstr (fname, "modmap")) { - gtk_list_store_append (tree, &parent_iter); - gtk_list_store_set (tree, &parent_iter, - 0, - g_strdup (fname), - -1); - } - } - sort_model = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (tree)); - gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (sort_model), - 0, - GTK_SORT_ASCENDING); - gtk_tree_view_set_model (GTK_TREE_VIEW (treeview), sort_model); - g_object_unref (G_OBJECT (tree)); - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)); - gtk_tree_selection_set_mode (GTK_TREE_SELECTION (selection), - GTK_SELECTION_MULTIPLE); - gtk_widget_show (load_dialog); - - g_dir_close (homeDir); - - /* Left treeview */ - treeview1 = glade_xml_get_widget (xml, "treeview1"); - tree = gtk_list_store_new (1, G_TYPE_STRING); - cell_renderer = gtk_cell_renderer_text_new (); - column = gtk_tree_view_column_new_with_attributes ("modmap", - cell_renderer, - "text", 0, - NULL); - gtk_tree_view_append_column (GTK_TREE_VIEW (treeview1), column); - gtk_tree_view_column_set_sort_column_id (column, 0); - - loaded_files = gconf_client_get_list (confClient, LOADED_FILES_KEY, GCONF_VALUE_STRING, NULL); - g_object_unref (confClient); - - /* Add the data */ - tmp = loaded_files; - while (tmp != NULL) { - gchar *command = NULL; - gtk_list_store_append (tree, &iter); - gtk_list_store_set (tree, &iter, - 0, - (char *)tmp->data, - -1); - tmp = tmp->next; - g_free (command); - } - - sort_model = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (tree)); - gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (sort_model), - 0, - GTK_SORT_ASCENDING); - gtk_tree_view_set_model (GTK_TREE_VIEW (treeview1), sort_model); - g_object_unref (G_OBJECT (tree)); - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview1)); - gtk_tree_selection_set_mode (GTK_TREE_SELECTION (selection), - GTK_SELECTION_MULTIPLE); - g_object_set_data (G_OBJECT (load_dialog), "tree", tree); - -} diff --git a/gnome-settings-daemon/gnome-settings-xmodmap.h b/gnome-settings-daemon/gnome-settings-xmodmap.h deleted file mode 100644 index 05aae15d5..000000000 --- a/gnome-settings-daemon/gnome-settings-xmodmap.h +++ /dev/null @@ -1,32 +0,0 @@ -/* gnome-settings-xmodmap.h - * - * Copyright © 2005 Novell Inc. - * - * Written by Shakti Sen <shprasad@novell.com> - * - * 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. - * - * 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. - * - * 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., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - - - - -#ifndef XMODMAP_H -#define XMODMAP_H - -void gnome_settings_load_modmap_files (void); -void gnome_settings_modmap_dialog_call (void); - -#endif diff --git a/gnome-settings-daemon/gnome-settings-xrdb.c b/gnome-settings-daemon/gnome-settings-xrdb.c deleted file mode 100644 index 51d22d8c7..000000000 --- a/gnome-settings-daemon/gnome-settings-xrdb.c +++ /dev/null @@ -1,342 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; style: linux -*- */ - -/* gnome-settings-xrdb.c - * - * Copyright © 2003 Ross Burton - * - * Written by Ross Burton <ross@burtonini.com> - * - * 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. - * - * 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. - * - * 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., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include <errno.h> -#include <stdio.h> -#include <string.h> -#include <glib/gi18n.h> -#include <gtk/gtkwindow.h> -#include <gconf/gconf-client.h> - -#include "gnome-settings-daemon.h" -#include "gnome-settings-xrdb.h" - -#define SYSTEM_AD_DIR DATADIR "/control-center-2.0/xrdb" -#define GENERAL_AD SYSTEM_AD_DIR "/General.ad" -#define USER_AD_DIR ".gnome2/xrdb" -#define USER_X_RESOURCES ".Xresources" -#define USER_X_DEFAULTS ".Xdefaults" - -#define GTK_THEME_KEY "/desktop/gnome/interface/gtk_theme" - -GtkWidget *widget; - -/* - * Theme colour functions - */ - -/* - * TODO: replace with the code from Smooth? (which should really be - * public in GTK+) - */ -static GdkColor* -colour_shade (GdkColor *a, gdouble shade, GdkColor *b) -{ - guint16 red, green, blue; - - red = CLAMP ((a->red) * shade, 0, 0xFFFF); - green = CLAMP ((a->green) * shade, 0, 0xFFFF); - blue = CLAMP ((a->blue) * shade, 0, 0xFFFF); - - b->red = red; - b->green = green; - b->blue = blue; - - return b; -} - -static void -append_colour_define (GString *string, const gchar* name, const GdkColor* colour) -{ - g_return_if_fail (string != NULL); - g_return_if_fail (name != NULL); - g_return_if_fail (colour != NULL); - - g_string_append_printf (string, "#define %s #%2.2hx%2.2hx%2.2hx\n", - name, colour->red>>8, colour->green>>8, colour->blue>>8); -} - -static void -append_theme_colours (GtkStyle *style, GString *string) -{ - GdkColor tmp; - - g_return_if_fail (style != NULL); - g_return_if_fail (string != NULL); - - append_colour_define(string, "BACKGROUND", - &style->bg[GTK_STATE_NORMAL]); - append_colour_define(string, "FOREGROUND", - &style->fg[GTK_STATE_NORMAL]); - append_colour_define(string, "SELECT_BACKGROUND", - &style->bg[GTK_STATE_SELECTED]); - append_colour_define(string, "SELECT_FOREGROUND", - &style->text[GTK_STATE_SELECTED]); - append_colour_define(string, "WINDOW_BACKGROUND", - &style->base[GTK_STATE_NORMAL]); - append_colour_define(string, "WINDOW_FOREGROUND", - &style->text[GTK_STATE_NORMAL]); - - append_colour_define(string, "INACTIVE_BACKGROUND", - &style->bg[GTK_STATE_INSENSITIVE]); - append_colour_define(string, "INACTIVE_FOREGROUND", - &style->text[GTK_STATE_INSENSITIVE]); - - append_colour_define(string, "ACTIVE_BACKGROUND", - &style->bg[GTK_STATE_SELECTED]); - append_colour_define(string, "ACTIVE_FOREGROUND", - &style->text[GTK_STATE_SELECTED]); - - append_colour_define(string, "HIGHLIGHT", - colour_shade (&style->bg[GTK_STATE_NORMAL], - 1.2, &tmp)); - append_colour_define(string, "LOWLIGHT", - colour_shade (&style->bg[GTK_STATE_NORMAL], - 2.0/3.0, &tmp)); - return; -} - -/* - * Directory scanning functions - */ - -/** - * Compare two file names on their base names. - */ -static gint -compare_basenames (gconstpointer a, gconstpointer b) -{ - char *base_a, *base_b; - int res; - base_a = g_path_get_basename (a); - base_b = g_path_get_basename (b); - res = strcmp (base_a, base_b); - g_free (base_a); - g_free (base_b); - return res; -} - -/** - * Append the contents of a file onto the end of a GString - */ -static void -append_file (const char* file, GString *string, GError **error) -{ - gchar *contents; - - g_return_if_fail (string != NULL); - g_return_if_fail (file != NULL); - - if (g_file_get_contents (file, &contents, NULL, error)) { - g_string_append (string, contents); - g_free (contents); - } -} - -/** - * Scan a single directory for .ad files, and return them all in a - * GSList* - */ -static GSList* -scan_ad_directory (const char *path, GError **error) -{ - GSList *list = NULL; - GDir *dir; - const gchar *entry; - - g_return_val_if_fail (path != NULL, NULL); - dir = g_dir_open (path, 0, error); - if (*error) { - return NULL; - } - while ((entry = g_dir_read_name (dir)) != NULL) { - int len; - len = strlen (entry); - if (g_str_has_suffix (entry, ".ad")) { - list = g_slist_prepend (list, g_strdup_printf ("%s/%s", path, entry)); - } - } - g_dir_close (dir); - /* TODO: sort still? */ - return g_slist_sort (list, (GCompareFunc)strcmp); -} - -/** - * Scan the user and system paths, and return a list of strings in the - * right order for processing. - */ -static GSList* -scan_for_files (GError **error) -{ - const char* home_dir; - - GSList *user_list = NULL, *system_list = NULL; - GSList *list = NULL, *p; - - system_list = scan_ad_directory (SYSTEM_AD_DIR, error); - if (*error) return NULL; - - home_dir = g_get_home_dir (); - if (home_dir) { - char *user_ad = g_build_filename (home_dir, USER_AD_DIR, NULL); - if (g_file_test (user_ad, G_FILE_TEST_IS_DIR)) { - user_list = scan_ad_directory (user_ad, error); - if (*error) { - g_slist_foreach (system_list, (GFunc)g_free, NULL); - g_slist_free (system_list); - g_free (user_ad); - return NULL; - } - } - g_free (user_ad); - } else { - g_warning (_("Cannot determine user's home directory")); - } - - /* An alternative approach would be to strdup() the strings - and free the entire contents of these lists, but that is a - little inefficient for my liking - RB */ - for (p = system_list; p != NULL; p = g_slist_next (p)) { - if (strcmp (p->data, GENERAL_AD) == 0) { - /* We ignore this, free the data now */ - g_free (p->data); - continue; - } - if (g_slist_find_custom (user_list, p->data, compare_basenames)) { - /* Ditto */ - g_free (p->data); - continue; - } - list = g_slist_prepend (list, p->data); - } - g_slist_free (system_list); - - for (p = user_list; p != NULL; p = g_slist_next (p)) { - list = g_slist_prepend (list, p->data); - } - g_slist_free (user_list); - - /* Reverse the order so it is the correct way */ - list = g_slist_reverse (list); - - /* Add the initial file */ - list = g_slist_prepend (list, g_strdup (GENERAL_AD)); - - return list; -} - -/** - * Append an X resources file, such as .Xresources, or .Xdefaults - */ -static void -append_xresource_file (const char * filename, GString *string, GError **error) -{ - const char* home_path; - char *xresources; - - g_return_if_fail (string != NULL); - - home_path = g_get_home_dir (); - if (home_path == NULL) { - g_warning (_("Cannot determine user's home directory")); - return; - } - - xresources = g_build_filename (home_path, filename, NULL); - if (g_file_test (xresources, G_FILE_TEST_EXISTS)) { - append_file (xresources, string, error); - if (*error) { - g_warning ("%s", (*error)->message); - g_error_free (*error); - error = NULL; - } - } - g_free (xresources); -} - -/* - * Entry point - */ -static void -apply_settings (GtkStyle *style) -{ - char *xrdb[] = { "xrdb", "-merge", NULL }; - GString *string; - GSList *list = NULL, *p; - GError *error = NULL; - - string = g_string_sized_new (256); - append_theme_colours (style, string); - - list = scan_for_files (&error); - if (error) { - g_warning (error->message); - g_error_free (error); - error = NULL; - } - for (p = list; p != NULL; p=g_slist_next (p)) { - append_file (p->data, string, &error); - if (error) { - g_warning (error->message); - g_error_free (error); - error = NULL; - } - } - - g_slist_foreach (list, (GFunc)g_free, NULL); - g_slist_free (list); - - append_xresource_file (USER_X_RESOURCES, string, &error); - append_xresource_file (USER_X_DEFAULTS, string, &error); - - if (error) { - g_warning (error->message); - g_error_free (error); - error = NULL; - } - - gnome_settings_daemon_spawn_with_input (xrdb, string->str); - g_string_free (string, TRUE); - return; -} - -static void -style_set_cb (GtkWidget *widget, GtkStyle *s, gpointer data) -{ - apply_settings (gtk_widget_get_style (widget)); -} - -void -gnome_settings_xrdb_init (GConfClient *client) -{ - widget = gtk_window_new (GTK_WINDOW_TOPLEVEL); - g_signal_connect (widget, "style-set", (GCallback)style_set_cb, NULL); - gtk_widget_ensure_style (widget); -} - -void -gnome_settings_xrdb_load (GConfClient *client) -{ - style_set_cb (widget, NULL, NULL); -} diff --git a/gnome-settings-daemon/gnome-settings-xrdb.h b/gnome-settings-daemon/gnome-settings-xrdb.h deleted file mode 100644 index 8bc1d1e5f..000000000 --- a/gnome-settings-daemon/gnome-settings-xrdb.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- mode: c; style: linux -*- */ - -/* gnome-settings-xrdb - * - * Copyright © 2003 Ross Burton - * - * Written by Ross Burton <ross@burtonini.com> - * - * 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. - * - * 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. - * - * 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., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef __GNOME_SETTINGS_XRDB_H -#define __GNOME_SETTINGS_XRDB_H - -#include <gconf/gconf-client.h> - -void gnome_settings_xrdb_init (GConfClient *client); -void gnome_settings_xrdb_load (GConfClient *client); - -#endif diff --git a/gnome-settings-daemon/gnome-settings-xsettings.c b/gnome-settings-daemon/gnome-settings-xsettings.c deleted file mode 100644 index bb58990fd..000000000 --- a/gnome-settings-daemon/gnome-settings-xsettings.c +++ /dev/null @@ -1,457 +0,0 @@ -#include <config.h> -#include <string.h> -#include <stdio.h> -#include <locale.h> -#include <glib.h> -#include <glib/gi18n.h> -#include <gconf/gconf-client.h> - -#include "gnome-settings-daemon.h" -#include "gnome-settings-xsettings.h" -#include "xsettings-manager.h" - -extern XSettingsManager **managers; - -#ifdef HAVE_XFT2 -#define FONT_RENDER_DIR "/desktop/gnome/font_rendering" -#define FONT_ANTIALIASING_KEY FONT_RENDER_DIR "/antialiasing" -#define FONT_HINTING_KEY FONT_RENDER_DIR "/hinting" -#define FONT_RGBA_ORDER_KEY FONT_RENDER_DIR "/rgba_order" -#define FONT_DPI_KEY FONT_RENDER_DIR "/dpi" -#endif /* HAVE_XFT2 */ - -typedef struct _TranslationEntry TranslationEntry; -typedef void (* TranslationFunc) (TranslationEntry *trans, - GConfValue *value); -struct _TranslationEntry -{ - const char *gconf_key; - const char *xsetting_name; - - GConfValueType gconf_type; - TranslationFunc translate; -}; - -#ifdef HAVE_XFT2 -static void gnome_settings_update_xft (GConfClient *client); -static void xft_callback (GConfEntry *entry); -#endif /* HAVE_XFT2 */ - -static void -translate_bool_int (TranslationEntry *trans, - GConfValue *value) -{ - int i; - - g_assert (value->type == trans->gconf_type); - - for (i = 0; managers [i]; i++) - xsettings_manager_set_int (managers [i], trans->xsetting_name, - gconf_value_get_bool (value)); -} - -static void -translate_int_int (TranslationEntry *trans, - GConfValue *value) -{ - int i; - - g_assert (value->type == trans->gconf_type); - - for (i = 0; managers [i]; i++) - xsettings_manager_set_int (managers [i], trans->xsetting_name, - gconf_value_get_int (value)); -} - -static void -translate_string_string (TranslationEntry *trans, - GConfValue *value) -{ - int i; - - g_assert (value->type == trans->gconf_type); - - for (i = 0; managers [i]; i++) - xsettings_manager_set_string (managers [i], - trans->xsetting_name, - gconf_value_get_string (value)); -} - -static void -translate_string_string_toolbar (TranslationEntry *trans, - GConfValue *value) -{ - int i; - const char *tmp; - - g_assert (value->type == trans->gconf_type); - - /* This is kind of a workaround since GNOME expects the key value to be - * "both_horiz" and gtk+ wants the XSetting to be "both-horiz". - */ - tmp = gconf_value_get_string (value); - if (tmp && strcmp (tmp, "both_horiz") == 0) - tmp = "both-horiz"; - - for (i = 0; managers [i]; i++) - xsettings_manager_set_string (managers [i], - trans->xsetting_name, - tmp); -} - -static TranslationEntry translations [] = { - { "/desktop/gnome/peripherals/mouse/double_click", "Net/DoubleClickTime", - GCONF_VALUE_INT, translate_int_int }, - { "/desktop/gnome/peripherals/mouse/drag_threshold", "Net/DndDragThreshold", - GCONF_VALUE_INT, translate_int_int }, - { "/desktop/gnome/gtk-color-palette", "Gtk/ColorPalette", - GCONF_VALUE_STRING, translate_string_string }, - { "/desktop/gnome/interface/font_name", "Gtk/FontName", - GCONF_VALUE_STRING, translate_string_string }, - { "/desktop/gnome/interface/gtk_key_theme", "Gtk/KeyThemeName", - GCONF_VALUE_STRING, translate_string_string }, - { "/desktop/gnome/interface/toolbar_style", "Gtk/ToolbarStyle", - GCONF_VALUE_STRING, translate_string_string_toolbar }, - { "/desktop/gnome/interface/toolbar_icon_size", "Gtk/ToolbarIconSize", - GCONF_VALUE_STRING, translate_string_string }, - { "/desktop/gnome/interface/can_change_accels", "Gtk/CanChangeAccels", - GCONF_VALUE_BOOL, translate_bool_int }, - { "/desktop/gnome/interface/cursor_blink", "Net/CursorBlink", - GCONF_VALUE_BOOL, translate_bool_int }, - { "/desktop/gnome/interface/cursor_blink_time", "Net/CursorBlinkTime", - GCONF_VALUE_INT, translate_int_int }, - { "/desktop/gnome/interface/gtk_theme", "Net/ThemeName", - GCONF_VALUE_STRING, translate_string_string }, - { "/desktop/gnome/interface/gtk-im-preedit-style", "Gtk/IMPreeditStyle", - GCONF_VALUE_STRING, translate_string_string }, - { "/desktop/gnome/interface/gtk-im-status-style", "Gtk/IMStatusStyle", - GCONF_VALUE_STRING, translate_string_string }, - { "/desktop/gnome/interface/icon_theme", "Net/IconThemeName", - GCONF_VALUE_STRING, translate_string_string }, - { "/desktop/gnome/interface/file_chooser_backend", "Gtk/FileChooserBackend", - GCONF_VALUE_STRING, translate_string_string }, - { "/desktop/gnome/interface/menus_have_icons", "Gtk/MenuImages", - GCONF_VALUE_BOOL, translate_bool_int }, - { "/desktop/gnome/interface/menubar_accel", "Gtk/MenuBarAccel", - GCONF_VALUE_STRING, translate_string_string }, -}; - -static TranslationEntry* -find_translation_entry (const char *gconf_key) -{ - int i; - - i = 0; - while (i < G_N_ELEMENTS (translations)) - { - if (strcmp (translations[i].gconf_key, gconf_key) == 0) - return &translations[i]; - - ++i; - } - - return NULL; -} - -static const gchar* -type_to_string (GConfValueType type) -{ - switch (type) - { - case GCONF_VALUE_INT: - return "int"; - break; - case GCONF_VALUE_STRING: - return "string"; - break; - case GCONF_VALUE_FLOAT: - return "float"; - break; - case GCONF_VALUE_BOOL: - return "bool"; - break; - case GCONF_VALUE_SCHEMA: - return "schema"; - break; - case GCONF_VALUE_LIST: - return "list"; - break; - case GCONF_VALUE_PAIR: - return "pair"; - break; - case GCONF_VALUE_INVALID: - return "*invalid*"; - break; - default: - g_assert_not_reached(); - return NULL; /* for warnings */ - break; - } -} - -static void -process_value (TranslationEntry *trans, - GConfValue *val) -{ - if (val == NULL) - { - int i; - - for (i = 0; managers [i]; i++) - xsettings_manager_delete_setting (managers [i], trans->xsetting_name); - } - else - { - if (val->type == trans->gconf_type) - { - (* trans->translate) (trans, val); - } - else - { - g_warning (_("GConf key %s set to type %s but its expected type was %s\n"), - trans->gconf_key, - type_to_string (val->type), - type_to_string (trans->gconf_type)); - } - } -} - -static void -xsettings_callback (GConfEntry *entry) -{ - TranslationEntry *trans; - int i; - - trans = find_translation_entry (entry->key); - if (trans == NULL) - return; - - process_value (trans, entry->value); - - for (i = 0; managers [i]; i++) - xsettings_manager_notify (managers [i]); -} - -void -gnome_settings_xsettings_init (GConfClient *client) -{ - gnome_settings_daemon_register_callback ("/desktop/gnome/peripherals/mouse", xsettings_callback); - gnome_settings_daemon_register_callback ("/desktop/gtk", xsettings_callback); - gnome_settings_daemon_register_callback ("/desktop/gnome/interface", xsettings_callback); - -#ifdef HAVE_XFT2 - gnome_settings_daemon_register_callback (FONT_RENDER_DIR, xft_callback); -#endif /* HAVE_XFT2 */ -} - -#ifdef HAVE_XFT2 -static void -xft_callback (GConfEntry *entry) -{ - GConfClient *client; - int i; - - client = gconf_client_get_default (); - - gnome_settings_update_xft (client); - g_object_unref (client); - - for (i = 0; managers [i]; i++) - xsettings_manager_notify (managers [i]); -} - -typedef struct -{ - gboolean antialias; - gboolean hinting; - int dpi; - const char *rgba; - const char *hintstyle; -} GnomeXftSettings; - -static const char *rgba_types[] = { "rgb", "bgr", "vbgr", "vrgb" }; - -/* Read GConf settings and determine the appropriate Xft settings based on them - * This probably could be done a bit more cleanly with gconf_string_to_enum - */ -static void -gnome_xft_settings_get (GConfClient *client, - GnomeXftSettings *settings) -{ - char *antialiasing = gconf_client_get_string (client, FONT_ANTIALIASING_KEY, NULL); - char *hinting = gconf_client_get_string (client, FONT_HINTING_KEY, NULL); - char *rgba_order = gconf_client_get_string (client, FONT_RGBA_ORDER_KEY, NULL); - double dpi = gconf_client_get_float (client, FONT_DPI_KEY, NULL); - - settings->antialias = TRUE; - settings->hinting = TRUE; - settings->hintstyle = "hintfull"; - settings->dpi = 96 * 1024; - settings->rgba = "rgb"; - - if ((int)(1024 * dpi + 0.5) > 0) - settings->dpi = (int)(1024 * dpi + 0.5); - - if (rgba_order) - { - int i; - gboolean found = FALSE; - - for (i = 0; i < G_N_ELEMENTS (rgba_types) && !found; i++) - if (strcmp (rgba_order, rgba_types[i]) == 0) - { - settings->rgba = rgba_types[i]; - found = TRUE; - } - - if (!found) - g_warning ("Invalid value for " FONT_RGBA_ORDER_KEY ": '%s'", - rgba_order); - } - - if (hinting) - { - if (strcmp (hinting, "none") == 0) - { - settings->hinting = 0; - settings->hintstyle = "hintnone"; - } - else if (strcmp (hinting, "slight") == 0) - { - settings->hinting = 1; - settings->hintstyle = "hintslight"; - } - else if (strcmp (hinting, "medium") == 0) - { - settings->hinting = 1; - settings->hintstyle = "hintmedium"; - } - else if (strcmp (hinting, "full") == 0) - { - settings->hinting = 1; - settings->hintstyle = "hintfull"; - } - else - g_warning ("Invalid value for " FONT_HINTING_KEY ": '%s'", - hinting); - } - - if (antialiasing) - { - gboolean use_rgba = FALSE; - - if (strcmp (antialiasing, "none") == 0) - settings->antialias = 0; - else if (strcmp (antialiasing, "grayscale") == 0) - settings->antialias = 1; - else if (strcmp (antialiasing, "rgba") == 0) - { - settings->antialias = 1; - use_rgba = TRUE; - } - else - g_warning ("Invalid value for " FONT_ANTIALIASING_KEY " : '%s'", - antialiasing); - - if (!use_rgba) - settings->rgba = "none"; - } - - g_free (rgba_order); - g_free (hinting); - g_free (antialiasing); -} - -static void -gnome_xft_settings_set_xsettings (GnomeXftSettings *settings) -{ - int i; - for (i = 0; managers [i]; i++) - { - xsettings_manager_set_int (managers [i], "Xft/Antialias", settings->antialias); - xsettings_manager_set_int (managers [i], "Xft/Hinting", settings->hinting); - xsettings_manager_set_string (managers [i], "Xft/HintStyle", settings->hintstyle); - xsettings_manager_set_int (managers [i], "Xft/DPI", settings->dpi); - xsettings_manager_set_string (managers [i], "Xft/RGBA", settings->rgba); - } -} - -static void -gnome_xft_settings_set_xresources (GnomeXftSettings *settings) -{ - char *add[] = { "xrdb", "-merge", NULL }; - GString *add_string = g_string_new (NULL); - char *old_locale = g_strdup (setlocale (LC_NUMERIC, NULL)); - - setlocale (LC_NUMERIC, "C"); - g_string_append_printf (add_string, - "Xft.dpi: %f\n", settings->dpi / 1024.); - g_string_append_printf (add_string, - "Xft.antialias: %d\n", settings->antialias); - g_string_append_printf (add_string, - "Xft.hinting: %d\n", settings->hinting); - g_string_append_printf (add_string, - "Xft.hintstyle: %s\n", settings->hintstyle); - g_string_append_printf (add_string, - "Xft.rgba: %s\n", settings->rgba); - - gnome_settings_daemon_spawn_with_input (add, add_string->str); - - g_string_free (add_string, TRUE); - setlocale (LC_NUMERIC, old_locale); - g_free (old_locale); -} - -/* We mirror the Xft properties both through XSETTINGS and through - * X resources - */ -static void -gnome_settings_update_xft (GConfClient *client) -{ - GnomeXftSettings settings; - - gnome_xft_settings_get (client, &settings); - gnome_xft_settings_set_xsettings (&settings); - gnome_xft_settings_set_xresources (&settings); -} -#endif /* HAVE_XFT2 */ - -void -gnome_settings_xsettings_load (GConfClient *client) -{ - int i; - - i = 0; - while (i < G_N_ELEMENTS (translations)) - { - GConfValue *val; - GError *err; - - err = NULL; - val = gconf_client_get (client, - translations[i].gconf_key, - &err); - - if (err != NULL) - { - fprintf (stderr, "Error getting value for %s: %s\n", - translations[i].gconf_key, err->message); - g_error_free (err); - } - else - { - process_value (&translations[i], val); - if (val != NULL) - gconf_value_free (val); - } - - ++i; - } - -#ifdef HAVE_XFT2 - gnome_settings_update_xft (client); -#endif /* HAVE_XFT */ - - for (i = 0; managers [i]; i++) - xsettings_manager_notify (managers [i]); -} diff --git a/gnome-settings-daemon/gnome-settings-xsettings.h b/gnome-settings-daemon/gnome-settings-xsettings.h deleted file mode 100644 index 259258c29..000000000 --- a/gnome-settings-daemon/gnome-settings-xsettings.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2001 Red Hat, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Red Hat not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. Red Hat makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Authors: Jonathan Blandford - */ - -#ifndef GNOME_SETTINGS_XSETTINGS_H -#define GNOME_SETTINGS_XSETTINGS_H - -#include <gconf/gconf.h> - -void gnome_settings_xsettings_init (GConfClient *client); -void gnome_settings_xsettings_load (GConfClient *client); - - -#endif /* GNOME_SETTINGS_XSETTINGS_H */ diff --git a/gnome-settings-daemon/list.c b/gnome-settings-daemon/list.c deleted file mode 100644 index 477eead77..000000000 --- a/gnome-settings-daemon/list.c +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright © 2004 Red Hat, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Red Hat not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. Red Hat makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Matthias Clasen, Red Hat, Inc. - */ - -#include <stdlib.h> -#include <list.h> - - -void -list_foreach (List *list, - Callback func, - void *user_data) -{ - while (list) - { - func (list->data, user_data); - - list = list->next; - } -} - -List * -list_prepend (List *list, - void *data) -{ - List *link; - - link = (List *) malloc (sizeof (List)); - link->next = list; - link->data = data; - - return link; -} - -void -list_free (List *list) -{ - while (list) - { - List *next = list->next; - - free (list); - - list = next; - } -} - -List * -list_find (List *list, - ListFindFunc func, - void *user_data) -{ - List *tmp; - - for (tmp = list; tmp; tmp = tmp->next) - { - if ((*func) (tmp->data, user_data)) - break; - } - - return tmp; -} - -List * -list_remove (List *list, - void *data) -{ - List *tmp, *prev; - - prev = NULL; - for (tmp = list; tmp; tmp = tmp->next) - { - if (tmp->data == data) - { - if (prev) - prev->next = tmp->next; - else - list = tmp->next; - - free (tmp); - break; - } - - prev = tmp; - } - - return list; -} - -int -list_length (List *list) -{ - List *tmp; - int length; - - length = 0; - for (tmp = list; tmp; tmp = tmp->next) - length++; - - return length; -} - -List * -list_copy (List *list) -{ - List *new_list = NULL; - - if (list) - { - List *last; - - new_list = (List *) malloc (sizeof (List)); - new_list->data = list->data; - new_list->next = NULL; - - last = new_list; - list = list->next; - - while (list) - { - last->next = (List *) malloc (sizeof (List)); - last = last->next; - last->data = list->data; - list = list->next; - } - - last->next = NULL; - } - - return new_list; -} diff --git a/gnome-settings-daemon/list.h b/gnome-settings-daemon/list.h deleted file mode 100644 index 158b77937..000000000 --- a/gnome-settings-daemon/list.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright © 2004 Red Hat, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Red Hat not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. Red Hat makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Matthias Clasen, Red Hat, Inc. - */ -#ifndef LIST_H -#define LIST_H - - -typedef struct _List List; -typedef void (*Callback) (void *data, - void *user_data); - - -struct _List -{ - void *data; - - List *next; -}; - -typedef int (*ListFindFunc) (void *data, - void *user_data); - -void list_foreach (List *list, - Callback func, - void *user_data); -List *list_prepend (List *list, - void *data); -void list_free (List *list); -List *list_find (List *list, - ListFindFunc func, - void *user_data); -List *list_remove (List *list, - void *data); -int list_length (List *list); - -List *list_copy (List *list); - -#endif /* LIST_H */ diff --git a/gnome-settings-daemon/modmap-dialog.glade b/gnome-settings-daemon/modmap-dialog.glade deleted file mode 100644 index c6ca36d41..000000000 --- a/gnome-settings-daemon/modmap-dialog.glade +++ /dev/null @@ -1,389 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> -<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> - -<glade-interface> -<requires lib="gnome"/> - -<widget class="GtkDialog" id="dialog1"> - <property name="visible">True</property> - <property name="title" translatable="yes">Load modmap files</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - <property name="decorated">True</property> - <property name="skip_taskbar_hint">False</property> - <property name="skip_pager_hint">False</property> - <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> - <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> - <property name="has_separator">True</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="dialog-vbox4"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child internal-child="action_area"> - <widget class="GtkHButtonBox" id="dialog-action_area3"> - <property name="visible">True</property> - <property name="layout_style">GTK_BUTTONBOX_END</property> - - <child> - <widget class="GtkButton" id="helpbutton2"> - <property name="visible">False</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-help</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="response_id">-11</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="okbutton1"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-ok</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="response_id">-5</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox44"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkLabel" id="label62"> - <property name="visible">True</property> - <property name="label" translatable="yes">Do you like to load the modmap file(s)?</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox32"> - <property name="border_width">12</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkVBox" id="vbox45"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="label63"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Loaded files:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkScrolledWindow" id="scrolledwindow7"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="shadow_type">GTK_SHADOW_IN</property> - <property name="window_placement">GTK_CORNER_TOP_LEFT</property> - - <child> - <widget class="GtkTreeView" id="treeview1"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="headers_visible">False</property> - <property name="rules_hint">False</property> - <property name="reorderable">False</property> - <property name="enable_search">True</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox46"> - <property name="border_width">6</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">12</property> - - <child> - <widget class="GtkLabel" id="label64"> - <property name="visible">True</property> - <property name="label" translatable="yes"></property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkButton" id="button7"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - - <child> - <widget class="GtkAlignment" id="alignment1"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">0</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">0</property> - <property name="right_padding">0</property> - - <child> - <widget class="GtkHBox" id="hbox33"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">2</property> - - <child> - <widget class="GtkImage" id="image1"> - <property name="visible">True</property> - <property name="stock">gtk-add</property> - <property name="icon_size">4</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label66"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Load</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkButton" id="button6"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-remove</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <placeholder/> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox47"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="label65"> - <property name="visible">True</property> - <property name="label" translatable="yes">A_vailable files:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkScrolledWindow" id="scrolledwindow8"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="shadow_type">GTK_SHADOW_IN</property> - <property name="window_placement">GTK_CORNER_TOP_LEFT</property> - - <child> - <widget class="GtkTreeView" id="treeview2"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="headers_visible">False</property> - <property name="rules_hint">False</property> - <property name="reorderable">False</property> - <property name="enable_search">True</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="checkbutton1"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Do _not show this warning again.</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">True</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - </child> -</widget> - -</glade-interface> - diff --git a/gnome-settings-daemon/reaper.c b/gnome-settings-daemon/reaper.c deleted file mode 100644 index 04a6c8382..000000000 --- a/gnome-settings-daemon/reaper.c +++ /dev/null @@ -1,299 +0,0 @@ -/* - * Copyright (C) 2002 Red Hat, Inc. - * - * This is free software; you can redistribute it and/or modify it under - * the terms of the GNU Library General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * 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. - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ident "$Id$" -#include "../config.h" -#include <sys/types.h> -#include <sys/wait.h> -#include <signal.h> -#include <stdlib.h> -#include <unistd.h> -#include <glib.h> -#include <glib-object.h> -#include <gtk/gtk.h> -#include <gtk/gtkmarshal.h> -#include "reaper.h" - -#ifdef ENABLE_NLS -#include <libintl.h> -#define _(String) dgettext(PACKAGE, String) -#else -#define _(String) String -#endif - -static VteReaper *singleton_reaper = NULL; -struct reaper_info { - int signum; - pid_t pid; - int status; -}; - -static void -vte_reaper_signal_handler(int signum) -{ - struct reaper_info info; - int status; - - /* This might become more general-purpose in the future, but for now - * just forget about signals other than SIGCHLD. */ - info.signum = signum; - if (signum != SIGCHLD) { - return; - } - - if ((singleton_reaper != NULL) && (singleton_reaper->iopipe[0] != -1)) { - info.pid = waitpid(-1, &status, WNOHANG); - if (info.pid != -1) { - info.status = status; - if (write(singleton_reaper->iopipe[1], "", 0) == 0) { - write(singleton_reaper->iopipe[1], - &info, sizeof(info)); - } - } - } -} - -static gboolean -vte_reaper_emit_signal(GIOChannel *channel, GIOCondition condition, - gpointer data) -{ - struct reaper_info info; - if (condition != G_IO_IN) { - return FALSE; - } - g_assert(data == singleton_reaper); - read(singleton_reaper->iopipe[0], &info, sizeof(info)); - if (info.signum == SIGCHLD) { - g_signal_emit_by_name(data, "child-exited", - info.pid, info.status); - } - return TRUE; -} - -static void -vte_reaper_channel_destroyed(gpointer data) -{ - /* no-op */ -} - -static void -vte_reaper_init(VteReaper *reaper, gpointer *klass) -{ - struct sigaction action; - int ret; - - /* Open the signal pipe. */ - ret = pipe(reaper->iopipe); - if (ret == -1) { - g_error(_("Error creating signal pipe.")); - } - - /* Create the channel. */ - reaper->channel = g_io_channel_unix_new(reaper->iopipe[0]); - - /* Add the channel to the source list. */ - g_io_add_watch_full(reaper->channel, - G_PRIORITY_HIGH, - G_IO_IN, - vte_reaper_emit_signal, - reaper, - vte_reaper_channel_destroyed); - - /* Set the signal handler. */ - action.sa_handler = vte_reaper_signal_handler; - sigemptyset(&action.sa_mask); - action.sa_flags = SA_RESTART | SA_NOCLDSTOP; - sigaction(SIGCHLD, &action, NULL); -} - -static void -vte_reaper_finalize(GObject *reaper) -{ - GObjectClass *object_class; - struct sigaction action, old_action; - - /* Reset the signal handler if we still have it hooked. */ - action.sa_handler = SIG_DFL; - sigemptyset(&action.sa_mask); - action.sa_flags = SA_RESTART | SA_NOCLDSTOP; - sigaction(SIGCHLD, NULL, &old_action); - if (old_action.sa_handler == vte_reaper_signal_handler) { - sigaction(SIGCHLD, &action, NULL); - } - - /* Remove the channel from the source list. */ - g_source_remove_by_user_data(reaper); - - /* Remove the channel. */ - g_io_channel_unref((VTE_REAPER(reaper))->channel); - - /* Close the pipes. */ - close((VTE_REAPER(reaper))->iopipe[1]); - close((VTE_REAPER(reaper))->iopipe[0]); - - /* Call the inherited destructor. */ - object_class = g_type_class_peek(G_TYPE_OBJECT); - if (G_OBJECT_CLASS(object_class)->finalize) { - (G_OBJECT_CLASS(object_class))->finalize(reaper); - } - singleton_reaper = NULL; -} - -static void -vte_reaper_class_init(VteReaperClass *klass, gpointer data) -{ - GObjectClass *gobject_class; - - klass->child_exited_signal = g_signal_new("child-exited", - G_OBJECT_CLASS_TYPE(klass), - G_SIGNAL_RUN_LAST, - 0, - NULL, - NULL, - gtk_marshal_NONE__INT_INT, - G_TYPE_NONE, - 2, G_TYPE_INT, G_TYPE_INT); - - gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = vte_reaper_finalize; -} - -GType -vte_reaper_get_type(void) -{ - static GType reaper_type = 0; - static GTypeInfo reaper_type_info = { - sizeof(VteReaperClass), - - (GBaseInitFunc)NULL, - (GBaseFinalizeFunc)NULL, - - (GClassInitFunc)vte_reaper_class_init, - (GClassFinalizeFunc)NULL, - NULL, - - sizeof(VteReaper), - 0, - (GInstanceInitFunc) vte_reaper_init, - - (const GTypeValueTable *) NULL, - }; - if (reaper_type == 0) { - reaper_type = g_type_register_static(G_TYPE_OBJECT, - "VteReaper", - &reaper_type_info, - 0); - } - return reaper_type; -} - -/** - * vte_reaper_get: - * - * Finds the address of the global #VteReaper object, creating the object if - * necessary. - * - * Returns: the global #VteReaper object, which should not be unreffed. - */ -VteReaper * -vte_reaper_get(void) -{ - if (!VTE_IS_REAPER(singleton_reaper)) { - singleton_reaper = g_object_new(VTE_TYPE_REAPER, NULL); - } - return singleton_reaper; -} - -#ifdef REAPER_MAIN -GMainContext *context; -GMainLoop *loop; -pid_t child; - -static void -child_exited(GObject *object, int pid, int status, gpointer data) -{ - g_print("[parent] Child with pid %d exited with code %d, " - "was waiting for %d.\n", pid, status, GPOINTER_TO_INT(data)); - if (child == pid) { - g_print("[parent] Quitting.\n"); - g_main_loop_quit(loop); - } -} - -int -main(int argc, char **argv) -{ - VteReaper *reaper; - pid_t p, q; - - _vte_debug_parse_string(getenv("VTE_DEBUG_FLAGS")); - - g_type_init(); - context = g_main_context_default(); - loop = g_main_loop_new(context, FALSE); - reaper = vte_reaper_get(); - - g_print("[parent] Forking.\n"); - p = fork(); - switch (p) { - case -1: - g_print("[parent] Fork failed.\n"); - g_assert_not_reached(); - break; - case 0: - g_print("[child] Going to sleep.\n"); - sleep(10); - g_print("[child] Quitting.\n"); - _exit(30); - break; - default: - g_print("[parent] Starting to wait for %d.\n", p); - child = p; - g_signal_connect(G_OBJECT(reaper), - "child-exited", - G_CALLBACK(child_exited), - GINT_TO_POINTER(child)); - break; - } - - g_print("[parent] Forking.\n"); - q = fork(); - switch (q) { - case -1: - g_print("[parent] Fork failed.\n"); - g_assert_not_reached(); - break; - case 0: - g_print("[child] Going to sleep.\n"); - sleep(5); - _exit(5); - break; - default: - g_print("[parent] Not waiting for %d.\n", q); - break; - } - - - g_main_loop_run(loop); - - reaper = vte_reaper_get(); - g_object_unref(VTE_REAPER(reaper)); - - return 0; -} -#endif diff --git a/gnome-settings-daemon/reaper.h b/gnome-settings-daemon/reaper.h deleted file mode 100644 index fb8521f69..000000000 --- a/gnome-settings-daemon/reaper.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2002 Red Hat, Inc. - * - * This is free software; you can redistribute it and/or modify it under - * the terms of the GNU Library General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * 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. - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef vte_reaper_h_included -#define vte_reaper_h_included - -#ident "$Id$" - -#include <sys/wait.h> -#include <signal.h> -#include <glib.h> -#include <glib-object.h> - -G_BEGIN_DECLS - -struct _VteReaper { - GObject object; - GIOChannel *channel; - int iopipe[2]; -}; -typedef struct _VteReaper VteReaper; - -struct _VteReaperClass { - GObjectClass parent_class; - guint child_exited_signal; -}; -typedef struct _VteReaperClass VteReaperClass; - -GType vte_reaper_get_type(void); - -#define VTE_TYPE_REAPER (vte_reaper_get_type()) -#define VTE_REAPER(obj) (GTK_CHECK_CAST((obj), \ - VTE_TYPE_REAPER, \ - VteReaper)) -#define VTE_REAPER_CLASS(klass) GTK_CHECK_CLASS_CAST((klass), \ - VTE_TYPE_REAPER, \ - VteReaperClass) -#define VTE_IS_REAPER(obj) GTK_CHECK_TYPE((obj), VTE_TYPE_REAPER) -#define VTE_IS_REAPER_CLASS(klass) GTK_CHECK_CLASS_TYPE((klass), \ - VTE_TYPE_REAPER) -#define VTE_REAPER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), \ - VTE_TYPE_REAPER, \ - VteReaperClass)) - -VteReaper *vte_reaper_get(void); - -G_END_DECLS - -#endif diff --git a/gnome-settings-daemon/xrdb/.cvsignore b/gnome-settings-daemon/xrdb/.cvsignore deleted file mode 100644 index 282522db0..000000000 --- a/gnome-settings-daemon/xrdb/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/gnome-settings-daemon/xrdb/Editres.ad b/gnome-settings-daemon/xrdb/Editres.ad deleted file mode 100644 index 9cd3e582b..000000000 --- a/gnome-settings-daemon/xrdb/Editres.ad +++ /dev/null @@ -1,6 +0,0 @@ -!Editres*Font: FONT -Editres*Tree.Background: WINDOW_BACKGROUND -Editres*Tree.Foreground: WINDOW_FOREGROUND -Editres*Tree.Toggle.Foreground: FOREGROUND -Editres*Tree.Toggle.Background: BACKGROUND -Editres*Panner.Background: BACKGROUND diff --git a/gnome-settings-daemon/xrdb/Emacs.ad b/gnome-settings-daemon/xrdb/Emacs.ad deleted file mode 100644 index 31850fc5b..000000000 --- a/gnome-settings-daemon/xrdb/Emacs.ad +++ /dev/null @@ -1,24 +0,0 @@ -Emacs.default.attributeForeground: WINDOW_FOREGROUND -Emacs.default.attributeBackground: WINDOW_BACKGROUND - -Emacs*Foreground: WINDOW_FOREGROUND -Emacs*Background: WINDOW_BACKGROUND -Emacs*menubar*foreground: FOREGROUND -Emacs*menubar*background: BACKGROUND -Emacs*popup*Foreground: FOREGROUND -Emacs*popup*Background: BACKGROUND -Emacs*Dialog*foreground: FOREGROUND -Emacs*Dialog*background: BACKGROUND -Emacs*XlwScrollBar.Foreground: FOREGROUND -Emacs*XlwScrollBar.Background: BACKGROUND -Emacs*topToolBarShadowColor: BACKGROUND -Emacs*bottomToolBarShadowColor: BACKGROUND -Emacs*backgroundToolBarColor: BACKGROUND -Emacs*toolBarShadowThickness: 0 - -!Emacs*font: FIXED_FONT -!Emacs*menubar*Font: FONT -!Emacs*popup*Font: FONT -!Emacs*Dialog*Font: FONT -!Emacs.default.attributeFont: FIXED_FONT - diff --git a/gnome-settings-daemon/xrdb/General.ad b/gnome-settings-daemon/xrdb/General.ad deleted file mode 100644 index f088091ce..000000000 --- a/gnome-settings-daemon/xrdb/General.ad +++ /dev/null @@ -1,5 +0,0 @@ -*background: BACKGROUND -*foreground: FOREGROUND -!*Font: FONT -!*font: FONT -!*fontList: FONTLIST diff --git a/gnome-settings-daemon/xrdb/Makefile.am b/gnome-settings-daemon/xrdb/Makefile.am deleted file mode 100644 index 6b2aa5d0d..000000000 --- a/gnome-settings-daemon/xrdb/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -xrdbdir = $(datadir)/control-center-2.0/xrdb -xrdb_DATA = \ - General.ad \ - Editres.ad \ - Emacs.ad \ - Motif.ad \ - Tk.ad \ - Xaw.ad - -EXTRA_DIST = $(xrdb_DATA) diff --git a/gnome-settings-daemon/xrdb/Motif.ad b/gnome-settings-daemon/xrdb/Motif.ad deleted file mode 100644 index 2db820cf6..000000000 --- a/gnome-settings-daemon/xrdb/Motif.ad +++ /dev/null @@ -1,81 +0,0 @@ -*XmScrollBar.background: BACKGROUND -*XmScrollBar.foreground: FOREGROUND - -*XmSash.background: BACKGROUND -*XmSash.foreground: FOREGROUND - -*XmLabel.background: BACKGROUND -*XmLabel.foreground: FOREGROUND -*XmLabelGadget.background: BACKGROUND -*XmLabelGadget.foreground: FOREGROUND - -*XmCascadeButton.background: BACKGROUND -*XmCascadeButton.foreground: FOREGROUND -*XmCascadeButtonGadget.background: BACKGROUND -*XmCascadeButtonGadget.foreground: FOREGROUND - -*XmToggleButton.background: BACKGROUND -*XmToggleButton.foreground: FOREGROUND -*XmToggleButtonGadget.background: BACKGROUND -*XmToggleButtonGadget.foreground: FOREGROUND - -*XmPushButton.background: BACKGROUND -*XmPushButton.foreground: FOREGROUND -*XmPushButtonGadget.background: BACKGROUND -*XmPushButtonGadget.foreground: FOREGROUND - -*XmSeparator.background: BACKGROUND -*XmSeparator.foreground: FOREGROUND -*XmSeparatorGadget.background: BACKGROUND -*XmSeparatorGadget.foreground: FOREGROUND - -*XmTearOffButton.background: BACKGROUND -*XmTearOffButton.foreground: FOREGROUND -*XmTearOffButtonGadget.background: BACKGROUND -*XmTearOffButtonGadget.foreground: FOREGROUND - -*XmMenuShell.background: BACKGROUND -*XmMenuShell.foreground: FOREGROUND - -*XmDialogShell.background: BACKGROUND -*XmDialogShell.foreground: FOREGROUND - -*XmFileSelectionBox.background: BACKGROUND -*XmFileSelectionBox.foreground: FOREGROUND - -*XmSelectionBox.background: BACKGROUND -*XmSelectionBox.foreground: FOREGROUND - -*XmMessageBox.background: BACKGROUND -*XmMessageBox.foreground: FOREGROUND - -*XmRowColumn.background: BACKGROUND -*XmRowColumn.foreground: FOREGROUND - -*XmFrame.background: BACKGROUND -*XmFrame.foreground: FOREGROUND - -*XmForm.background: BACKGROUND -*XmForm.foreground: FOREGROUND - -*XmScrolledWindow.background: BACKGROUND -*XmScrolledWindow.foreground: FOREGROUND - -*XmPanedWindow.background: BACKGROUND -*XmPanedWindow.foreground: FOREGROUND - -*XmText.background: WINDOW_BACKGROUND -*XmText.foreground: WINDOW_FOREGROUND - -*XmTextField.background: WINDOW_BACKGROUND -*XmTextField.foreground: WINDOW_FOREGROUND - -*XmList.background: WINDOW_BACKGROUND -*XmList.foreground: WINDOW_FOREGROUND - -!! Use fixed font in motif lists and textfields -!! If you don't want this, copy this file into the -!! $HOME/.grdb directory and comment out these lines. -!*XmTextField.fontList: FIXED_FONT -!*XmText.fontList: FIXED_FONT -!*XmList*fontList: FIXED_FONT diff --git a/gnome-settings-daemon/xrdb/Tk.ad b/gnome-settings-daemon/xrdb/Tk.ad deleted file mode 100644 index 33a12009f..000000000 --- a/gnome-settings-daemon/xrdb/Tk.ad +++ /dev/null @@ -1,107 +0,0 @@ -*Toplevel.background: BACKGROUND -*Toplevel.foreground: FOREGROUND -*Toplevel.highlightBackground: BACKGROUND -*Toplevel.highlightColor: FOREGROUND -*Toplevel.activeBackground: BACKGROUND -*Toplevel.activeForeground: FOREGROUND - -*Button.background: BACKGROUND -*Button.foreground: FOREGROUND -*Button.highlightBackground: BACKGROUND -*Button.highlightColor: FOREGROUND -*Button.activeBackground: BACKGROUND -*Button.activeForeground: FOREGROUND - -*Menubutton.background: BACKGROUND -*Menubutton.foreground: FOREGROUND -*Menubutton.highlightBackground: BACKGROUND -*Menubutton.highlightColor: FOREGROUND -*Menubutton.activeBackground: BACKGROUND -*Menubutton.activeForeground: FOREGROUND - -*Checkbutton.background: BACKGROUND -*Checkbutton.foreground: FOREGROUND -*Checkbutton.highlightBackground: BACKGROUND -*Checkbutton.highlightColor: FOREGROUND -*Checkbutton.activeBackground: BACKGROUND -*Checkbutton.activeForeground: FOREGROUND - -*Radiobutton.background: BACKGROUND -*Radiobutton.foreground: FOREGROUND -*Radiobutton.highlightBackground: BACKGROUND -*Radiobutton.highlightColor: FOREGROUND -*Radiobutton.activeBackground: BACKGROUND -*Radiobutton.activeForeground: FOREGROUND - -!*Label.background: BACKGROUND -!*Label.foreground: FOREGROUND -*Label.highlightBackground: BACKGROUND -*Label.highlightColor: FOREGROUND -*Label.activeBackground: BACKGROUND -*Label.activeForeground: FOREGROUND - -*Menu.background: BACKGROUND -*Menu.foreground: FOREGROUND -*Menu.highlightBackground: BACKGROUND -*Menu.highlightColor: FOREGROUND -*Menu.activeBackground: BACKGROUND -*Menu.activeForeground: FOREGROUND - -*Frame.background: BACKGROUND -*Frame.foreground: FOREGROUND -*Frame.highlightBackground: BACKGROUND -*Frame.highlightColor: FOREGROUND -*Frame.activeBackground: BACKGROUND -*Frame.activeForeground: FOREGROUND - -!*Scrollbar.background: BACKGROUND -!*Scrollbar.foreground: FOREGROUND -*Scrollbar.highlightBackground: BACKGROUND -*Scrollbar.highlightColor: FOREGROUND -*Scrollbar.activeBackground: BACKGROUND -*Scrollbar.activeForeground: FOREGROUND -*Scrollbar.troughColor: BACKGROUND - -*Scale.background: BACKGROUND -*Scale.foreground: FOREGROUND -*Scale.highlightBackground: BACKGROUND -*Scale.highlightColor: FOREGROUND -*Scale.activeBackground: BACKGROUND -*Scale.activeForeground: FOREGROUND -*Scale.troughColor: BACKGROUND - -*Entry.background: WINDOW_BACKGROUND -*Entry.foreground: WINDOW_FOREGROUND -*Entry.highlightBackground: WINDOW_BACKGROUND -*Entry.highlightColor: WINDOW_FOREGROUND -*Entry.activeBackground: WINDOW_BACKGROUND -*Entry.activeForeground: WINDOW_FOREGROUND -*Entry.selectBackground: SELECT_BACKGROUND -*Entry.selectForeground: SELECT_FOREGROUND - -!*Text.background: WINDOW_BACKGROUND -!*Text.foreground: WINDOW_FOREGROUND -*Text.highlightBackground: WINDOW_BACKGROUND -*Text.highlightColor: WINDOW_FOREGROUND -*Text.activeBackground: WINDOW_BACKGROUND -*Text.activeForeground: WINDOW_FOREGROUND -*Text.selectBackground: SELECT_BACKGROUND -*Text.selectForeground: SELECT_FOREGROUND - -*Listbox.background: WINDOW_BACKGROUND -*Listbox.foreground: WINDOW_FOREGROUND -*Listbox.highlightBackground: WINDOW_BACKGROUND -*Listbox.highlightColor: WINDOW_FOREGROUND -*Listbox.activeBackground: WINDOW_BACKGROUND -*Listbox.activeForeground: WINDOW_FOREGROUND -*Listbox.selectBackground: SELECT_BACKGROUND -*Listbox.selectForeground: SELECT_FOREGROUND - -*Canvas.background: WINDOW_BACKGROUND -*Canvas.foreground: WINDOW_FOREGROUND -*Canvas.highlightBackground: WINDOW_BACKGROUND -*Canvas.highlightColor: WINDOW_FOREGROUND -*Canvas.activeBackground: WINDOW_BACKGROUND -*Canvas.activeForeground: WINDOW_FOREGROUND -*Canvas.selectbackground: SELECT_BACKGROUND -*Canvas.selectforeground: SELECT_FOREGROUND diff --git a/gnome-settings-daemon/xrdb/Xaw.ad b/gnome-settings-daemon/xrdb/Xaw.ad deleted file mode 100644 index c88213841..000000000 --- a/gnome-settings-daemon/xrdb/Xaw.ad +++ /dev/null @@ -1,41 +0,0 @@ -*beNiceToColormap: false -*borderColor: black - -*MenuButton.background: BACKGROUND -*Command.background: BACKGROUND -*Toggle.background: BACKGROUND -*Label.background: BACKGROUND -*Scrollbar*background: BACKGROUND -*SimpleMenu*background: BACKGROUND -*Box.background: BACKGROUND -*Form.background: BACKGROUND -*Dialog.background: BACKGROUND -*Text.background: WINDOW_BACKGROUND -*List.background: WINDOW_BACKGROUND - -*MenuButton.foreground: FOREGROUND -*Command.foreground: FOREGROUND -*Toggle.foreground: FOREGROUND -*Label.foreground: FOREGROUND -*Scrollbar.foreground: FOREGROUND -*SimpleMenu*foreground: FOREGROUND -*Box.foreground: FOREGROUND -*Form.foreground: FOREGROUND -*Dialog.foreground: FOREGROUND -*Text.foreground: WINDOW_FOREGROUND -*List.foreground: WINDOW_FOREGROUND - -*ScrollbarBackground: BACKGROUND -*Scrollbar*width: 15 -*Scrollbar*height: 15 -*Scrollbar*shadowWidth: 2 -*Scrollbar*cursorName: left_ptr -*Scrollbar*pushThumb: false -*ShapeStyle: Rectangle -*SmeBSB*shadowWidth: 3 -*Scrollbar*Cursor: left_ptr -*Command.translations: \ - <LeaveWindow>: reset()\n\ - <Btn1Down>: set()\n\ - <Btn1Up>: notify() unset() - diff --git a/gnome-settings-daemon/xsettings-common.c b/gnome-settings-daemon/xsettings-common.c deleted file mode 100644 index 992175a11..000000000 --- a/gnome-settings-daemon/xsettings-common.c +++ /dev/null @@ -1,264 +0,0 @@ -/* - * Copyright © 2001 Red Hat, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Red Hat not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. Red Hat makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Owen Taylor, Red Hat, Inc. - */ -#include "string.h" -#include "stdlib.h" - -#include <X11/Xlib.h> -#include <X11/Xmd.h> /* For CARD32 */ - -#include "xsettings-common.h" - -XSettingsSetting * -xsettings_setting_copy (XSettingsSetting *setting) -{ - XSettingsSetting *result; - size_t str_len; - - result = malloc (sizeof *result); - if (!result) - return NULL; - - str_len = strlen (setting->name); - result->name = malloc (str_len + 1); - if (!result->name) - goto err; - - memcpy (result->name, setting->name, str_len + 1); - - result->type = setting->type; - - switch (setting->type) - { - case XSETTINGS_TYPE_INT: - result->data.v_int = setting->data.v_int; - break; - case XSETTINGS_TYPE_COLOR: - result->data.v_color = setting->data.v_color; - break; - case XSETTINGS_TYPE_STRING: - str_len = strlen (setting->data.v_string); - result->data.v_string = malloc (str_len + 1); - if (!result->data.v_string) - goto err; - - memcpy (result->data.v_string, setting->data.v_string, str_len + 1); - break; - } - - result->last_change_serial = setting->last_change_serial; - - return result; - - err: - if (result->name) - free (result->name); - free (result); - - return NULL; -} - -XSettingsList * -xsettings_list_copy (XSettingsList *list) -{ - XSettingsList *new = NULL; - XSettingsList *old_iter = list; - XSettingsList *new_iter = NULL; - - while (old_iter) - { - XSettingsList *new_node; - - new_node = malloc (sizeof *new_node); - if (!new_node) - goto error; - - new_node->setting = xsettings_setting_copy (old_iter->setting); - if (!new_node->setting) - { - free (new_node); - goto error; - } - - if (new_iter) - new_iter->next = new_node; - else - new = new_node; - - new_iter = new_node; - - old_iter = old_iter->next; - } - - return new; - - error: - xsettings_list_free (new); - return NULL; -} - -int -xsettings_setting_equal (XSettingsSetting *setting_a, - XSettingsSetting *setting_b) -{ - if (setting_a->type != setting_b->type) - return 0; - - if (strcmp (setting_a->name, setting_b->name) != 0) - return 0; - - switch (setting_a->type) - { - case XSETTINGS_TYPE_INT: - return setting_a->data.v_int == setting_b->data.v_int; - case XSETTINGS_TYPE_COLOR: - return (setting_a->data.v_color.red == setting_b->data.v_color.red && - setting_a->data.v_color.green == setting_b->data.v_color.green && - setting_a->data.v_color.blue == setting_b->data.v_color.blue && - setting_a->data.v_color.alpha == setting_b->data.v_color.alpha); - case XSETTINGS_TYPE_STRING: - return strcmp (setting_a->data.v_string, setting_b->data.v_string) == 0; - } - - return 0; -} - -void -xsettings_setting_free (XSettingsSetting *setting) -{ - if (setting->type == XSETTINGS_TYPE_STRING) - free (setting->data.v_string); - - if (setting->name) - free (setting->name); - - free (setting); -} - -void -xsettings_list_free (XSettingsList *list) -{ - while (list) - { - XSettingsList *next = list->next; - - xsettings_setting_free (list->setting); - free (list); - - list = next; - } -} - -XSettingsResult -xsettings_list_insert (XSettingsList **list, - XSettingsSetting *setting) -{ - XSettingsList *node; - XSettingsList *iter; - XSettingsList *last = NULL; - - node = malloc (sizeof *node); - if (!node) - return XSETTINGS_NO_MEM; - node->setting = setting; - - iter = *list; - while (iter) - { - int cmp = strcmp (setting->name, iter->setting->name); - - if (cmp < 0) - break; - else if (cmp == 0) - { - free (node); - return XSETTINGS_DUPLICATE_ENTRY; - } - - last = iter; - iter = iter->next; - } - - if (last) - last->next = node; - else - *list = node; - - node->next = iter; - - return XSETTINGS_SUCCESS; -} - -XSettingsResult -xsettings_list_delete (XSettingsList **list, - const char *name) -{ - XSettingsList *iter; - XSettingsList *last = NULL; - - iter = *list; - while (iter) - { - if (strcmp (name, iter->setting->name) == 0) - { - if (last) - last->next = iter->next; - else - *list = iter->next; - - xsettings_setting_free (iter->setting); - free (iter); - - return XSETTINGS_SUCCESS; - } - - last = iter; - iter = iter->next; - } - - return XSETTINGS_FAILED; -} - -XSettingsSetting * -xsettings_list_lookup (XSettingsList *list, - const char *name) -{ - XSettingsList *iter; - - iter = list; - while (iter) - { - if (strcmp (name, iter->setting->name) == 0) - return iter->setting; - - iter = iter->next; - } - - return NULL; -} - -char -xsettings_byte_order (void) -{ - CARD32 myint = 0x01020304; - return (*(char *)&myint == 1) ? MSBFirst : LSBFirst; -} diff --git a/gnome-settings-daemon/xsettings-common.h b/gnome-settings-daemon/xsettings-common.h deleted file mode 100644 index e3af4a662..000000000 --- a/gnome-settings-daemon/xsettings-common.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright © 2001 Red Hat, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Red Hat not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. Red Hat makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Owen Taylor, Red Hat, Inc. - */ -#ifndef XSETTINGS_COMMON_H -#define XSETTINGS_COMMON_H - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -typedef struct _XSettingsBuffer XSettingsBuffer; -typedef struct _XSettingsColor XSettingsColor; -typedef struct _XSettingsList XSettingsList; -typedef struct _XSettingsSetting XSettingsSetting; - -/* Types of settings possible. Enum values correspond to - * protocol values. - */ -typedef enum -{ - XSETTINGS_TYPE_INT = 0, - XSETTINGS_TYPE_STRING = 1, - XSETTINGS_TYPE_COLOR = 2 -} XSettingsType; - -typedef enum -{ - XSETTINGS_SUCCESS, - XSETTINGS_NO_MEM, - XSETTINGS_ACCESS, - XSETTINGS_FAILED, - XSETTINGS_NO_ENTRY, - XSETTINGS_DUPLICATE_ENTRY -} XSettingsResult; - -struct _XSettingsBuffer -{ - char byte_order; - size_t len; - unsigned char *data; - unsigned char *pos; -}; - -struct _XSettingsColor -{ - unsigned short red, green, blue, alpha; -}; - -struct _XSettingsList -{ - XSettingsSetting *setting; - XSettingsList *next; -}; - -struct _XSettingsSetting -{ - char *name; - XSettingsType type; - - union { - int v_int; - char *v_string; - XSettingsColor v_color; - } data; - - unsigned long last_change_serial; -}; - -XSettingsSetting *xsettings_setting_copy (XSettingsSetting *setting); -void xsettings_setting_free (XSettingsSetting *setting); -int xsettings_setting_equal (XSettingsSetting *setting_a, - XSettingsSetting *setting_b); - -void xsettings_list_free (XSettingsList *list); -XSettingsList *xsettings_list_copy (XSettingsList *list); -XSettingsResult xsettings_list_insert (XSettingsList **list, - XSettingsSetting *setting); -XSettingsSetting *xsettings_list_lookup (XSettingsList *list, - const char *name); -XSettingsResult xsettings_list_delete (XSettingsList **list, - const char *name); - -char xsettings_byte_order (void); - -#define XSETTINGS_PAD(n,m) ((n + m - 1) & (~(m-1))) - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* XSETTINGS_COMMON_H */ diff --git a/gnome-settings-daemon/xsettings-manager.c b/gnome-settings-daemon/xsettings-manager.c deleted file mode 100644 index 98c800c0d..000000000 --- a/gnome-settings-daemon/xsettings-manager.c +++ /dev/null @@ -1,424 +0,0 @@ -/* - * Copyright © 2001 Red Hat, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Red Hat not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. Red Hat makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Owen Taylor, Red Hat, Inc. - */ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include <X11/Xmd.h> /* For CARD16 */ - -#include "xsettings-manager.h" - -struct _XSettingsManager -{ - Display *display; - int screen; - - Window window; - Atom manager_atom; - Atom selection_atom; - Atom xsettings_atom; - - XSettingsTerminateFunc terminate; - void *cb_data; - - XSettingsList *settings; - unsigned long serial; -}; - -XSettingsList *settings; - -typedef struct -{ - Window window; - Atom timestamp_prop_atom; -} TimeStampInfo; - -static Bool -timestamp_predicate (Display *display, - XEvent *xevent, - XPointer arg) -{ - TimeStampInfo *info = (TimeStampInfo *)arg; - - if (xevent->type == PropertyNotify && - xevent->xproperty.window == info->window && - xevent->xproperty.atom == info->timestamp_prop_atom) - return True; - - return False; -} - -/** - * get_server_time: - * @display: display from which to get the time - * @window: a #Window, used for communication with the server. - * The window must have PropertyChangeMask in its - * events mask or a hang will result. - * - * Routine to get the current X server time stamp. - * - * Return value: the time stamp. - **/ -static Time -get_server_time (Display *display, - Window window) -{ - unsigned char c = 'a'; - XEvent xevent; - TimeStampInfo info; - - info.timestamp_prop_atom = XInternAtom (display, "_TIMESTAMP_PROP", False); - info.window = window; - - XChangeProperty (display, window, - info.timestamp_prop_atom, info.timestamp_prop_atom, - 8, PropModeReplace, &c, 1); - - XIfEvent (display, &xevent, - timestamp_predicate, (XPointer)&info); - - return xevent.xproperty.time; -} - -Bool -xsettings_manager_check_running (Display *display, - int screen) -{ - char buffer[256]; - Atom selection_atom; - - sprintf(buffer, "_XSETTINGS_S%d", screen); - selection_atom = XInternAtom (display, buffer, False); - - if (XGetSelectionOwner (display, selection_atom)) - return True; - else - return False; -} - -XSettingsManager * -xsettings_manager_new (Display *display, - int screen, - XSettingsTerminateFunc terminate, - void *cb_data) -{ - XSettingsManager *manager; - Time timestamp; - XClientMessageEvent xev; - - char buffer[256]; - - manager = malloc (sizeof *manager); - if (!manager) - return NULL; - - manager->display = display; - manager->screen = screen; - - sprintf(buffer, "_XSETTINGS_S%d", screen); - manager->selection_atom = XInternAtom (display, buffer, False); - manager->xsettings_atom = XInternAtom (display, "_XSETTINGS_SETTINGS", False); - manager->manager_atom = XInternAtom (display, "MANAGER", False); - - manager->terminate = terminate; - manager->cb_data = cb_data; - - manager->settings = NULL; - manager->serial = 0; - - manager->window = XCreateSimpleWindow (display, - RootWindow (display, screen), - 0, 0, 10, 10, 0, - WhitePixel (display, screen), - WhitePixel (display, screen)); - - XSelectInput (display, manager->window, PropertyChangeMask); - timestamp = get_server_time (display, manager->window); - - XSetSelectionOwner (display, manager->selection_atom, - manager->window, timestamp); - - /* Check to see if we managed to claim the selection. If not, - * we treat it as if we got it then immediately lost it - */ - - if (XGetSelectionOwner (display, manager->selection_atom) == - manager->window) - { - xev.type = ClientMessage; - xev.window = RootWindow (display, screen); - xev.message_type = manager->manager_atom; - xev.format = 32; - xev.data.l[0] = timestamp; - xev.data.l[1] = manager->selection_atom; - xev.data.l[2] = manager->window; - xev.data.l[3] = 0; /* manager specific data */ - xev.data.l[4] = 0; /* manager specific data */ - - XSendEvent (display, RootWindow (display, screen), - False, StructureNotifyMask, (XEvent *)&xev); - } - else - { - manager->terminate (manager->cb_data); - } - - return manager; -} - -void -xsettings_manager_destroy (XSettingsManager *manager) -{ - XDestroyWindow (manager->display, manager->window); - - xsettings_list_free (manager->settings); - free (manager); -} - -Window -xsettings_manager_get_window (XSettingsManager *manager) -{ - return manager->window; -} - -Bool -xsettings_manager_process_event (XSettingsManager *manager, - XEvent *xev) -{ - if (xev->xany.window == manager->window && - xev->xany.type == SelectionClear && - xev->xselectionclear.selection == manager->selection_atom) - { - manager->terminate (manager->cb_data); - return True; - } - - return False; -} - -XSettingsResult -xsettings_manager_delete_setting (XSettingsManager *manager, - const char *name) -{ - return xsettings_list_delete (&settings, name); -} - -XSettingsResult -xsettings_manager_set_setting (XSettingsManager *manager, - XSettingsSetting *setting) -{ - XSettingsSetting *old_setting = xsettings_list_lookup (settings, setting->name); - XSettingsSetting *new_setting; - XSettingsResult result; - - if (old_setting) - { - if (xsettings_setting_equal (old_setting, setting)) - return XSETTINGS_SUCCESS; - - xsettings_list_delete (&settings, setting->name); - } - - new_setting = xsettings_setting_copy (setting); - if (!new_setting) - return XSETTINGS_NO_MEM; - - new_setting->last_change_serial = manager->serial; - - result = xsettings_list_insert (&settings, new_setting); - - if (result != XSETTINGS_SUCCESS) - xsettings_setting_free (new_setting); - - return result; -} - -XSettingsResult -xsettings_manager_set_int (XSettingsManager *manager, - const char *name, - int value) -{ - XSettingsSetting setting; - - setting.name = (char *)name; - setting.type = XSETTINGS_TYPE_INT; - setting.data.v_int = value; - - return xsettings_manager_set_setting (manager, &setting); -} - -XSettingsResult -xsettings_manager_set_string (XSettingsManager *manager, - const char *name, - const char *value) -{ - XSettingsSetting setting; - - setting.name = (char *)name; - setting.type = XSETTINGS_TYPE_STRING; - setting.data.v_string = (char *)value; - - return xsettings_manager_set_setting (manager, &setting); -} - -XSettingsResult -xsettings_manager_set_color (XSettingsManager *manager, - const char *name, - XSettingsColor *value) -{ - XSettingsSetting setting; - - setting.name = (char *)name; - setting.type = XSETTINGS_TYPE_COLOR; - setting.data.v_color = *value; - - return xsettings_manager_set_setting (manager, &setting); -} - -size_t -setting_length (XSettingsSetting *setting) -{ - size_t length = 8; /* type + pad + name-len + last-change-serial */ - length += XSETTINGS_PAD (strlen (setting->name), 4); - - switch (setting->type) - { - case XSETTINGS_TYPE_INT: - length += 4; - break; - case XSETTINGS_TYPE_STRING: - length += 4 + XSETTINGS_PAD (strlen (setting->data.v_string), 4); - break; - case XSETTINGS_TYPE_COLOR: - length += 8; - break; - } - - return length; -} - -void -setting_store (XSettingsSetting *setting, - XSettingsBuffer *buffer) -{ - size_t string_len; - size_t length; - - *(buffer->pos++) = setting->type; - *(buffer->pos++) = 0; - - string_len = strlen (setting->name); - *(CARD16 *)(buffer->pos) = string_len; - buffer->pos += 2; - - length = XSETTINGS_PAD (string_len, 4); - memcpy (buffer->pos, setting->name, string_len); - length -= string_len; - buffer->pos += string_len; - - while (length > 0) - { - *(buffer->pos++) = 0; - length--; - } - - *(CARD32 *)(buffer->pos) = setting->last_change_serial; - buffer->pos += 4; - - switch (setting->type) - { - case XSETTINGS_TYPE_INT: - *(CARD32 *)(buffer->pos) = setting->data.v_int; - buffer->pos += 4; - break; - case XSETTINGS_TYPE_STRING: - string_len = strlen (setting->data.v_string); - *(CARD32 *)(buffer->pos) = string_len; - buffer->pos += 4; - - length = XSETTINGS_PAD (string_len, 4); - memcpy (buffer->pos, setting->data.v_string, string_len); - length -= string_len; - buffer->pos += string_len; - - while (length > 0) - { - *(buffer->pos++) = 0; - length--; - } - break; - case XSETTINGS_TYPE_COLOR: - *(CARD16 *)(buffer->pos) = setting->data.v_color.red; - *(CARD16 *)(buffer->pos + 2) = setting->data.v_color.green; - *(CARD16 *)(buffer->pos + 4) = setting->data.v_color.blue; - *(CARD16 *)(buffer->pos + 6) = setting->data.v_color.alpha; - buffer->pos += 8; - break; - } -} - -XSettingsResult -xsettings_manager_notify (XSettingsManager *manager) -{ - XSettingsBuffer buffer; - XSettingsList *iter; - int n_settings = 0; - - buffer.len = 12; /* byte-order + pad + SERIAL + N_SETTINGS */ - - iter = settings; - while (iter) - { - buffer.len += setting_length (iter->setting); - n_settings++; - iter = iter->next; - } - - buffer.data = buffer.pos = malloc (buffer.len); - if (!buffer.data) - return XSETTINGS_NO_MEM; - - *buffer.pos = xsettings_byte_order (); - - buffer.pos += 4; - *(CARD32 *)buffer.pos = manager->serial++; - buffer.pos += 4; - *(CARD32 *)buffer.pos = n_settings; - buffer.pos += 4; - - iter = settings; - while (iter) - { - setting_store (iter->setting, &buffer); - iter = iter->next; - } - - XChangeProperty (manager->display, manager->window, - manager->xsettings_atom, manager->xsettings_atom, - 8, PropModeReplace, buffer.data, buffer.len); - - free (buffer.data); - - return XSETTINGS_SUCCESS; -} - diff --git a/gnome-settings-daemon/xsettings-manager.h b/gnome-settings-daemon/xsettings-manager.h deleted file mode 100644 index f309768b1..000000000 --- a/gnome-settings-daemon/xsettings-manager.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright © 2001 Red Hat, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Red Hat not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. Red Hat makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Owen Taylor, Red Hat, Inc. - */ -#ifndef XSETTINGS_MANAGER_H -#define XSETTINGS_MANAGER_H - -#include <X11/Xlib.h> -#include "xsettings-common.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -typedef struct _XSettingsManager XSettingsManager; - -typedef void (*XSettingsTerminateFunc) (void *cb_data); - -Bool xsettings_manager_check_running (Display *display, - int screen); - -XSettingsManager *xsettings_manager_new (Display *display, - int screen, - XSettingsTerminateFunc terminate, - void *cb_data); - -void xsettings_manager_destroy (XSettingsManager *manager); -Window xsettings_manager_get_window (XSettingsManager *manager); -Bool xsettings_manager_process_event (XSettingsManager *manager, - XEvent *xev); - -XSettingsResult xsettings_manager_delete_setting (XSettingsManager *manager, - const char *name); -XSettingsResult xsettings_manager_set_setting (XSettingsManager *manager, - XSettingsSetting *setting); -XSettingsResult xsettings_manager_set_int (XSettingsManager *manager, - const char *name, - int value); -XSettingsResult xsettings_manager_set_string (XSettingsManager *manager, - const char *name, - const char *value); -XSettingsResult xsettings_manager_set_color (XSettingsManager *manager, - const char *name, - XSettingsColor *value); -XSettingsResult xsettings_manager_notify (XSettingsManager *manager); - - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* XSETTINGS_MANAGER_H */ diff --git a/gnome-settings-daemon/xutils.c b/gnome-settings-daemon/xutils.c deleted file mode 100644 index 4e48b98f0..000000000 --- a/gnome-settings-daemon/xutils.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright © 2004 Red Hat, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Red Hat not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. Red Hat makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Matthias Clasen, Red Hat, Inc. - */ - -#include <stdlib.h> - -#include "xutils.h" - -Atom XA_ATOM_PAIR; -Atom XA_CLIPBOARD_MANAGER; -Atom XA_CLIPBOARD; -Atom XA_DELETE; -Atom XA_INCR; -Atom XA_INSERT_PROPERTY; -Atom XA_INSERT_SELECTION; -Atom XA_MANAGER; -Atom XA_MULTIPLE; -Atom XA_NULL; -Atom XA_SAVE_TARGETS; -Atom XA_TARGETS; -Atom XA_TIMESTAMP; - -unsigned long SELECTION_MAX_SIZE = 0; - - -void -init_atoms (Display *display) -{ - unsigned long max_request_size; - - if (SELECTION_MAX_SIZE > 0) - return; - - XA_ATOM_PAIR = XInternAtom (display, "ATOM_PAIR", False); - XA_CLIPBOARD_MANAGER = XInternAtom (display, "CLIPBOARD_MANAGER", False); - XA_CLIPBOARD = XInternAtom (display, "CLIPBOARD", False); - XA_DELETE = XInternAtom (display, "DELETE", False); - XA_INCR = XInternAtom (display, "INCR", False); - XA_INSERT_PROPERTY = XInternAtom (display, "INSERT_PROPERTY", False); - XA_INSERT_SELECTION = XInternAtom (display, "INSERT_SELECTION", False); - XA_MANAGER = XInternAtom (display, "MANAGER", False); - XA_MULTIPLE = XInternAtom (display, "MULTIPLE", False); - XA_NULL = XInternAtom (display, "NULL", False); - XA_SAVE_TARGETS = XInternAtom (display, "SAVE_TARGETS", False); - XA_TARGETS = XInternAtom (display, "TARGETS", False); - XA_TIMESTAMP = XInternAtom (display, "TIMESTAMP", False); - - max_request_size = XExtendedMaxRequestSize (display); - if (max_request_size == 0) - max_request_size = XMaxRequestSize (display); - - SELECTION_MAX_SIZE = max_request_size - 100; - if (SELECTION_MAX_SIZE > 262144) - SELECTION_MAX_SIZE = 262144; -} - -typedef struct -{ - Window window; - Atom timestamp_prop_atom; -} TimeStampInfo; - -static Bool -timestamp_predicate (Display *display, - XEvent *xevent, - XPointer arg) -{ - TimeStampInfo *info = (TimeStampInfo *)arg; - - if (xevent->type == PropertyNotify && - xevent->xproperty.window == info->window && - xevent->xproperty.atom == info->timestamp_prop_atom) - return True; - - return False; -} - -Time -get_server_time (Display *display, - Window window) -{ - unsigned char c = 'a'; - XEvent xevent; - TimeStampInfo info; - - info.timestamp_prop_atom = XInternAtom (display, "_TIMESTAMP_PROP", False); - info.window = window; - - XChangeProperty (display, window, - info.timestamp_prop_atom, info.timestamp_prop_atom, - 8, PropModeReplace, &c, 1); - - XIfEvent (display, &xevent, - timestamp_predicate, (XPointer)&info); - - return xevent.xproperty.time; -} - diff --git a/gnome-settings-daemon/xutils.h b/gnome-settings-daemon/xutils.h deleted file mode 100644 index 143fe443a..000000000 --- a/gnome-settings-daemon/xutils.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright © 2004 Red Hat, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Red Hat not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. Red Hat makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Matthias Clasen, Red Hat, Inc. - */ -#ifndef X_UTILS_H -#define X_UTILS_H - -#include <X11/Xlib.h> - - -extern Atom XA_ATOM_PAIR; -extern Atom XA_CLIPBOARD_MANAGER; -extern Atom XA_CLIPBOARD; -extern Atom XA_DELETE; -extern Atom XA_INCR; -extern Atom XA_INSERT_PROPERTY; -extern Atom XA_INSERT_SELECTION; -extern Atom XA_MANAGER; -extern Atom XA_MULTIPLE; -extern Atom XA_NULL; -extern Atom XA_SAVE_TARGETS; -extern Atom XA_TARGETS; -extern Atom XA_TIMESTAMP; - -extern unsigned long SELECTION_MAX_SIZE; - -void init_atoms (Display *display); - -Time get_server_time (Display *display, - Window window); - -#endif /* X_UTILS_H */ |