Example #1
0
static gboolean
gdk_monitor_has_fullscreen_window (GdkMonitor *monitor)
{
    GdkScreen *screen = gdk_display_get_default_screen (monitor->display);
    GList *toplevels, *l;
    GdkWindow *window;
    gboolean has_fullscreen;

    toplevels = gdk_screen_get_toplevel_windows (screen);

    has_fullscreen = FALSE;
    for (l = toplevels; l; l = l->next)
    {
        window = l->data;

        if ((gdk_window_get_state (window) & GDK_WINDOW_STATE_FULLSCREEN) == 0)
            continue;

        if (gdk_window_get_fullscreen_mode (window) == GDK_FULLSCREEN_ON_ALL_MONITORS ||
                gdk_display_get_monitor_at_window (monitor->display, window) == monitor)
        {
            has_fullscreen = TRUE;
            break;
        }
    }

    g_list_free (toplevels);

    return has_fullscreen;
}
Example #2
0
void
_gdk_x11_screen_set_window_scale (GdkX11Screen *x11_screen,
				  gint          scale)
{
  GdkX11Display *x11_display = GDK_X11_DISPLAY (x11_screen->display);
  GList *toplevels, *l;
  GdkWindow *root;
  int i;

  if (x11_screen->window_scale == scale)
    return;

  x11_screen->window_scale = scale;

  root = x11_screen->root_window;
  GDK_WINDOW_IMPL_X11 (root->impl)->window_scale = scale;

  toplevels = gdk_screen_get_toplevel_windows (GDK_SCREEN (x11_screen));

  for (l = toplevels; l != NULL; l = l->next)
    {
      GdkWindow *window = l->data;

      _gdk_x11_window_set_window_scale (window, scale);
    }

  for (i = 0; i < x11_display->monitors->len; i++)
    {
      GdkMonitor *monitor = GDK_MONITOR (x11_display->monitors->pdata[i]);

      gdk_monitor_set_scale_factor (monitor, scale);
    }

  g_signal_emit_by_name (GDK_SCREEN (x11_screen), "monitors-changed");
}
Example #3
0
void
_gdk_x11_screen_set_window_scale (GdkX11Screen *x11_screen,
				  gint          scale)
{
  GList *toplevels, *l;
  GdkWindow *root;

  if (x11_screen->window_scale == scale)
    return;

  x11_screen->window_scale = scale;

  root = x11_screen->root_window;
  GDK_WINDOW_IMPL_X11 (root->impl)->window_scale = scale;

  toplevels = gdk_screen_get_toplevel_windows (GDK_SCREEN (x11_screen));

  for (l = toplevels; l != NULL; l = l->next)
    {
      GdkWindow *window = l->data;

      _gdk_x11_window_set_window_scale (window, scale);
    }

  g_signal_emit_by_name (GDK_SCREEN (x11_screen), "monitors-changed");
}
Example #4
0
/**
\brief      Screen and Display
            size - returns the physical screen size in millimeters
            geometry -returns the logicaL screen size in pixels
\author     William J Giddings
\date       03-Jan-2010
**/
int gnoclScreenCmd ( ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[] )
{
	static const char *cmd[] = { "size", "geometry", "name", "screens", "composited", "windowList", "toplevels", NULL };
	enum optIdx { SizeIdx, GeometryIdx, NameIdx, ScreensIdx, CompositedIdx, WindowListIdx, TopLevelsIdx };
	int idx;


	if ( objc != 2 )
	{
		Tcl_WrongNumArgs ( interp, 1, objv, "option " );
		return TCL_ERROR;
	}

	if ( Tcl_GetIndexFromObj ( interp, objv[1], cmd, "option", TCL_EXACT, &idx ) != TCL_OK )
	{
		return TCL_ERROR;
	}

	/*
	display = gdk_display_get_default ();
	num_screen = gdk_display_get_n_screens (display);
	displayname = gdk_display_get_name (display);

	*/
	switch ( idx )
	{
		case TopLevelsIdx:
		case WindowListIdx:
			{
				gchar buffer[16];
				GdkScreen *screen;
				GSList *toplevels, *p;
				gchar *widgetName;

				screen = gdk_screen_get_default();

				toplevels = gdk_screen_get_toplevel_windows ( screen );

				/* check to see if the windows are registered with gnocl */
				for ( p = toplevels; p != NULL ; p = p->next )
				{

					/* this returns GDKWindow, not Gtk */
					widgetName = gnoclGetNameFromWidget ( GTK_WIDGET ( p->data ) );
					printf ( "toplevel %s\n", widgetName );

					if ( widgetName != NULL )
					{
						printf ( "toplevel %s\n", widgetName );
					}

					else
					{
						printf ( "Missed this one! List length = %d\n", g_slist_length ( toplevels ) );
						printf ( "toplevel %s\n", widgetName );
					}
				}

				gboolean state = 0;

				sprintf ( &buffer, "%d", state );
				Tcl_SetObjResult ( interp, Tcl_NewIntObj ( state ) );
			}
			break;
		case CompositedIdx:
			{
				gchar buffer[16];
				GdkScreen *screen;
				gboolean state;

				screen = gdk_screen_get_default();
				state =  gdk_screen_is_composited ( screen );

				sprintf ( &buffer, "%d", state );
				Tcl_SetObjResult ( interp, Tcl_NewIntObj ( state ) );
			}
			break;
		case ScreensIdx:
			{
				gchar buffer[16];
				GdkDisplay *display;

				display = gdk_display_get_default ();
				gint   screens =  gdk_display_get_n_screens ( display );

				sprintf ( &buffer, "%d", screens );
				Tcl_SetObjResult ( interp, Tcl_NewStringObj ( buffer, -1 ) );
			}
			break;
		case NameIdx:
			{
				gchar buffer[16];
				GdkDisplay *display;
				const gchar *name;

				display  = gdk_display_get_default ();
				name = gdk_display_get_name ( display );

				sprintf ( &buffer, "%s", name );
				Tcl_SetObjResult ( interp, Tcl_NewStringObj ( buffer, -1 ) );
			}
			break;
		case SizeIdx:
			{
				gchar buffer[16];
				gint width_mm = 0;
				gint height_mm = 0;
				GdkScreen *screen;

				screen = gdk_screen_get_default();
				width_mm = gdk_screen_get_width_mm ( screen );
				height_mm = gdk_screen_get_height_mm ( screen );

				sprintf ( &buffer, "%d %d", width_mm, height_mm );
				Tcl_SetObjResult ( interp, Tcl_NewStringObj ( buffer, -1 ) );
			}

			break;
		case GeometryIdx:
			{
				gchar buffer[16];

				gint width = 0;
				gint height = 0;
				GdkScreen *screen;
				screen = gdk_screen_get_default();

				width = gdk_screen_get_width ( screen );
				height = gdk_screen_get_height ( screen );

				sprintf ( &buffer, "%d %d", width, height );

				Tcl_SetObjResult ( interp, Tcl_NewStringObj ( buffer, -1 ) );
			}

			break;
	}

	return TCL_OK;
}