/*
Copyright (C) 2004 Free Software Foundation, Inc.
Author: Banlu Kemiyatorn
This file is part of GNUstep.
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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef XGXI_h
#define XGXI_h
#include
#include
#include
#include "config.h"
#include "x11/XGServerWindow.h"
#define GS_XINPUT_DEVICE_MAX_CLASSES 13
typedef struct _gs_input_device_state_t
{
Time lastClick;
NSPoint lastClickPoint;
Window lastClickWindow;
Time clickTime;
float clickSlip;
} gs_input_device_state_t;
@class XGServer;
@interface GSInputDevice : NSObject
{
@public
int num_buttons;
gs_input_device_state_t *buttonStates;
/* generic time */
Time lastButtonTime;
Time lastMotionTime;
NSPoint lastLocation;
int clickCount;
@private
BOOL _isEnable;
XGServer *__server;
unsigned int (*getState)(id, SEL, unsigned int);
Window lastWindow;
gswindow_device_t *gswindow;
BOOL _handleProx;
NSSize screenSize;
NSRect area;
NSRect tiltArea;
NSRange pressure;
float lastPressure;
float resV,resH;
NSString *_name;
int use;
XID deviceID;
XDeviceInfo *dinfo;
XDevice *xdevice;
XEventClass eventList[GS_XINPUT_DEVICE_MAX_CLASSES];
int nevent;
}
- (id) initWithDeviceInfo:(void *)info
displayServer:(GSDisplayServer *)server
proximity:(BOOL)willHandleProximity;
- (NSString *) description;
- (int) deviceID;
- (NSString *) name;
- (BOOL) isExtensionDevice;
- (BOOL) isPointer;
- (BOOL) isKeyboard;
- (BOOL) hasButton;
- (int) numberOfButtons;
- (BOOL) hasKey;
- (int) numberOfKeys;
- (int) minKeycode;
- (int) maxKeycode;
- (void) setHandleProximity:(BOOL)prox;
- (BOOL) willHandleProximity;
- (BOOL) hasAxis;
- (int) numberOfAxes;
- (BOOL) isRelative;
- (int) motionBuffer;
- (int) minValueForAxis:(int)axis;
- (int) maxValueForAxis:(int)axis;
- (int) resolutionForAxis:(int)axis;
- (BOOL) isEnable;
- (void) setEnable:(BOOL)enable;
- (void) setScreenSize:(NSSize)size;
- (NSSize) screenSize;
- (Time) lastClick;
- (Time) lastTime;
@end
@interface GSInputDevice (XInput)
- (void) selectXExtensionEventForWindow:(Window)win;
- (NSEvent*) mouseEventForXDeviceMotionEvent: (XDeviceMotionEvent *)motion
modifierFlags: (unsigned int)flags
windowDevice: (gswindow_device_t *)gswindow
context: (NSGraphicsContext*)context
clickCount: (int)clickNum
buttonNumber: (int)buttonNum;
@end
#endif