int clip_GDK_WINDOWSETHINTS(ClipMachine * cm) { C_widget *cwin = _fetch_cw_arg(cm); gint x = INT_OPTION(cm,2,-1); gint y = INT_OPTION(cm,3,-1); gint min_width = INT_OPTION(cm,4,-1); gint min_height = INT_OPTION(cm,5,-1); gint max_width = INT_OPTION(cm,6,-1); gint max_height = INT_OPTION(cm,7,-1); gint flags = INT_OPTION(cm,8,0); GdkWindow *win = NULL; CHECKCWID(cwin,GTK_IS_WIDGET); CHECKOPT(2,NUMERIC_t); CHECKOPT(3,NUMERIC_t); CHECKOPT(4,NUMERIC_t); CHECKOPT(5,NUMERIC_t); CHECKOPT(6,NUMERIC_t); CHECKOPT(7,NUMERIC_t); CHECKOPT(8,NUMERIC_t); CHECKCWID(cwin,GTK_IS_WIDGET); if (cwin && cwin->widget) win = cwin->widget->window; gdk_window_set_hints(win,x,y,min_width,min_height,max_width,max_height,flags); return 0; err: return 1; }
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 eplay_load_image() { if (im) { gdk_imlib_kill_image(im); im = NULL; } if(!p[image_idx]) { im = gdk_imlib_load_image(image_names[image_idx]); } if (first) { w = org_w = im->rgb_width; h = org_h = im->rgb_height; win_x = (screen_x - w) / 2; win_y = (screen_y - h) / 2; attr.window_type = GDK_WINDOW_TEMP; attr.wclass = GDK_INPUT_OUTPUT; attr.event_mask = GDK_ALL_EVENTS_MASK; attr.x = attr.y = 0; attr.width = screen_x; attr.height = screen_y; parent = NULL; win = gdk_window_new(parent, &attr, ATTRIBUTES_MASK); gdk_window_show(win); gc = gdk_gc_new(win); first = 0; gdk_window_set_background(win, &color_bg); gdk_keyboard_grab(win, FALSE, CurrentTime); gdk_pointer_grab(win, FALSE, event_mask, NULL, cursor, CurrentTime); gdk_window_set_hints(win, win_x, win_y, w, h, w, h, GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE | GDK_HINT_POS); } /* gdk_imlib_free_pixmap(p[image_idx]); */ /* killing old pixmap */ if(!p[image_idx]) { gdk_imlib_render(im, w, h); /* Imlib render ... */ p[image_idx] = gdk_imlib_move_image(im); /* creating new */ } gdk_draw_pixmap(win, gc, p[image_idx], 0, 0, win_x, win_y, w, h); gdk_window_show(win); /* display image */ }