コード例 #1
0
ファイル: clutter-stage-gdk.c プロジェクト: ebassi/clutter
static void
clutter_stage_gdk_set_gdk_geometry (ClutterStageGdk *stage)
{
  GdkGeometry geometry;
  ClutterStage *wrapper = CLUTTER_STAGE_COGL (stage)->wrapper;
  gboolean resize = clutter_stage_get_user_resizable (wrapper);

  if (!resize)
    {
      geometry.min_width = geometry.max_width = gdk_window_get_width (stage->window);
      geometry.min_height = geometry.max_height = gdk_window_get_height (stage->window);

      gdk_window_set_geometry_hints (stage->window,
				     &geometry,
				     GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE);
    }
  else
    {
      clutter_stage_get_minimum_size (wrapper,
				      (guint *)&geometry.min_width,
				      (guint *)&geometry.min_height);

      gdk_window_set_geometry_hints (stage->window,
				     &geometry,
				     GDK_HINT_MIN_SIZE);
    }
}
コード例 #2
0
ファイル: GdkWindow.c プロジェクト: cyberpython/java-gnome
JNIEXPORT void JNICALL
Java_org_gnome_gdk_GdkWindow_gdk_1window_1set_1geometry_1hints
(
	JNIEnv* env,
	jclass cls,
	jlong _self,
	jlong _geometry,
	jint _flags
)
{
	GdkWindow* self;
	GdkGeometry* geometry;
	GdkWindowHints flags;

	// convert parameter self
	self = (GdkWindow*) _self;

	// convert parameter geometry
	geometry = (GdkGeometry*) _geometry;

	// convert parameter flags
	flags = (GdkWindowHints) _flags;

	// call function
	gdk_window_set_geometry_hints(self, geometry, flags);

	// cleanup parameter self

	// cleanup parameter geometry

	// cleanup parameter flags
}
コード例 #3
0
ファイル: preview.c プロジェクト: RandomEngy/HandBrake
void
preview_set_render_size(signal_user_data_t *ud, int width, int height)
{
    GtkWidget     * widget;
    GtkWindow     * window;
    GdkWindow     * w;
    GdkGeometry     geo;

    widget = GHB_WIDGET (ud->builder, "preview_image");
    gtk_widget_set_size_request(widget, width, height);
    window = GTK_WINDOW(GHB_WIDGET(ud->builder, "preview_window"));
    gtk_window_unmaximize(window);
    gtk_window_resize(window, width, height);
    w = gtk_widget_get_window(GTK_WIDGET(window));
    if (w != NULL)
    {
        geo.min_aspect = (double)(width - 4) / height;
        geo.max_aspect = (double)(width + 4) / height;
        geo.width_inc = geo.height_inc = 2;
        gdk_window_set_geometry_hints(w, &geo,
                                      GDK_HINT_ASPECT|GDK_HINT_RESIZE_INC);
    }

    ud->preview->render_width = width;
    ud->preview->render_height = height;
}
コード例 #4
0
ファイル: rbgdkwindow.c プロジェクト: geoffyoungs/ruby-gnome2
static VALUE
gdkwin_set_geometry_hints(VALUE self, VALUE geometry, VALUE geom_mask)
{
    gdk_window_set_geometry_hints(_SELF(self), 
                                  NIL_P(geometry) ? (GdkGeometry*)NULL : (GdkGeometry*)RVAL2BOXED(geometry, GDK_TYPE_GEOMETRY),
                                  RVAL2GFLAGS(geom_mask, GDK_TYPE_WINDOW_HINTS));
    return self;
}
コード例 #5
0
static VALUE
rg_set_geometry_hints(VALUE self, VALUE geometry, VALUE geom_mask)
{
    gdk_window_set_geometry_hints(_SELF(self), 
                                  NIL_P(geometry) ? (GdkGeometry*)NULL : RVAL2GDKGEOMETRY(geometry),
                                  RVAL2GDKWINDOWHINTS(geom_mask));
    return self;
}
コード例 #6
0
ファイル: dock.c プロジェクト: oberon2007/dde-workspace
void _update_dock_size(gint16 x, gint16 y, guint16 w, guint16 h)
{
    GdkGeometry geo = {0};
    geo.min_width = 0;
    geo.min_height = 0;

    gdk_window_set_geometry_hints(WEBVIEW_GDK_WINDOW(), &geo, GDK_HINT_MIN_SIZE);
    gdk_window_set_geometry_hints(DOCK_GDK_WINDOW(), &geo, GDK_HINT_MIN_SIZE);
    gdk_flush();

    g_debug("[%s] %dx%d(%d, %d)", __func__, w, h, x, y);
    gdk_window_move_resize(DOCK_GDK_WINDOW(), x, y, w, h);
    gdk_window_move_resize(WEBVIEW_GDK_WINDOW(), 0, 0, w, h);

    gdk_flush();

    dock_change_workarea_height(GD.dock_height);
}
コード例 #7
0
ファイル: image.c プロジェクト: pts/pts-qiv
static void setup_win(qiv_image *q)
{
  GdkWindowAttr attr;
  GdkPixmap *cursor_pixmap;

  if (!fullscreen) {
    attr.window_type=GDK_WINDOW_TOPLEVEL;
    attr.wclass=GDK_INPUT_OUTPUT;
    attr.event_mask=GDK_ALL_EVENTS_MASK;
    attr.x = center ? q->win_x : 0;
    attr.y = center ? q->win_y : 0;
    attr.width  = q->win_w;
    attr.height = q->win_h;
    q->win = gdk_window_new(NULL, &attr, GDK_WA_X|GDK_WA_Y);

    if (center) {
      GdkGeometry geometry = {
        .min_width = q->win_w,
        .min_height = q->win_h,
        .max_width = q->win_w,
        .max_height = q->win_h,
        .win_gravity = GDK_GRAVITY_STATIC
      };
      gdk_window_set_geometry_hints(q->win, &geometry,
        GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE | GDK_HINT_WIN_GRAVITY);
      gdk_window_move_resize(q->win, q->win_x, q->win_y, q->win_w, q->win_h);
    } else {
      GdkGeometry geometry = {
        .min_width = q->win_w,
        .min_height = q->win_h,
        .max_width = q->win_w,
        .max_height = q->win_h,
      };
      gdk_window_set_geometry_hints(q->win, &geometry,
        GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE);
      gdk_window_resize(q->win, q->win_w, q->win_h);
    }

    gdk_window_show(q->win);

  } else { /* fullscreen */
コード例 #8
0
ファイル: panel.c プロジェクト: johannesthoma/ubiquity
/* At some point subclass GtkWindow instead. */
static void
on_realize(GtkWidget *win, gpointer data) {
	guint width;
	GtkAllocation allocation;
	gtk_widget_get_allocation(win, &allocation);
	width = gdk_screen_width();
	gtk_window_set_decorated (GTK_WINDOW (win), FALSE);
	set_strut(GTK_WINDOW(win), width, 0, allocation.height, allocation.height, 0, width);
	// We don't care about showing the panel on all desktops just yet.
	gtk_window_stick (GTK_WINDOW (win));
	gtk_window_set_type_hint(GTK_WINDOW(win), GDK_WINDOW_TYPE_HINT_DOCK);
	gdk_window_set_geometry_hints (gtk_widget_get_window(win), NULL, GDK_HINT_POS);
	gdk_window_move_resize(gtk_widget_get_window(win), 0, 0, width, allocation.height);
	gtk_window_set_has_resize_grip(GTK_WINDOW(win), FALSE);
}
コード例 #9
0
ファイル: gtk.c プロジェクト: Centuriondan/xlennart
static void
gtk_ui_make_main_window(int size) {
	GdkWindowHints flags;
	GdkGeometry geom;
	gint winwidth, winheight;

	screensize = size;

	base = gtk_vbox_new(FALSE, 0);
	gtk_container_add(GTK_CONTAINER(toplevel), base);

	menubar = CreateMenuBar();
	gtk_box_pack_start(GTK_BOX(base), menubar, FALSE, FALSE, 0);

	field = CreateDrawingArea(size, size);
	gtk_box_pack_start(GTK_BOX(base), field, FALSE, FALSE, 0);

	gtk_signal_connect(GTK_OBJECT(field), "button-press-event",
			   GTK_SIGNAL_FUNC(button_press), NULL);
	gtk_signal_connect(GTK_OBJECT(field), "button-release-event",
			   GTK_SIGNAL_FUNC(button_release), NULL);
	gtk_signal_connect(GTK_OBJECT(field), "enter-notify-event",
			   GTK_SIGNAL_FUNC(enter_window), NULL);
	gtk_signal_connect(GTK_OBJECT(field), "leave-notify-event",
			   GTK_SIGNAL_FUNC(leave_window), NULL);
	gtk_signal_connect(GTK_OBJECT(field), "expose-event",
			   GTK_SIGNAL_FUNC(redraw_window), NULL);
	gtk_widget_set_events(field, GDK_BUTTON_PRESS_MASK |
			      GDK_BUTTON_RELEASE_MASK |
			      GDK_ENTER_NOTIFY_MASK |
			      GDK_LEAVE_NOTIFY_MASK |
			      GDK_EXPOSURE_MASK);

	gtk_widget_show_all(toplevel);

	gdk_window_get_size(toplevel->window, &winwidth, &winheight);
	geom.min_width = geom.max_width = geom.base_width = winwidth;
	geom.min_height = geom.max_height = geom.base_height = winheight;
	geom.width_inc = geom.height_inc = 0;
	flags = GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE | GDK_HINT_BASE_SIZE |
		GDK_HINT_RESIZE_INC;
	gdk_window_set_geometry_hints(toplevel->window, &geom, flags);

	gdk_color_parse("white", &white);
	gdk_color_parse("black", &black);
}
コード例 #10
0
NS_IMETHODIMP sbNativeWindowManager::SetMinimumWindowSize(nsISupports *aWindow, PRInt32 aMinimumWidth, PRInt32 aMinimumHeight)
{
  nsresult rv;
  GdkWindow* window = NULL;
  GdkGeometry hints;

  NS_ENSURE_ARG_POINTER(aWindow);

  /* find the window that was passed in */
  rv = GetToplevelGdkWindow(aWindow, &window);
  NS_ENSURE_SUCCESS(rv, rv);

  /* set up the GdkGeometry with the info we have */
  hints.min_width = aMinimumWidth;
  hints.min_height = aMinimumHeight;
  gdk_window_set_geometry_hints(window, &hints, GDK_HINT_MIN_SIZE);

  return NS_OK;
}
コード例 #11
0
ファイル: emuwin.c プロジェクト: tiagocasalribeiro/tilem
/* Set size hints for the toplevel window */
static void set_size_hints(GtkWidget *widget, gpointer data)
{
	TilemEmulatorWindow *ewin = data;

	/* Don't use gtk_window_set_geometry_hints() (which would
	   appear to do what we want) because, in addition to setting
	   the hints we want, that function causes GTK+ to argue with
	   the window manager.

	   Instead, we call this function after the check-resize
	   signal (which is when GTK+ itself would normally set the
	   hints.)

	   FIXME: check that this works as desired on Win32/Quartz. */

	if (gtk_widget_get_window(widget))
		gdk_window_set_geometry_hints(gtk_widget_get_window(widget),
		                              &ewin->geomhints,
		                              ewin->geomhintmask);
}
コード例 #12
0
void widget_move_by_rect(GtkWidget* widget,struct DisplayInfo info)
{
    GdkGeometry geo = {0};
    geo.min_height = 0;
    geo.min_width = 0;

    gboolean realized = gtk_widget_get_realized(widget);
    g_message("[%s] realized: %d, info: %d*%d(%d, %d)\n", __func__, realized,
              info.width, info.height, info.x, info.y);
    if (!realized) {
        gtk_window_set_geometry_hints(GTK_WINDOW(widget), NULL, &geo,
                                      GDK_HINT_MIN_SIZE);
        gtk_widget_set_size_request(widget, info.width, info.height);
        gtk_window_move(GTK_WINDOW(widget), info.x, info.y);
    } else {
        GdkWindow* gdk = gtk_widget_get_window(widget);
        gdk_window_set_geometry_hints(gdk, &geo, GDK_HINT_MIN_SIZE);
        gdk_window_move_resize(gdk, info.x, info.y,info.width,info.height );
    }
}
コード例 #13
0
ファイル: dock.c プロジェクト: oberon2007/dde-workspace
void container_size_workaround(GtkWidget* container, GdkRectangle* allocation)
{
    static GRWLock lock;
    g_rw_lock_writer_lock(&lock);
    update_primary_info(&dock);
    g_rw_lock_writer_unlock(&lock);
    if (gtk_widget_get_realized(container) && (dock.width != allocation->width || dock.height != allocation->height)) {
        GdkWindow* w = gtk_widget_get_window(container);
        GdkGeometry geo = {0};
        geo.min_width = 0;
        geo.min_height = 0;

        gdk_window_set_geometry_hints(w, &geo, GDK_HINT_MIN_SIZE);
        XSelectInput(gdk_x11_get_default_xdisplay(), GDK_WINDOW_XID(w), NoEventMask);
        gdk_window_move_resize(w, dock.x, dock.y, dock.width, dock.height);
        gdk_flush();
        gdk_window_set_events(w, gdk_window_get_events(w));

        g_warning("[%s] size workaround run fix (%d,%d) to (%d,%d)\n",
                  __func__,
                  allocation->width, allocation->height,
                  dock.width, dock.height);
    }
}