2004-02-20 Mike Kestner <mkestner@ximian.com>

* gdk/Gdk.metadata : hide NoExpose, Client, Setting, WindowState,
	and Proximity events.
	* gdk/EventClient.cs : glue-based manual implementation.
	* gdk/EventClient.custom : kill
	* gdk/EventNoExpose.custom : kill
	* gdk/EventProximity.cs : glue-based manual implementation.
	* gdk/EventProximity.custom : kill
	* gdk/EventSetting.cs : glue-based manual implementation.
	* gdk/EventSetting.custom : kill
	* gdk/EventWindowState.cs : glue-based manual implementation.
	* gdk/EventWindowState.custom : kill
	* gdk/gdk-api.xml : regen
	* gdk/gdk-symbols.xml : manual mappings.
	* glue/event.cs : expose event struct fields.
	* gtk/Application.cs : simplify CurrentEvent prop.

svn path=/trunk/gtk-sharp/; revision=23300
This commit is contained in:
Mike Kestner 2004-02-20 22:33:32 +00:00
parent bb22b822a0
commit db137117c4
15 changed files with 266 additions and 177 deletions

View file

@ -1,3 +1,21 @@
2004-02-20 Mike Kestner <mkestner@ximian.com>
* gdk/Gdk.metadata : hide NoExpose, Client, Setting, WindowState,
and Proximity events.
* gdk/EventClient.cs : glue-based manual implementation.
* gdk/EventClient.custom : kill
* gdk/EventNoExpose.custom : kill
* gdk/EventProximity.cs : glue-based manual implementation.
* gdk/EventProximity.custom : kill
* gdk/EventSetting.cs : glue-based manual implementation.
* gdk/EventSetting.custom : kill
* gdk/EventWindowState.cs : glue-based manual implementation.
* gdk/EventWindowState.custom : kill
* gdk/gdk-api.xml : regen
* gdk/gdk-symbols.xml : manual mappings.
* glue/event.cs : expose event struct fields.
* gtk/Application.cs : simplify CurrentEvent prop.
2004-02-20 Mike Kestner <mkestner@ximian.com>
* gdk/Gdk.metadata : hide Property, Selection, and DND events

62
gdk/EventClient.cs Normal file
View file

@ -0,0 +1,62 @@
// Gdk.EventClient.cs - Custom client event wrapper
//
// Author: Mike Kestner <mkestner@ximian.com>
//
// (c) 2004 Novell, Inc.
namespace Gdk {
using System;
using System.Runtime.InteropServices;
public class EventClient : Event {
[DllImport("gtksharpglue")]
static extern uint gtksharp_gdk_event_client_get_time (IntPtr evt);
[DllImport("gtksharpglue")]
static extern IntPtr gtksharp_gdk_event_client_get_message_type (IntPtr evt);
[DllImport("gtksharpglue")]
static extern ushort gtksharp_gdk_event_client_get_data_format (IntPtr evt);
[DllImport("gtksharpglue")]
static extern IntPtr gtksharp_gdk_event_client_get_data (IntPtr evt);
public EventClient (IntPtr raw) : base (raw) {}
public Atom MessageType {
get {
return new Atom (gtksharp_gdk_event_client_get_message_type (Handle));
}
}
public ushort DataFormat {
get {
return gtksharp_gdk_event_client_get_data_format (Handle);
}
}
public Array Data {
get {
switch (DataFormat) {
case 8:
byte[] b = new byte [20];
Marshal.Copy (b, 0, gtksharp_gdk_event_client_get_data (Handle), 20);
return b;
case 16:
short[] s = new short [10];
Marshal.Copy (s, 0, gtksharp_gdk_event_client_get_data (Handle), 10);
return s;
case 32:
long[] l = new long [5];
Marshal.Copy (l, 0, gtksharp_gdk_event_client_get_data (Handle), 5);
return l;
default:
throw new Exception ("Invalid Data Format: " + DataFormat);
}
}
}
}
}

View file

@ -1,18 +0,0 @@
//
// gdk/EventClient.custom
//
// Author: Gustavo Giraldez <gustavo.giraldez@gmx.net>
//
// Copyright (C) 2004 Gustavo Giraldez.
//
[DllImport("libgdk-win32-2.0-0.dll")]
static extern IntPtr gdk_event_get_type();
public static GLib.GType GType {
get {
IntPtr raw_ret = gdk_event_get_type();
GLib.GType ret = new GLib.GType(raw_ret);
return ret;
}
}

View file

@ -1,18 +0,0 @@
//
// gdk/EventNoExpose.custom
//
// Author: Gustavo Giraldez <gustavo.giraldez@gmx.net>
//
// Copyright (C) 2004 Gustavo Giraldez.
//
[DllImport("libgdk-win32-2.0-0.dll")]
static extern IntPtr gdk_event_get_type();
public static GLib.GType GType {
get {
IntPtr raw_ret = gdk_event_get_type();
GLib.GType ret = new GLib.GType(raw_ret);
return ret;
}
}

35
gdk/EventProximity.cs Normal file
View file

@ -0,0 +1,35 @@
// Gdk.EventProximity.cs - Custom proximity event wrapper
//
// Author: Mike Kestner <mkestner@ximian.com>
//
// (c) 2004 Novell, Inc.
namespace Gdk {
using System;
using System.Runtime.InteropServices;
public class EventProximity : Event {
[DllImport("gtksharpglue")]
static extern uint gtksharp_gdk_event_proximity_get_time (IntPtr evt);
[DllImport("gtksharpglue")]
static extern IntPtr gtksharp_gdk_event_proximity_get_device (IntPtr evt);
public EventProximity (IntPtr raw) : base (raw) {}
public Device Device {
get {
return GLib.Object.GetObject (gtksharp_gdk_event_proximity_get_device (Handle)) as Device;
}
}
public uint Time {
get {
return gtksharp_gdk_event_proximity_get_time (Handle);
}
}
}
}

View file

@ -1,18 +0,0 @@
//
// gdk/EventProximity.custom
//
// Author: Gustavo Giraldez <gustavo.giraldez@gmx.net>
//
// Copyright (C) 2004 Gustavo Giraldez.
//
[DllImport("libgdk-win32-2.0-0.dll")]
static extern IntPtr gdk_event_get_type();
public static GLib.GType GType {
get {
IntPtr raw_ret = gdk_event_get_type();
GLib.GType ret = new GLib.GType(raw_ret);
return ret;
}
}

35
gdk/EventSetting.cs Normal file
View file

@ -0,0 +1,35 @@
// Gdk.EventSetting.cs - Custom Setting event wrapper
//
// Author: Mike Kestner <mkestner@ximian.com>
//
// (c) 2004 Novell, Inc.
namespace Gdk {
using System;
using System.Runtime.InteropServices;
public class EventSetting : Event {
[DllImport("gtksharpglue")]
static extern SettingAction gtksharp_gdk_event_setting_get_action (IntPtr evt);
[DllImport("gtksharpglue")]
static extern IntPtr gtksharp_gdk_event_setting_get_name (IntPtr evt);
public EventSetting (IntPtr raw) : base (raw) {}
public SettingAction Action {
get {
return gtksharp_gdk_event_setting_get_action (Handle);
}
}
public string Name {
get {
return Marshal.PtrToStringAnsi (gtksharp_gdk_event_setting_get_name (Handle));
}
}
}
}

View file

@ -1,18 +0,0 @@
//
// gdk/EventSetting.custom
//
// Author: Gustavo Giraldez <gustavo.giraldez@gmx.net>
//
// Copyright (C) 2004 Gustavo Giraldez.
//
[DllImport("libgdk-win32-2.0-0.dll")]
static extern IntPtr gdk_event_get_type();
public static GLib.GType GType {
get {
IntPtr raw_ret = gdk_event_get_type();
GLib.GType ret = new GLib.GType(raw_ret);
return ret;
}
}

35
gdk/EventWindowState.cs Normal file
View file

@ -0,0 +1,35 @@
// Gdk.EventWindowState.cs - Custom WindowState event wrapper
//
// Author: Mike Kestner <mkestner@ximian.com>
//
// (c) 2004 Novell, Inc.
namespace Gdk {
using System;
using System.Runtime.InteropServices;
public class EventWindowState : Event {
[DllImport("gtksharpglue")]
static extern WindowState gtksharp_gdk_event_window_state_get_changed_mask (IntPtr evt);
[DllImport("gtksharpglue")]
static extern WindowState gtksharp_gdk_event_window_state_get_new_window_state (IntPtr evt);
public EventWindowState (IntPtr raw) : base (raw) {}
public WindowState ChangedMask {
get {
return gtksharp_gdk_event_window_state_get_changed_mask (Handle);
}
}
public WindowState NewWindowState {
get {
return gtksharp_gdk_event_window_state_get_new_window_state (Handle);
}
}
}
}

View file

@ -1,18 +0,0 @@
//
// gdk/EventWindowState.custom
//
// Author: Gustavo Giraldez <gustavo.giraldez@gmx.net>
//
// Copyright (C) 2004 Gustavo Giraldez.
//
[DllImport("libgdk-win32-2.0-0.dll")]
static extern IntPtr gdk_event_get_type();
public static GLib.GType GType {
get {
IntPtr raw_ret = gdk_event_get_type();
GLib.GType ret = new GLib.GType(raw_ret);
return ret;
}
}

View file

@ -65,6 +65,7 @@
<attr path="//object[@cname='GdkWindow']/method[@name='SetIconList']" name="hidden">1</attr>
<attr path="//struct[@cname='GdkEventAny']" name="hidden">1</attr>
<attr path="//struct[@cname='GdkEventButton']" name="hidden">1</attr>
<attr path="//struct[@cname='GdkEventClient']" name="hidden">1</attr>
<attr path="//struct[@cname='GdkEventConfigure']" name="hidden">1</attr>
<attr path="//struct[@cname='GdkEventCrossing']" name="hidden">1</attr>
<attr path="//struct[@cname='GdkEventDND']" name="hidden">1</attr>
@ -72,10 +73,14 @@
<attr path="//struct[@cname='GdkEventFocus']" name="hidden">1</attr>
<attr path="//struct[@cname='GdkEventKey']" name="hidden">1</attr>
<attr path="//struct[@cname='GdkEventMotion']" name="hidden">1</attr>
<attr path="//struct[@cname='GdkEventNoExpose']" name="hidden">1</attr>
<attr path="//struct[@cname='GdkEventProperty']" name="hidden">1</attr>
<attr path="//struct[@cname='GdkEventProximity']" name="hidden">1</attr>
<attr path="//struct[@cname='GdkEventScroll']" name="hidden">1</attr>
<attr path="//struct[@cname='GdkEventSelection']" name="hidden">1</attr>
<attr path="//struct[@cname='GdkEventSetting']" name="hidden">1</attr>
<attr path="//struct[@cname='GdkEventVisibility']" name="hidden">1</attr>
<attr path="//struct[@cname='GdkEventWindowState']" name="hidden">1</attr>
<attr path="//struct[@cname='GdkPixmapObject']" name="hidden">1</attr>
<attr path="//struct[@cname='GdkRegion']" name="opaque">1</attr>
<attr path="//struct[@cname='GdkTimeCoord']/field[@cname='axes']" name="array_len">128</attr>

View file

@ -2284,7 +2284,7 @@
<field cname="x_root" type="gdouble" />
<field cname="y_root" type="gdouble" />
</struct>
<struct name="EventClient" cname="GdkEventClient">
<struct name="EventClient" cname="GdkEventClient" hidden="1">
<field cname="type" type="GdkEventType" />
<field cname="window" type="GdkWindow*" />
<field cname="send_event" type="gint8" />
@ -2365,7 +2365,7 @@
<field cname="x_root" type="gdouble" />
<field cname="y_root" type="gdouble" />
</struct>
<struct name="EventNoExpose" cname="GdkEventNoExpose">
<struct name="EventNoExpose" cname="GdkEventNoExpose" hidden="1">
<field cname="type" type="GdkEventType" />
<field cname="window" type="GdkWindow*" />
<field cname="send_event" type="gint8" />
@ -2378,7 +2378,7 @@
<field cname="time" type="guint32" />
<field cname="state" type="guint" />
</struct>
<struct name="EventProximity" cname="GdkEventProximity">
<struct name="EventProximity" cname="GdkEventProximity" hidden="1">
<field cname="type" type="GdkEventType" />
<field cname="window" type="GdkWindow*" />
<field cname="send_event" type="gint8" />
@ -2408,7 +2408,7 @@
<field cname="time" type="guint32" />
<field cname="requestor" type="GdkNativeWindow" />
</struct>
<struct name="EventSetting" cname="GdkEventSetting">
<struct name="EventSetting" cname="GdkEventSetting" hidden="1">
<field cname="type" type="GdkEventType" />
<field cname="window" type="GdkWindow*" />
<field cname="send_event" type="gint8" />
@ -2421,7 +2421,7 @@
<field cname="send_event" type="gint8" />
<field cname="state" type="GdkVisibilityState" />
</struct>
<struct name="EventWindowState" cname="GdkEventWindowState">
<struct name="EventWindowState" cname="GdkEventWindowState" hidden="1">
<field cname="type" type="GdkEventType" />
<field cname="window" type="GdkWindow*" />
<field cname="send_event" type="gint8" />

View file

@ -3,6 +3,7 @@
<symbol type="manual" cname="GdkEvent" name="Gdk.Event"/>
<symbol type="manual" cname="GdkEventAny" name="Gdk.Event"/>
<symbol type="manual" cname="GdkEventButton" name="Gdk.EventButton"/>
<symbol type="manual" cname="GdkEventClient" name="Gdk.EventClient"/>
<symbol type="manual" cname="GdkEventConfigure" name="Gdk.EventConfigure"/>
<symbol type="manual" cname="GdkEventCrossing" name="Gdk.EventCrossing"/>
<symbol type="manual" cname="GdkEventDND" name="Gdk.EventDND"/>
@ -10,9 +11,13 @@
<symbol type="manual" cname="GdkEventFocus" name="Gdk.EventFocus"/>
<symbol type="manual" cname="GdkEventKey" name="Gdk.EventKey"/>
<symbol type="manual" cname="GdkEventMotion" name="Gdk.EventMotion"/>
<symbol type="manual" cname="GdkEventNoExpose" name="Gdk.Event"/>
<symbol type="manual" cname="GdkEventProperty" name="Gdk.EventProperty"/>
<symbol type="manual" cname="GdkEventProximity" name="Gdk.EventProximity"/>
<symbol type="manual" cname="GdkEventScroll" name="Gdk.EventScroll"/>
<symbol type="manual" cname="GdkEventSelection" name="Gdk.EventSelection"/>
<symbol type="manual" cname="GdkEventSetting" name="Gdk.EventSetting"/>
<symbol type="manual" cname="GdkEventVisibility" name="Gdk.EventVisibility"/>
<symbol type="manual" cname="GdkEventWindowState" name="Gdk.EventWindowState"/>
</api>

View file

@ -30,7 +30,7 @@ gdouble* gtksharp_gdk_event_button_get_axes (GdkEventButton *event);
GdkDevice* gtksharp_gdk_event_button_get_device (GdkEventButton *event);
guint32 gtksharp_gdk_event_scroll_get_time (GdkEventScroll *event);
guint gtksharp_gdk_event_scroll_get_state (GdkEventScroll *event);
guint gtksharp_gdk_event_scroll_get_scroll_direction (GdkEventScroll *event);
guint gtksharp_gdk_event_scroll_get_direction (GdkEventScroll *event);
gdouble gtksharp_gdk_event_scroll_get_x (GdkEventScroll *event);
gdouble gtksharp_gdk_event_scroll_get_y (GdkEventScroll *event);
gdouble gtksharp_gdk_event_scroll_get_x_root (GdkEventScroll *event);
@ -76,6 +76,15 @@ guint32 gtksharp_gdk_event_dnd_get_time (GdkEventDND *event);
gshort gtksharp_gdk_event_dnd_get_x_root (GdkEventDND *event);
gshort gtksharp_gdk_event_dnd_get_y_root (GdkEventDND *event);
GdkDragContext* gtksharp_gdk_event_dnd_get_context (GdkEventDND *event);
GdkDevice* gtksharp_gdk_event_proximity_get_device (GdkEventProximity *event);
guint32 gtksharp_gdk_event_proximity_get_time (GdkEventProximity *event);
GdkAtom gtksharp_gdk_event_client_get_message_type (GdkEventClient *event);
gushort gtksharp_gdk_event_client_get_data_format (GdkEventClient *event);
gpointer gtksharp_gdk_event_client_get_data (GdkEventClient *event);
GdkWindowState gtksharp_gdk_event_window_state_get_changed_mask (GdkEventWindowState *event);
GdkWindowState gtksharp_gdk_event_window_state_get_new_window_state (GdkEventWindowState *event);
GdkSettingAction gtksharp_gdk_event_setting_get_action (GdkEventSetting *event);
char* gtksharp_gdk_event_setting_get_name (GdkEventSetting *event);
/* */
GdkEventType
@ -468,3 +477,57 @@ gtksharp_gdk_event_dnd_get_time (GdkEventDND *event)
return event->time;
}
GdkDevice*
gtksharp_gdk_event_proximity_get_device (GdkEventProximity *event)
{
return event->device;
}
guint32
gtksharp_gdk_event_proximity_get_time (GdkEventProximity *event)
{
return event->time;
}
GdkAtom
gtksharp_gdk_event_client_get_message_type (GdkEventClient *event)
{
return event->message_type;
}
gushort
gtksharp_gdk_event_client_get_data_format (GdkEventClient *event)
{
return event->data_format;
}
gpointer
gtksharp_gdk_event_client_get_data (GdkEventClient *event)
{
return &event->data;
}
GdkWindowState
gtksharp_gdk_event_window_state_get_changed_mask (GdkEventWindowState *event)
{
return event->changed_mask;
}
GdkWindowState
gtksharp_gdk_event_window_state_get_new_window_state (GdkEventWindowState *event)
{
return event->new_window_state;
}
GdkSettingAction
gtksharp_gdk_event_setting_get_action (GdkEventSetting *event)
{
return event->action;
}
char*
gtksharp_gdk_event_setting_get_name (GdkEventSetting *event)
{
return event->name;
}

View file

@ -118,88 +118,9 @@ namespace Gtk {
[DllImport("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_get_current_event ();
public static object CurrentEvent {
public static Gdk.Event CurrentEvent {
get {
IntPtr handle = gtk_get_current_event ();
Gdk.EventType type;
type = (Gdk.EventType) Marshal.ReadInt32 (handle);
switch (type){
case EventType.Delete:
case EventType.Destroy:
// Fixme: do not know what this maps to.
break;
case EventType.Expose:
return Marshal.PtrToStructure (handle, typeof (Gdk.EventExpose));
case EventType.MotionNotify:
return Marshal.PtrToStructure (handle, typeof (Gdk.EventMotion));
case EventType.ButtonPress:
case EventType.TwoButtonPress:
case EventType.ThreeButtonPress:
case EventType.ButtonRelease:
return Marshal.PtrToStructure (handle, typeof (Gdk.EventButton));
case EventType.KeyPress:
case EventType.KeyRelease:
return Marshal.PtrToStructure (handle, typeof (Gdk.EventKey));
case EventType.EnterNotify:
case EventType.LeaveNotify:
// FIXME: Do not know what this maps to.
break;
case EventType.FocusChange:
return Marshal.PtrToStructure (handle, typeof (Gdk.EventFocus));
case EventType.Configure:
return Marshal.PtrToStructure (handle, typeof (Gdk.EventConfigure));
case EventType.Map:
case EventType.Unmap:
// FIXME: Do not know what this maps to.
break;
case EventType.PropertyNotify:
return Marshal.PtrToStructure (handle, typeof (Gdk.EventProperty));
case EventType.SelectionClear:
case EventType.SelectionRequest:
case EventType.SelectionNotify:
return Marshal.PtrToStructure (handle, typeof (Gdk.EventSelection));
case EventType.ProximityIn:
case EventType.ProximityOut:
return Marshal.PtrToStructure (handle, typeof (Gdk.EventProximity));
case EventType.DragEnter:
case EventType.DragLeave:
case EventType.DragMotion:
case EventType.DragStatus:
case EventType.DropFinished:
return Marshal.PtrToStructure (handle, typeof (Gdk.EventDND));
case EventType.ClientEvent:
return Marshal.PtrToStructure (handle, typeof (Gdk.EventClient));
case EventType.VisibilityNotify:
return Marshal.PtrToStructure (handle, typeof (Gdk.EventVisibility));
case EventType.NoExpose:
return Marshal.PtrToStructure (handle, typeof (Gdk.EventNoExpose));
case EventType.Scroll:
return Marshal.PtrToStructure (handle, typeof (Gdk.EventScroll));
case EventType.WindowState:
return Marshal.PtrToStructure (handle, typeof (Gdk.EventWindowState));
case EventType.Setting:
return Marshal.PtrToStructure (handle, typeof (Gdk.EventSetting));
}
return null;
return new Gdk.Event (gtk_get_current_event ());
}
}
}