Compare commits
5 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9149946902 | ||
|
|
e1dee286d8 | ||
|
|
a84e346d1a | ||
|
|
f3a17b8920 | ||
|
|
a5155f06c9 |
2 changed files with 115 additions and 3 deletions
103
0001-XI2-support.patch
Normal file
103
0001-XI2-support.patch
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
diff -upNr numlockx-1.0.orign/main.c numlockx-1.0/main.c
|
||||
--- numlockx-1.0.orign/main.c 2001-04-30 22:55:20.000000000 +0200
|
||||
+++ numlockx-1.0/main.c 2010-10-22 10:56:33.686559525 +0200
|
||||
@@ -47,6 +47,8 @@ DEALINGS IN THE SOFTWARE.
|
||||
#include <X11/XKBlib.h>
|
||||
#endif
|
||||
|
||||
+#include <X11/extensions/XInput2.h>
|
||||
+
|
||||
#include <X11/keysym.h>
|
||||
|
||||
void usage( const char* argv0 )
|
||||
@@ -95,10 +97,10 @@ unsigned int xkb_mask_modifier( XkbDescP
|
||||
return 0;
|
||||
}
|
||||
|
||||
-unsigned int xkb_numlock_mask()
|
||||
+unsigned int xkb_numlock_mask( int deviceid )
|
||||
{
|
||||
XkbDescPtr xkb;
|
||||
- if(( xkb = XkbGetKeyboard( dpy, XkbAllComponentsMask, XkbUseCoreKbd )) != NULL )
|
||||
+ if(( xkb = XkbGetKeyboard( dpy, XkbAllComponentsMask, deviceid )) != NULL )
|
||||
{
|
||||
unsigned int mask = xkb_mask_modifier( xkb, "NumLock" );
|
||||
XkbFreeKeyboard( xkb, 0, True );
|
||||
@@ -107,29 +109,52 @@ unsigned int xkb_numlock_mask()
|
||||
return 0;
|
||||
}
|
||||
|
||||
-int xkb_set_on()
|
||||
+int xkb_set_on( int deviceid )
|
||||
{
|
||||
unsigned int mask;
|
||||
if( !xkb_init())
|
||||
return 0;
|
||||
- mask = xkb_numlock_mask();
|
||||
+ mask = xkb_numlock_mask ( deviceid );
|
||||
if( mask == 0 )
|
||||
return 0;
|
||||
- XkbLockModifiers ( dpy, XkbUseCoreKbd, mask, mask);
|
||||
+ XkbLockModifiers ( dpy, deviceid, mask, mask);
|
||||
return 1;
|
||||
}
|
||||
|
||||
-int xkb_set_off()
|
||||
+int xkb_set_off( int deviceid )
|
||||
{
|
||||
unsigned int mask;
|
||||
if( !xkb_init())
|
||||
return 0;
|
||||
- mask = xkb_numlock_mask();
|
||||
+ mask = xkb_numlock_mask ( deviceid );
|
||||
if( mask == 0 )
|
||||
return 0;
|
||||
- XkbLockModifiers ( dpy, XkbUseCoreKbd, mask, 0);
|
||||
+ XkbLockModifiers ( dpy, deviceid, mask, 0);
|
||||
return 1;
|
||||
}
|
||||
+
|
||||
+static int xkb_foreach_keyboard( int (*func)(int))
|
||||
+{
|
||||
+ XIDeviceInfo *info;
|
||||
+ int ndevices;
|
||||
+
|
||||
+ info = XIQueryDevice ( dpy, XIAllDevices, &ndevices );
|
||||
+
|
||||
+ while ( ndevices-- )
|
||||
+ {
|
||||
+ XIDeviceInfo *d = &info[ndevices];
|
||||
+ if ( d->use != XISlaveKeyboard )
|
||||
+ continue;
|
||||
+ if ( d->attachment != 3 ) /* virtual core keyboard */
|
||||
+ continue;
|
||||
+
|
||||
+ func( d->deviceid);
|
||||
+ }
|
||||
+
|
||||
+ XIFreeDeviceInfo ( info );
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_XTEST
|
||||
@@ -179,7 +204,7 @@ void xtest_set_off()
|
||||
void numlock_set_on()
|
||||
{
|
||||
#ifdef HAVE_XKB
|
||||
- if( xkb_set_on())
|
||||
+ if ( xkb_foreach_keyboard( xkb_set_on))
|
||||
return;
|
||||
#endif
|
||||
#ifdef HAVE_XTEST
|
||||
@@ -190,7 +215,7 @@ void numlock_set_on()
|
||||
void numlock_set_off()
|
||||
{
|
||||
#ifdef HAVE_XKB
|
||||
- if( xkb_set_off())
|
||||
+ if ( xkb_foreach_keyboard( xkb_set_off))
|
||||
return;
|
||||
#endif
|
||||
#ifdef HAVE_XTEST
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
Name: numlockx
|
||||
Version: 1.0
|
||||
Release: 16%{?dist}
|
||||
Release: 18%{?dist}
|
||||
Summary: NumLockX turns on NumLock after starting X
|
||||
|
||||
Group: Applications/System
|
||||
|
|
@ -10,18 +10,21 @@ Source0: http://ktown.kde.org/~seli/numlockx/numlockx-%{version}.tar.gz
|
|||
Source1: numlockx.sh
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
|
||||
BuildRequires: libX11-devel libXtst-devel libXext-devel libXt-devel imake
|
||||
BuildRequires: libX11-devel libXtst-devel libXext-devel libXt-devel libXi-devel imake sed
|
||||
Requires: xorg-x11-xinit
|
||||
|
||||
Patch1: 0001-XI2-support.patch
|
||||
|
||||
%description
|
||||
%{summary}
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
%patch1 -p1 -b .xi2
|
||||
|
||||
%build
|
||||
%configure
|
||||
%{__sed} -i 's/-lX11/-lX11 -lXi/' Makefile
|
||||
make %{?_smp_mflags}
|
||||
|
||||
|
||||
|
|
@ -41,6 +44,12 @@ rm -rf $RPM_BUILD_ROOT
|
|||
%doc AUTHORS README LICENSE
|
||||
|
||||
%changelog
|
||||
* Fri Oct 22 2010 Adel Gadllah <adel.gadllah@gmail.com> 1.0-18
|
||||
- Fix up XI2 patch to patch Makefile.am and not depend on the arch
|
||||
|
||||
* Fri Oct 22 2010 Peter Hutterer <peter.hutterer@redhat.com> 1.0-17
|
||||
- 0001-XI2-support.patch: add support for per-device numlock switching.
|
||||
|
||||
* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0-16
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue