remove checks for fb-level support Remove the brightness keybindings

2006-04-27  Bastien Nocera  <hadess@hadess.net>

	* configure.in: remove checks for fb-level support
	* schemas/apps_gnome_settings_daemon_keybindings.schemas.in:
	Remove the brightness keybindings (Closes: #339857)

2006-04-27  Bastien Nocera  <hadess@hadess.net>

	* gnome-keybinding-properties.c: remove brightness keybindings, as
	they duplicate with gnome-power-manager's (greater) functionality
	(Closes: #339857)

2006-04-27  Bastien Nocera  <hadess@hadess.net>

	* actions/Makefile.am:
	* actions/acme-brightness.png:
	* actions/acme-fb-level.c:
	* actions/acme-fb-level.h:
	* actions/acme.h:
	* gnome-settings-multimedia-keys.c: (do_action),
	(acme_filter_events), (gnome_settings_multimedia_keys_load):
	Remove references to the brightness controls, we have moved the
	functionality (and enhanced it!) to gnome-power-manager
	(Closes: #339857)
This commit is contained in:
Bastien Nocera 2006-04-27 09:50:43 +00:00 committed by Bastien Nocera
parent a2609c1513
commit 8bf679ab31
12 changed files with 26 additions and 404 deletions

View file

@ -1,3 +1,9 @@
2006-04-27 Bastien Nocera <hadess@hadess.net>
* configure.in: remove checks for fb-level support
* schemas/apps_gnome_settings_daemon_keybindings.schemas.in:
Remove the brightness keybindings (Closes: #339857)
2006-04-20 Sergey Udaltsov <svu@gnome.org> 2006-04-20 Sergey Udaltsov <svu@gnome.org>
* configure.in: * configure.in:

View file

@ -1,3 +1,9 @@
2006-04-27 Bastien Nocera <hadess@hadess.net>
* gnome-keybinding-properties.c: remove brightness keybindings, as
they duplicate with gnome-power-manager's (greater) functionality
(Closes: #339857)
2006-01-30 Rodrigo Moya <rodrigo@novell.com> 2006-01-30 Rodrigo Moya <rodrigo@novell.com>
* actions/acme.h: * actions/acme.h:

View file

@ -20,12 +20,6 @@
#define LABEL_DATA "gnome-keybinding-properties-label" #define LABEL_DATA "gnome-keybinding-properties-label"
#define MAX_ELEMENTS_BEFORE_SCROLLING 10 #define MAX_ELEMENTS_BEFORE_SCROLLING 10
#if defined(__powerpc__) && defined (__linux__)
#define USE_FBLEVEL
#else
#undef USE_FBLEVEL
#endif
typedef enum { typedef enum {
ALWAYS_VISIBLE, ALWAYS_VISIBLE,
N_WORKSPACES_GT N_WORKSPACES_GT
@ -53,10 +47,6 @@ static const KeyListEntry desktop_key_list[] =
{ "/apps/metacity/global_keybindings/run_command_screenshot", ALWAYS_VISIBLE, 0 }, { "/apps/metacity/global_keybindings/run_command_screenshot", ALWAYS_VISIBLE, 0 },
{ "/apps/metacity/global_keybindings/run_command_window_screenshot", ALWAYS_VISIBLE, 0 }, { "/apps/metacity/global_keybindings/run_command_window_screenshot", ALWAYS_VISIBLE, 0 },
{ "/apps/metacity/global_keybindings/run_command_terminal", ALWAYS_VISIBLE, 0 }, { "/apps/metacity/global_keybindings/run_command_terminal", ALWAYS_VISIBLE, 0 },
#ifdef USE_FBLEVEL
{ "/apps/gnome_settings_daemon/keybindings/brightness_down", ALWAYS_VISIBLE, 0 },
{ "/apps/gnome_settings_daemon/keybindings/brightness_up", ALWAYS_VISIBLE, 0 },
#endif
{ NULL } { NULL }
}; };
static const KeyListEntry sounds_key_list[] = static const KeyListEntry sounds_key_list[] =

View file

@ -513,22 +513,6 @@ AM_CONDITIONAL(HAVE_GST10, test x"$GST_MAJORMINOR" = "x0.10")
AC_SUBST(GST_LIBS) AC_SUBST(GST_LIBS)
AC_SUBST(GST_CFLAGS) AC_SUBST(GST_CFLAGS)
dnl ==============================================
dnl FB Level section
dnl ==============================================
have_fb=no
AC_TRY_COMPILE([
#include <linux/fb.h>
#include <linux/pmu.h>
],[
int arg = 0;
],[
have_fb=yes
])
AC_MSG_CHECKING(for Brightness control support)
AC_MSG_RESULT($have_fb)
AM_CONDITIONAL(HAVE_FB, test x"$have_fb" = "xyes")
dnl ============================================== dnl ==============================================
dnl Define the main variables dnl Define the main variables
dnl ============================================== dnl ==============================================

View file

@ -1,3 +1,16 @@
2006-04-27 Bastien Nocera <hadess@hadess.net>
* actions/Makefile.am:
* actions/acme-brightness.png:
* actions/acme-fb-level.c:
* actions/acme-fb-level.h:
* actions/acme.h:
* gnome-settings-multimedia-keys.c: (do_action),
(acme_filter_events), (gnome_settings_multimedia_keys_load):
Remove references to the brightness controls, we have moved the
functionality (and enhanced it!) to gnome-power-manager
(Closes: #339857)
2006-04-20 Sergey Udaltsov <svu@gnome.org> 2006-04-20 Sergey Udaltsov <svu@gnome.org>
* gnome-settings-keyboard-xkb.c: fixed the libxklavier engine * gnome-settings-keyboard-xkb.c: fixed the libxklavier engine

View file

@ -28,22 +28,16 @@ endif # HAVE_OSS
endif # HAVE_ALSA endif # HAVE_ALSA
endif # HAVE_GSTREAMER endif # HAVE_GSTREAMER
if HAVE_FB
INCLUDES += -DHAVE_FB
libacme_la_SOURCES += acme-fb-level.c acme-fb-level.h
endif
Datadir = $(datadir)/control-center-2.0/interfaces/ Datadir = $(datadir)/control-center-2.0/interfaces/
Data_DATA = acme.glade Data_DATA = acme.glade
pixmapsdir = $(GNOMECC_PIXMAPS_DIR) pixmapsdir = $(GNOMECC_PIXMAPS_DIR)
pixmaps_DATA = acme-brightness.png acme-eject.png gnome-speakernotes-muted.png gnome-speakernotes.png pixmaps_DATA = acme-eject.png gnome-speakernotes-muted.png gnome-speakernotes.png
EXTRA_DIST = \ EXTRA_DIST = \
acme-volume-alsa.c acme-volume-alsa.h \ acme-volume-alsa.c acme-volume-alsa.h \
acme-volume-gstreamer.c acme-volume-gstreamer.h \ acme-volume-gstreamer.c acme-volume-gstreamer.h \
acme-volume-oss.c acme-volume-oss.h \ acme-volume-oss.c acme-volume-oss.h \
acme-fb-level.c acme-fb-level.h \
acme.h \ acme.h \
acme.glade \ acme.glade \
$(pixmaps_DATA) $(pixmaps_DATA)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

View file

@ -1,201 +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>
#include <libgnome/gnome-i18n.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;
}
GQuark
acme_fblevel_error_quark (void)
{
static GQuark quark = 0;
if (quark == 0)
quark = g_quark_from_string ("acme-fblevel-quark");
return quark;
}
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 (GError **error)
{
AcmeFblevel *self;
int fd, foo;
if (g_file_test ("/dev/pmu", G_FILE_TEST_EXISTS) == FALSE) {
*error = g_error_new_literal (ACME_FBLEVEL_ERROR,
ACME_FBLEVEL_ERROR_NO_PMU_DEVICE,
_("No '/dev/pmu' device found"));
return NULL;
}
if (acme_fblevel_is_powerbook () == FALSE) {
*error = g_error_new_literal (ACME_FBLEVEL_ERROR,
ACME_FBLEVEL_ERROR_NO_POWERBOOK,
_("Not a powerbook"));
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) {
*error = g_error_new_literal (ACME_FBLEVEL_ERROR,
ACME_FBLEVEL_ERROR_WRONG_PERMS,
_("Wrong permission for '/dev/pmu' device"));
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;
}

View file

@ -1,65 +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))
#define ACME_FBLEVEL_ERROR (acme_fblevel_error_quark ())
typedef struct AcmeFblevelPrivate AcmeFblevelPrivate;
typedef struct AcmeFblevel AcmeFblevel;
typedef struct AcmeFblevelClass AcmeFblevelClass;
typedef enum AcmeFblevelError AcmeFblevelError;
struct AcmeFblevel {
GObject parent;
int level;
gboolean dim;
AcmeFblevelPrivate *_priv;
};
struct AcmeFblevelClass {
GObjectClass parent;
};
enum AcmeFblevelError {
ACME_FBLEVEL_ERROR_NO_PMU_DEVICE,
ACME_FBLEVEL_ERROR_NO_POWERBOOK,
ACME_FBLEVEL_ERROR_WRONG_PERMS
};
GType acme_fblevel_get_type (void);
GQuark acme_fblevel_error_quark (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 (GError **error);
gboolean acme_fblevel_is_powerbook (void);

View file

@ -38,10 +38,6 @@ enum {
SCREENSAVER_KEY, SCREENSAVER_KEY,
HELP_KEY, HELP_KEY,
WWW_KEY, WWW_KEY,
#ifdef USE_FBLEVEL
BRIGHT_DOWN_KEY,
BRIGHT_UP_KEY,
#endif
PLAY_KEY, PLAY_KEY,
PAUSE_KEY, PAUSE_KEY,
STOP_KEY, STOP_KEY,
@ -73,10 +69,6 @@ static struct {
{ SCREENSAVER_KEY, GCONF_BINDING_DIR "/screensaver", NULL }, { SCREENSAVER_KEY, GCONF_BINDING_DIR "/screensaver", NULL },
{ HELP_KEY, GCONF_BINDING_DIR "/help", NULL }, { HELP_KEY, GCONF_BINDING_DIR "/help", NULL },
{ WWW_KEY, GCONF_BINDING_DIR "/www", 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 }, { PLAY_KEY, GCONF_BINDING_DIR "/play", NULL },
{ PAUSE_KEY, GCONF_BINDING_DIR "/pause", NULL }, { PAUSE_KEY, GCONF_BINDING_DIR "/pause", NULL },
{ STOP_KEY, GCONF_BINDING_DIR "/stop", NULL }, { STOP_KEY, GCONF_BINDING_DIR "/stop", NULL },

View file

@ -35,13 +35,6 @@
#include "eggaccelerators.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.h"
#include "actions/acme-volume.h" #include "actions/acme-volume.h"
@ -59,9 +52,6 @@
typedef struct { typedef struct {
AcmeVolume *volobj; AcmeVolume *volobj;
#ifdef USE_FBLEVEL
AcmeFblevel *levobj;
#endif
GladeXML *xml; GladeXML *xml;
GtkWidget *dialog; GtkWidget *dialog;
GConfClient *conf_client; GConfClient *conf_client;
@ -75,7 +65,6 @@ typedef struct {
enum { enum {
ICON_MUTED, ICON_MUTED,
ICON_LOUD, ICON_LOUD,
ICON_BRIGHT,
ICON_EJECT, ICON_EJECT,
}; };
@ -151,7 +140,6 @@ do_sleep_action (char *cmd1, char *cmd2)
static char *images[] = { static char *images[] = {
PIXMAPSDIR "/gnome-speakernotes-muted.png", PIXMAPSDIR "/gnome-speakernotes-muted.png",
PIXMAPSDIR "/gnome-speakernotes.png", PIXMAPSDIR "/gnome-speakernotes.png",
PIXMAPSDIR "/acme-brightness.png",
PIXMAPSDIR "/acme-eject.png", PIXMAPSDIR "/acme-eject.png",
}; };
@ -674,46 +662,6 @@ do_eject_action (Acme *acme)
gtk_widget_set_sensitive (progress, 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 static void
do_sound_action (Acme *acme, int type) do_sound_action (Acme *acme, int type)
{ {
@ -818,12 +766,6 @@ do_action (Acme *acme, int type)
case WWW_KEY: case WWW_KEY:
do_www_action (acme, NULL); do_www_action (acme, NULL);
break; break;
#ifdef USE_FBLEVEL
case BRIGHT_DOWN_KEY:
case BRIGHT_UP_KEY:
do_brightness_action (acme, type);
break;
#endif
default: default:
g_assert_not_reached (); g_assert_not_reached ();
} }
@ -874,10 +816,6 @@ acme_filter_events (GdkXEvent *xevent, GdkEvent *event, gpointer data)
switch (keys[i].key_type) { switch (keys[i].key_type) {
case VOLUME_DOWN_KEY: case VOLUME_DOWN_KEY:
case VOLUME_UP_KEY: case VOLUME_UP_KEY:
#ifdef USE_FBLEVEL
case BRIGHT_DOWN_KEY:
case BRIGHT_UP_KEY:
#endif
/* auto-repeatable keys */ /* auto-repeatable keys */
if (xev->type != KeyPress) if (xev->type != KeyPress)
return GDK_FILTER_CONTINUE; return GDK_FILTER_CONTINUE;
@ -925,17 +863,6 @@ gnome_settings_multimedia_keys_load (GConfClient *client)
/* initialise Volume handler */ /* initialise Volume handler */
acme->volobj = acme_volume_new(); acme->volobj = acme_volume_new();
#ifdef USE_FBLEVEL
/* initialise Frame Buffer level handler */
acme->levobj = acme_fblevel_new (&err);
if (acme->levobj == NULL && err != NULL) {
if (!g_error_matches (err, ACME_FBLEVEL_ERROR,
ACME_FBLEVEL_ERROR_NO_POWERBOOK))
acme_error (err->message);
g_error_free (err);
}
#endif
/* Start filtering the events */ /* Start filtering the events */
for (l = acme->screens; l != NULL; l = l->next) for (l = acme->screens; l != NULL; l = l->next)
gdk_window_add_filter (gdk_screen_get_root_window (l->data), gdk_window_add_filter (gdk_screen_get_root_window (l->data),

View file

@ -157,30 +157,6 @@
</schema> </schema>
<schema>
<key>/schemas/apps/gnome_settings_daemon/keybindings/brightness_down</key>
<applyto>/apps/gnome_settings_daemon/keybindings/brightness_down</applyto>
<type>string</type>
<default></default>
<locale name="C">
<short>Brightness down</short>
<long>Brightness down's shortcut.</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/gnome_settings_daemon/keybindings/brightness_up</key>
<applyto>/apps/gnome_settings_daemon/keybindings/brightness_up</applyto>
<type>string</type>
<default></default>
<locale name="C">
<short>Brightness up</short>
<long>Brightness up's shortcut.</long>
</locale>
</schema>
<schema> <schema>
<key>/schemas/apps/gnome_settings_daemon/keybindings/play</key> <key>/schemas/apps/gnome_settings_daemon/keybindings/play</key>
<applyto>/apps/gnome_settings_daemon/keybindings/play</applyto> <applyto>/apps/gnome_settings_daemon/keybindings/play</applyto>