static gboolean animation_timeout_cb (gpointer user_data) { GdNotification *notification = GD_NOTIFICATION (user_data); GdNotificationPrivate *priv = notification->priv; GtkAllocation allocation; int target, delta; target = animation_target (notification); if (priv->animate_y != target) { gtk_widget_get_allocation (GTK_WIDGET (notification), &allocation); delta = allocation.height * ANIMATION_STEP / ANIMATION_TIME; if (priv->revealed) priv->animate_y += delta; else priv->animate_y -= delta; priv->animate_y = CLAMP (priv->animate_y, 0, allocation.height); if (priv->bin_window != NULL) gdk_window_move (priv->bin_window, 0, -allocation.height + priv->animate_y); return TRUE; } if (priv->dismissed && priv->animate_y == 0) gtk_widget_destroy (GTK_WIDGET (notification)); priv->animate_timeout = 0; return FALSE; }
void gtk_window_set_win_position (GtkWidget *widget, gint x, gint y) { /* this is an quick & dirty hack */ g_return_if_fail (widget); g_return_if_fail (GTK_WINDOW (widget)); if ((x >= 0) && (y >= 0)) gtk_widget_set_uposition (widget, x,y); else { /* g_message ("Negative warp to %d,%d", x,y); */ if (! GTK_WIDGET_REALIZED (widget)) gtk_widget_realize (widget); widget -> allocation.x = x; widget -> allocation.y = y; gdk_window_set_hints (widget->window, x, y, 0, 0, 0, 0, GDK_HINT_POS); gdk_window_move (widget->window, x,y); } }
void ZoneClassInfoToolTipWindow::handleCursorMovement(int x, int y, OovStringRef str) { if(!mTopWindow) { mTopWindow = gtk_window_new(GTK_WINDOW_POPUP); mLabel = GTK_LABEL(gtk_label_new(nullptr)); // This doesn't fix the left justify // gtk_label_set_justify(mLabel, GTK_JUSTIFY_LEFT); gtk_container_add(GTK_CONTAINER(mTopWindow), GTK_WIDGET(mLabel)); } Gui::setText(mLabel, str); Gui::setVisible(mTopWindow, true); // If the focus isn't grabbed, the drawing area won't get the // focus-out event. gtk_widget_grab_focus(getDiagramWidget()); // Position tooltip window relative to the drawing area window. // If it clips on the right, then move it left. GdkWindow *drawWin = gtk_widget_get_window(getDiagramWidget()); GdkWindow *tipWin = gtk_widget_get_window(GTK_WIDGET(mTopWindow)); int winX; int winY; gdk_window_get_origin(drawWin, &winX, &winY); int padHeight = 10; x += winX; y += winY + padHeight; int screenWidth = gdk_screen_get_width(gtk_widget_get_screen(mTopWindow)); int winWidth = gdk_window_get_width(tipWin); if(x+winWidth > screenWidth) x = screenWidth - winWidth; gdk_window_move(tipWin, x, y); }
static void timeline_frame_cb (GsdTimeline *timeline, gdouble progress, gpointer user_data) { GsdLocatePointerData *data = (GsdLocatePointerData *) user_data; GdkScreen *screen; gint cursor_x, cursor_y; if (gtk_widget_is_composited (data->widget)) { gdk_window_invalidate_rect (data->window, NULL, FALSE); data->progress = progress; } else if (progress >= data->progress + CIRCLES_PROGRESS_INTERVAL) { /* only invalidate window each circle interval */ update_shape (data); gdk_window_invalidate_rect (data->window, NULL, FALSE); data->progress += CIRCLES_PROGRESS_INTERVAL; } screen = gdk_drawable_get_screen (data->window); gdk_window_get_pointer (gdk_screen_get_root_window (screen), &cursor_x, &cursor_y, NULL); gdk_window_move (data->window, cursor_x - WINDOW_SIZE / 2, cursor_y - WINDOW_SIZE / 2); }
JNIEXPORT void JNICALL Java_org_gnome_gdk_GdkWindow_gdk_1window_1move ( JNIEnv* env, jclass cls, jlong _self, jint _x, jint _y ) { GdkWindow* self; gint x; gint y; // convert parameter self self = (GdkWindow*) _self; // convert parameter x x = (gint) _x; // convert parameter y y = (gint) _y; // call function gdk_window_move(self, x, y); // cleanup parameter self // cleanup parameter x // cleanup parameter y }
static gboolean dt_bauhaus_popup_scroll(GtkWidget *widget, GdkEventScroll *event, gpointer user_data) { gtk_widget_queue_draw(darktable.bauhaus->popup_area); dt_bauhaus_widget_t *w = darktable.bauhaus->current; switch(w->type) { case DT_BAUHAUS_COMBOBOX: { gint wx, wy; GtkWidget *w = GTK_WIDGET(darktable.bauhaus->current); const int ht = w->allocation.height; const int skip = ht + get_line_space(); gdk_window_get_origin (gtk_widget_get_window (w), &wx, &wy); dt_bauhaus_combobox_data_t *d = &darktable.bauhaus->current->data.combobox; if(event->direction == GDK_SCROLL_UP) dt_bauhaus_combobox_set(w, CLAMP(d->active-1, 0, d->num_labels-1)); else dt_bauhaus_combobox_set(w, CLAMP(d->active+1, 0, d->num_labels-1)); gdk_window_move(gtk_widget_get_window(darktable.bauhaus->popup_window), wx, wy - d->active * skip); } break; case DT_BAUHAUS_SLIDER: break; default: break; } return TRUE; }
void GTKWindow::DockCheck(void) { if (!m_bIsDockWindow) return; gdk_threads_enter(); Pos dock = GetFocusPos(); gdk_threads_leave(); if (dock.x == -1 && dock.y == -1) return; if (dock.x <= 0) dock.x = 1; if (dock.y <= 0) dock.y = 1; dock.x += m_oDockPos.x; dock.y += m_oDockPos.y; if (dock.x != lastDockPos.x || dock.y != lastDockPos.y) { if (dock.x > 0 && dock.y > 0) { gdk_threads_enter(); gdk_window_move(mainWindow->window, dock.x, dock.y); gdk_window_raise(mainWindow->window); gdk_threads_leave(); lastDockPos.x = dock.x; lastDockPos.y = dock.y; } } }
Error GTKWindow::SetWindowPosition(Rect &oWindowRect) { gdk_threads_enter(); gdk_window_move(mainWindow->window, oWindowRect.x1, oWindowRect.y1); gdk_threads_leave(); return kError_NoErr; }
static void move_window(GtkWidget *widget, guint x, guint y, gpointer data) { if (GTK_IS_WIDGET(data)) { if ((GTK_WIDGET(data))->window) { gdk_window_move((GTK_WIDGET(data))->window, x, y); } } }
static void move_window_cb (G_GNUC_UNUSED GtkWidget *widgets, guint x, guint y, gpointer data) { DEBUG_FUNCTION ("move_window_cb"); DEBUG_ASSERT (data != NULL); if (GTK_IS_WIDGET(data)) if (gtk_widget_get_window (GTK_WIDGET (data))) gdk_window_move (gtk_widget_get_window (GTK_WIDGET (data)), x, y); }
void mainwindow_show() { // Show window gtk_widget_show (mainwindow_data.window); // Move window to old position if requested if (plugin_config->save_window_pos && plugin_config->winpos_x!=-1 && plugin_config->winpos_y!=-1) { gdk_window_move (mainwindow_data.window->window,plugin_config->winpos_x,plugin_config->winpos_y); } }
void gtk_xtbin_set_position (GtkXtBin *xtbin, gint x, gint y) { xtbin->x = x; xtbin->y = y; if (gtk_widget_get_realized (GTK_WIDGET(xtbin))) gdk_window_move (gtk_widget_get_window(GTK_WIDGET (xtbin)), x, y); }
void gtk_xtbin_set_position (GtkXtBin *xtbin, gint x, gint y) { xtbin->x = x; xtbin->y = y; if (GTK_WIDGET_REALIZED (xtbin)) gdk_window_move (GTK_WIDGET (xtbin)->window, x, y); }
static void move_window(GtkWidget *widget, guint x, guint y, gpointer data) { GdkWindow *window; if (GTK_IS_WIDGET(data)) { window = gtk_widget_get_window(GTK_WIDGET(data)); if (window) { gdk_window_move(window, x, y); } } }
void mainwindow_sigmotion (GtkWidget *widget,GdkEventMotion *event,gpointer callback_data) { if (mainwindow_data.window_moving) { gint mx,my,newx,newy; GdkModifierType modmask; // Get Position gdk_window_get_pointer (NULL,&mx,&my,&modmask); // Moving window newx = mx-mainwindow_data.movement_x; newy = my-mainwindow_data.movement_y; gdk_window_move (mainwindow_data.window->window,newx,newy); plugin_config->winpos_x = newx; plugin_config->winpos_y = newy; } }
static gboolean display_animation_func(gpointer data) { DISPLAY_INFO* di = (DISPLAY_INFO*) data; if (di->x + di->width < 0) { gtk_widget_destroy(di->popup); di->popup = NULL; notifications = g_list_remove(notifications, di); free_display_info(di); return FALSE; } if (!di->hover) di->x -= 10; gdk_window_move(di->popup->window, di->x, di->y); return TRUE; }
static GdkWindow* get_dnd_window() { if (dnd_window == NULL) { GdkWindowAttr attr; memset(&attr, 0, sizeof (GdkWindowAttr)); attr.override_redirect = TRUE; attr.window_type = GDK_WINDOW_TEMP; attr.type_hint = GDK_WINDOW_TYPE_HINT_UTILITY; attr.wclass = GDK_INPUT_OUTPUT; attr.event_mask = GDK_ALL_EVENTS_MASK; dnd_window = gdk_window_new(NULL, &attr, GDK_WA_NOREDIR | GDK_WA_TYPE_HINT); gdk_window_move(dnd_window, -100, -100); gdk_window_resize(dnd_window, 1, 1); gdk_window_show(dnd_window); } return dnd_window; }
void ViewOvBox_SetFraction(ViewOvBox *that, // IN double fraction) // IN { g_return_if_fail(that != NULL); g_return_if_fail(fraction >=0 && fraction <= 1); that->priv->fraction = fraction; if (gtk_widget_get_realized(GTK_WIDGET (that))) { int x; int y; int width; int height; ViewOvBoxGetOverGeometry(that, &x, &y, &width, &height); gdk_window_move(that->priv->overWin, x, y); } }
static gboolean gd_stack_set_transition_position (GdStack *stack, gdouble pos) { GdStackPrivate *priv = stack->priv; gboolean done; priv->transition_pos = pos; gtk_widget_queue_draw (GTK_WIDGET (stack)); if (priv->bin_window != NULL && (priv->transition_type == GD_STACK_TRANSITION_TYPE_SLIDE_LEFT || priv->transition_type == GD_STACK_TRANSITION_TYPE_SLIDE_RIGHT)) { GtkAllocation allocation; gtk_widget_get_allocation (GTK_WIDGET (stack), &allocation); gdk_window_move (priv->bin_window, get_bin_window_x (stack, &allocation), 0); } done = pos >= 1.0; if (done || priv->last_visible_surface != NULL) { if (priv->last_visible_child) { gtk_widget_set_child_visible (priv->last_visible_child->widget, FALSE); priv->last_visible_child = NULL; } } if (done) { if (priv->last_visible_surface != NULL) { cairo_surface_destroy (priv->last_visible_surface); priv->last_visible_surface = NULL; } gtk_widget_queue_resize (GTK_WIDGET (stack)); } return done; }
static void term_app_request_resize_move(VteTerminal *term, guint x, guint y, gpointer user_data) { int event = GPOINTER_TO_INT(user_data); if (event == TERM_RESIZE_WINDOW) { gint owidth, oheight, xpad, ypad; gtk_window_get_size(GTK_WINDOW(mainwindow), &owidth, &oheight); owidth -= term->char_width * term->column_count; oheight -= term->char_height * term->row_count; vte_terminal_get_padding(term, &xpad, &ypad); owidth -= xpad; oheight -= ypad; gtk_window_resize(GTK_WINDOW(mainwindow), x+owidth, y+oheight); } if (event == TERM_MOVE_WINDOW) { gdk_window_move(GTK_WIDGET(mainwindow)->window, x, y); } }
static void move_window_clicked (GtkWidget *button, gpointer data) { GdkWindow *window; GtkDirectionType direction; GList *selected, *l; gint x, y; direction = GPOINTER_TO_INT (data); selected = get_selected_windows (); for (l = selected; l != NULL; l = l->next) { window = l->data; gdk_window_get_position (window, &x, &y); switch (direction) { case GTK_DIR_UP: y -= 10; break; case GTK_DIR_DOWN: y += 10; break; case GTK_DIR_LEFT: x -= 10; break; case GTK_DIR_RIGHT: x += 10; break; default: break; } gdk_window_move (window, x, y); } g_list_free (selected); }
static void timeline_frame_cb (GsdTimeline *timeline, gdouble progress, gpointer user_data) { GsdLocatePointerData *data = (GsdLocatePointerData *) user_data; gint cursor_x, cursor_y; if (gtk_widget_is_composited (data->widget)) { gdk_window_invalidate_rect (data->window, NULL, FALSE); data->progress = progress; } else if (progress >= data->progress + CIRCLES_PROGRESS_INTERVAL) { /* only invalidate window each circle interval */ update_shape (data); gdk_window_invalidate_rect (data->window, NULL, FALSE); data->progress += CIRCLES_PROGRESS_INTERVAL; } // // gdk_window_get_pointer (gdk_screen_get_root_window (screen), // &cursor_x, &cursor_y, NULL); // use gdk_device_get_position instead of gdk_window_get_device_position // 'coz we use root window here. GdkDisplay *display; GdkDeviceManager * device_manager; GdkDevice* pointer_device; display = gdk_window_get_display (data->window); device_manager = gdk_display_get_device_manager (display); pointer_device = gdk_device_manager_get_client_pointer (device_manager); gdk_device_get_position (pointer_device, NULL, &cursor_x, &cursor_y); // gdk_window_move (data->window, cursor_x - WINDOW_SIZE / 2, cursor_y - WINDOW_SIZE / 2); }
void cairo_dock_place_desklet (CairoDesklet *pDesklet, CairoDockMinimalAppletConfig *pMinimalConfig) { cd_message ("%s (%dx%d ; (%d,%d) ; %d,%d,%d)", __func__, pMinimalConfig->iDeskletWidth, pMinimalConfig->iDeskletHeight, pMinimalConfig->iDeskletPositionX, pMinimalConfig->iDeskletPositionY, pMinimalConfig->bKeepBelow, pMinimalConfig->bKeepAbove, pMinimalConfig->bOnWidgetLayer); if (pMinimalConfig->bDeskletUseSize) gdk_window_resize (pDesklet->pWidget->window, pMinimalConfig->iDeskletWidth, pMinimalConfig->iDeskletHeight); gdk_window_move(pDesklet->pWidget->window, pMinimalConfig->iDeskletPositionX, pMinimalConfig->iDeskletPositionY); gtk_window_set_keep_below (GTK_WINDOW (pDesklet->pWidget), pMinimalConfig->bKeepBelow); gtk_window_set_keep_above (GTK_WINDOW (pDesklet->pWidget), pMinimalConfig->bKeepAbove); Window Xid = GDK_WINDOW_XID (pDesklet->pWidget->window); if (pMinimalConfig->bOnWidgetLayer) cairo_dock_set_xwindow_type_hint (Xid, "_NET_WM_WINDOW_TYPE_UTILITY"); // le hide-show le fait deconner completement, il perd son skip_task_bar ! au moins sous KDE. else cairo_dock_set_xwindow_type_hint (Xid, "_NET_WM_WINDOW_TYPE_NORMAL"); pDesklet->bPositionLocked = pMinimalConfig->bPositionLocked; }
/* copied from panel-toplevel.c */ static void _window_move_resize_window (CsmFailWhaleDialog *window, gboolean move, gboolean resize) { GtkWidget *widget; widget = GTK_WIDGET (window); g_assert (gtk_widget_get_realized (widget)); if (window->priv->debug_mode) return; g_debug ("Move and/or resize window x=%d y=%d w=%d h=%d", window->priv->geometry.x, window->priv->geometry.y, window->priv->geometry.width, window->priv->geometry.height); if (move && resize) { gdk_window_move_resize (gtk_widget_get_window (widget), window->priv->geometry.x, window->priv->geometry.y, window->priv->geometry.width, window->priv->geometry.height); } else if (move) { gdk_window_move (gtk_widget_get_window (widget), window->priv->geometry.x, window->priv->geometry.y); } else if (resize) { gdk_window_resize (gtk_widget_get_window (widget), window->priv->geometry.width, window->priv->geometry.height); } }
static VALUE gdkwin_move(VALUE self, VALUE x, VALUE y) { gdk_window_move(_SELF(self), NUM2INT(x), NUM2INT(y)); return self; }
void gldi_desklet_configure (CairoDesklet *pDesklet, CairoDeskletAttr *pAttribute) { //g_print ("%s (%dx%d ; (%d,%d) ; %d)\n", __func__, pAttribute->iDeskletWidth, pAttribute->iDeskletHeight, pAttribute->iDeskletPositionX, pAttribute->iDeskletPositionY, pAttribute->iVisibility); if (pAttribute->bDeskletUseSize && (pAttribute->iDeskletWidth != pDesklet->container.iWidth || pAttribute->iDeskletHeight != pDesklet->container.iHeight)) { pDesklet->iDesiredWidth = pAttribute->iDeskletWidth; pDesklet->iDesiredHeight = pAttribute->iDeskletHeight; gdk_window_resize (gldi_container_get_gdk_window (CAIRO_CONTAINER (pDesklet)), pAttribute->iDeskletWidth, pAttribute->iDeskletHeight); } if (! pAttribute->bDeskletUseSize) { gtk_container_set_border_width (GTK_CONTAINER (pDesklet->container.pWidget), 0); gtk_window_set_resizable (GTK_WINDOW(pDesklet->container.pWidget), FALSE); } int iAbsolutePositionX = (pAttribute->iDeskletPositionX < 0 ? gldi_desktop_get_width() + pAttribute->iDeskletPositionX : pAttribute->iDeskletPositionX); iAbsolutePositionX = MAX (0, MIN (gldi_desktop_get_width() - pAttribute->iDeskletWidth, iAbsolutePositionX)); int iAbsolutePositionY = (pAttribute->iDeskletPositionY < 0 ? gldi_desktop_get_height() + pAttribute->iDeskletPositionY : pAttribute->iDeskletPositionY); iAbsolutePositionY = MAX (0, MIN (gldi_desktop_get_height() - pAttribute->iDeskletHeight, iAbsolutePositionY)); //g_print (" let's place the deklet at (%d;%d)", iAbsolutePositionX, iAbsolutePositionY); if (pAttribute->bOnAllDesktops) { gtk_window_stick (GTK_WINDOW (pDesklet->container.pWidget)); gdk_window_move (gldi_container_get_gdk_window (CAIRO_CONTAINER (pDesklet)), iAbsolutePositionX, iAbsolutePositionY); } else { gtk_window_unstick (GTK_WINDOW (pDesklet->container.pWidget)); if (g_desktopGeometry.iNbViewportX > 0 && g_desktopGeometry.iNbViewportY > 0) { int iNumDesktop, iNumViewportX, iNumViewportY; iNumDesktop = pAttribute->iNumDesktop / (g_desktopGeometry.iNbViewportX * g_desktopGeometry.iNbViewportY); int index2 = pAttribute->iNumDesktop % (g_desktopGeometry.iNbViewportX * g_desktopGeometry.iNbViewportY); iNumViewportX = index2 / g_desktopGeometry.iNbViewportY; iNumViewportY = index2 % g_desktopGeometry.iNbViewportY; int iCurrentDesktop, iCurrentViewportX, iCurrentViewportY; gldi_desktop_get_current (&iCurrentDesktop, &iCurrentViewportX, &iCurrentViewportY); cd_debug (">>> on fixe le desklet sur le bureau (%d,%d,%d) (cur : %d,%d,%d)", iNumDesktop, iNumViewportX, iNumViewportY, iCurrentDesktop, iCurrentViewportX, iCurrentViewportY); iNumViewportX -= iCurrentViewportX; iNumViewportY -= iCurrentViewportY; cd_debug ("on le place en %d + %d", iNumViewportX * gldi_desktop_get_width(), iAbsolutePositionX); gldi_container_move (CAIRO_CONTAINER (pDesklet), iNumDesktop, iNumViewportX * gldi_desktop_get_width() + iAbsolutePositionX, iNumViewportY * gldi_desktop_get_height() + iAbsolutePositionY); } } pDesklet->bPositionLocked = pAttribute->bPositionLocked; pDesklet->bNoInput = pAttribute->bNoInput; pDesklet->fRotation = pAttribute->iRotation / 180. * G_PI ; pDesklet->fDepthRotationY = pAttribute->iDepthRotationY / 180. * G_PI ; pDesklet->fDepthRotationX = pAttribute->iDepthRotationX / 180. * G_PI ; g_free (pDesklet->cDecorationTheme); pDesklet->cDecorationTheme = pAttribute->cDecorationTheme; pAttribute->cDecorationTheme = NULL; gldi_desklet_decoration_free (pDesklet->pUserDecoration); pDesklet->pUserDecoration = pAttribute->pUserDecoration; pAttribute->pUserDecoration = NULL; gldi_desklet_set_accessibility (pDesklet, pAttribute->iVisibility, FALSE); //cd_debug ("%s (%dx%d ; %d)", __func__, pDesklet->iDesiredWidth, pDesklet->iDesiredHeight, pDesklet->iSidWriteSize); if (pDesklet->iDesiredWidth == 0 && pDesklet->iDesiredHeight == 0 && pDesklet->iSidWriteSize == 0) { gldi_desklet_load_desklet_decorations (pDesklet); } }
void gtk_pizza_scroll (GtkPizza *pizza, gint dx, gint dy) { GtkWidget *widget; XEvent xevent; XID win; gint x,y,w,h,border; widget = GTK_WIDGET (pizza); pizza->xoffset += dx; pizza->yoffset += dy; if (!GTK_WIDGET_MAPPED (pizza)) { gtk_pizza_position_children (pizza); return; } gtk_pizza_adjust_allocations (pizza, -dx, -dy); if (pizza->shadow_type == GTK_MYSHADOW_NONE) border = 0; else if (pizza->shadow_type == GTK_MYSHADOW_THIN) border = 1; else border = 2; x = 0; y = 0; w = widget->allocation.width - 2*border; h = widget->allocation.height - 2*border; if (dx > 0) { if (gravity_works) { gdk_window_resize (pizza->bin_window, w + dx, h); gdk_window_move (pizza->bin_window, x-dx, y); gdk_window_move_resize (pizza->bin_window, x, y, w, h ); } else { /* FIXME */ } } else if (dx < 0) { if (gravity_works) { gdk_window_move_resize (pizza->bin_window, x + dx, y, w - dx, h); gdk_window_move (pizza->bin_window, x, y); gdk_window_resize (pizza->bin_window, w, h ); } else { /* FIXME */ } } if (dy > 0) { if (gravity_works) { gdk_window_resize (pizza->bin_window, w, h + dy); gdk_window_move (pizza->bin_window, x, y-dy); gdk_window_move_resize (pizza->bin_window, x, y, w, h ); } else { /* FIXME */ } } else if (dy < 0) { if (gravity_works) { gdk_window_move_resize (pizza->bin_window, x, y+dy, w, h - dy ); gdk_window_move (pizza->bin_window, x, y); gdk_window_resize (pizza->bin_window, w, h ); } else { /* FIXME */ } } gtk_pizza_position_children (pizza); gdk_flush(); win = GDK_WINDOW_XWINDOW (pizza->bin_window); while (XCheckIfEvent(GDK_WINDOW_XDISPLAY (pizza->bin_window), &xevent, gtk_pizza_expose_predicate, (XPointer)&win)) { GdkEvent event; GtkWidget *event_widget; if ((xevent.xany.window == GDK_WINDOW_XWINDOW (pizza->bin_window)) ) gtk_pizza_filter (&xevent, &event, pizza); if (xevent.type == Expose) { event.expose.window = gdk_window_lookup (xevent.xany.window); gdk_window_get_user_data (event.expose.window, (gpointer *)&event_widget); if (event_widget) { event.expose.type = GDK_EXPOSE; event.expose.area.x = xevent.xexpose.x; event.expose.area.y = xevent.xexpose.y; event.expose.area.width = xevent.xexpose.width; event.expose.area.height = xevent.xexpose.height; event.expose.count = xevent.xexpose.count; gdk_window_ref (event.expose.window); gtk_widget_event (event_widget, &event); gdk_window_unref (event.expose.window); } } } }
NS_IMETHODIMP sbNativeWindowManager::BeginResizeDrag(nsISupports *aWindow, nsIDOMMouseEvent* aEvent, PRInt32 aDirection) { nsresult rv; PRInt32 screenX; PRInt32 screenY; PRUint16 button; PRUint32 server_time; GdkWindow* window = NULL; GdkWindowEdge window_edge; NS_ENSURE_ARG_POINTER(aWindow); NS_ENSURE_ARG_POINTER(aEvent); /* find the window that was passed in */ rv = GetToplevelGdkWindow(aWindow, &window); NS_ENSURE_SUCCESS(rv, rv); /* get the currently pressed mouse button from the event */ rv = aEvent->GetButton(&button); NS_ENSURE_SUCCESS(rv, rv); /* mozilla and gtk disagree about button numbering... */ button++; /* to work around an old, buggy metacity we need to move ourselves */ /* where are we? */ gdk_window_get_position(window, &screenX, &screenY); /* let's move to there */ gdk_window_move(window, screenX, screenY); #ifdef MOUSE_POSITION_FROM_EVENT /* pull the mouse position out of the mozilla event */ rv = aEvent->GetScreenX(&screenX); NS_ENSURE_SUCCESS(rv, rv); rv = aEvent->GetScreenY(&screenY); NS_ENSURE_SUCCESS(rv, rv); #else { /* ask X where the mouse is */ GdkDisplay* display = NULL; GdkScreen* screen = NULL; GdkModifierType mask; /* get the current (default) display */ display = gdk_display_get_default(); if (display == NULL) { return NS_ERROR_FAILURE; } /* get the current pointer position */ gdk_display_get_pointer(display, &screen, &screenX, &screenY, &mask); } #endif /* convert interface directions to GDK_WINDOW_EDGE* */ switch(aDirection) { case sbINativeWindowManager::DIRECTION_NORTH_WEST: window_edge = GDK_WINDOW_EDGE_NORTH_WEST; break; case sbINativeWindowManager::DIRECTION_NORTH: window_edge = GDK_WINDOW_EDGE_NORTH; break; case sbINativeWindowManager::DIRECTION_NORTH_EAST: window_edge = GDK_WINDOW_EDGE_NORTH_EAST; break; case sbINativeWindowManager::DIRECTION_WEST: window_edge = GDK_WINDOW_EDGE_WEST; break; case sbINativeWindowManager::DIRECTION_EAST: window_edge = GDK_WINDOW_EDGE_EAST; break; case sbINativeWindowManager::DIRECTION_SOUTH_WEST: window_edge = GDK_WINDOW_EDGE_SOUTH_WEST; break; case sbINativeWindowManager::DIRECTION_SOUTH: window_edge = GDK_WINDOW_EDGE_SOUTH; break; case sbINativeWindowManager::DIRECTION_SOUTH_EAST: window_edge = GDK_WINDOW_EDGE_SOUTH_EAST; break; default: return NS_ERROR_FAILURE; } /* if I were an event, when would I happen? */ server_time = gdk_x11_get_server_time(window); /* tell the window manager to start the resize */ gdk_window_begin_resize_drag(window, window_edge, button, screenX, screenY, server_time); return NS_OK; }
int main (int argc, char **argv) { GtkWidget *panel, *panel2, *button, *button2, *button3, *button4, *window, *window2, *window_t, *socket, *sbold; Display *display; Window win; Atom atoms[3]; gtk_init (&argc,&argv); socket = g_object_new (STATUSBAR_TYPE_ITEM_SOCKET,NULL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); window2 = gtk_window_new (GTK_WINDOW_TOPLEVEL); window_t = gtk_window_new (GTK_WINDOW_TOPLEVEL); panel = g_object_new (DESKTOP_TYPE_PANEL,NULL); panel2 = g_object_new (DESKTOP_TYPE_PANEL,"orientation",GTK_ORIENTATION_VERTICAL,NULL); gtk_window_set_type_hint( GTK_WINDOW(window),GDK_WINDOW_TYPE_HINT_DOCK); gtk_window_set_type_hint( GTK_WINDOW(window2),GDK_WINDOW_TYPE_HINT_DOCK); gtk_window_set_type_hint( GTK_WINDOW(window_t),GDK_WINDOW_TYPE_HINT_DESKTOP); gtk_widget_realize (GTK_WIDGET (window_t)); gtk_widget_set_size_request (GTK_WIDGET (window_t), gdk_screen_width (), gdk_screen_height ()); gtk_window_set_decorated (GTK_WINDOW (window),FALSE); gtk_widget_realize (window); gtk_widget_realize (window2); gtk_widget_set_size_request (GTK_WIDGET (panel),300,40); gtk_widget_set_size_request (GTK_WIDGET (panel2),80,gdk_screen_height ()); button = gtk_button_new_with_label("Testing"); button2 = GTK_WIDGET (statusbar_item_wrapper_new ("load","/usr/lib/hildon-status-bar/libload.so",FALSE)); button4 = GTK_WIDGET (hn_app_switcher_new ()); button3 = GTK_WIDGET (tasknavigator_item_wrapper_new ("contacts","/usr/lib/hildon-navigator/libosso-contact-plugin.so")); sbold = gtk_button_new_with_label("Testing 4"); gtk_box_pack_start (GTK_BOX (panel),button, FALSE,FALSE,0); gtk_box_pack_start (GTK_BOX (panel),socket, FALSE,FALSE,0); gtk_box_pack_start (GTK_BOX (panel),button2, FALSE,FALSE,0); gtk_box_pack_start (GTK_BOX (panel),sbold, FALSE,FALSE,0); gtk_box_pack_start (GTK_BOX (panel2),button3, FALSE,FALSE,0); gtk_box_pack_start (GTK_BOX (panel2),button4, FALSE,FALSE,0); gtk_container_add (GTK_CONTAINER (window),panel); gtk_container_add (GTK_CONTAINER (window2),panel2); gtk_widget_realize (socket); printf ("%d\n",hildon_desktop_item_socket_get_id (HILDON_DESKTOP_ITEM_SOCKET(socket))); gtk_widget_show_all (window_t); gtk_widget_show_all (window); gtk_widget_show_all (window2); gdk_window_move (GDK_WINDOW (window->window), 400, 0); gtk_main(); return 0; }
void moz_drawingarea_move (MozDrawingarea *drawingarea, gint x, gint y) { gdk_window_move(drawingarea->clip_window, x, y); }