GtkComponentPeer.java (insets): New field.
2003-10-02 Thomas Fitzsimmons <fitzsim@redhat.com> * gnu/java/awt/peer/gtk/GtkComponentPeer.java (insets): New field. (initializeInsets): New method. (GtkComponentPeer): Call initializeInsets. Call setCursor and setBounds unconditionally. (setBounds): Convert coordinates if parent is a Window. * gnu/java/awt/peer/gtk/GtkContainerPeer.java (insets): Move field to GtkComponentPeer. (GtkContainerPeer): Don't initialize insets. * gnu/java/awt/peer/gtk/GtkDialogPeer.java (initializeInsets): New method. (create): Call new GtkWindowPeer create method. * gnu/java/awt/peer/gtk/GtkFramePeer.java (initializeInsets): New method. (create): Call new GtkWindowPeer create method. (setBounds): Remove method. (postConfigureEvent): Likewise. * gnu/java/awt/peer/gtk/GtkWindowPeer.java: Replace GTK window type constants with GDK window type constants. (create(int,boolean,int,int,GtkWindowPeer)): New method. (create(int,boolean)): Likewise. (create()): Call create(int,boolean). (nativeSetBounds): New native method declaration. (setBounds): Call native method declaration. (setSize): New native method declaration. (setBoundsCallback): Likewise. (postConfigureEvent): Handle change in insets. Call setSize and setBoundsCallback methods. * java/awt/Window.java (Window): Set visible to false. (setBoundsCallback): New method. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c (gtkWidgetGetLocationOnScreen): If this component is not a container, adjust the location returned based on the peer's allocation. (set(String,boolean)): Revert change from 2003-09-19. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c (awt_event_handler): Fix inset calculation. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c: Add JNI glue for Window.setBoundsCallback. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c (create): Set up stacking order, window decorations and window manager hints. (setBoundsCallback): New method. (setSize): New method. (nativeSetBounds): New method. * jni/gtk-peer/gtkpeer.h: Declare setBoundsCallbackID. From-SVN: r72043
This commit is contained in:
parent
01d28c3ff9
commit
b59b508138
12 changed files with 316 additions and 107 deletions
|
@ -981,31 +981,40 @@ awt_event_handler (GdkEvent *event)
|
|||
if (widget && GTK_WIDGET_TOPLEVEL (widget))
|
||||
{
|
||||
gint top, left, right, bottom;
|
||||
gint x, y, w, h, wb, d;
|
||||
gint x, y, w, h, d;
|
||||
GdkRectangle r;
|
||||
|
||||
/* calculate our insets */
|
||||
gdk_window_get_root_geometry (event->any.window,
|
||||
&x, &y, &w, &h, &wb, &d);
|
||||
|
||||
/* We used to compute these based on the configure
|
||||
event's fields. However, that gives strange and
|
||||
apparently incorrect results. */
|
||||
top = left = bottom = right = 0;
|
||||
|
||||
/* configure events are not posted to the AWT event queue,
|
||||
and as such, gdk/gtk will be called back before
|
||||
postConfigureEvent returns */
|
||||
/* Configure events are not posted to the AWT event
|
||||
queue, and as such, the gdk/gtk peer functions will
|
||||
be called back before postConfigureEvent
|
||||
returns. */
|
||||
gdk_threads_leave ();
|
||||
(*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr,
|
||||
|
||||
/* Calculate our insets. */
|
||||
|
||||
/* When called from within the gdk_threads critical
|
||||
section these functions seem to return strange
|
||||
results, so we call them after
|
||||
gdk_threads_leave. */
|
||||
gdk_window_get_geometry (event->any.window,
|
||||
&x, &y, &w, &h, &d);
|
||||
gdk_window_get_frame_extents (event->any.window, &r);
|
||||
|
||||
top = y;
|
||||
left = x;
|
||||
bottom = r.height - h - y;
|
||||
right = r.width - w - x;
|
||||
|
||||
(*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr,
|
||||
postConfigureEventID,
|
||||
(jint)event->configure.x,
|
||||
(jint)event->configure.y,
|
||||
(jint)event->configure.width,
|
||||
(jint)event->configure.height,
|
||||
(jint)top,
|
||||
(jint)left,
|
||||
(jint)bottom,
|
||||
(jint)right);
|
||||
(jint) event->configure.x,
|
||||
(jint) event->configure.y,
|
||||
(jint) event->configure.width,
|
||||
(jint) event->configure.height,
|
||||
(jint) top,
|
||||
(jint) left,
|
||||
(jint) bottom,
|
||||
(jint) right);
|
||||
gdk_threads_enter ();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue