Added root coords to button & motion events - sopwith

This commit is contained in:
Elliot Lee
1997-12-17 14:36:57 +00:00
parent 134466992b
commit 4c530ae5bc
6 changed files with 82 additions and 22 deletions

View File

@ -1755,6 +1755,8 @@ gdk_event_translate (GdkEvent *event,
event->button.time = xevent->xbutton.time; event->button.time = xevent->xbutton.time;
event->button.x = xevent->xbutton.x; event->button.x = xevent->xbutton.x;
event->button.y = xevent->xbutton.y; event->button.y = xevent->xbutton.y;
event->button.x_root = xevent->xbutton.x_root;
event->button.y_root = xevent->xbutton.y_root;
event->button.pressure = 0.5; event->button.pressure = 0.5;
event->button.xtilt = 0; event->button.xtilt = 0;
event->button.ytilt = 0; event->button.ytilt = 0;
@ -1826,6 +1828,8 @@ gdk_event_translate (GdkEvent *event,
event->motion.time = xevent->xmotion.time; event->motion.time = xevent->xmotion.time;
event->motion.x = xevent->xmotion.x; event->motion.x = xevent->xmotion.x;
event->motion.y = xevent->xmotion.y; event->motion.y = xevent->xmotion.y;
event->motion.x_root = xevent->xmotion.x_root;
event->motion.y_root = xevent->xmotion.y_root;
event->motion.pressure = 0.5; event->motion.pressure = 0.5;
event->motion.xtilt = 0; event->motion.xtilt = 0;
event->motion.ytilt = 0; event->motion.ytilt = 0;

View File

@ -807,6 +807,7 @@ struct _GdkEventMotion
gint16 is_hint; gint16 is_hint;
GdkInputSource source; GdkInputSource source;
guint32 deviceid; guint32 deviceid;
gdouble x_root, y_root;
}; };
struct _GdkEventButton struct _GdkEventButton
@ -823,6 +824,7 @@ struct _GdkEventButton
guint button; guint button;
GdkInputSource source; GdkInputSource source;
guint32 deviceid; guint32 deviceid;
gdouble x_root, y_root;
}; };
struct _GdkEventKey struct _GdkEventKey

View File

@ -1755,6 +1755,8 @@ gdk_event_translate (GdkEvent *event,
event->button.time = xevent->xbutton.time; event->button.time = xevent->xbutton.time;
event->button.x = xevent->xbutton.x; event->button.x = xevent->xbutton.x;
event->button.y = xevent->xbutton.y; event->button.y = xevent->xbutton.y;
event->button.x_root = xevent->xbutton.x_root;
event->button.y_root = xevent->xbutton.y_root;
event->button.pressure = 0.5; event->button.pressure = 0.5;
event->button.xtilt = 0; event->button.xtilt = 0;
event->button.ytilt = 0; event->button.ytilt = 0;
@ -1826,6 +1828,8 @@ gdk_event_translate (GdkEvent *event,
event->motion.time = xevent->xmotion.time; event->motion.time = xevent->xmotion.time;
event->motion.x = xevent->xmotion.x; event->motion.x = xevent->xmotion.x;
event->motion.y = xevent->xmotion.y; event->motion.y = xevent->xmotion.y;
event->motion.x_root = xevent->xmotion.x_root;
event->motion.y_root = xevent->xmotion.y_root;
event->motion.pressure = 0.5; event->motion.pressure = 0.5;
event->motion.xtilt = 0; event->motion.xtilt = 0;
event->motion.ytilt = 0; event->motion.ytilt = 0;

View File

@ -19,23 +19,27 @@
#include "gtkhandlebox.h" #include "gtkhandlebox.h"
static void gtk_handle_box_class_init (GtkHandleBoxClass *klass); static void gtk_handle_box_class_init (GtkHandleBoxClass *klass);
static void gtk_handle_box_init (GtkHandleBox *event_box); static void gtk_handle_box_init (GtkHandleBox *handle_box);
static void gtk_handle_box_realize (GtkWidget *widget); static void gtk_handle_box_realize (GtkWidget *widget);
static void gtk_handle_box_size_request (GtkWidget *widget, static void gtk_handle_box_size_request (GtkWidget *widget,
GtkRequisition *requisition); GtkRequisition *requisition);
static void gtk_handle_box_size_allocate (GtkWidget *widget, static void gtk_handle_box_size_allocate (GtkWidget *widget,
GtkAllocation *allocation); GtkAllocation *allocation);
static void gtk_handle_box_draw (GtkWidget *widget, static void gtk_handle_box_draw (GtkWidget *widget,
GdkRectangle *area); GdkRectangle *area);
static gint gtk_handle_box_expose (GtkWidget *widget, static gint gtk_handle_box_expose (GtkWidget *widget,
GdkEventExpose *event); GdkEventExpose *event);
static gint gtk_handle_box_button_changed(GtkWidget *widget,
GdkEventButton *event);
static gint gtk_handle_box_motion (GtkWidget *widget,
GdkEventMotion *event);
guint guint
gtk_handle_box_get_type () gtk_handle_box_get_type ()
{ {
static guint event_box_type = 0; static guint handle_box_type = 0;
if (!event_box_type) if (!event_box_type)
{ {
@ -49,10 +53,10 @@ gtk_handle_box_get_type ()
(GtkArgFunc) NULL, (GtkArgFunc) NULL,
}; };
event_box_type = gtk_type_unique (gtk_event_box_get_type (), &handle_box_info); handle_box_type = gtk_type_unique (gtk_event_box_get_type (), &handle_box_info);
} }
return event_box_type; return handle_box_type;
} }
static void static void
@ -67,15 +71,18 @@ gtk_handle_box_class_init (GtkHandleBoxClass *class)
widget_class->size_allocate = gtk_handle_box_size_allocate; widget_class->size_allocate = gtk_handle_box_size_allocate;
widget_class->draw = gtk_handle_box_draw; widget_class->draw = gtk_handle_box_draw;
widget_class->expose_event = gtk_handle_box_expose; widget_class->expose_event = gtk_handle_box_expose;
widget_class->button_press_event = gtk_handle_box_button_change;
widget_class->button_release_event = gtk_handle_box_button_change;
widget_class->motion_notify_event = gtk_handle_box_motion;
} }
static void static void
gtk_handle_box_init (GtkHandleBox *event_box) gtk_handle_box_init (GtkHandleBox *handle_box)
{ {
GTK_WIDGET_UNSET_FLAGS (event_box, GTK_NO_WINDOW); GTK_WIDGET_UNSET_FLAGS (handle_box, GTK_NO_WINDOW);
GTK_WIDGET_SET_FLAGS (event_box, GTK_BASIC); GTK_WIDGET_SET_FLAGS (handle_box, GTK_BASIC);
event_box->show_handle = TRUE; handle_box->is_being_dragged = FALSE;
event_box->real_parent = NULL; handle_box->real_parent = NULL;
} }
GtkWidget* GtkWidget*
@ -226,3 +233,43 @@ gtk_handle_box_expose (GtkWidget *widget,
return FALSE; return FALSE;
} }
static gint gtk_handle_box_button_changed(GtkWidget *widget,
GdkEventButton *event)
{
GtkHandleBox *hb;
g_return_val_if_fail(widget != NULL, FALSE);
g_return_val_if_fail(GTK_IS_HANDLE_BOX(widget), FALSE);
g_return_val_if_fail(event != NULL, FALSE);
hb = GTK_HANDLE_BOX(widget);
if(event->button == 0)
{
if(event->type == GDK_BUTTON_PRESS)
{
hb->is_being_dragged = TRUE;
real_parent = widget->parent;
gdk_window_set_override_redirect(hb->window, TRUE);
gdk_window_reparent(hb->window, GDK_ROOT_PARENT(),
event->x, event->y);
}
else if(event->type == GDK_BUTTON_RELEASE)
{
hb->is_being_dragged = FALSE;
}
}
}
static gint gtk_handle_box_motion (GtkWidget *widget,
GdkEventMotion *event)
{
GtkHandleBox *hb;
g_return_val_if_fail(widget != NULL, FALSE);
g_return_val_if_fail(GTK_IS_HANDLE_BOX(widget), FALSE);
g_return_val_if_fail(event != NULL, FALSE);
hb = GTK_HANDLE_BOX(widget);
if(hb->is_being_dragged) {
}
}

View File

@ -15,6 +15,7 @@
* License along with this library; if not, write to the Free * License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* The GtkHandleBox is to allow
#ifndef __GTK_HANDLE_BOX_H__ #ifndef __GTK_HANDLE_BOX_H__
#define __GTK_HANDLE_BOX_H__ #define __GTK_HANDLE_BOX_H__
@ -38,8 +39,9 @@ typedef struct _GtkHandleBoxClass GtkHandleBoxClass;
struct _GtkHandleBox struct _GtkHandleBox
{ {
GtkEventBox bin; GtkEventBox event_box;
GtkWidget *real_parent; GtkWidget *real_parent;
gboolean is_being_dragged;
}; };
struct _GtkHandleBoxClass struct _GtkHandleBoxClass

View File

@ -776,7 +776,8 @@ else
hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes hardcode_minus_L=yes
allow_undefined_flag=unsupported allow_undefined_flag=unsupported
archive_cmds='echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def;echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def;echo DATA >> $objdir/$libname.def;echo " SINGLE NONSHARED" >> $objdir/$libname.def;echo EXPORTS >> $objdir/$libname.def;emxexp$libobjs >> $objdir/$libname.def;$CC -Zdll -Zcrtdll -o $lib$libobjs $objdir/$libname.def' archive_cmds='echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def;echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def;echo DATA >> $objdir/$libname.def;echo " SINGLE NONSHARED" >> $objdir/$libname.def;echo EXPORTS >> $objdir/$libname.def;e
mxexp$libobjs >> $objdir/$libname.def;$CC -Zdll -Zcrtdll -o $lib$libobjs $objdir/$libname.def'
old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def' old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def'
;; ;;
@ -1351,7 +1352,7 @@ hardcode_action=$hardcode_action
# Flag to hardcode \$libdir into a binary during linking. # Flag to hardcode \$libdir into a binary during linking.
# This must work even if \$libdir does not exist. # This must work even if \$libdir does not exist.
hardcode_libdir_flag_spec="$hardcode_libdir_flag_spec" #hardcode_libdir_flag_spec="$hardcode_libdir_flag_spec"
# Whether we need a single -rpath flag with a separated argument. # Whether we need a single -rpath flag with a separated argument.
hardcode_libdir_separator="$hardcode_libdir_separator" hardcode_libdir_separator="$hardcode_libdir_separator"