34 #include "../NativeWindowFromNode.h"
38 #include <gtk/gtkwindow.h>
41 #undef MOUSE_POSITION_FROM_EVENT
51 if (!aToplevelWindow) {
52 return NS_ERROR_FAILURE;
57 if (!GDK_IS_WINDOW(window)) {
58 return NS_ERROR_FAILURE;
62 window = gdk_window_get_toplevel(window);
63 if (!GDK_IS_WINDOW(window)) {
64 return NS_ERROR_FAILURE;
74 GdkWindow* gdkwindow = NULL;
75 GtkWindow* gtkwindow = NULL;
76 gpointer user_data = NULL;
81 NS_ENSURE_SUCCESS(rv, rv);
84 gdk_window_get_user_data(gdkwindow, &user_data);
86 return NS_ERROR_FAILURE;
90 gtkwindow = GTK_WINDOW(user_data);
93 *aToplevelWindow = gtkwindow;
104 PRUint32 server_time;
106 GdkWindowEdge window_edge;
108 NS_ENSURE_ARG_POINTER(aWindow);
109 NS_ENSURE_ARG_POINTER(aEvent);
113 NS_ENSURE_SUCCESS(rv, rv);
116 rv = aEvent->GetButton(&button);
117 NS_ENSURE_SUCCESS(rv, rv);
123 gdk_window_get_position(window, &screenX, &screenY);
125 gdk_window_move(window, screenX, screenY);
128 #ifdef MOUSE_POSITION_FROM_EVENT
130 rv = aEvent->GetScreenX(&screenX);
131 NS_ENSURE_SUCCESS(rv, rv);
132 rv = aEvent->GetScreenY(&screenY);
133 NS_ENSURE_SUCCESS(rv, rv);
137 GdkDisplay* display = NULL;
138 GdkScreen* screen = NULL;
139 GdkModifierType mask;
141 display = gdk_display_get_default();
142 if (display == NULL) {
143 return NS_ERROR_FAILURE;
146 gdk_display_get_pointer(display, &screen, &screenX, &screenY, &mask);
153 window_edge = GDK_WINDOW_EDGE_NORTH_WEST;
156 window_edge = GDK_WINDOW_EDGE_NORTH;
159 window_edge = GDK_WINDOW_EDGE_NORTH_EAST;
162 window_edge = GDK_WINDOW_EDGE_WEST;
165 window_edge = GDK_WINDOW_EDGE_EAST;
168 window_edge = GDK_WINDOW_EDGE_SOUTH_WEST;
171 window_edge = GDK_WINDOW_EDGE_SOUTH;
174 window_edge = GDK_WINDOW_EDGE_SOUTH_EAST;
177 return NS_ERROR_FAILURE;
181 server_time = gdk_x11_get_server_time(window);
184 gdk_window_begin_resize_drag(window, window_edge, button,
185 screenX, screenY, server_time);
191 NS_IMETHODIMP sbNativeWindowManager::GetSupportsResizeDrag(PRBool *aSupportsResizeDrag)
193 NS_ENSURE_ARG_POINTER(aSupportsResizeDrag);
195 *aSupportsResizeDrag = PR_TRUE;
201 NS_IMETHODIMP sbNativeWindowManager::SetMinimumWindowSize(
nsISupports *aWindow, PRInt32 aMinimumWidth, PRInt32 aMinimumHeight)
204 GdkWindow* window = NULL;
207 NS_ENSURE_ARG_POINTER(aWindow);
211 NS_ENSURE_SUCCESS(rv, rv);
214 hints.min_width = aMinimumWidth;
215 hints.min_height = aMinimumHeight;
216 gdk_window_set_geometry_hints(window, &hints, GDK_HINT_MIN_SIZE);
222 NS_IMETHODIMP sbNativeWindowManager::SetMaximumWindowSize(
nsISupports *aWindow, PRInt32 aMaximumWidth, PRInt32 aMaximumHeight)
224 return NS_ERROR_NOT_IMPLEMENTED;
228 NS_IMETHODIMP sbNativeWindowManager::GetSupportsMinimumWindowSize(PRBool *aSupportsMinimumWindowSize)
230 NS_ENSURE_ARG_POINTER(aSupportsMinimumWindowSize);
231 *aSupportsMinimumWindowSize = PR_TRUE;
236 NS_IMETHODIMP sbNativeWindowManager::GetSupportsMaximumWindowSize(PRBool *aSupportsMaximumWindowSize)
238 NS_ENSURE_ARG_POINTER(aSupportsMaximumWindowSize);
239 *aSupportsMaximumWindowSize = PR_FALSE;
244 NS_IMETHODIMP sbNativeWindowManager::SetOnTop(
nsISupports *aWindow, PRBool aOnTop)
247 GtkWindow* window = NULL;
249 NS_ENSURE_ARG_POINTER(aWindow);
258 NS_ENSURE_SUCCESS(rv, rv);
261 gtk_window_set_keep_above(window, aOnTop);
266 NS_IMETHODIMP sbNativeWindowManager::SetShadowing(
nsISupports *aWindow, PRBool aShadowing)
268 return NS_ERROR_NOT_IMPLEMENTED;
271 NS_IMETHODIMP sbNativeWindowManager::GetSupportsOnTop(PRBool *aSupportsOnTop)
273 NS_ENSURE_ARG_POINTER(aSupportsOnTop);
275 *aSupportsOnTop = PR_TRUE;
280 NS_IMETHODIMP sbNativeWindowManager::GetSupportsShadowing(PRBool *aSupportsShadowing)
282 NS_ENSURE_ARG_POINTER(aSupportsShadowing);
284 *aSupportsShadowing = PR_FALSE;
const PRInt32 DIRECTION_SOUTH_EAST
const PRInt32 DIRECTION_NORTH_EAST
static nsresult GetToplevelGtkWindow(nsISupports *aWindow, GtkWindow **aToplevelWindow)
const PRInt32 DIRECTION_SOUTH
const PRInt32 DIRECTION_SOUTH_WEST
NS_IMPL_ISUPPORTS1(sbDeviceCapabilitiesUtils, sbIDeviceCapabilitiesUtils) sbDeviceCapabilitiesUtils
const PRInt32 DIRECTION_WEST
static nsresult GetToplevelGdkWindow(nsISupports *aWindow, GdkWindow **aToplevelWindow)
const PRInt32 DIRECTION_EAST
interface to the operating system's window manager This Interfaces to allows JavaScript to talk to th...
const PRInt32 DIRECTION_NORTH
const PRInt32 DIRECTION_NORTH_WEST
static void * get(nsISupports *window)