Bug 1433866 - Rename CSD_SUPPORT_FULL/FLAT to better names, r?jhorak
MozReview-Commit-ID: 8btSuxa5oeT
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -3742,17 +3742,17 @@ nsWindow::Create(nsIWidget* aParent,
* are drawn by Gtk+ to mShell. Content is rendered to mContainer
* and we listen to the Gtk+ events on mContainer.
* 3) We're running on Wayland. All gecko content is rendered
* to mContainer and we listen to the Gtk+ events on mContainer.
*/
GtkStyleContext* style = gtk_widget_get_style_context(mShell);
drawToContainer =
!mIsX11Display ||
- (mIsCSDAvailable && GetCSDSupportLevel() == CSD_SUPPORT_FLAT ) ||
+ (mIsCSDAvailable && GetCSDSupportLevel() == CSD_SUPPORT_CLIENT) ||
gtk_style_context_has_class(style, "csd");
eventWidget = (drawToContainer) ? container : mShell;
gtk_widget_add_events(eventWidget, kEvents);
if (drawToContainer)
gtk_widget_add_events(mShell, GDK_PROPERTY_CHANGE_MASK);
// Prevent GtkWindow from painting a background to avoid flickering.
@@ -6535,17 +6535,17 @@ nsWindow::SetNonClientMargins(LayoutDevi
void
nsWindow::SetDrawsInTitlebar(bool aState)
{
if (!mIsCSDAvailable || aState == mIsCSDEnabled)
return;
if (mShell) {
- if (GetCSDSupportLevel() == CSD_SUPPORT_FULL) {
+ if (GetCSDSupportLevel() == CSD_SUPPORT_SYSTEM) {
SetWindowDecoration(aState ? eBorderStyle_border : mBorderStyle);
}
else {
/* Window manager does not support GDK_DECOR_BORDER,
* emulate it by CSD.
*
* gtk_window_set_titlebar() works on unrealized widgets only,
* we need to handle mShell carefully here.
@@ -6882,81 +6882,81 @@ nsWindow::GetCSDSupportLevel() {
if (sCSDSupportLevel != CSD_SUPPORT_UNKNOWN) {
return sCSDSupportLevel;
}
const char* currentDesktop = getenv("XDG_CURRENT_DESKTOP");
if (currentDesktop) {
// GNOME Flashback (fallback)
if (strstr(currentDesktop, "GNOME-Flashback:GNOME") != nullptr) {
- sCSDSupportLevel = CSD_SUPPORT_FLAT;
+ sCSDSupportLevel = CSD_SUPPORT_CLIENT;
// gnome-shell
} else if (strstr(currentDesktop, "GNOME") != nullptr) {
- sCSDSupportLevel = CSD_SUPPORT_FULL;
+ sCSDSupportLevel = CSD_SUPPORT_SYSTEM;
} else if (strstr(currentDesktop, "XFCE") != nullptr) {
- sCSDSupportLevel = CSD_SUPPORT_FLAT;
+ sCSDSupportLevel = CSD_SUPPORT_CLIENT;
} else if (strstr(currentDesktop, "X-Cinnamon") != nullptr) {
- sCSDSupportLevel = CSD_SUPPORT_FULL;
+ sCSDSupportLevel = CSD_SUPPORT_SYSTEM;
// KDE Plasma
} else if (strstr(currentDesktop, "KDE") != nullptr) {
- sCSDSupportLevel = CSD_SUPPORT_FLAT;
+ sCSDSupportLevel = CSD_SUPPORT_CLIENT;
} else if (strstr(currentDesktop, "LXDE") != nullptr) {
- sCSDSupportLevel = CSD_SUPPORT_FLAT;
+ sCSDSupportLevel = CSD_SUPPORT_CLIENT;
} else if (strstr(currentDesktop, "openbox") != nullptr) {
- sCSDSupportLevel = CSD_SUPPORT_FLAT;
+ sCSDSupportLevel = CSD_SUPPORT_CLIENT;
} else if (strstr(currentDesktop, "i3") != nullptr) {
sCSDSupportLevel = CSD_SUPPORT_NONE;
} else if (strstr(currentDesktop, "MATE") != nullptr) {
- sCSDSupportLevel = CSD_SUPPORT_FLAT;
+ sCSDSupportLevel = CSD_SUPPORT_CLIENT;
// Ubuntu Unity
} else if (strstr(currentDesktop, "Unity") != nullptr) {
- sCSDSupportLevel = CSD_SUPPORT_FLAT;
+ sCSDSupportLevel = CSD_SUPPORT_CLIENT;
// Elementary OS
} else if (strstr(currentDesktop, "Pantheon") != nullptr) {
- sCSDSupportLevel = CSD_SUPPORT_FULL;
+ sCSDSupportLevel = CSD_SUPPORT_SYSTEM;
} else if (strstr(currentDesktop, "LXQt") != nullptr) {
- sCSDSupportLevel = CSD_SUPPORT_FULL;
+ sCSDSupportLevel = CSD_SUPPORT_SYSTEM;
} else {
// Release or beta builds are not supposed to be broken
// so disable titlebar rendering on untested/unknown systems.
#if defined(RELEASE_OR_BETA)
sCSDSupportLevel = CSD_SUPPORT_NONE;
#else
- sCSDSupportLevel = CSD_SUPPORT_FLAT;
+ sCSDSupportLevel = CSD_SUPPORT_CLIENT;
#endif
}
} else {
sCSDSupportLevel = CSD_SUPPORT_NONE;
}
- // We don't support CSD_SUPPORT_FULL on Wayland
+ // We don't support CSD_SUPPORT_SYSTEM on Wayland
if (!GDK_IS_X11_DISPLAY(gdk_display_get_default()) &&
- sCSDSupportLevel == CSD_SUPPORT_FULL) {
- sCSDSupportLevel = CSD_SUPPORT_FLAT;
+ sCSDSupportLevel == CSD_SUPPORT_SYSTEM) {
+ sCSDSupportLevel = CSD_SUPPORT_CLIENT;
}
// GTK_CSD forces CSD mode - use also CSD because window manager
// decorations does not work with CSD.
// We check GTK_CSD as well as gtk_window_should_use_csd() does.
- if (sCSDSupportLevel == CSD_SUPPORT_FULL) {
+ if (sCSDSupportLevel == CSD_SUPPORT_SYSTEM) {
const char* csdOverride = getenv("GTK_CSD");
if (csdOverride && g_strcmp0(csdOverride, "1") == 0) {
- sCSDSupportLevel = CSD_SUPPORT_FLAT;
+ sCSDSupportLevel = CSD_SUPPORT_CLIENT;
}
}
// Allow MOZ_GTK_TITLEBAR_DECORATION to override our heuristics
const char* decorationOverride = getenv("MOZ_GTK_TITLEBAR_DECORATION");
if (decorationOverride) {
if (strcmp(decorationOverride, "none") == 0) {
sCSDSupportLevel = CSD_SUPPORT_NONE;
} else if (strcmp(decorationOverride, "client") == 0) {
- sCSDSupportLevel = CSD_SUPPORT_FLAT;
+ sCSDSupportLevel = CSD_SUPPORT_CLIENT;
} else if (strcmp(decorationOverride, "system") == 0) {
- sCSDSupportLevel = CSD_SUPPORT_FULL;
+ sCSDSupportLevel = CSD_SUPPORT_SYSTEM;
}
}
return sCSDSupportLevel;
}
int32_t
nsWindow::RoundsWidgetCoordinatesTo()
--- a/widget/gtk/nsWindow.h
+++ b/widget/gtk/nsWindow.h
@@ -371,19 +371,19 @@ public:
LayoutDeviceIntPoint GdkPointToDevicePixels(GdkPoint point);
LayoutDeviceIntPoint GdkEventCoordsToDevicePixels(gdouble x, gdouble y);
LayoutDeviceIntRect GdkRectToDevicePixels(GdkRectangle rect);
virtual bool WidgetTypeSupportsAcceleration() override;
bool DoDrawTitlebar() const;
- typedef enum { CSD_SUPPORT_FULL, // CSD including shadows
- CSD_SUPPORT_FLAT, // CSD without shadows
- CSD_SUPPORT_NONE, // WM does not support CSD at all
+ typedef enum { CSD_SUPPORT_SYSTEM, // CSD including shadows
+ CSD_SUPPORT_CLIENT, // CSD without shadows
+ CSD_SUPPORT_NONE, // WM does not support CSD at all
CSD_SUPPORT_UNKNOWN
} CSDSupportLevel;
/**
* Get the support of Client Side Decoration by checking
* the XDG_CURRENT_DESKTOP environment variable.
*/
static CSDSupportLevel GetCSDSupportLevel();