This file is indexed.

/usr/include/d/gtkd-3/gdk/DisplayManager.d is in libgtkd-3-dev 3.7.5-2build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
/*
 * This file is part of gtkD.
 *
 * gtkD is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 3
 * of the License, or (at your option) any later version, with
 * some exceptions, please read the COPYING file.
 *
 * gtkD is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with gtkD; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
 */

// generated automatically - do not change
// find conversion definition on APILookup.txt
// implement new conversion functionalities on the wrap.utils pakage


module gdk.DisplayManager;

private import gdk.Display;
private import gdk.c.functions;
public  import gdk.c.types;
private import glib.ListSG;
private import glib.Str;
private import gobject.ObjectG;
private import gobject.Signals;
public  import gtkc.gdktypes;
private import std.algorithm;


/**
 * The purpose of the #GdkDisplayManager singleton object is to offer
 * notification when displays appear or disappear or the default display
 * changes.
 * 
 * You can use gdk_display_manager_get() to obtain the #GdkDisplayManager
 * singleton, but that should be rarely necessary. Typically, initializing
 * GTK+ opens a display that you can work with without ever accessing the
 * #GdkDisplayManager.
 * 
 * The GDK library can be built with support for multiple backends.
 * The #GdkDisplayManager object determines which backend is used
 * at runtime.
 * 
 * When writing backend-specific code that is supposed to work with
 * multiple GDK backends, you have to consider both compile time and
 * runtime. At compile time, use the #GDK_WINDOWING_X11, #GDK_WINDOWING_WIN32
 * macros, etc. to find out which backends are present in the GDK library
 * you are building your application against. At runtime, use type-check
 * macros like GDK_IS_X11_DISPLAY() to find out which backend is in use:
 * 
 * ## Backend-specific code ## {#backend-specific}
 * 
 * |[<!-- language="C" -->
 * #ifdef GDK_WINDOWING_X11
 * if (GDK_IS_X11_DISPLAY (display))
 * {
 * // make X11-specific calls here
 * }
 * else
 * #endif
 * #ifdef GDK_WINDOWING_QUARTZ
 * if (GDK_IS_QUARTZ_DISPLAY (display))
 * {
 * // make Quartz-specific calls here
 * }
 * else
 * #endif
 * g_error ("Unsupported GDK backend");
 * ]|
 */
public class DisplayManager : ObjectG
{
	/** the main Gtk struct */
	protected GdkDisplayManager* gdkDisplayManager;

	/** Get the main Gtk struct */
	public GdkDisplayManager* getDisplayManagerStruct(bool transferOwnership = false)
	{
		if (transferOwnership)
			ownedRef = false;
		return gdkDisplayManager;
	}

	/** the main Gtk struct as a void* */
	protected override void* getStruct()
	{
		return cast(void*)gdkDisplayManager;
	}

	protected override void setStruct(GObject* obj)
	{
		gdkDisplayManager = cast(GdkDisplayManager*)obj;
		super.setStruct(obj);
	}

	/**
	 * Sets our main struct and passes it to the parent class.
	 */
	public this (GdkDisplayManager* gdkDisplayManager, bool ownedRef = false)
	{
		this.gdkDisplayManager = gdkDisplayManager;
		super(cast(GObject*)gdkDisplayManager, ownedRef);
	}


	/** */
	public static GType getType()
	{
		return gdk_display_manager_get_type();
	}

	/**
	 * Gets the singleton #GdkDisplayManager object.
	 *
	 * When called for the first time, this function consults the
	 * `GDK_BACKEND` environment variable to find out which
	 * of the supported GDK backends to use (in case GDK has been compiled
	 * with multiple backends). Applications can use gdk_set_allowed_backends()
	 * to limit what backends can be used.
	 *
	 * Returns: The global #GdkDisplayManager singleton;
	 *     gdk_parse_args(), gdk_init(), or gdk_init_check() must have
	 *     been called first.
	 *
	 * Since: 2.2
	 */
	public static DisplayManager get()
	{
		auto p = gdk_display_manager_get();

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(DisplayManager)(cast(GdkDisplayManager*) p);
	}

	/**
	 * Gets the default #GdkDisplay.
	 *
	 * Returns: a #GdkDisplay, or %NULL if
	 *     there is no default display.
	 *
	 * Since: 2.2
	 */
	public Display getDefaultDisplay()
	{
		auto p = gdk_display_manager_get_default_display(gdkDisplayManager);

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(Display)(cast(GdkDisplay*) p);
	}

	/**
	 * List all currently open displays.
	 *
	 * Returns: a newly
	 *     allocated #GSList of #GdkDisplay objects. Free with g_slist_free()
	 *     when you are done with it.
	 *
	 * Since: 2.2
	 */
	public ListSG listDisplays()
	{
		auto p = gdk_display_manager_list_displays(gdkDisplayManager);

		if(p is null)
		{
			return null;
		}

		return new ListSG(cast(GSList*) p);
	}

	/**
	 * Opens a display.
	 *
	 * Params:
	 *     name = the name of the display to open
	 *
	 * Returns: a #GdkDisplay, or %NULL if the
	 *     display could not be opened
	 *
	 * Since: 3.0
	 */
	public Display openDisplay(string name)
	{
		auto p = gdk_display_manager_open_display(gdkDisplayManager, Str.toStringz(name));

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(Display)(cast(GdkDisplay*) p);
	}

	/**
	 * Sets @display as the default display.
	 *
	 * Params:
	 *     display = a #GdkDisplay
	 *
	 * Since: 2.2
	 */
	public void setDefaultDisplay(Display display)
	{
		gdk_display_manager_set_default_display(gdkDisplayManager, (display is null) ? null : display.getDisplayStruct());
	}

	protected class OnDisplayOpenedDelegateWrapper
	{
		void delegate(Display, DisplayManager) dlg;
		gulong handlerId;

		this(void delegate(Display, DisplayManager) dlg)
		{
			this.dlg = dlg;
			onDisplayOpenedListeners ~= this;
		}

		void remove(OnDisplayOpenedDelegateWrapper source)
		{
			foreach(index, wrapper; onDisplayOpenedListeners)
			{
				if (wrapper.handlerId == source.handlerId)
				{
					onDisplayOpenedListeners[index] = null;
					onDisplayOpenedListeners = std.algorithm.remove(onDisplayOpenedListeners, index);
					break;
				}
			}
		}
	}
	OnDisplayOpenedDelegateWrapper[] onDisplayOpenedListeners;

	/**
	 * The ::display-opened signal is emitted when a display is opened.
	 *
	 * Params:
	 *     display = the opened display
	 *
	 * Since: 2.2
	 */
	gulong addOnDisplayOpened(void delegate(Display, DisplayManager) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
	{
		auto wrapper = new OnDisplayOpenedDelegateWrapper(dlg);
		wrapper.handlerId = Signals.connectData(
			this,
			"display-opened",
			cast(GCallback)&callBackDisplayOpened,
			cast(void*)wrapper,
			cast(GClosureNotify)&callBackDisplayOpenedDestroy,
			connectFlags);
		return wrapper.handlerId;
	}

	extern(C) static void callBackDisplayOpened(GdkDisplayManager* displaymanagerStruct, GdkDisplay* display, OnDisplayOpenedDelegateWrapper wrapper)
	{
		wrapper.dlg(ObjectG.getDObject!(Display)(display), wrapper.outer);
	}

	extern(C) static void callBackDisplayOpenedDestroy(OnDisplayOpenedDelegateWrapper wrapper, GClosure* closure)
	{
		wrapper.remove(wrapper);
	}
}