(From update of attachment 446645)
In principal, this looks sensible to me.
>+ /**
>+ * Begin a window moving drag. We don't need an event.
>+ */
>+ NS_IMETHOD BeginMoveDrag() = 0;
>+ // get the current pointer position and button state
>+ GdkScreen* screen = NULL;
>+ gint screenX, screenY;
>+ GdkModifierType mask;
>+ gdk_display_get_pointer(display, &screen, &screenX, &screenY, &mask);
>+
>+ // we only support moving with button 1
>+ if (!(mask & GDK_BUTTON1_MASK)) {
>+ return NS_ERROR_FAILURE;
>+ }
>+
>+ // tell the window manager to start the move
>+ gdk_window_begin_move_drag(gdk_window, 1, screenX, screenY, GDK_CURRENT_TIME);
This really does need an event for the root window coordinates and timestamp.
If the user is dragging, the coordinates at the time of processing will often
differ from those of the ButtonPress. And a window drag is something that we
should be careful not to initiate on the wrong button press.
nsMouseEvents really deserve root window coordinates, but the easiest way to
implement this might be by setting nsGUIEvent::pluginEvent. BeginMoveDrag can
fail for synthetic events and WindowDraggingUtils will use the fallback code.
>+ // get the gdk window for this widget
>+ GdkWindow* gdk_window = mGdkWindow;
>+ if (!GDK_IS_WINDOW(gdk_window)) {
>+ return NS_ERROR_FAILURE;
>+ }
>+
Only test mGdkWindow against NULL. It won't be any other GObject type.
(From update of attachment 446645)
In principal, this looks sensible to me.
>+ /**
>+ * Begin a window moving drag. We don't need an event.
>+ */
>+ NS_IMETHOD BeginMoveDrag() = 0;
>+ // get the current pointer position and button state get_pointer( display, &screen, &screenX, &screenY, &mask); begin_move_ drag(gdk_ window, 1, screenX, screenY, GDK_CURRENT_TIME);
>+ GdkScreen* screen = NULL;
>+ gint screenX, screenY;
>+ GdkModifierType mask;
>+ gdk_display_
>+
>+ // we only support moving with button 1
>+ if (!(mask & GDK_BUTTON1_MASK)) {
>+ return NS_ERROR_FAILURE;
>+ }
>+
>+ // tell the window manager to start the move
>+ gdk_window_
This really does need an event for the root window coordinates and timestamp.
If the user is dragging, the coordinates at the time of processing will often
differ from those of the ButtonPress. And a window drag is something that we
should be careful not to initiate on the wrong button press.
nsMouseEvents really deserve root window coordinates, but the easiest way to :pluginEvent. BeginMoveDrag can
implement this might be by setting nsGUIEvent:
fail for synthetic events and WindowDraggingUtils will use the fallback code.
(I see that standards. freedesktop. org/wm- spec/1. 4/ar01s04. html#id2568642 adds MOVERESIZE_ CANCEL, but GDK doesn't yet support it, so I guess we won't
http://
_NET_WM_
worry about that.)
>+ // get the gdk window for this widget WINDOW( gdk_window) ) {
>+ GdkWindow* gdk_window = mGdkWindow;
>+ if (!GDK_IS_
>+ return NS_ERROR_FAILURE;
>+ }
>+
Only test mGdkWindow against NULL. It won't be any other GObject type.
>+ gdk_window = gdk_window_ get_toplevel( gdk_window) ; WINDOW( gdk_window) ) {
>+ if (!GDK_IS_
>+ return NS_ERROR_FAILURE;
>+ }
>+
>+
No need to check the result.
It won't be NULL because the parameter was not NULL.