1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
4 /* This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
9 #include "nsDebug.h" // for NS_ASSERTION, etc
10 #include "MainThreadUtils.h" // for NS_IsMainThread
14 void FindVisualAndDepth(Display
* aDisplay
, VisualID aVisualID
, Visual
** aVisual
,
16 const Screen
* screen
= DefaultScreenOfDisplay(aDisplay
);
18 for (int d
= 0; d
< screen
->ndepths
; d
++) {
19 Depth
* d_info
= &screen
->depths
[d
];
20 for (int v
= 0; v
< d_info
->nvisuals
; v
++) {
21 Visual
* visual
= &d_info
->visuals
[v
];
22 if (visual
->visualid
== aVisualID
) {
24 *aDepth
= d_info
->depth
;
30 NS_ASSERTION(aVisualID
== X11None
, "VisualID not on Screen.");
35 void FinishX(Display
* aDisplay
) {
36 unsigned long lastRequest
= NextRequest(aDisplay
) - 1;
37 if (lastRequest
== LastKnownRequestProcessed(aDisplay
)) return;
39 XSync(aDisplay
, X11False
);
42 } // namespace mozilla