| events.h | | events.h | |
|
| /* $Id: events.h,v 1.2 2003/04/13 02:23:12 ggibecka Exp $ | | /* $Id: events.h,v 1.5 2005/07/31 15:31:11 soyt Exp $ | |
| ***************************************************************************
*** | | ***************************************************************************
*** | |
| | | | |
| LibGII event definitions | | LibGII event definitions | |
| | | | |
| Copyright (C) 1995-1997 Steffen Seeger [seeger@ggi-project.org] | | Copyright (C) 1995-1997 Steffen Seeger [seeger@ggi-project.org] | |
| Copyright (C) 1998 Andrew Apted [andrew@ggi-project.org] | | Copyright (C) 1998 Andrew Apted [andrew@ggi-project.org] | |
| Copyright (C) 1998 Andreas Beck [becka@ggi-project.org] | | Copyright (C) 1998 Andreas Beck [becka@ggi-project.org] | |
| | | | |
| Permission is hereby granted, free of charge, to any person obtaining a | | Permission is hereby granted, free of charge, to any person obtaining a | |
| copy of this software and associated documentation files (the "Software"
), | | copy of this software and associated documentation files (the "Software"
), | |
| | | | |
| skipping to change at line 104 | | skipping to change at line 104 | |
| | | | |
| #define GII_EV_ORIGIN_NONE 0x00000000 /* Anonymous */ | | #define GII_EV_ORIGIN_NONE 0x00000000 /* Anonymous */ | |
| #define GII_EV_ORIGIN_SENDEVENT 0x80000000 /* Event was due to | | #define GII_EV_ORIGIN_SENDEVENT 0x80000000 /* Event was due to | |
| SendEvent call */ | | SendEvent call */ | |
| #define GII_EV_ORIGIN(id) (id) /* Otherwise, it's an id */ | | #define GII_EV_ORIGIN(id) (id) /* Otherwise, it's an id */ | |
| | | | |
| #define GII_EV_TARGET_ALL 0x00000000 /* Broadcast event */ | | #define GII_EV_TARGET_ALL 0x00000000 /* Broadcast event */ | |
| #define GII_EV_TARGET_QUEUE 0x80000000 /* Just queue the event */ | | #define GII_EV_TARGET_QUEUE 0x80000000 /* Just queue the event */ | |
| | | | |
| #define COMMON_DATA \ | | #define COMMON_DATA \ | |
|
| uint8 size; /* size of event in bytes */\ | | uint8_t size; /* size of event in bytes */\ | |
| uint8 type; /* type of this event */\ | | uint8_t type; /* type of this event */\ | |
| sint16 error; /* error (for replies) */\ | | int16_t error; /* error (for replies) */\ | |
| uint32 origin; /* origin device (etc) */\ | | uint32_t origin; /* origin device (etc) */\ | |
| uint32 target; /* target device (etc) */\ | | uint32_t target; /* target device (etc) */\ | |
| struct timeval time /* timestamp */ | | struct timeval time /* timestamp */ | |
| | | | |
| /* This information is reported with all events. Use the <any> field | | /* This information is reported with all events. Use the <any> field | |
| ** in a gii_event structure to access these fields. | | ** in a gii_event structure to access these fields. | |
| */ | | */ | |
| typedef struct { | | typedef struct { | |
| | | | |
| COMMON_DATA; | | COMMON_DATA; | |
| | | | |
| } gii_any_event; | | } gii_any_event; | |
| | | | |
| /* | | /* | |
| ***************************************************************************
*** | | ***************************************************************************
*** | |
| Command/Information events | | Command/Information events | |
| ***************************************************************************
*** | | ***************************************************************************
*** | |
| */ | | */ | |
| | | | |
|
| #define GII_CMDFLAG_NODATA ((uint32)(1<<31)) /* Event has no data | | #define GII_CMDFLAG_NODATA ((uint32_t)(1<<31)) /* Event has no data | |
| */ | | */ | |
| #define GII_CMDFLAG_PRIVATE ((uint32)(1<<30)) /* The code is spec | | #define GII_CMDFLAG_PRIVATE ((uint32_t)(1<<30)) /* The code is spec | |
| ific to a certain | | ific to a certain | |
| inputlib */ | | inputlib */ | |
|
| #define GII_CMDFLAG_EXTERNAL ((uint32)(1<<29)) /* Event is sent to/
from an external | | #define GII_CMDFLAG_EXTERNAL ((uint32_t)(1<<29)) /* Event is sent to/
from an external | |
| system (like LibG
GI) */ | | system (like LibG
GI) */ | |
| | | | |
| /* These are used internally or to/from the application. | | /* These are used internally or to/from the application. | |
| The same event is used for both Command and Information events. | | The same event is used for both Command and Information events. | |
| The recipient must not store references to the data. If the data | | The recipient must not store references to the data. If the data | |
| information is needed afterwards, copy it! | | information is needed afterwards, copy it! | |
| */ | | */ | |
| | | | |
| typedef struct { | | typedef struct { | |
| | | | |
| COMMON_DATA; | | COMMON_DATA; | |
| | | | |
|
| uint32 code; /* command/request code */ | | uint32_t code; /* command/request code */ | |
| | | | |
| } gii_cmd_nodata_event; | | } gii_cmd_nodata_event; | |
| | | | |
| #define GII_CMD_DATA_MAX (248-sizeof(gii_cmd_nodata_event)) | | #define GII_CMD_DATA_MAX (248-sizeof(gii_cmd_nodata_event)) | |
| typedef struct { | | typedef struct { | |
| | | | |
| COMMON_DATA; | | COMMON_DATA; | |
| | | | |
|
| uint32 code; /* command/request code */ | | uint32_t code; /* command/request code */ | |
| uint8 data[GII_CMD_DATA_MAX]; /* command related data */ | | uint8_t data[GII_CMD_DATA_MAX]; /* command related data */ | |
| | | | |
| } gii_cmd_event; | | } gii_cmd_event; | |
| | | | |
| /* This one is posted, if at least one event has been lost due to queue | | /* This one is posted, if at least one event has been lost due to queue | |
| overflow: */ | | overflow: */ | |
|
| #define GII_CMDCODE_EVENTLOST ((uint32)0x01 | GII_CMDFLAG_NODATA) | | #define GII_CMDCODE_EVENTLOST ((uint32_t)0x01 | GII_CMDFLAG_NODATA
) | |
| | | | |
| /* This event tell inputlibs that the application prefer absolute pointer | | /* This event tell inputlibs that the application prefer absolute pointer | |
| events. */ | | events. */ | |
|
| #define GII_CMDCODE_PREFER_ABSPTR ((uint32)0x02 | GII_CMDFLAG_NODATA) | | #define GII_CMDCODE_PREFER_ABSPTR ((uint32_t)0x02 | GII_CMDFLAG_NODATA
) | |
| | | | |
| /* This event tell inputlibs that the application prefer relative pointer | | /* This event tell inputlibs that the application prefer relative pointer | |
| events. */ | | events. */ | |
|
| #define GII_CMDCODE_PREFER_RELPTR ((uint32)0x03 | GII_CMDFLAG_NODATA) | | #define GII_CMDCODE_PREFER_RELPTR ((uint32_t)0x03 | GII_CMDFLAG_NODATA
) | |
| | | | |
| /* This event is sent/received to require/get the capabilities of a device | | /* This event is sent/received to require/get the capabilities of a device | |
| * as specified in target/origin. | | * as specified in target/origin. | |
| * An event stating num_buttons=num_axes=0 says, that the device is inactiv
e, | | * An event stating num_buttons=num_axes=0 says, that the device is inactiv
e, | |
| * unplugged, whatever. Devices automatically report (detectable) state | | * unplugged, whatever. Devices automatically report (detectable) state | |
| * changes via devinfo. But you need to re-query the valinfo records. | | * changes via devinfo. But you need to re-query the valinfo records. | |
| */ | | */ | |
|
| #define GII_CMDCODE_GETDEVINFO ((uint32)0x01) | | #define GII_CMDCODE_GETDEVINFO ((uint32_t)0x01) | |
| typedef struct { | | typedef struct { | |
| | | | |
| char longname[75]; | | char longname[75]; | |
| char shortname[5]; | | char shortname[5]; | |
| | | | |
| gii_event_mask can_generate; | | gii_event_mask can_generate; | |
| | | | |
|
| uint32 num_buttons; /* Maximum number of buttons. */ | | uint32_t num_buttons; /* Maximum number of buttons. */ | |
| uint32 num_axes; /* Maximum number of axes. */ | | uint32_t num_axes; /* Maximum number of axes. */ | |
| } gii_cmddata_getdevinfo; | | } gii_cmddata_getdevinfo; | |
| #define GII_NUM_MAX 0xfffeffff /* If num_buttons or num_axes is | | #define GII_NUM_MAX 0xfffeffff /* If num_buttons or num_axes is | |
| more than this they should not | | more than this they should not | |
| be interpreted as absolute | | be interpreted as absolute | |
| values (see below for what the
y | | values (see below for what the
y | |
| mean). */ | | mean). */ | |
| #define GII_NUM_UNKNOWN 0xffffffff /* Number is unknown. */ | | #define GII_NUM_UNKNOWN 0xffffffff /* Number is unknown. */ | |
| | | | |
| typedef struct gii_valrange { | | typedef struct gii_valrange { | |
|
| sint32 min, center, max; | | int32_t min, center, max; | |
| } gii_valrange; | | } gii_valrange; | |
| | | | |
| typedef enum { | | typedef enum { | |
| GII_PT_UNKNOWN, /* unknown */ | | GII_PT_UNKNOWN, /* unknown */ | |
|
| GII_PT_TIME, /* base unit s */ | | GII_PT_TIME, /* base unit s */ | |
| GII_PT_FREQUENCY, /* base unit 1/s (Hz) */ | | GII_PT_FREQUENCY, /* base unit 1/s (Hz) */ | |
|
| GII_PT_LENGTH, /* base unit m */ | | GII_PT_LENGTH, /* base unit m */ | |
| GII_PT_VELOCITY, /* base unit m/s */ | | GII_PT_VELOCITY, /* base unit m/s */ | |
| GII_PT_ACCELERATION, /* base unit m/s^2 */ | | GII_PT_ACCELERATION, /* base unit m/s^2 */ | |
| GII_PT_ANGLE, /* base unit radian */ | | GII_PT_ANGLE, /* base unit radian */ | |
| GII_PT_ANGVELOCITY, /* base unit radian/s */ | | GII_PT_ANGVELOCITY, /* base unit radian/s */ | |
| GII_PT_ANGACCELERATION, /* base unit radian/s^2 */ | | GII_PT_ANGACCELERATION, /* base unit radian/s^2 */ | |
|
| GII_PT_AREA, /* base unit m^2 */ | | GII_PT_AREA, /* base unit m^2 */ | |
| GII_PT_VOLUME, /* base unit m^3 */ | | GII_PT_VOLUME, /* base unit m^3 */ | |
| GII_PT_MASS, /* base unit kg */ | | GII_PT_MASS, /* base unit kg */ | |
| GII_PT_FORCE, /* base unit N (kg*m/s^2) */ | | GII_PT_FORCE, /* base unit N (kg*m/s^2) */ | |
| GII_PT_PRESSURE, /* base unit N/m^2 (Pa) */ | | GII_PT_PRESSURE, /* base unit N/m^2 (Pa) */ | |
| GII_PT_TORQUE, /* base unit Nm */ | | GII_PT_TORQUE, /* base unit Nm */ | |
| GII_PT_ENERGY, /* base unit Nm, VAs, J */ | | GII_PT_ENERGY, /* base unit Nm, VAs, J */ | |
| GII_PT_POWER, /* base unit Nm/s, VA, W */ | | GII_PT_POWER, /* base unit Nm/s, VA, W */ | |
| GII_PT_TEMPERATURE, /* base unit K */ | | GII_PT_TEMPERATURE, /* base unit K */ | |
| GII_PT_CURRENT, /* base unit A */ | | GII_PT_CURRENT, /* base unit A */ | |
| GII_PT_VOLTAGE, /* base unit V (kg*m^2/(As^3)) */ | | GII_PT_VOLTAGE, /* base unit V (kg*m^2/(As^3)) */ | |
|
| GII_PT_RESISTANCE, /* base unit V/A (Ohm) */ | | GII_PT_RESISTANCE, /* base unit V/A (Ohm) */ | |
| GII_PT_CAPACITY, /* base unit As/V (Farad) */ | | GII_PT_CAPACITY, /* base unit As/V (Farad) */ | |
| GII_PT_INDUCTIVITY, /* base unit Vs/A (Henry) */ | | GII_PT_INDUCTIVITY, /* base unit Vs/A (Henry) */ | |
| GGI_PT_LAST | | GGI_PT_LAST | |
| } gii_phystype; | | } gii_phystype; | |
| | | | |
| /* This event is sent/received to require/get detailed data about valuator | | /* This event is sent/received to require/get detailed data about valuator | |
| * axis. | | * axis. | |
| */ | | */ | |
|
| #define GII_CMDCODE_GETVALINFO ((uint32)0x02) | | #define GII_CMDCODE_GETVALINFO ((uint32_t)0x02) | |
| typedef struct { | | typedef struct { | |
| | | | |
|
| uint32 number; /* Number of the valuator */ | | uint32_t number; /* Number of the valuator */ | |
| /* You may send this to get all valuators at once. Not recommended. */ | | /* You may send this to get all valuators at once. Not recommended. */ | |
| #define GII_VAL_QUERY_ALL 0xffffffff | | #define GII_VAL_QUERY_ALL 0xffffffff | |
| | | | |
| char longname[75]; | | char longname[75]; | |
| char shortname[5]; | | char shortname[5]; | |
| | | | |
| gii_valrange range; | | gii_valrange range; | |
| gii_phystype phystype; | | gii_phystype phystype; | |
| | | | |
| /* The SI value can be computed using the values below | | /* The SI value can be computed using the values below | |
| * and the following formula (unless SI_mul is 0, which | | * and the following formula (unless SI_mul is 0, which | |
| * means the device is non-linear or the factor is unknown). | | * means the device is non-linear or the factor is unknown). | |
| * | | * | |
| * float SI; | | * float SI; | |
| * | | * | |
| * SI = (float) (SI_add + value[n]) * (float) SI_mul | | * SI = (float) (SI_add + value[n]) * (float) SI_mul | |
| * / (float) SI_div * pow(2.0, SI_shift); | | * / (float) SI_div * pow(2.0, SI_shift); | |
| */ | | */ | |
| | | | |
|
| sint32 SI_add,SI_mul,SI_div,SI_shift; | | int32_t SI_add,SI_mul,SI_div,SI_shift; | |
| | | | |
| } gii_cmddata_getvalinfo; | | } gii_cmddata_getvalinfo; | |
| | | | |
| /* | | /* | |
| ***************************************************************************
*** | | ***************************************************************************
*** | |
| Other events | | Other events | |
| ***************************************************************************
*** | | ***************************************************************************
*** | |
| */ | | */ | |
| | | | |
| /* Exposure events give rectangles that need to be refreshed. | | /* Exposure events give rectangles that need to be refreshed. | |
| */ | | */ | |
| typedef struct { | | typedef struct { | |
| | | | |
| COMMON_DATA; | | COMMON_DATA; | |
| | | | |
|
| uint32 x,y; | | uint32_t x,y; | |
| uint32 h,w; | | uint32_t h,w; | |
| | | | |
| } gii_expose_event; | | } gii_expose_event; | |
| | | | |
| /* key events should be used to report events obtained from keys and | | /* key events should be used to report events obtained from keys and | |
| ** other switches. | | ** other switches. | |
| */ | | */ | |
| typedef struct { | | typedef struct { | |
| | | | |
| COMMON_DATA; | | COMMON_DATA; | |
| | | | |
|
| uint32 modifiers; /* current modifiers in effect */ | | uint32_t modifiers; /* current modifiers in effect */ | |
| uint32 sym; /* meaning of key */ | | uint32_t sym; /* meaning of key */ | |
| uint32 label; /* label on key */ | | uint32_t label; /* label on key */ | |
| uint32 button; /* button number */ | | uint32_t button; /* button number */ | |
| | | | |
| } gii_key_event; | | } gii_key_event; | |
| | | | |
| /* This is used to report change of pointer position. | | /* This is used to report change of pointer position. | |
| ** Depending on the event type, the values are either absolute | | ** Depending on the event type, the values are either absolute | |
| ** or relative. | | ** or relative. | |
| */ | | */ | |
| typedef struct { | | typedef struct { | |
| | | | |
| COMMON_DATA; | | COMMON_DATA; | |
| | | | |
|
| sint32 x, y; /* absolute/relative position */ | | int32_t x, y; /* absolute/relative position */ | |
| sint32 z, wheel; | | int32_t z, wheel; | |
| | | | |
| } gii_pmove_event; | | } gii_pmove_event; | |
| | | | |
| /* Button events are sent to report a change in pointer button | | /* Button events are sent to report a change in pointer button | |
| ** state. Depending on the event type, the button is either being | | ** state. Depending on the event type, the button is either being | |
| ** pressed or released. | | ** pressed or released. | |
| */ | | */ | |
| typedef struct { | | typedef struct { | |
| | | | |
| COMMON_DATA; | | COMMON_DATA; | |
| | | | |
|
| uint32 button; /* button number. This is a number, NOT a ma
sk */ | | uint32_t button; /* button number. This is a number, NOT a ma
sk */ | |
| | | | |
| } gii_pbutton_event; | | } gii_pbutton_event; | |
| | | | |
| #define GII_PBUTTON_(x) (x) /* Generic button access */ | | #define GII_PBUTTON_(x) (x) /* Generic button access */ | |
| | | | |
| #define GII_PBUTTON_NONE 0 /* Dummy */ | | #define GII_PBUTTON_NONE 0 /* Dummy */ | |
| | | | |
| #define GII_PBUTTON_LEFT 1 /* Left or primary button */ | | #define GII_PBUTTON_LEFT 1 /* Left or primary button */ | |
| #define GII_PBUTTON_PRIMARY 1 | | #define GII_PBUTTON_PRIMARY 1 | |
| #define GII_PBUTTON_FIRST 1 | | #define GII_PBUTTON_FIRST 1 | |
| | | | |
| skipping to change at line 333 | | skipping to change at line 333 | |
| #define GII_PBUTTON_THIRD 3 | | #define GII_PBUTTON_THIRD 3 | |
| | | | |
| /* Valuator events report a change of up to 32 of the | | /* Valuator events report a change of up to 32 of the | |
| ** input device valuators. Only a range of 32 valuators beginning | | ** input device valuators. Only a range of 32 valuators beginning | |
| ** from first can be reported with one event. | | ** from first can be reported with one event. | |
| */ | | */ | |
| typedef struct { | | typedef struct { | |
| | | | |
| COMMON_DATA; | | COMMON_DATA; | |
| | | | |
|
| uint32 first; /* first valuator reported */ | | uint32_t first; /* first valuator reported */ | |
| uint32 count; /* number reported */ | | uint32_t count; /* number reported */ | |
| sint32 value[32]; /* absolute/relative values */ | | int32_t value[32]; /* absolute/relative values */ | |
| | | | |
| } gii_val_event; | | } gii_val_event; | |
| | | | |
| typedef union { | | typedef union { | |
| | | | |
|
| uint8 size; /* size of this event */ | | uint8_t size; /* size of this event */ | |
| | | | |
| gii_any_event any; /* access COMMON_DATA */ | | gii_any_event any; /* access COMMON_DATA */ | |
| gii_cmd_event cmd; /* command/information */ | | gii_cmd_event cmd; /* command/information */ | |
| gii_expose_event expose; /* exposure event */ | | gii_expose_event expose; /* exposure event */ | |
| gii_val_event val; /* valuator change */ | | gii_val_event val; /* valuator change */ | |
| gii_key_event key; /* key press/release */ | | gii_key_event key; /* key press/release */ | |
| gii_pmove_event pmove; /* pointer move */ | | gii_pmove_event pmove; /* pointer move */ | |
| gii_pbutton_event pbutton; /* pointer buttons */ | | gii_pbutton_event pbutton; /* pointer buttons */ | |
| | | | |
| } gii_event; | | } gii_event; | |
| | | | |
End of changes. 25 change blocks. |
| 50 lines changed or deleted | | 50 lines changed or added | |
|
| gg.h | | gg.h | |
|
| /* $Id: gg.h,v 1.14.2.1 2004/10/18 15:15:54 cegger Exp $ | | /* $Id: gg.h,v 1.33 2005/09/19 20:08:50 cegger Exp $ | |
| ***************************************************************************
*** | | ***************************************************************************
*** | |
| | | | |
| LibGG - API header file | | LibGG - API header file | |
| | | | |
| Copyright (C) 1998-1999 Marcus Sundberg [marcus@ggi-project.org] | | Copyright (C) 1998-1999 Marcus Sundberg [marcus@ggi-project.org] | |
| | | | |
| Permission is hereby granted, free of charge, to any person obtaining a | | Permission is hereby granted, free of charge, to any person obtaining a | |
| copy of this software and associated documentation files (the "Software"
), | | copy of this software and associated documentation files (the "Software"
), | |
| to deal in the Software without restriction, including without limitatio
n | | to deal in the Software without restriction, including without limitatio
n | |
| the rights to use, copy, modify, merge, publish, distribute, sublicense, | | the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
| | | | |
| skipping to change at line 35 | | skipping to change at line 35 | |
| ***************************************************************************
*** | | ***************************************************************************
*** | |
| */ | | */ | |
| | | | |
| #ifndef _GGI_GG_H | | #ifndef _GGI_GG_H | |
| #define _GGI_GG_H | | #define _GGI_GG_H | |
| | | | |
| #include <ggi/errors.h> | | #include <ggi/errors.h> | |
| #include <ggi/system.h> | | #include <ggi/system.h> | |
| #include <ggi/gg-defs.h> | | #include <ggi/gg-defs.h> | |
| | | | |
|
| #include <stdio.h> | | #include <stdio.h> /* needed for FILE structure */ | |
| #include <stdlib.h> | | | |
| | | | |
| __BEGIN_DECLS | | __BEGIN_DECLS | |
| /* | | /* | |
| ***************************************************************************
*** | | ***************************************************************************
*** | |
| Initialize/Deinitialize library | | Initialize/Deinitialize library | |
| ***************************************************************************
*** | | ***************************************************************************
*** | |
| */ | | */ | |
| | | | |
| GGAPIFUNC int ggInit(void); | | GGAPIFUNC int ggInit(void); | |
| | | | |
| GGAPIFUNC int ggExit(void); | | GGAPIFUNC int ggExit(void); | |
| | | | |
| /* | | /* | |
| ***************************************************************************
*** | | ***************************************************************************
*** | |
| Time functions | | Time functions | |
| ***************************************************************************
*** | | ***************************************************************************
*** | |
| */ | | */ | |
| | | | |
| GGAPIFUNC int ggCurTime(struct timeval *tv); | | GGAPIFUNC int ggCurTime(struct timeval *tv); | |
| | | | |
|
| GGAPIFUNC int ggUSleep(sint32 usecs); | | GGAPIFUNC int ggUSleep(int32_t usecs); | |
| | | | |
|
| GGAPIFUNC void ggUSlumber(sint32 usecs); | | GGAPIFUNC void ggUSlumber(int32_t usecs); | |
| | | | |
| /* | | /* | |
| ***************************************************************************
*** | | ***************************************************************************
*** | |
| Functions for adding and removing cleanup callbacks | | Functions for adding and removing cleanup callbacks | |
| ***************************************************************************
*** | | ***************************************************************************
*** | |
| */ | | */ | |
| | | | |
| typedef void (ggcleanup_func)(void *); | | typedef void (ggcleanup_func)(void *); | |
| | | | |
| GGAPIFUNC int ggRegisterCleanup(ggcleanup_func *func, void *arg); | | GGAPIFUNC int ggRegisterCleanup(ggcleanup_func *func, void *arg); | |
| | | | |
| skipping to change at line 114 | | skipping to change at line 113 | |
| struct gg_task *next; | | struct gg_task *next; | |
| struct gg_task *last; | | struct gg_task *last; | |
| | | | |
| /* Double-linked ordered linear-list of tasks with expired deadlines
*/ | | /* Double-linked ordered linear-list of tasks with expired deadlines
*/ | |
| struct gg_task *nextdl; | | struct gg_task *nextdl; | |
| struct gg_task *lastdl; | | struct gg_task *lastdl; | |
| }; | | }; | |
| | | | |
| GGAPIFUNC int ggAddTask(struct gg_task *task); | | GGAPIFUNC int ggAddTask(struct gg_task *task); | |
| GGAPIFUNC int ggDelTask(struct gg_task *task); | | GGAPIFUNC int ggDelTask(struct gg_task *task); | |
|
| GGAPIFUNC uint32 ggTimeBase(void); | | GGAPIFUNC uint32_t ggTimeBase(void); | |
| | | | |
| /* | | /* | |
| ***************************************************************************
*** | | ***************************************************************************
*** | |
| Misc functions | | Misc functions | |
| ***************************************************************************
*** | | ***************************************************************************
*** | |
| */ | | */ | |
| | | | |
| /* Get the users "home" directory, or whatever the equivalent is under the | | /* Get the users "home" directory, or whatever the equivalent is under the | |
| system we are running on. */ | | system we are running on. */ | |
| GGAPIFUNC const char *ggGetUserDir(void); | | GGAPIFUNC const char *ggGetUserDir(void); | |
| | | | |
| skipping to change at line 150 | | skipping to change at line 149 | |
| * Appends src to string dst of size siz (unlike strncat, siz is the | | * Appends src to string dst of size siz (unlike strncat, siz is the | |
| * full size of dst, not space left). At most siz-1 characters | | * full size of dst, not space left). At most siz-1 characters | |
| * will be copied. Always NUL terminates (unless siz <= strlen(dst)). | | * will be copied. Always NUL terminates (unless siz <= strlen(dst)). | |
| * Returns strlen(src) + MIN(siz, strlen(initial dst)). | | * Returns strlen(src) + MIN(siz, strlen(initial dst)). | |
| * If retval >= siz, truncation occurred. | | * If retval >= siz, truncation occurred. | |
| */ | | */ | |
| GGAPIFUNC size_t ggstrlcat(char *dst, const char *src, size_t siz); | | GGAPIFUNC size_t ggstrlcat(char *dst, const char *src, size_t siz); | |
| | | | |
| /* | | /* | |
| ***************************************************************************
*** | | ***************************************************************************
*** | |
|
| | | Iterators definitions | |
| | | *************************************************************************** | |
| | | *** | |
| | | */ | |
| | | | |
| | | struct gg_iter; | |
| | | | |
| | | typedef int (ggfunc_iter_next)(struct gg_iter *); | |
| | | typedef void (ggfunc_iter_done)(struct gg_iter *); | |
| | | | |
| | | struct gg_iter { | |
| | | ggfunc_iter_next *next; | |
| | | ggfunc_iter_done *done; | |
| | | }; | |
| | | | |
| | | #define ITER_DONE 0 /* end of iteration reached */ | |
| | | #define ITER_YIELD 1 /* got a result */ | |
| | | | |
| | | #define GG_AS_ITER(i) ((struct gg_iter *)i) | |
| | | #define GG_ITER_PREPARE(i, n, d) do { \ | |
| | | GG_AS_ITER(i)->next = (ggfunc_iter_next*)n; \ | |
| | | GG_AS_ITER(i)->done = (ggfunc_iter_done*)d; \ | |
| | | } while(0) | |
| | | #define GG_ITER_FOREACH(i) while(GG_AS_ITER(i)->next(GG_AS_ITER(i))) | |
| | | #define GG_ITER_DONE(i) if(GG_AS_ITER(i)->done) GG_AS_ITER(i)->done(GG_AS_I | |
| | | TER(i)) | |
| | | | |
| | | /* | |
| | | *************************************************************************** | |
| | | *** | |
| | | Simple observer framework | |
| | | *************************************************************************** | |
| | | *** | |
| | | */ | |
| | | | |
| | | #include <ggi/gg-queue.h> | |
| | | | |
| | | /* | |
| | | ** return non zero to delete this observer form the callback. | |
| | | */ | |
| | | typedef int (ggfunc_observer_update)(void *arg, int flag, void *data); | |
| | | | |
| | | struct gg_observer { | |
| | | ggfunc_observer_update *update; | |
| | | void *arg; | |
| | | GG_LIST_ENTRY(gg_observer) _others; | |
| | | }; | |
| | | | |
| | | struct gg_publisher { | |
| | | GG_LIST_HEAD(gg_observer_list, gg_observer) observers; | |
| | | }; | |
| | | | |
| | | #define INIT_PUBLISHER(pub) GG_LIST_INIT(&((pub)->observers)) | |
| | | | |
| | | GGAPIFUNC struct gg_observer * ggAddObserver(struct gg_publisher *, | |
| | | ggfunc_observer_update *, void | |
| | | *); | |
| | | | |
| | | GGAPIFUNC void ggDelObserver(struct gg_observer *); | |
| | | | |
| | | GGAPIFUNC void ggNotifyObservers(struct gg_publisher *, int, void *); | |
| | | | |
| | | GGAPIFUNC void ggClearPublisher(struct gg_publisher *); | |
| | | | |
| | | /* | |
| | | *************************************************************************** | |
| | | *** | |
| Configuration file handling | | Configuration file handling | |
| ***************************************************************************
*** | | ***************************************************************************
*** | |
| */ | | */ | |
| | | | |
|
| GGAPIFUNC int ggLoadConfig(const char *file, void **confret); | | typedef void *gg_config; | |
| | | | |
|
| GGAPIFUNC void ggFreeConfig(void *conf); | | GGAPIFUNC int ggLoadConfig(const char *file, gg_config *conf); | |
| | | | |
| | | GGAPIFUNC void ggFreeConfig(gg_config); | |
| | | | |
| | | struct gg_location_iter { | |
| | | struct gg_iter iter; | |
| | | | |
| | | /* These must be set by the caller before calling | |
| | | * ggConfigIterLocation | |
| | | */ | |
| | | gg_config config; | |
| | | const char *name; | |
| | | | |
| | | /* Placeholders for results */ | |
| | | char *location; | |
| | | const char *symbol; | |
| | | | |
| | | /* Internal */ | |
| | | void *_state; | |
| | | }; | |
| | | | |
|
| | | /* Prepare the given iterator to generate pattern matches */ | |
| | | GGAPIFUNC int ggConfigIterLocation(struct gg_location_iter * iter); | |
| | | | |
| | | struct gg_target_iter { | |
| | | struct gg_iter iter; | |
| | | | |
| | | /* These must be set by the caller before calling | |
| | | * ggConfigIterTarget | |
| | | */ | |
| | | gg_config config; | |
| | | const char *input; | |
| | | | |
| | | /* Placeholders for results */ | |
| | | char *target; | |
| | | char *options; | |
| | | | |
| | | /* Internal */ | |
| | | void *nested; | |
| | | }; | |
| | | | |
| | | /* Prepare the given iterator to generate target specifications */ | |
| | | GGAPIFUNC int ggConfigIterTarget(struct gg_target_iter *iter); | |
| | | | |
| | | /******* Legacy interface. DEPRECATED ********/ | |
| | | | |
| | | /* This will return the first found location */ | |
| GGAPIFUNC const char *ggMatchConfig(const void *conf, const char *name, | | GGAPIFUNC const char *ggMatchConfig(const void *conf, const char *name, | |
| const char *version); | | const char *version); | |
| | | | |
|
| GGAPIFUNC int ggConfigExpandAlias(void *confhandle, const char *list_in, | | /* | |
| | | * The function will always fail currently, but the symbol is there | |
| | | * to not break builds | |
| | | */ | |
| | | GGAPIFUNC int ggConfigExpandAlias(const void *confhandle, const char *list_ | |
| | | in, | |
| char *list_out, size_t outmax); | | char *list_out, size_t outmax); | |
| | | | |
| /* | | /* | |
| ***************************************************************************
*** | | ***************************************************************************
*** | |
|
| Dynamic module loading | | Dynamic module and other scope look-up abstraction | |
| ***************************************************************************
*** | | ***************************************************************************
*** | |
| */ | | */ | |
| | | | |
|
| | | typedef void *gg_scope; | |
| | | | |
| | | typedef void *(ggfunc_scope_get)(void *handle, const char *symbol); | |
| | | typedef void (ggfunc_scope_del)(void *handle); | |
| | | | |
| | | /* Get a scope by its location */ | |
| | | GGAPIFUNC gg_scope ggGetScope(const char *location); | |
| | | | |
| | | /* Call when a scope is not used anymore */ | |
| | | GGAPIFUNC void ggDelScope(gg_scope scope); | |
| | | | |
| | | /* Get a symbol from the scope */ | |
| | | GGAPIFUNC void *ggFromScope(gg_scope scope, const char *symbol); | |
| | | | |
| | | /* Register a new custom scope */ | |
| | | GGAPIFUNC gg_scope ggNewScope(const char * location, void *handle, | |
| | | ggfunc_scope_get *get, | |
| | | ggfunc_scope_del *del); | |
| | | | |
| | | typedef int (ggfunc_target_open)(void *, gg_scope, void *, | |
| | | const char *, const char *, void *); | |
| | | | |
| | | /* This function is a helper that will perform the location and target | |
| | | * lookup internally. The caller provides a callback for initializing | |
| | | * (whatever it means) the target when a hook function is retreived. | |
| | | * it will be given a user specified argument, the scope to which the | |
| | | * hook function belong, the hook, the target name, argument string, | |
| | | * and the argument pointer if any. | |
| | | * If the callback returns non-zero, the call is considered failed, | |
| | | * and libgg will take care of releasing the scope. On success, | |
| | | * the scope reference is 'given' to the user, which must keep it | |
| | | * somewhere to release it later. | |
| | | * | |
| | | * If flags is 0, libgg will try to open all targets that can be | |
| | | * derived from the target spec and config handle. Otherwise it will | |
| | | * stop once the first target is successfuly opened. | |
| | | * | |
| | | * The function returns the number of target that were successfuly | |
| | | * opened. | |
| | | */ | |
| | | GGAPIFUNC int ggOpenTarget(const char *targetspec, | |
| | | gg_config conf, const char *defaultsym, | |
| | | ggfunc_target_open *func, void *arg, | |
| | | void *tgtargptr, int flags); | |
| | | | |
| | | /******* Legacy interface. DEPRECATED ********/ | |
| | | | |
| typedef void *gg_module; | | typedef void *gg_module; | |
| | | | |
| #define GG_MODULE_NULL NULL | | #define GG_MODULE_NULL NULL | |
|
| | | | |
| #define GG_MODULE_GLOBAL 1 | | #define GG_MODULE_GLOBAL 1 | |
| | | | |
| /* Dynamicly load file */ | | /* Dynamicly load file */ | |
| GGAPIFUNC gg_module ggLoadModule(const char *filename, int flags); | | GGAPIFUNC gg_module ggLoadModule(const char *filename, int flags); | |
| | | | |
| /* Try to match name in conf and load the resulting filename */ | | /* Try to match name in conf and load the resulting filename */ | |
| GGAPIFUNC gg_module ggMLoadModule(const void *conf, const char *name, | | GGAPIFUNC gg_module ggMLoadModule(const void *conf, const char *name, | |
| const char *version, int flags); | | const char *version, int flags); | |
| | | | |
| /* Get Address of symbol in module */ | | /* Get Address of symbol in module */ | |
| | | | |
| skipping to change at line 200 | | skipping to change at line 355 | |
| ***************************************************************************
*** | | ***************************************************************************
*** | |
| Parsing functions | | Parsing functions | |
| ***************************************************************************
*** | | ***************************************************************************
*** | |
| */ | | */ | |
| | | | |
| /* Read the first matching option from an option file into the correspondin
g | | /* Read the first matching option from an option file into the correspondin
g | |
| result entry */ | | result entry */ | |
| GGAPIFUNC int ggGetFileOpt(FILE *fp, const char **optnames, | | GGAPIFUNC int ggGetFileOpt(FILE *fp, const char **optnames, | |
| char **results, int ressize); | | char **results, int ressize); | |
| | | | |
|
| GGAPIFUNC char *ggParseTarget(const char *str, char *target, int max); | | GGAPIFUNC const char *ggParseTarget(const char *str, char *target, int max)
; | |
| | | | |
| #define GG_MAX_OPTION_NAME 32 | | #define GG_MAX_OPTION_NAME 32 | |
| #define GG_MAX_OPTION_RESULT 256 | | #define GG_MAX_OPTION_RESULT 256 | |
| | | | |
| typedef struct gg_option | | typedef struct gg_option | |
| { | | { | |
| char name[GG_MAX_OPTION_NAME]; | | char name[GG_MAX_OPTION_NAME]; | |
| char result[GG_MAX_OPTION_RESULT]; | | char result[GG_MAX_OPTION_RESULT]; | |
| } gg_option; | | } gg_option; | |
| | | | |
|
| GGAPIFUNC char *ggParseOptions(const char *str, gg_option *optlist, | | GGAPIFUNC const char *ggParseOptions(const char *str, gg_option *optlist, | |
| int count); | | int count); | |
| | | | |
| /* | | /* | |
| ***************************************************************************
*** | | ***************************************************************************
*** | |
| Debug output | | Debug output | |
| ***************************************************************************
*** | | ***************************************************************************
*** | |
| */ | | */ | |
| | | | |
| GGAPIFUNC void ggDPrintf(int _sync, const char *subsys, | | GGAPIFUNC void ggDPrintf(int _sync, const char *subsys, | |
| const char *form, ...); | | const char *form, ...); | |
| | | | |
| | | | |
| skipping to change at line 245 | | skipping to change at line 400 | |
| GGAPIFUNC void ggUnlock(void *lock); | | GGAPIFUNC void ggUnlock(void *lock); | |
| | | | |
| GGAPIFUNC int ggTryLock(void *lock); | | GGAPIFUNC int ggTryLock(void *lock); | |
| | | | |
| /* | | /* | |
| ***************************************************************************
*** | | ***************************************************************************
*** | |
| CPU Identification and SIMD disable/enable | | CPU Identification and SIMD disable/enable | |
| ***************************************************************************
*** | | ***************************************************************************
*** | |
| */ | | */ | |
| | | | |
|
| /* These are exclusive even between architectures to limit cpp complexity. | | /* There's a reason not to use enums: | |
| * And who knows, perhaps cross-arch emulations may happen. | | * | |
| | | * All versions of the C standard contain this wording: | |
| | | * "The expression that defines the value of an enumeration | |
| | | * constant shall be an integer constant expression that has | |
| | | * a value representable as an int." | |
| */ | | */ | |
|
| enum gg_swartype { | | | |
| GG_SWAR_NONE = 0x00000001, /* Vanilla C implementation */ | | | |
| GG_SWAR_32BITC = 0x00000002, /* Fast 32b math vs 16b */ | | | |
| GG_SWAR_ALTIVEC = 0x00000004, | | | |
| GG_SWAR_SSE = 0x00000008, | | | |
| GG_SWAR_SSE2 = 0x00000010, | | | |
| GG_SWAR_MMX = 0x00000020, | | | |
| GG_SWAR_MMXPLUS = 0x00000040, /* Cyrix. */ | | | |
| GG_SWAR_3DNOW = 0x00000080, /* Implies MMX enhancements */ | | | |
| GG_SWAR_ADV3DNOW= 0x00000100, /* Implies MMX enhancements */ | | | |
| GG_SWAR_MAX = 0x00000200, | | | |
| GG_SWAR_SIGD = 0x00000400, /* 32b or 64b?? */ | | | |
| GG_SWAR_SSE3 = 0x00000800, | | | |
| | | | |
| #ifdef GG_HAVE_INT64 | | #ifdef GG_HAVE_INT64 | |
|
| | | typedef uint64_t gg_swartype; | |
| | | #else | |
| | | typedef uint32_t gg_swartype; | |
| | | #endif | |
| | | | |
|
| GG_SWAR_64BITC = 0x0000000100000000LL, /* Fast 64b vs 32b | | #define GG_SWAR_NONE 0x00000001 /* Vanilla C implementation */ | |
| */ | | #define GG_SWAR_32BITC 0x00000002 /* Fast 32b math vs 16b * | |
| GG_SWAR_MVI = 0x0000000200000000LL, /* avail in 32b mode? | | / | |
| */ | | #define GG_SWAR_ALTIVEC 0x00000004 | |
| GG_SWAR_MAX2 = 0x0000000400000000LL, | | #define GG_SWAR_SSE 0x00000008 | |
| GG_SWAR_MDMX = 0x0000000800000000LL, /* avail in 32b mode? | | #define GG_SWAR_SSE2 0x00000010 | |
| */ | | #define GG_SWAR_MMX 0x00000020 | |
| GG_SWAR_MAJC = 0x0000001000000000LL, | | #define GG_SWAR_MMXPLUS 0x00000040 /* Cyrix. */ | |
| GG_SWAR_VIS = 0x0000002000000000LL, | | #define GG_SWAR_3DNOW 0x00000080 /* Implies MMX enhancemen | |
| | | ts */ | |
| | | #define GG_SWAR_ADV3DNOW 0x00000100 /* Implies MMX enhancemen | |
| | | ts */ | |
| | | #define GG_SWAR_MAX 0x00000200 | |
| | | #define GG_SWAR_SIGD 0x00000400 /* 32b or 64b?? */ | |
| | | #define GG_SWAR_SSE3 0x00000800 | |
| | | | |
|
| GG_SWAR_ALL = 0xffffffffffffffffLL | | #ifdef GG_HAVE_INT64 | |
| #else | | | |
| GG_SWAR_ALL = 0xffffffff | | | |
| | | | |
|
| | | #ifdef _MSC_VER | |
| | | #define GG_INT64_C(x) x ## i64 | |
| | | #define GG_UINT64_C(x) x ## ui64 | |
| | | #else | |
| | | #define GG_INT64_C(x) x ## LL | |
| | | #define GG_UINT64_C(x) x ## ULL | |
| #endif | | #endif | |
| | | | |
|
| }; | | #define GG_SWAR_64BITC GG_INT64_C(0x0000000100000000) /* Fa | |
| | | st 64b vs 32b */ | |
| | | #define GG_SWAR_MVI GG_INT64_C(0x0000000200000000) /* av | |
| | | ail in 32b mode? */ | |
| | | #define GG_SWAR_MAX2 GG_INT64_C(0x0000000400000000) | |
| | | #define GG_SWAR_MDMX GG_INT64_C(0x0000000800000000) /* av | |
| | | ail in 32b mode? */ | |
| | | #define GG_SWAR_MAJC GG_INT64_C(0x0000001000000000) | |
| | | #define GG_SWAR_VIS GG_INT64_C(0x0000002000000000) | |
| | | | |
|
| GGAPIFUNC enum gg_swartype ggGetSwarType(void); | | #define GG_SWAR_ALL GG_INT64_C(0xffffffffffffffff) | |
| | | #else | |
| | | #define GG_SWAR_ALL 0xffffffff | |
| | | | |
| | | #endif | |
| | | | |
| | | GGAPIFUNC gg_swartype ggGetSwarType(void); | |
| | | | |
| __END_DECLS | | __END_DECLS | |
| | | | |
| #endif /* _GGI_GG_H */ | | #endif /* _GGI_GG_H */ | |
| | | | |
End of changes. 23 change blocks. |
| 43 lines changed or deleted | | 224 lines changed or added | |
|
| gii.h | | gii.h | |
|
| /* $Id: gii.h,v 1.4 2004/02/23 14:16:38 pekberg Exp $ | | /* $Id: gii.h,v 1.6 2005/07/29 16:40:54 soyt Exp $ | |
| ***************************************************************************
*** | | ***************************************************************************
*** | |
| | | | |
| LibGII API header file | | LibGII API header file | |
| | | | |
| Copyright (C) 1998 Andreas Beck [becka@ggi-project.o
rg] | | Copyright (C) 1998 Andreas Beck [becka@ggi-project.o
rg] | |
| Copyright (C) 1999-2000 Marcus Sundberg [marcus@ggi-project.org] | | Copyright (C) 1999-2000 Marcus Sundberg [marcus@ggi-project.org] | |
| | | | |
| Permission is hereby granted, free of charge, to any person obtaining a | | Permission is hereby granted, free of charge, to any person obtaining a | |
| copy of this software and associated documentation files (the "Software"
), | | copy of this software and associated documentation files (the "Software"
), | |
| to deal in the Software without restriction, including without limitatio
n | | to deal in the Software without restriction, including without limitatio
n | |
| | | | |
| skipping to change at line 72 | | skipping to change at line 72 | |
| | | | |
| /* Open a new Input - use input `NULL' for autoselect. | | /* Open a new Input - use input `NULL' for autoselect. | |
| */ | | */ | |
| GIIAPIFUNC gii_input_t giiOpen(const char *input,...); | | GIIAPIFUNC gii_input_t giiOpen(const char *input,...); | |
| GIIAPIFUNC int giiClose(gii_input_t inp); | | GIIAPIFUNC int giiClose(gii_input_t inp); | |
| | | | |
| /* Input management | | /* Input management | |
| */ | | */ | |
| GIIAPIFUNC gii_input_t giiJoinInputs(gii_input_t inp, gii_input_t inp2); | | GIIAPIFUNC gii_input_t giiJoinInputs(gii_input_t inp, gii_input_t inp2); | |
| GIIAPIFUNC int giiSplitInputs(gii_input_t inp, gii_input_t *newhand, | | GIIAPIFUNC int giiSplitInputs(gii_input_t inp, gii_input_t *newhand, | |
|
| uint32 origin, uint32 flags); | | uint32_t origin, uint32_t flags); | |
| | | | |
| /* Event Handling | | /* Event Handling | |
| */ | | */ | |
| GIIAPIFUNC gii_event_mask giiEventPoll(gii_input_t inp, | | GIIAPIFUNC gii_event_mask giiEventPoll(gii_input_t inp, | |
| gii_event_mask mask, | | gii_event_mask mask, | |
| struct timeval *t); | | struct timeval *t); | |
|
| GIIAPIFUNC int giiEventRead(gii_input_t inp, gii_ev
ent *ev, | | GIIAPIFUNC int giiEventRead(gii_input_t inp, gii_event *ev, | |
| gii_event_mask mask); | | gii_event_mask mask); | |
| GIIAPIFUNC int giiEventsQueued(gii_input_t inp, | | GIIAPIFUNC int giiEventsQueued(gii_input_t inp, | |
| gii_event_mask mask); | | gii_event_mask mask); | |
|
| GIIAPIFUNC int giiEventSend(gii_input_t inp, gii_event *ev)
; | | GIIAPIFUNC int giiEventSend(gii_input_t inp, gii_event *ev)
; | |
| GIIAPIFUNC int giiSetEventMask(gii_input_t inp, | | GIIAPIFUNC int giiSetEventMask(gii_input_t inp, | |
| gii_event_mask evm); | | gii_event_mask evm); | |
| GIIAPIFUNC gii_event_mask giiGetEventMask(gii_input_t inp); | | GIIAPIFUNC gii_event_mask giiGetEventMask(gii_input_t inp); | |
| | | | |
| #define giiAddEventMask(inp,mask) \ | | #define giiAddEventMask(inp,mask) \ | |
| giiSetEventMask((inp), giiGetEventMask((inp)) | (mask)) | | giiSetEventMask((inp), giiGetEventMask((inp)) | (mask)) | |
| #define giiRemoveEventMask(inp,mask) \ | | #define giiRemoveEventMask(inp,mask) \ | |
| giiSetEventMask((inp), giiGetEventMask((inp)) & ~(mask)) | | giiSetEventMask((inp), giiGetEventMask((inp)) & ~(mask)) | |
| | | | |
| /* Deviceinfo stuff | | /* Deviceinfo stuff | |
| */ | | */ | |
|
| GIIAPIFUNC int giiQueryDeviceInfo (gii_input_t inp, uint32 orig | | GIIAPIFUNC int giiQueryDeviceInfo (gii_input_t inp, | |
| in, gii_cmddata_getdevinfo *info); | | uint32_t origin, | |
| GIIAPIFUNC int giiQueryDeviceInfoByNumber(gii_input_t inp, uint32 numb | | gii_cmddata_getdevinfo *info | |
| er, uint32 *origin, gii_cmddata_getdevinfo *info); | | ); | |
| GIIAPIFUNC int giiQueryValInfo (gii_input_t inp, uint32 origin, uint | | GIIAPIFUNC int giiQueryDeviceInfoByNumber(gii_input_t inp, | |
| 32 valnumber, gii_cmddata_getvalinfo *info); | | uint32_t number, | |
| | | uint32_t *origin, | |
| | | gii_cmddata_getdevinfo *info | |
| | | ); | |
| | | GIIAPIFUNC int giiQueryValInfo (gii_input_t inp, | |
| | | uint32_t origin, | |
| | | uint32_t valnumber, | |
| | | gii_cmddata_getvalinfo *info); | |
| | | | |
| __END_DECLS | | __END_DECLS | |
| | | | |
| #endif /* _GGI_GII_H */ | | #endif /* _GGI_GII_H */ | |
| | | | |
End of changes. 5 change blocks. |
| 10 lines changed or deleted | | 17 lines changed or added | |
|
| keyboard.h | | keyboard.h | |
|
| /* $Id$ | | /* $Id: keyboard.h,v 1.5 2005/05/01 00:55:17 aldot Exp $ | |
| ***************************************************************************
*** | | ***************************************************************************
*** | |
| | | | |
| LibGII keyboard definitions | | LibGII keyboard definitions | |
| | | | |
| Copyright (C) 1998 Andrew Apted [andrew@ggi-project.org] | | Copyright (C) 1998 Andrew Apted [andrew@ggi-project.org] | |
| Copyright (C) 1999 Marcus Sundberg [marcus@ggi-project.org] | | Copyright (C) 1999 Marcus Sundberg [marcus@ggi-project.org] | |
| | | | |
| Permission is hereby granted, free of charge, to any person obtaining a | | Permission is hereby granted, free of charge, to any person obtaining a | |
| copy of this software and associated documentation files (the "Software"
), | | copy of this software and associated documentation files (the "Software"
), | |
| to deal in the Software without restriction, including without limitatio
n | | to deal in the Software without restriction, including without limitatio
n | |
| | | | |
| skipping to change at line 175 | | skipping to change at line 175 | |
| #define GIIK_Redo GII_KEY(GII_KT_SPEC, 24) | | #define GIIK_Redo GII_KEY(GII_KT_SPEC, 24) | |
| #define GIIK_Menu GII_KEY(GII_KT_SPEC, 25) | | #define GIIK_Menu GII_KEY(GII_KT_SPEC, 25) | |
| #define GIIK_Cancel GII_KEY(GII_KT_SPEC, 26) | | #define GIIK_Cancel GII_KEY(GII_KT_SPEC, 26) | |
| #define GIIK_PrintScreen GII_KEY(GII_KT_SPEC, 27) | | #define GIIK_PrintScreen GII_KEY(GII_KT_SPEC, 27) | |
| #define GIIK_Execute GII_KEY(GII_KT_SPEC, 28) | | #define GIIK_Execute GII_KEY(GII_KT_SPEC, 28) | |
| #define GIIK_Find GII_KEY(GII_KT_SPEC, 30) | | #define GIIK_Find GII_KEY(GII_KT_SPEC, 30) | |
| #define GIIK_Begin GII_KEY(GII_KT_SPEC, 31) | | #define GIIK_Begin GII_KEY(GII_KT_SPEC, 31) | |
| #define GIIK_Clear GII_KEY(GII_KT_SPEC, 32) | | #define GIIK_Clear GII_KEY(GII_KT_SPEC, 32) | |
| #define GIIK_Insert GII_KEY(GII_KT_SPEC, 34) | | #define GIIK_Insert GII_KEY(GII_KT_SPEC, 34) | |
| #define GIIK_Select GII_KEY(GII_KT_SPEC, 35) | | #define GIIK_Select GII_KEY(GII_KT_SPEC, 35) | |
|
| #define GIIK_Macro GII_KEY(GII_KT_SPEC, 38) | | #define GIIK_Macro GII_KEY(GII_KT_SPEC, 38) | |
| #define GIIK_Help GII_KEY(GII_KT_SPEC, 39) | | #define GIIK_Help GII_KEY(GII_KT_SPEC, 39) | |
| #define GIIK_Do GII_KEY(GII_KT_SPEC, 40) | | #define GIIK_Do GII_KEY(GII_KT_SPEC, 40) | |
|
| #define GIIK_Pause GII_KEY(GII_KT_SPEC, 41) | | #define GIIK_Pause GII_KEY(GII_KT_SPEC, 41) | |
| #define GIIK_Stop GIIK_Pause | | #define GIIK_Stop GIIK_Pause | |
| #define GIIK_SysRq GII_KEY(GII_KT_SPEC, 42) | | #define GIIK_SysRq GII_KEY(GII_KT_SPEC, 42) | |
| #define GIIK_ModeSwitch GII_KEY(GII_KT_SPEC, 43) | | #define GIIK_ModeSwitch GII_KEY(GII_KT_SPEC, 43) | |
| | | | |
| #define GIIK_Up GII_KEY(GII_KT_SPEC, 50) | | #define GIIK_Up GII_KEY(GII_KT_SPEC, 50) | |
| #define GIIK_Down GII_KEY(GII_KT_SPEC, 51) | | #define GIIK_Down GII_KEY(GII_KT_SPEC, 51) | |
| #define GIIK_Left GII_KEY(GII_KT_SPEC, 52) | | #define GIIK_Left GII_KEY(GII_KT_SPEC, 52) | |
| #define GIIK_Right GII_KEY(GII_KT_SPEC, 53) | | #define GIIK_Right GII_KEY(GII_KT_SPEC, 53) | |
| #define GIIK_Prior GII_KEY(GII_KT_SPEC, 54) | | #define GIIK_Prior GII_KEY(GII_KT_SPEC, 54) | |
| #define GIIK_PageUp GIIK_Prior | | #define GIIK_PageUp GIIK_Prior | |
| | | | |
| skipping to change at line 451 | | skipping to change at line 451 | |
| #define GIIK_MetaLock (GIIK_Meta | GII_KM_LOCK) | | #define GIIK_MetaLock (GIIK_Meta | GII_KM_LOCK) | |
| #define GIIK_SuperLock (GIIK_Super | GII_KM_LOCK) | | #define GIIK_SuperLock (GIIK_Super | GII_KM_LOCK) | |
| #define GIIK_HyperLock (GIIK_Hyper | GII_KM_LOCK) | | #define GIIK_HyperLock (GIIK_Hyper | GII_KM_LOCK) | |
| #define GIIK_AltGrLock (GIIK_AltGr | GII_KM_LOCK) | | #define GIIK_AltGrLock (GIIK_AltGr | GII_KM_LOCK) | |
| #define GIIK_CapsLock (GIIK_Caps | GII_KM_LOCK) | | #define GIIK_CapsLock (GIIK_Caps | GII_KM_LOCK) | |
| #define GIIK_NumLock (GIIK_Num | GII_KM_LOCK) | | #define GIIK_NumLock (GIIK_Num | GII_KM_LOCK) | |
| #define GIIK_ScrollLock (GIIK_Scroll | GII_KM_LOCK) | | #define GIIK_ScrollLock (GIIK_Scroll | GII_KM_LOCK) | |
| | | | |
| /* miscellaneous */ | | /* miscellaneous */ | |
| | | | |
|
| #define GIIK_NIL 0xffff /* used to indicate "not mapped yet" */ | | #define GIIK_NIL 0xffff /* used to indicate "not mapped yet" */ | |
| #define GII_BUTTON_NIL 0xff /* used for pseudo keys (composed ones) */ | | #define GII_BUTTON_NIL 0xff /* used for pseudo keys (composed ones) */ | |
| | | | |
| /* ASCII keys */ | | /* ASCII keys */ | |
| #define GIIUC_Nul 0x00 | | #define GIIUC_Nul 0x00 | |
| #define GIIUC_BackSpace 0x08 | | #define GIIUC_BackSpace 0x08 | |
| #define GIIUC_Tab 0x09 | | #define GIIUC_Tab 0x09 | |
| #define GIIUC_Linefeed 0x0a | | #define GIIUC_Linefeed 0x0a | |
| #define GIIUC_Return 0x0d | | #define GIIUC_Return 0x0d | |
| #define GIIUC_Escape 0x1b | | #define GIIUC_Escape 0x1b | |
| #define GIIUC_Delete 0x7f | | #define GIIUC_Delete 0x7f | |
| | | | |
End of changes. 4 change blocks. |
| 4 lines changed or deleted | | 4 lines changed or added | |
|
| system.h | | system.h | |
|
| /* $Id: system.h.in,v 1.13 2004/03/29 11:57:03 pekberg Exp $ | | /* $Id: system.h.in,v 1.21 2005/09/05 05:35:36 pekberg Exp $ | |
| ***************************************************************************
*** | | ***************************************************************************
*** | |
| | | | |
| GGI - Architecture specific things (autogenerated by configure) | | GGI - Architecture specific things (autogenerated by configure) | |
| | | | |
| ***************************************************************************
*** | | ***************************************************************************
*** | |
| */ | | */ | |
| | | | |
| #ifndef _GGI_SYSTEM_H | | #ifndef _GGI_SYSTEM_H | |
| #define _GGI_SYSTEM_H | | #define _GGI_SYSTEM_H | |
| | | | |
| #include <stdlib.h> | | #include <stdlib.h> | |
| | | | |
|
| | | #include <inttypes.h> | |
| #include <sys/time.h> | | #include <sys/time.h> | |
| | | | |
| #ifndef __BEGIN_DECLS | | #ifndef __BEGIN_DECLS | |
| # ifdef __cplusplus | | # ifdef __cplusplus | |
| # define __BEGIN_DECLS extern "C" { | | # define __BEGIN_DECLS extern "C" { | |
| # define __END_DECLS } | | # define __END_DECLS } | |
| # else | | # else | |
| # define __BEGIN_DECLS /* empty */ | | # define __BEGIN_DECLS /* empty */ | |
| # define __END_DECLS /* empty */ | | # define __END_DECLS /* empty */ | |
| # endif | | # endif | |
| | | | |
| skipping to change at line 46 | | skipping to change at line 47 | |
| defined(_WIN32) | | defined(_WIN32) | |
| # define __WIN32__ | | # define __WIN32__ | |
| # endif | | # endif | |
| #endif /* ! __WIN32__ */ | | #endif /* ! __WIN32__ */ | |
| | | | |
| /* EXPORTVAR and IMPORTVAR are supposed to be used in | | /* EXPORTVAR and IMPORTVAR are supposed to be used in | |
| * declarations of exported and imported variables | | * declarations of exported and imported variables | |
| * respectively. | | * respectively. | |
| */ | | */ | |
| | | | |
|
| #ifdef __WIN32__ | | #if defined(__WIN32__) && defined(_MSC_VER) | |
| # define EXPORTVAR extern __declspec(dllexport) | | /* On win32 with MSVC, rely on the compiler/linker | |
| # define IMPORTVAR extern __declspec(dllimport) | | * to do the right thing if a variable is declared | |
| # define EXPORTFUNC __declspec(dllexport) | | * dllimport even if there is no need to import it | |
| # define IMPORTFUNC extern __declspec(dllimport) | | * from a dll (i.e. when linking statically). | |
| | | */ | |
| | | # define EXPORTVAR extern | |
| | | # define IMPORTVAR extern __declspec(dllimport) | |
| | | # define EXPORTFUNC /* empty */ | |
| | | # define IMPORTFUNC extern | |
| | | #elif defined(__WIN32__) | |
| | | /* But on win32, gcc can't build shared and static | |
| | | * libraries at the same time. auto-import should work | |
| | | * but it doesn't for variables (segfault in libggiwmh, | |
| | | * libgii and libggi seem fine by themselves). | |
| | | * So favour shared, and force users to configure | |
| | | * --disable-static. | |
| | | */ | |
| | | # define EXPORTVAR extern __declspec(dllexport) | |
| | | # define IMPORTVAR extern __declspec(dllimport) | |
| | | # define EXPORTFUNC __declspec(dllexport) | |
| | | # define IMPORTFUNC extern __declspec(dllimport) | |
| #else | | #else | |
| # define EXPORTVAR extern | | # define EXPORTVAR extern | |
| # define IMPORTVAR extern | | # define IMPORTVAR extern | |
| # define EXPORTFUNC /* empty */ | | # define EXPORTFUNC /* empty */ | |
| # define IMPORTFUNC extern | | # define IMPORTFUNC extern | |
| #endif | | #endif | |
| | | | |
|
| typedef signed char sint8; | | | |
| typedef unsigned char uint8; | | | |
| | | | |
| typedef signed short sint16; | | | |
| typedef unsigned short uint16; | | | |
| | | | |
| typedef signed int sint32; | | | |
| typedef unsigned int uint32; | | | |
| | | | |
| typedef signed int ggi_sint; | | | |
| typedef unsigned int ggi_uint; | | | |
| | | | |
| typedef signed int gg_sint; | | | |
| typedef unsigned int gg_uint; | | | |
| | | | |
| #define GG_HAVE_INT64 | | #define GG_HAVE_INT64 | |
| | | | |
|
| #ifdef GG_HAVE_INT64 | | /* If inttypes can not be found at compile time, GGI libraries (or any | |
| typedef signed long long sint64; | | * app) can define GG_NEED_INTTYPES at configure time to build anyway. | |
| typedef unsigned long long uint64; | | */ | |
| #endif | | #ifdef GG_NEED_INTTYPES | |
| | | typedef signed char int8_t; | |
| | | typedef unsigned char uint8_t; | |
| | | typedef signed short int16_t; | |
| | | typedef unsigned short uint16_t; | |
| | | typedef signed int int32_t; | |
| | | typedef unsigned int uint32_t; | |
| | | # ifdef GG_HAVE_INT64 | |
| | | typedef signed long long int64_t; | |
| | | typedef unsigned long long uint64_t; | |
| | | # endif | |
| | | #endif /* GG_NEED_INTTYPES */ | |
| | | | |
| | | /* If a GGI library or app has not been updated to the new inttypes | |
| | | * notation, it can define GG_NEED_OLD_INTTYPES in configure to build | |
| | | * the library anyway. | |
| | | */ | |
| | | #ifdef GG_NEED_OLD_INTTYPES | |
| | | /* Define old types for compatibility */ | |
| | | typedef int8_t sint8; | |
| | | typedef uint8_t uint8; | |
| | | typedef int16_t sint16; | |
| | | typedef uint16_t uint16; | |
| | | typedef int32_t sint32; | |
| | | typedef uint32_t uint32; | |
| | | # ifdef GG_HAVE_INT64 | |
| | | typedef int64_t sint64; | |
| | | typedef uint64_t uint64; | |
| | | # endif | |
| | | typedef signed int ggi_sint; | |
| | | typedef unsigned int ggi_uint; | |
| | | typedef signed int gg_sint; | |
| | | typedef unsigned int gg_uint; | |
| | | #endif /* GG_NEED_OLD_INTTYPES */ | |
| | | | |
| #define GGI_LITTLE_ENDIAN 1 | | #define GGI_LITTLE_ENDIAN 1 | |
| | | | |
| #ifdef GGI_LITTLE_ENDIAN | | #ifdef GGI_LITTLE_ENDIAN | |
| #define GG_LITTLE_ENDIAN | | #define GG_LITTLE_ENDIAN | |
| #endif | | #endif | |
| #ifdef GGI_BIG_ENDIAN | | #ifdef GGI_BIG_ENDIAN | |
| #define GG_BIG_ENDIAN | | #define GG_BIG_ENDIAN | |
| #endif | | #endif | |
| /* TODO: what about PDP endian? */ | | /* TODO: what about PDP endian? */ | |
| | | | |
|
| | | #ifndef ssize_t | |
| | | #define ssize_t ssize_t | |
| | | #endif | |
| | | | |
| #endif /* _GGI_SYSTEM_H */ | | #endif /* _GGI_SYSTEM_H */ | |
| | | | |
End of changes. 6 change blocks. |
| 25 lines changed or deleted | | 65 lines changed or added | |
|
| xwin.h | | xwin.h | |
|
| /* $Id: xwin.h,v 1.2 2004/04/05 23:11:33 ggibecka Exp $ | | /* $Id: xwin.h,v 1.3 2005/03/28 20:33:33 pekberg Exp $ | |
| ***************************************************************************
*** | | ***************************************************************************
*** | |
| | | | |
| Xwin inputlib - use an existing X window as a LibGII input source | | Xwin inputlib - use an existing X window as a LibGII input source | |
| | | | |
| Copyright (C) 1998 Marcus Sundberg [marcus@ggi-project.org] | | Copyright (C) 1998 Marcus Sundberg [marcus@ggi-project.org] | |
| | | | |
| Permission is hereby granted, free of charge, to any person obtaining a | | Permission is hereby granted, free of charge, to any person obtaining a | |
| copy of this software and associated documentation files (the "Software"
), | | copy of this software and associated documentation files (the "Software"
), | |
| to deal in the Software without restriction, including without limitatio
n | | to deal in the Software without restriction, including without limitatio
n | |
| the rights to use, copy, modify, merge, publish, distribute, sublicense, | | the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
| | | | |
| skipping to change at line 36 | | skipping to change at line 36 | |
| */ | | */ | |
| | | | |
| #ifndef _GGI_INPUT_XWIN_H | | #ifndef _GGI_INPUT_XWIN_H | |
| #define _GGI_INPUT_XWIN_H | | #define _GGI_INPUT_XWIN_H | |
| | | | |
| #include <X11/Xlib.h> | | #include <X11/Xlib.h> | |
| | | | |
| /* Returns non-zero if we should queue the expose event */ | | /* Returns non-zero if we should queue the expose event */ | |
| typedef int (gii_inputxwin_exposefunc)(void *arg, int x, int y, int w, int
h); | | typedef int (gii_inputxwin_exposefunc)(void *arg, int x, int y, int w, int
h); | |
| typedef int (gii_inputxwin_resizefunc)(void *arg, int w, int h, gii_event *
ev); | | typedef int (gii_inputxwin_resizefunc)(void *arg, int w, int h, gii_event *
ev); | |
|
| | | typedef int (gii_inputxwin_lockfunc)(void *arg); | |
| | | typedef int (gii_inputxwin_unlockfunc)(void *arg); | |
| | | | |
| typedef struct { | | typedef struct { | |
| Display *disp; /* Display to use */ | | Display *disp; /* Display to use */ | |
| Window win; /* Window to use */ | | Window win; /* Window to use */ | |
| int ptralwaysrel; /* Pointer events are always relative */ | | int ptralwaysrel; /* Pointer events are always relative */ | |
| int wait; /* Wait for SETPARAM event before being | | int wait; /* Wait for SETPARAM event before being | |
| usable */ | | usable */ | |
| gii_inputxwin_exposefunc *exposefunc; /* If this is non-null we call | | gii_inputxwin_exposefunc *exposefunc; /* If this is non-null we call | |
| the specified function to see if we shoul
d | | the specified function to see if we shoul
d | |
| send the expose event or not */ | | send the expose event or not */ | |
| void *exposearg; /* This is the argument we pass to exposefun
c*/ | | void *exposearg; /* This is the argument we pass to exposefun
c*/ | |
|
| void *gglock; /* If this is non-null we use it to ggLock() | | | |
| in the polling function */ | | | |
| gii_inputxwin_resizefunc *resizefunc; /* If this is non-null we call | | gii_inputxwin_resizefunc *resizefunc; /* If this is non-null we call | |
| the specified function to fill in a suita
ble | | the specified function to fill in a suita
ble | |
| event to send due to the resize if it ret
urns | | event to send due to the resize if it ret
urns | |
| 0. If it returns non-0, we don't queue an
y | | 0. If it returns non-0, we don't queue an
y | |
| event. */ | | event. */ | |
| void *resizearg; /* This is the argument we pass to resizefun
c*/ | | void *resizearg; /* This is the argument we pass to resizefun
c*/ | |
|
| | | gii_inputxwin_lockfunc *lockfunc; /* If this is non-null we call | |
| | | the specified function to lock the pollin | |
| | | g | |
| | | function */ | |
| | | void *lockarg; /* This is the argument we pass to lockfunc | |
| | | */ | |
| | | gii_inputxwin_unlockfunc *unlockfunc; /* If this is non-null we call | |
| | | the specified function to unlock the poll | |
| | | ing | |
| | | function */ | |
| | | void *unlockarg; /* This is the argument we pass to unlockfun | |
| | | c*/ | |
| } gii_inputxwin_arg; | | } gii_inputxwin_arg; | |
| | | | |
| /* Send this event to change parameters on the fly */ | | /* Send this event to change parameters on the fly */ | |
| #define GII_CMDCODE_XWINSETPARAM (0x01 | GII_CMDFLAG_PRIVATE) | | #define GII_CMDCODE_XWINSETPARAM (0x01 | GII_CMDFLAG_PRIVATE) | |
| typedef struct { | | typedef struct { | |
| Window win; | | Window win; | |
| int ptralwaysrel; | | int ptralwaysrel; | |
| Window parentwin; | | Window parentwin; | |
| } gii_xwin_cmddata_setparam; | | } gii_xwin_cmddata_setparam; | |
| | | | |
| | | | |
End of changes. 4 change blocks. |
| 3 lines changed or deleted | | 15 lines changed or added | |
|