diff --git a/CMakeLists.txt b/CMakeLists.txt index 000252c2d6ed619f398cb4a0f64696ce7e19a5f5..fd9f83664756aae6191268cf5f961f6d3489e3a9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -78,6 +78,9 @@ set (compiz_metadatadir ${datadir}/compiz) set (COMPIZ_I18N_DIR ${CMAKE_SOURCE_DIR}/po) # Don't allow subdirectories to add schema recompile rule +set_property (GLOBAL + PROPERTY GSETTINGS_LOCAL_COMPILE_INHIBIT_RULE + TRUE) set_property (GLOBAL PROPERTY COMPIZ_INHIBIT_ADD_INSTALL_RECOMPILE_RULE TRUE) diff --git a/VERSION b/VERSION index 3e4f21925f8b3ce851db315102b758a180bdc126..b295667acfc9e950b0931e4357ab9ba071b02c7b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.9.8.2 +0.9.8.3 diff --git a/cmake/CompizCommon.cmake b/cmake/CompizCommon.cmake index 139d0165d6f8245ab17a6d1e5d8c0346e5140a79..8c3394d8322ee687bc8c6fce3310d4be2cb2978e 100644 --- a/cmake/CompizCommon.cmake +++ b/cmake/CompizCommon.cmake @@ -443,8 +443,12 @@ macro (compiz_add_plugins_in_folder folder) ) foreach (_plugin ${_plugins_in}) - get_filename_component (_plugin_dir ${_plugin} PATH) - add_subdirectory (${folder}/${_plugin_dir}) + get_filename_component (_plugin_dir ${_plugin} PATH) + string (TOUPPER ${_plugin_dir} _plugin_upper) + if (NOT COMPIZ_DISABLE_PLUGIN_${_plugin_upper}) + add_subdirectory (${folder}/${_plugin_dir}) + set (COMPIZ_ENABLED_PLUGIN_${_plugin_upper} Y CACHE INTERNAL "") + endif () endforeach () endmacro () diff --git a/cmake/CompizGSettings.cmake b/cmake/CompizGSettings.cmake index 162486b4dd113e265a8570dd66eadc707c750e7c..13907218fc9bcf4338d0f6a58821f106b41737f1 100644 --- a/cmake/CompizGSettings.cmake +++ b/cmake/CompizGSettings.cmake @@ -106,37 +106,83 @@ function (compiz_install_gsettings_schema _src _dst) USE_GSETTINGS) endfunction () -function (add_gsettings_schema_to_recompilation_list _target_name_for_schema) +function (add_gsettings_local_recompilation_rule _schemas) - find_program (GLIB_COMPILE_SCHEMAS glib-compile-schemas) - mark_as_advanced (GLIB_COMPILE_SCHEMAS) + get_property (GSETTINGS_LOCAL_COMPILE_INHIBIT_RULE_SET + GLOBAL + PROPERTY GSETTINGS_LOCAL_COMPILE_INHIBIT_RULE + SET) + + if (GSETTINGS_LOCAL_COMPILE_INHIBIT_RULE_SET) + get_property (GSETTINGS_LOCAL_COMPILE_INHIBIT_RULE + GLOBAL + PROPERTY GSETTINGS_LOCAL_COMPILE_INHIBIT_RULE) + else (GSETTINGS_LOCAL_COMPILE_INHIBIT_RULE_SET) + set (GSETTINGS_LOCAL_COMPILE_INHIBIT_RULE FALSE) + endif (GSETTINGS_LOCAL_COMPILE_INHIBIT_RULE_SET) get_property (GSETTINGS_LOCAL_COMPILE_TARGET_SET GLOBAL PROPERTY GSETTINGS_LOCAL_COMPILE_TARGET_SET SET) - if (NOT GSETTINGS_LOCAL_COMPILE_TARGET_SET AND - GLIB_COMPILE_SCHEMAS) + if (NOT GSETTINGS_LOCAL_COMPILE_INHIBIT_RULE AND + NOT GSETTINGS_LOCAL_COMPILE_TARGET_SET) - add_custom_command (OUTPUT ${CMAKE_BINARY_DIR}/generated/glib-2.0/schemas/gschemas.compiled - COMMAND ${GLIB_COMPILE_SCHEMAS} --targetdir=${CMAKE_BINARY_DIR}/generated/glib-2.0/schemas/ - ${CMAKE_BINARY_DIR}/generated/glib-2.0/schemas/ - COMMENT "Recompiling GSettings schemas locally" - ) + find_program (GLIB_COMPILE_SCHEMAS glib-compile-schemas) + mark_as_advanced (GLIB_COMPILE_SCHEMAS) + + if (GLIB_COMPILE_SCHEMAS) + + set (_compiled_gschemas ${CMAKE_BINARY_DIR}/generated/glib-2.0/schemas/gschemas.compiled) + + # Invalidate the rule + if (EXISTS ${_compiled_gschemas}) + execute_process (COMMAND rm ${_compiled_gschemas}) + endif (EXISTS ${_compiled_gschemas}) + + add_custom_command (OUTPUT ${CMAKE_BINARY_DIR}/generated/glib-2.0/schemas/gschemas.compiled + COMMAND ${GLIB_COMPILE_SCHEMAS} --targetdir=${CMAKE_BINARY_DIR}/generated/glib-2.0/schemas/ + ${CMAKE_BINARY_DIR}/generated/glib-2.0/schemas/ + COMMENT "Recompiling GSettings schemas locally" + DEPENDS ${${_schemas}} + ) + + add_custom_target (compiz_gsettings_compile_local ALL + DEPENDS ${CMAKE_BINARY_DIR}/generated/glib-2.0/schemas/gschemas.compiled) - add_custom_target (compiz_gsettings_compile_local ALL - DEPENDS ${CMAKE_BINARY_DIR}/generated/glib-2.0/schemas/gschemas.compiled) + set_property (GLOBAL + PROPERTY GSETTINGS_LOCAL_COMPILE_TARGET_SET + TRUE) - set_property (GLOBAL - PROPERTY GSETTINGS_LOCAL_COMPILE_TARGET_SET - TRUE) + endif (GLIB_COMPILE_SCHEMAS) - endif (NOT GSETTINGS_LOCAL_COMPILE_TARGET_SET AND - GLIB_COMPILE_SCHEMAS) + endif (NOT GSETTINGS_LOCAL_COMPILE_INHIBIT_RULE AND + NOT GSETTINGS_LOCAL_COMPILE_TARGET_SET) + +endfunction () + +function (add_all_gsettings_schemas_to_local_recompilation_rule) + + get_property (GSETTINGS_LOCAL_COMPILE_SCHEMAS + GLOBAL + PROPERTY GSETTINGS_LOCAL_COMPILE_SCHEMAS) + + # Deferencing it appears to just give it the first schema, that's not what + # we really want, so just pass the reference and double-dereference + # internally + add_gsettings_local_recompilation_rule (GSETTINGS_LOCAL_COMPILE_SCHEMAS) + +endfunction () + +function (add_gsettings_schema_to_recompilation_list _schema_file_name) + + set_property (GLOBAL + APPEND + PROPERTY GSETTINGS_LOCAL_COMPILE_SCHEMAS + "${_schema_file_name}") - add_dependencies (compiz_gsettings_compile_local - ${_target_name_for_schema}) + add_all_gsettings_schemas_to_local_recompilation_rule () endfunction () diff --git a/cmake/CompizPackage.cmake b/cmake/CompizPackage.cmake index aae7c541bc1c99588bbde2a778be69221cbb953f..8a34ad28c3430a1c8f3d02654779611d86413847 100644 --- a/cmake/CompizPackage.cmake +++ b/cmake/CompizPackage.cmake @@ -67,7 +67,7 @@ function (compiz_print_plugin_stats _folder) string (TOUPPER ${_plugin_name} _PLUGIN) compiz_format_string (${_plugin_name} 14 _plugin_name) - if (COMPIZ_DISABLE_PLUGIN_${_PLUGIN}) + if (NOT COMPIZ_ENABLED_PLUGIN_${_PLUGIN}) compiz_color_message (" ${_plugin_name}: ${_escape}[1;34mDisabled${_escape}[0m") else () if (COMPIZ_${_PLUGIN}_BUILD) diff --git a/compizconfig/libcompizconfig/src/main.c b/compizconfig/libcompizconfig/src/main.c index 2c9a7727a6464830a1335aafc2b6f67c9946db9c..949fecf22fae4ac39dad4201ac02b73bbaf08df6 100644 --- a/compizconfig/libcompizconfig/src/main.c +++ b/compizconfig/libcompizconfig/src/main.c @@ -4879,7 +4879,7 @@ ccsGetUpgradeFilesForProcessing (const char *upgradePath, struct dirent **nameList = NULL; unsigned int nFile = scandir (upgradePath, &nameList, upgradeNameFilter, alphasort); - if (nFile <= 0) + if (!nFile) return 0; *passedNameList = nameList; diff --git a/gtk/window-decorator/CMakeLists.txt b/gtk/window-decorator/CMakeLists.txt index a377b155f5326788f8a0b8fd482e0ded5ac743b9..d62f285664de3ad410d142e5381e6451b12e3c32 100644 --- a/gtk/window-decorator/CMakeLists.txt +++ b/gtk/window-decorator/CMakeLists.txt @@ -23,6 +23,12 @@ if (USE_GTK) ${COMPIZ_LINK_DIRS} ) + add_library (gtk_window_decorator_metacity_window_decoration_util + ${CMAKE_CURRENT_SOURCE_DIR}/gwd-metacity-window-decoration-util.c) + + add_library (gtk_window_decorator_cairo_window_decoration_util + ${CMAKE_CURRENT_SOURCE_DIR}/gwd-cairo-window-decoration-util.c) + add_library (gtk_window_decorator_settings_interface STATIC ${CMAKE_CURRENT_SOURCE_DIR}/gwd-settings-interface.c) @@ -47,7 +53,9 @@ if (USE_GTK) gtk_window_decorator_settings_writable_interface gtk_window_decorator_settings gtk_window_decorator_settings_storage_interface - gtk_window_decorator_settings_storage_xproperty_interface) + gtk_window_decorator_settings_storage_xproperty_interface + gtk_window_decorator_metacity_window_decoration_util + gtk_window_decorator_cairo_window_decoration_util) if (USE_GCONF) set (gwd_schema ${CMAKE_CURRENT_BINARY_DIR}/gwd.schemas) diff --git a/gtk/window-decorator/cairo.c b/gtk/window-decorator/cairo.c index c9da7a8c63f510c63dde0666dc38d11890f15d7a..f2b564ea1874311c7980e81e9221529a86d82781 100644 --- a/gtk/window-decorator/cairo.c +++ b/gtk/window-decorator/cairo.c @@ -24,6 +24,7 @@ */ #include "gtk-window-decorator.h" +#include "gwd-cairo-window-decoration-util.h" void rounded_rectangle (cairo_t *cr, @@ -922,8 +923,9 @@ update_border_extents (decor_frame_t *frame) { frame = gwd_decor_frame_ref (frame); - frame->win_extents = frame->win_extents; - frame->max_win_extents = frame->win_extents; + gwd_cairo_window_decoration_get_extents (&frame->win_extents, + &frame->max_win_extents); + frame->titlebar_height = frame->max_titlebar_height = (frame->text_height < 17) ? 17 : frame->text_height; diff --git a/gtk/window-decorator/decorator.c b/gtk/window-decorator/decorator.c index 4172a195c26f2efd12492a630cc5b516a2ae15d7..0abbe82279fd6d9217c5d8ea309835236e237de5 100644 --- a/gtk/window-decorator/decorator.c +++ b/gtk/window-decorator/decorator.c @@ -1034,17 +1034,8 @@ update_frames_shadows (gpointer key, } -void -cairo_get_shadow (decor_frame_t *d, decor_shadow_options_t *opts, gboolean active) -{ - if (active) - g_object_get (settings, "active-shadow", &opts, NULL); - else - g_object_get (settings, "inactive-shadow", &opts, NULL); -} - -void -meta_get_shadow (decor_frame_t *frame, decor_shadow_options_t *opts, gboolean active) +static void +get_shadow_common (decor_frame_t *d, decor_shadow_options_t *opts, gboolean active) { decor_shadow_options_t *setting_opts = NULL; @@ -1059,6 +1050,18 @@ meta_get_shadow (decor_frame_t *frame, decor_shadow_options_t *opts, gboolean ac } } +void +cairo_get_shadow (decor_frame_t *frame, decor_shadow_options_t *opts, gboolean active) +{ + get_shadow_common (frame, opts, active); +} + +void +meta_get_shadow (decor_frame_t *frame, decor_shadow_options_t *opts, gboolean active) +{ + get_shadow_common (frame, opts, active); +} + int update_shadow (void) { diff --git a/gtk/window-decorator/frames.c b/gtk/window-decorator/frames.c index 84db7972f4acc0d57ca62fb6ccda99883628ed39..9d18797df1b727991faf4dda9fb2d9e18df6d346 100644 --- a/gtk/window-decorator/frames.c +++ b/gtk/window-decorator/frames.c @@ -232,7 +232,6 @@ decor_frame_new (const gchar *type) gtk_widget_set_size_request (frame->style_window_rgba, 0, 0); gtk_window_move (GTK_WINDOW (frame->style_window_rgba), -100, -100); - gtk_widget_show_all (frame->style_window_rgba); frame->pango_context = gtk_widget_create_pango_context (frame->style_window_rgba); @@ -250,7 +249,6 @@ decor_frame_new (const gchar *type) gtk_widget_set_size_request (frame->style_window_rgb, 0, 0); gtk_window_move (GTK_WINDOW (frame->style_window_rgb), -100, -100); - gtk_widget_show_all (frame->style_window_rgb); g_signal_connect_data (frame->style_window_rgb, "style-set", G_CALLBACK (style_changed), diff --git a/gtk/window-decorator/gwd-cairo-window-decoration-util.c b/gtk/window-decorator/gwd-cairo-window-decoration-util.c new file mode 100644 index 0000000000000000000000000000000000000000..c135d1b196d41b6e6a9ad95fe9746378c3cfc978 --- /dev/null +++ b/gtk/window-decorator/gwd-cairo-window-decoration-util.c @@ -0,0 +1,56 @@ +/* + * Copyright © 2012 Canonical Ltd + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * Authored By: Sam Spilsbury + */ +#include +#include "gwd-cairo-window-decoration-util.h" + +static const decor_extents_t gwd_cairo_window_decoration_default_win_extents = +{ + 6, 6, 10, 6 +}; + +static const decor_extents_t gwd_cairo_window_decoration_default_max_win_extents = +{ + 6, 6, 4, 6 +}; + +const decor_extents_t * +gwd_cairo_window_decoration_get_default_max_win_extents () +{ + return &gwd_cairo_window_decoration_default_max_win_extents; +} + + +const decor_extents_t * +gwd_cairo_window_decoration_get_default_win_extents () +{ + return &gwd_cairo_window_decoration_default_win_extents; +} + +void +gwd_cairo_window_decoration_get_extents (decor_extents_t *win_extents, + decor_extents_t *max_win_extents) +{ + memcpy (win_extents, + gwd_cairo_window_decoration_get_default_max_win_extents (), + sizeof (decor_extents_t)); + memcpy (max_win_extents, + gwd_cairo_window_decoration_get_default_win_extents (), + sizeof (decor_extents_t)); +} diff --git a/gtk/window-decorator/gwd-cairo-window-decoration-util.h b/gtk/window-decorator/gwd-cairo-window-decoration-util.h new file mode 100644 index 0000000000000000000000000000000000000000..42af2f9de23f64888a17b3e11d32ed31bd217e90 --- /dev/null +++ b/gtk/window-decorator/gwd-cairo-window-decoration-util.h @@ -0,0 +1,38 @@ +/* + * Copyright © 2012 Canonical Ltd + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * Authored By: Sam Spilsbury + */ +#ifndef _GWD_CAIRO_WINDOW_DECORATION_UTIL_H +#define _GWD_CAIRO_WINDOW_DECORATION_UTIL_H + +#include + +G_BEGIN_DECLS + +typedef struct _decor_extents decor_extents_t; + +const decor_extents_t * gwd_cairo_window_decoration_get_default_max_win_extents (); +const decor_extents_t * gwd_cairo_window_decoration_get_default_win_extents (); + +void +gwd_cairo_window_decoration_get_extents (decor_extents_t *win_extents, + decor_extents_t *max_win_extents); + +G_END_DECLS; + +#endif diff --git a/gtk/window-decorator/gwd-metacity-window-decoration-util.c b/gtk/window-decorator/gwd-metacity-window-decoration-util.c new file mode 100644 index 0000000000000000000000000000000000000000..dc8851d1853ac5ced259768355062e8f06da8353 --- /dev/null +++ b/gtk/window-decorator/gwd-metacity-window-decoration-util.c @@ -0,0 +1,45 @@ +/* + * Copyright © 2012 Canonical Ltd + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * Authored By: Sam Spilsbury + */ +#include +#include +#include "gwd-metacity-window-decoration-util.h" + +gboolean +gwd_metacity_window_decoration_update_meta_theme (const gchar *theme, + GWDMetaThemeGetCurrentProc get_current, + GWDMetaThemeSetProc set_current) +{ + if (!theme) + return FALSE; + + /* meta_theme_get_current seems to return the last + * good theme now, so if one was already set this function + * will be ineffectual, so we need to check if the theme + * is obviously bad as the user intended to disable metacity + * themes */ + if (!strlen (theme)) + return FALSE; + + (*set_current) (theme, TRUE); + if (!(*get_current) ()) + return FALSE; + + return TRUE; +} diff --git a/gtk/window-decorator/gwd-metacity-window-decoration-util.h b/gtk/window-decorator/gwd-metacity-window-decoration-util.h new file mode 100644 index 0000000000000000000000000000000000000000..9a62833eb15c4a0c69a11baf0d956fd86f35b307 --- /dev/null +++ b/gtk/window-decorator/gwd-metacity-window-decoration-util.h @@ -0,0 +1,39 @@ +/* + * Copyright © 2012 Canonical Ltd + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * Authored By: Sam Spilsbury + */ +#ifndef _GWD_METACITY_WINDOW_DECORATION_UTIL_H +#define _GWD_METACITY_WINDOW_DECORATION_UTIL_H + +#include + +G_BEGIN_DECLS + +typedef struct _MetaTheme MetaTheme; +typedef MetaTheme * (*GWDMetaThemeGetCurrentProc) (); +typedef void (*GWDMetaThemeSetProc) (const gchar *theme, + gboolean force_update); + +gboolean +gwd_metacity_window_decoration_update_meta_theme (const gchar *theme, + GWDMetaThemeGetCurrentProc get_current, + GWDMetaThemeSetProc set_current); + +G_END_DECLS; + +#endif diff --git a/gtk/window-decorator/gwd-settings-notified.c b/gtk/window-decorator/gwd-settings-notified.c index 0a6123efad8d0b2f3ca1cc041be8e3d1fe7cd403..cde68cde841518d5cc24962c68bee05a82f46496 100644 --- a/gtk/window-decorator/gwd-settings-notified.c +++ b/gtk/window-decorator/gwd-settings-notified.c @@ -21,6 +21,7 @@ #include "gwd-settings-notified-interface.h" #include "gwd-settings-notified.h" +#include "gwd-metacity-window-decoration-util.h" #include "gtk-window-decorator.h" @@ -119,22 +120,9 @@ gwd_settings_notified_impl_update_metacity_theme (GWDSettingsNotified *notified) const gchar *meta_theme = NULL; g_object_get (settings, "metacity-theme", &meta_theme, NULL); - if (meta_theme) - { - const gchar *theme = meta_theme; - - if (theme) - { - meta_theme_set_current (theme, TRUE); - if (!meta_theme_get_current ()) - { - g_warning ("specified a theme that does not exist! falling back to cairo decoration\n"); - meta_theme = NULL; - } - } - } - - if (meta_theme) + if (gwd_metacity_window_decoration_update_meta_theme (meta_theme, + meta_theme_get_current, + meta_theme_set_current)) { theme_draw_window_decoration = meta_draw_window_decoration; theme_calc_decoration_size = meta_calc_decoration_size; @@ -146,6 +134,7 @@ gwd_settings_notified_impl_update_metacity_theme (GWDSettingsNotified *notified) } else { + g_log ("gtk-window-decorator", G_LOG_LEVEL_INFO, "using cairo decoration"); theme_draw_window_decoration = draw_window_decoration; theme_calc_decoration_size = calc_decoration_size; theme_update_border_extents = update_border_extents; @@ -172,6 +161,7 @@ gwd_settings_notified_impl_update_metacity_theme (GWDSettingsNotified *notified) static gboolean gwd_settings_notified_impl_update_metacity_button_layout (GWDSettingsNotified *notified) { +#ifdef USE_METACITY const gchar *button_layout; g_object_get (settings, "metacity-button-layout", &button_layout, NULL); @@ -190,6 +180,7 @@ gwd_settings_notified_impl_update_metacity_button_layout (GWDSettingsNotified *n return TRUE; } +#endif return FALSE; } diff --git a/gtk/window-decorator/gwd-settings-storage-gsettings.c b/gtk/window-decorator/gwd-settings-storage-gsettings.c index 5e14cd2e44ef9fb82a60df043ae15459722472f4..20d285054922b6d6f9b1dd53de0b9fe108952fe1 100644 --- a/gtk/window-decorator/gwd-settings-storage-gsettings.c +++ b/gtk/window-decorator/gwd-settings-storage-gsettings.c @@ -125,7 +125,7 @@ gwd_settings_storage_gsettings_update_attach_modal_dialogs (GWDSettingsStorage * GWDSettingsStorageGSettings *storage = GWD_SETTINGS_STORAGE_GSETTINGS (settings); GWDSettingsStorageGSettingsPrivate *priv = GET_PRIVATE (storage); - if (!priv->gwd) + if (!priv->mutter) return FALSE; return gwd_settings_writable_attach_modal_dialogs_changed (priv->writable, diff --git a/gtk/window-decorator/gwd-settings.c b/gtk/window-decorator/gwd-settings.c index 1b9d606e874865677507bb4839e9af1d9407ecfb..d18cc6ed207691f2c78cdeed5741e8026eba6fb4 100644 --- a/gtk/window-decorator/gwd-settings.c +++ b/gtk/window-decorator/gwd-settings.c @@ -357,10 +357,10 @@ gwd_settings_metacity_theme_changed (GWDSettingsWritable *settings, static gboolean gwd_settings_opacity_changed (GWDSettingsWritable *settings, - gdouble inactive_opacity, gdouble active_opacity, - gboolean inactive_shade_opacity, - gboolean active_shade_opacity) + gdouble inactive_opacity, + gboolean active_shade_opacity, + gboolean inactive_shade_opacity) { GWDSettingsImpl *settings_impl = GWD_SETTINGS_IMPL (settings); GWDSettingsImplPrivate *priv = GET_PRIVATE (settings_impl); diff --git a/gtk/window-decorator/tests/CMakeLists.txt b/gtk/window-decorator/tests/CMakeLists.txt index 7fb99f2139a53214ca816831be4bab69c18b2afd..72d64bcb15c419f30bc5fda91e94b5e6c342c4a3 100644 --- a/gtk/window-decorator/tests/CMakeLists.txt +++ b/gtk/window-decorator/tests/CMakeLists.txt @@ -111,4 +111,34 @@ if (COMPIZ_TEST_GTK_WINDOW_DECORATOR_FOUND) COVERAGE ${COMPIZ_TEST_GWD_SETTINGS_COVERAGE_TARGETS}) + add_executable (compiz_test_gwd_cairo_decorations + ${CMAKE_CURRENT_SOURCE_DIR}/test_gwd_cairo_decorations.cpp) + + target_link_libraries (compiz_test_gwd_cairo_decorations + gtk_window_decorator_cairo_window_decoration_util + ${COMPIZ_TEST_GTK_WINDOW_DECORATOR_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT} # Link in pthread. + ${GTEST_BOTH_LIBRARIES} + ${GMOCK_LIBRARY} + ${GMOCK_MAIN_LIBRARY} + decoration) + + compiz_discover_tests (compiz_test_gwd_cairo_decorations COVERAGE + gtk_window_decorator_cairo_window_decoration_util) + + add_executable (compiz_test_gwd_metacity_decorations + ${CMAKE_CURRENT_SOURCE_DIR}/test_gwd_metacity_decorations.cpp) + + target_link_libraries (compiz_test_gwd_metacity_decorations + gtk_window_decorator_metacity_window_decoration_util + ${COMPIZ_TEST_GTK_WINDOW_DECORATOR_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT} # Link in pthread. + ${GTEST_BOTH_LIBRARIES} + ${GMOCK_LIBRARY} + ${GMOCK_MAIN_LIBRARY} + decoration) + + compiz_discover_tests (compiz_test_gwd_metacity_decorations COVERAGE + gtk_window_decorator_metacity_window_decoration_util) + endif (COMPIZ_TEST_GTK_WINDOW_DECORATOR_FOUND) diff --git a/gtk/window-decorator/tests/test_gwd_cairo_decorations.cpp b/gtk/window-decorator/tests/test_gwd_cairo_decorations.cpp new file mode 100644 index 0000000000000000000000000000000000000000..cc99d48383a4acd60eeb3d48b1a9b4adfe4522aa --- /dev/null +++ b/gtk/window-decorator/tests/test_gwd_cairo_decorations.cpp @@ -0,0 +1,52 @@ +/* + * Copyright © 2010 Canonical Ltd + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * Authored By: Sam Spilsbury + */ + +#include +#include + +#include "gwd-cairo-window-decoration-util.h" + +bool +operator== (const decor_extents_t &rhs, + const decor_extents_t &lhs) +{ + return decor_extents_cmp (&rhs, &lhs); +} + +class GWDCairoDecorationsTest : + public ::testing::Test +{ +}; + +namespace +{ + const decor_extents_t *defaultWinExtents = gwd_cairo_window_decoration_get_default_win_extents (); + const decor_extents_t *defaultMaxWinExtents = gwd_cairo_window_decoration_get_default_max_win_extents (); +} + +TEST (GWDCairoDecorationsTest, TestGetCairoDecorationExtents) +{ + decor_extents_t winExtents, maxWinExtents; + + gwd_cairo_window_decoration_get_extents (&winExtents, &maxWinExtents); + + EXPECT_EQ (winExtents, *defaultWinExtents); + EXPECT_EQ (maxWinExtents, *defaultMaxWinExtents); +} diff --git a/gtk/window-decorator/tests/test_gwd_metacity_decorations.cpp b/gtk/window-decorator/tests/test_gwd_metacity_decorations.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e77cc3db522668d608ddfba597cb266449f9b609 --- /dev/null +++ b/gtk/window-decorator/tests/test_gwd_metacity_decorations.cpp @@ -0,0 +1,82 @@ +/* + * Copyright © 2010 Canonical Ltd + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * Authored By: Sam Spilsbury + */ + +#include +#include +#include +#include "gwd-metacity-window-decoration-util.h" + +class GWDMetacityDecorationUtilTest : + public ::testing::Test +{ +}; + +MATCHER(IsTrue, "Is TRUE") { if (arg) return true; else return false; } +MATCHER(IsFalse, "Is FALSE") { if (!arg) return true; else return false; } + +namespace +{ + MetaTheme * get_current_returns_null () + { + return NULL; + } + + MetaTheme * get_current_returns_nonnull () + { + return (MetaTheme *) 1; + } + + void set_current_seam (const gchar *theme, + gboolean force) + { + } + + const std::string emptyTheme (""); + const std::string realTheme ("Adwaita"); + const std::string badTheme ("Clearlooks"); +} + +TEST (GWDMetacityDecorationUtilTest, TestNULLDecorationRevertsToCairo) +{ + EXPECT_THAT (gwd_metacity_window_decoration_update_meta_theme (NULL, + get_current_returns_nonnull, + set_current_seam), IsFalse ()); +} + +TEST (GWDMetacityDecorationUtilTest, TestEmptyStringDecorationRevertsToCairo) +{ + EXPECT_THAT (gwd_metacity_window_decoration_update_meta_theme (emptyTheme.c_str (), + get_current_returns_nonnull, + set_current_seam), IsFalse ()); +} + +TEST (GWDMetacityDecorationUtilTest, TestBadThemeStringDecorationRevertsToCairo) +{ + EXPECT_THAT (gwd_metacity_window_decoration_update_meta_theme (badTheme.c_str (), + get_current_returns_null, + set_current_seam), IsFalse ()); +} + +TEST (GWDMetacityDecorationUtilTest, TestGoodThemeStringDecorationUsesMetacity) +{ + EXPECT_THAT (gwd_metacity_window_decoration_update_meta_theme (realTheme.c_str (), + get_current_returns_nonnull, + set_current_seam), IsTrue ()); +} diff --git a/gtk/window-decorator/tests/test_gwd_settings.cpp b/gtk/window-decorator/tests/test_gwd_settings.cpp index 116935ffc8867a1ee197bbf0e11a4b9c4761e231..8ce8e8ebe047bb0ed5fdb524dd4cde73233def48 100644 --- a/gtk/window-decorator/tests/test_gwd_settings.cpp +++ b/gtk/window-decorator/tests/test_gwd_settings.cpp @@ -922,10 +922,10 @@ TEST_F(GWDSettingsTest, TestMetacityOpacityChanged) { EXPECT_CALL (*mGMockNotified, updateDecorations ()); EXPECT_THAT (gwd_settings_writable_opacity_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()), - testing_values::INACTIVE_OPACITY_VALUE, testing_values::ACTIVE_OPACITY_VALUE, - testing_values::INACTIVE_SHADE_OPACITY_VALUE, - testing_values::ACTIVE_SHADE_OPACITY_VALUE), GBooleanTrue ()); + testing_values::INACTIVE_OPACITY_VALUE, + testing_values::ACTIVE_SHADE_OPACITY_VALUE, + testing_values::INACTIVE_SHADE_OPACITY_VALUE), GBooleanTrue ()); AutoUnsetGValue metacityInactiveOpacityValue (G_TYPE_DOUBLE); AutoUnsetGValue metacityActiveOpacityValue (G_TYPE_DOUBLE); @@ -963,10 +963,10 @@ TEST_F(GWDSettingsTest, TestMetacityOpacityChanged) TEST_F(GWDSettingsTest, TestMetacityOpacityChangedIsDefault) { EXPECT_THAT (gwd_settings_writable_opacity_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()), - METACITY_INACTIVE_OPACITY_DEFAULT, METACITY_ACTIVE_OPACITY_DEFAULT, - METACITY_INACTIVE_SHADE_OPACITY_DEFAULT, - METACITY_ACTIVE_SHADE_OPACITY_DEFAULT), GBooleanFalse ()); + METACITY_INACTIVE_OPACITY_DEFAULT, + METACITY_ACTIVE_SHADE_OPACITY_DEFAULT, + METACITY_INACTIVE_SHADE_OPACITY_DEFAULT), GBooleanFalse ()); } TEST_F(GWDSettingsTest, TestButtonLayoutChanged) diff --git a/include/decoration.h b/include/decoration.h index 91d5e888353b81e0ff616f0c8a3831d493028e5e..9203dc90307a5cdcb7814715b98c7be786300d37 100644 --- a/include/decoration.h +++ b/include/decoration.h @@ -510,6 +510,10 @@ decor_post_generate_request (Display *xdisplay, unsigned int frame_state, unsigned int frame_actions); +int +decor_extents_cmp (const decor_extents_t *a, + const decor_extents_t *b); + int decor_shadow_options_cmp (const decor_shadow_options_t *a, const decor_shadow_options_t *b); diff --git a/libdecoration/decoration.c b/libdecoration/decoration.c index b53121c0a5b21fbb1ac3b4954639662b36912e5b..83352d2be34bd28e85b5cd49f529b6ad6e483114 100644 --- a/libdecoration/decoration.c +++ b/libdecoration/decoration.c @@ -413,7 +413,7 @@ decor_quad_cmp (const decor_quad_t *a, const decor_quad_t *b) ); } -static int +int decor_extents_cmp (const decor_extents_t *a, const decor_extents_t *b) { /* Use binary | to avoid branch prediction slow-downs */ diff --git a/plugins/bench/bench.xml.in b/plugins/bench/bench.xml.in index dbfc0bfadde83669b59beb5887b685649f0ed61d..cc014121e75c65267be3fdea06da3d7e2ddefc44 100644 --- a/plugins/bench/bench.xml.in +++ b/plugins/bench/bench.xml.in @@ -50,14 +50,14 @@ diff --git a/plugins/copytex/src/copytex.cpp b/plugins/copytex/src/copytex.cpp index b581c7e0859ef1146638b1608b6c11f0dded75ad..ed619a6f6cc7becd0e8b253447cc3d4d43d12e0b 100644 --- a/plugins/copytex/src/copytex.cpp +++ b/plugins/copytex/src/copytex.cpp @@ -37,10 +37,11 @@ static GLTexture::Matrix _identity_matrix = { }; GLTexture::List -CopyPixmap::bindPixmapToTexture (Pixmap pixmap, - int width, - int height, - int depth) +CopyPixmap::bindPixmapToTexture (Pixmap pixmap, + int width, + int height, + int depth, + compiz::opengl::PixmapSource source) { if (depth != 32 && depth != 24) return GLTexture::List (); diff --git a/plugins/copytex/src/copytex.h b/plugins/copytex/src/copytex.h index b5228a70bd29f7133748cc0f7478bcf1e1a56a7a..8530c5fba9f6beed6bac91f94a46551dcce544ef 100644 --- a/plugins/copytex/src/copytex.h +++ b/plugins/copytex/src/copytex.h @@ -52,10 +52,11 @@ class CopyPixmap { ~CopyPixmap (); - static GLTexture::List bindPixmapToTexture (Pixmap pixmap, - int width, - int height, - int depth); + static GLTexture::List bindPixmapToTexture (Pixmap pixmap, + int width, + int height, + int depth, + compiz::opengl::PixmapSource source); public: Textures textures; diff --git a/plugins/decor/src/decor.cpp b/plugins/decor/src/decor.cpp index de8b7409e7d0a0723c91de5c0fbac0795b518720..b1a0aacc201bb06a6bdbeb977da451ec750b83d7 100644 --- a/plugins/decor/src/decor.cpp +++ b/plugins/decor/src/decor.cpp @@ -159,6 +159,8 @@ DecorWindow::glDraw (const GLMatrix &transform, { bool status; + status = gWindow->glDraw (transform, attrib, region, mask); + /* Don't render dock decorations (shadows) on just any old window */ if (!(window->type () & CompWindowTypeDockMask)) { @@ -198,8 +200,6 @@ DecorWindow::glDraw (const GLMatrix &transform, } } - status = gWindow->glDraw (transform, attrib, region, mask); - return status; } @@ -337,7 +337,9 @@ DecorTexture::DecorTexture (DecorPixmapInterface::Ptr pixmap) : } bindFailed = false; - textures = GLTexture::bindPixmapToTexture (pixmap->getPixmap (), width, height, depth); + textures = GLTexture::bindPixmapToTexture (pixmap->getPixmap (), + width, height, depth, + compiz::opengl::ExternallyManaged); if (textures.size () != 1) { bindFailed = true; diff --git a/plugins/opacify/src/opacify.cpp b/plugins/opacify/src/opacify.cpp index 5c3bc1186bef49ef393d1a905683ae9c776fd45b..77d3034d1df81553ec635d2b6b606886153d589c 100644 --- a/plugins/opacify/src/opacify.cpp +++ b/plugins/opacify/src/opacify.cpp @@ -414,7 +414,7 @@ OpacifyScreen::OpacifyScreen (CompScreen *screen) : optionSetTimeoutNotify (boost::bind (&OpacifyScreen::optionChanged, this, _1, _2)); - screen->handleEventSetEnabled (this, optionGetInitToggle ()); + setFunctions (optionGetInitToggle ()); } bool diff --git a/plugins/opengl/CMakeLists.txt b/plugins/opengl/CMakeLists.txt index a8926a492215195f0fa3f5bce784658228e8f56b..13c2a3ec853cd41c40f0f492fee6e2bfed1507ab 100644 --- a/plugins/opengl/CMakeLists.txt +++ b/plugins/opengl/CMakeLists.txt @@ -5,10 +5,14 @@ include (CompizPlugin) set (INTERNAL_LIBRARIES compiz_opengl_double_buffer compiz_opengl_fsregion + compiz_opengl_glx_tfp_bind ) add_subdirectory (src/doublebuffer) add_subdirectory (src/fsregion) +add_subdirectory (src/glxtfpbind) + +include_directories (src/glxtfpbind/include) if (USE_GLES) compiz_plugin(opengl PLUGINDEPS composite CFLAGSADD "-DUSE_GLES -std=c++0x" LIBRARIES ${OPENGLES2_LIBRARIES} ${INTERNAL_LIBRARIES} dl INCDIRS ${OPENGLES2_INCLUDE_DIR}) diff --git a/plugins/opengl/include/opengl/doublebuffer.h b/plugins/opengl/include/opengl/doublebuffer.h index d1cdc572ffcead46060a898cc3396ce1144bd6dc..d0e94525eff25b1364739e71823f4f99a4e24f98 100644 --- a/plugins/opengl/include/opengl/doublebuffer.h +++ b/plugins/opengl/include/opengl/doublebuffer.h @@ -19,11 +19,13 @@ class DoubleBuffer virtual void blit (const CompRegion ®ion) const = 0; virtual bool fallbackBlitAvailable () const = 0; virtual void fallbackBlit (const CompRegion ®ion) const = 0; + virtual void copyFrontToBack () const = 0; typedef enum { VSYNC, - PERSISTENT_BACK_BUFFER, + HAVE_PERSISTENT_BACK_BUFFER, + NEED_PERSISTENT_BACK_BUFFER, _NSETTINGS } Setting; diff --git a/plugins/opengl/include/opengl/opengl.h b/plugins/opengl/include/opengl/opengl.h index b96ae6b0736e4b24b1fb9b55021ca1b3319a8a19..dfa094c152f72853c8280d25b09fbe47da1f6609 100644 --- a/plugins/opengl/include/opengl/opengl.h +++ b/plugins/opengl/include/opengl/opengl.h @@ -50,7 +50,7 @@ #include #include -#define COMPIZ_OPENGL_ABI 5 +#define COMPIZ_OPENGL_ABI 6 /* * Some plugins check for #ifdef USE_MODERN_COMPIZ_GL. Support it for now, but diff --git a/plugins/opengl/include/opengl/pixmapsource.h b/plugins/opengl/include/opengl/pixmapsource.h new file mode 100644 index 0000000000000000000000000000000000000000..6c75207c7abe61b2089a8746d448f0ea30b47f91 --- /dev/null +++ b/plugins/opengl/include/opengl/pixmapsource.h @@ -0,0 +1,40 @@ +/* + * + * Copyright (c) 2012 Canonical Ltd. + * Authors: Sam Spilsbury + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef _COMPIZ_OPENGL_PIXMAP_SOURCE_H +#define _COMPIZ_OPENGL_PIXMAP_SOURCE_H + +namespace compiz +{ + namespace opengl + { + typedef enum _PixmapSource + { + InternallyManaged = 0, + ExternallyManaged = 1 + } PixmapSource; + } +} + +#endif diff --git a/plugins/opengl/include/opengl/texture.h b/plugins/opengl/include/opengl/texture.h index 20d8faca6501e2df963bacaf283589c85cd11841..b8b26f25cb5991e266e369b2a156f8dcd9b98d2e 100644 --- a/plugins/opengl/include/opengl/texture.h +++ b/plugins/opengl/include/opengl/texture.h @@ -43,6 +43,8 @@ #include +#include + #define POWER_OF_TWO(v) ((v & (v - 1)) == 0) @@ -104,7 +106,7 @@ class GLTexture : public CompRect { void clear (); }; - typedef boost::function BindPixmapProc; + typedef boost::function BindPixmapProc; typedef unsigned int BindPixmapHandle; public: @@ -181,11 +183,14 @@ class GLTexture : public CompRect { * @param width Specifies the width of the texture * @param height Specifies the height of the texture * @param depth Specifies the color depth of the texture + * @param source Whether the pixmap lifecycle is managed externall */ - static List bindPixmapToTexture (Pixmap pixmap, - int width, - int height, - int depth); + static List bindPixmapToTexture (Pixmap pixmap, + int width, + int height, + int depth, + compiz::opengl::PixmapSource source + = compiz::opengl::InternallyManaged); /** * Returns a GLTexture::List with the contents of of diff --git a/plugins/opengl/src/doublebuffer/src/double-buffer.cpp b/plugins/opengl/src/doublebuffer/src/double-buffer.cpp index f8d16fba433bcd18b6b11b1ea4ab1f90a0c7a9df..edb33aa900bc7914b00ae140a59c742608b4da08 100644 --- a/plugins/opengl/src/doublebuffer/src/double-buffer.cpp +++ b/plugins/opengl/src/doublebuffer/src/double-buffer.cpp @@ -41,7 +41,8 @@ namespace opengl DoubleBuffer::DoubleBuffer () { setting[VSYNC] = true; - setting[PERSISTENT_BACK_BUFFER] = false; + setting[HAVE_PERSISTENT_BACK_BUFFER] = false; + setting[NEED_PERSISTENT_BACK_BUFFER] = false; } DoubleBuffer::~DoubleBuffer () @@ -59,7 +60,14 @@ DoubleBuffer::render (const CompRegion ®ion, bool fullscreen) { if (fullscreen) + { swap (); + if (setting[NEED_PERSISTENT_BACK_BUFFER] && + !setting[HAVE_PERSISTENT_BACK_BUFFER]) + { + copyFrontToBack (); + } + } else if (blitAvailable ()) blit (region); else if (fallbackBlitAvailable ()) diff --git a/plugins/opengl/src/doublebuffer/tests/test-opengl-double-buffer.cpp b/plugins/opengl/src/doublebuffer/tests/test-opengl-double-buffer.cpp index fbf2de9ae9db665048ea311942806ceae5a2fec5..7160ca39efc6fef71e5650229125e517f92616ed 100644 --- a/plugins/opengl/src/doublebuffer/tests/test-opengl-double-buffer.cpp +++ b/plugins/opengl/src/doublebuffer/tests/test-opengl-double-buffer.cpp @@ -18,6 +18,7 @@ class MockDoubleBuffer : MOCK_CONST_METHOD1 (blit, void (const CompRegion &)); MOCK_CONST_METHOD0 (fallbackBlitAvailable, bool ()); MOCK_CONST_METHOD1 (fallbackBlit, void (const CompRegion &)); + MOCK_CONST_METHOD0 (copyFrontToBack, void ()); }; class DoubleBufferTest : @@ -38,6 +39,7 @@ class CompizOpenGLDoubleBufferDeathTest : TEST_F(DoubleBufferTest, TestPaintedFullAlwaysSwaps) { EXPECT_CALL (db, swap ()); + EXPECT_CALL (db, copyFrontToBack ()).Times (0); db.render (blitRegion, true); } @@ -46,6 +48,31 @@ TEST_F(DoubleBufferTest, TestNoPaintedFullscreenOrFBOAlwaysBlitsSubBuffer) { EXPECT_CALL (db, blitAvailable ()).WillOnce (Return (true)); EXPECT_CALL (db, blit (_)); + EXPECT_CALL (db, copyFrontToBack ()).Times (0); + + db.render (blitRegion, false); +} + +TEST_F(DoubleBufferTest, SwapWithoutFBO) +{ + db.set (DoubleBuffer::HAVE_PERSISTENT_BACK_BUFFER, false); + db.set (DoubleBuffer::NEED_PERSISTENT_BACK_BUFFER, true); + + EXPECT_CALL (db, swap ()); + EXPECT_CALL (db, copyFrontToBack ()).Times (1); + + db.render (blitRegion, true); +} + +TEST_F(DoubleBufferTest, BlitWithoutFBO) +{ + db.set (DoubleBuffer::HAVE_PERSISTENT_BACK_BUFFER, false); + db.set (DoubleBuffer::NEED_PERSISTENT_BACK_BUFFER, false); + + EXPECT_CALL (db, blitAvailable ()).WillRepeatedly (Return (true)); + EXPECT_CALL (db, blit (_)); + EXPECT_CALL (db, swap ()).Times (0); + EXPECT_CALL (db, copyFrontToBack ()).Times (0); db.render (blitRegion, false); } diff --git a/plugins/opengl/src/fsregion/fsregion.cpp b/plugins/opengl/src/fsregion/fsregion.cpp index 264b4ad3d23a41457d319d02b31dfaff18c28a81..b8b8c3343df0bcc5850dd537b89cf2c5bee9a481 100644 --- a/plugins/opengl/src/fsregion/fsregion.cpp +++ b/plugins/opengl/src/fsregion/fsregion.cpp @@ -30,7 +30,8 @@ namespace opengl { FullscreenRegion::FullscreenRegion (const CompRect &rect) : covered (false), - untouched (rect) + untouched (rect), + orig (untouched) { } @@ -50,5 +51,14 @@ FullscreenRegion::isCoveredBy (const CompRegion ®ion, WinFlags flags) return fullscreen; } +bool +FullscreenRegion::allowRedirection (const CompRegion ®ion) +{ + /* Don't allow existing unredirected windows that cover this + * region to be redirected again as they were probably unredirected + * on another monitor */ + return region.intersects (orig); +} + } // namespace opengl } // namespace compiz diff --git a/plugins/opengl/src/fsregion/fsregion.h b/plugins/opengl/src/fsregion/fsregion.h index bd178399f72fb7e63d432fc1b72282fdb2d0bc14..1b7461f912c88f4a54b192c60c3dabf85943ad10 100644 --- a/plugins/opengl/src/fsregion/fsregion.h +++ b/plugins/opengl/src/fsregion/fsregion.h @@ -46,10 +46,12 @@ public: // isCoveredBy is called for windows from TOP to BOTTOM bool isCoveredBy (const CompRegion ®ion, WinFlags flags = 0); + bool allowRedirection (const CompRegion ®ion); private: bool covered; CompRegion untouched; + CompRegion orig; }; } // namespace opengl diff --git a/plugins/opengl/src/fsregion/tests/test-fsregion.cpp b/plugins/opengl/src/fsregion/tests/test-fsregion.cpp index 961600e84110e30259856a6825518a3729b20991..e0e4dfb142825f74a060b1ab1b051f4e94dd8bed 100644 --- a/plugins/opengl/src/fsregion/tests/test-fsregion.cpp +++ b/plugins/opengl/src/fsregion/tests/test-fsregion.cpp @@ -137,4 +137,14 @@ TEST (OpenGLFullscreenRegion, Overflow) FullscreenRegion::Desktop)); } +TEST (OpenGLFullscreenRegion, KeepUnredirectedStateIfNotOnMonitor) +{ + FullscreenRegion monitor (CompRect (0, 0, 1024, 768)); + CompRegion window (1025, 0, 1024, 768); + /* Eg, not covering the monitor, should be redirected */ + EXPECT_FALSE (monitor.isCoveredBy (window)); + /* Don't allow the redirection however, because we weren't + * covering the monitor at all. */ + EXPECT_FALSE (monitor.allowRedirection (window)); +} diff --git a/plugins/opengl/src/glxtfpbind/CMakeLists.txt b/plugins/opengl/src/glxtfpbind/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..e0b8622d1dcb492f10d04e9a9b888dba85eff6ac --- /dev/null +++ b/plugins/opengl/src/glxtfpbind/CMakeLists.txt @@ -0,0 +1,31 @@ +INCLUDE_DIRECTORIES ( + ${compiz_SOURCE_DIR}/src/servergrab/include + ${CMAKE_CURRENT_SOURCE_DIR}/../../include + ${CMAKE_CURRENT_SOURCE_DIR}/include + ${CMAKE_CURRENT_SOURCE_DIR}/src + + ${Boost_INCLUDE_DIRS} +) + +LINK_DIRECTORIES (${COMPIZ_LIBRARY_DIRS}) + +SET( + SRCS + ${CMAKE_CURRENT_SOURCE_DIR}/src/glx-tfp-bind.cpp +) + +ADD_LIBRARY( + compiz_opengl_glx_tfp_bind STATIC + + ${SRCS} +) + +if (COMPIZ_BUILD_TESTING) +ADD_SUBDIRECTORY( ${CMAKE_CURRENT_SOURCE_DIR}/tests ) +endif (COMPIZ_BUILD_TESTING) + +TARGET_LINK_LIBRARIES( + compiz_opengl_glx_tfp_bind + + compiz_servergrab +) diff --git a/plugins/opengl/src/glxtfpbind/include/glx-tfp-bind.h b/plugins/opengl/src/glxtfpbind/include/glx-tfp-bind.h new file mode 100644 index 0000000000000000000000000000000000000000..6b21619981fd490973255bba18733fad664a92c3 --- /dev/null +++ b/plugins/opengl/src/glxtfpbind/include/glx-tfp-bind.h @@ -0,0 +1,53 @@ +/* + * Compiz, opengl plugin, GLX_EXT_texture_from_pixmap rebind logic + * + * Copyright (c) 2012 Canonical Ltd. + * Authors: Sam Spilsbury + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +#ifndef _COMPIZ_OPENGL_GLX_TFP_BIND_H +#define _COMPIZ_OPENGL_GLX_TFP_BIND_H + +#include +#include + +class ServerGrabInterface; +typedef unsigned long Pixmap; +typedef unsigned long GLXPixmap; + +namespace compiz +{ + namespace opengl + { + typedef boost::function PixmapCheckValidityFunc; + typedef boost::function BindTexImageEXTFunc; + typedef boost::function WaitGLXFunc; + + bool bindTexImageGLX (ServerGrabInterface *, + Pixmap, + GLXPixmap, + const PixmapCheckValidityFunc &, + const BindTexImageEXTFunc &, + const WaitGLXFunc &, + PixmapSource); + + } // namespace opengl +} // namespace compiz +#endif diff --git a/plugins/opengl/src/glxtfpbind/src/glx-tfp-bind.cpp b/plugins/opengl/src/glxtfpbind/src/glx-tfp-bind.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3a2625e7a3629b7a5bffd1a2f88d667b805b5011 --- /dev/null +++ b/plugins/opengl/src/glxtfpbind/src/glx-tfp-bind.cpp @@ -0,0 +1,53 @@ +/* + * Compiz, opengl plugin, GLX_EXT_texture_from_pixmap rebind logic + * + * Copyright (c) 2012 Canonical Ltd. + * Authors: Sam Spilsbury + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +#include +#include +#include "glx-tfp-bind.h" + +namespace cgl = compiz::opengl; + +bool +cgl::bindTexImageGLX (ServerGrabInterface *serverGrabInterface, + Pixmap x11Pixmap, + GLXPixmap glxPixmap, + const cgl::PixmapCheckValidityFunc &checkPixmapValidity, + const cgl::BindTexImageEXTFunc &bindTexImageEXT, + const cgl::WaitGLXFunc &waitGLX, + cgl::PixmapSource source) +{ + ServerLock lock (serverGrabInterface); + + waitGLX (); + + /* External pixmaps can disappear on us, but not + * while we have a server grab at least */ + if (source == cgl::ExternallyManaged) + if (!checkPixmapValidity (x11Pixmap)) + return false; + + bindTexImageEXT (glxPixmap); + + return true; +} diff --git a/plugins/opengl/src/glxtfpbind/tests/CMakeLists.txt b/plugins/opengl/src/glxtfpbind/tests/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..43d4d2622b33b84cd8a4d8b4c06524938a8acd54 --- /dev/null +++ b/plugins/opengl/src/glxtfpbind/tests/CMakeLists.txt @@ -0,0 +1,24 @@ +find_library (GMOCK_LIBRARY gmock) +find_library (GMOCK_MAIN_LIBRARY gmock_main) + +if (NOT GMOCK_LIBRARY OR NOT GMOCK_MAIN_LIBRARY OR NOT GTEST_FOUND) + message ("Google Mock and Google Test not found - cannot build tests!") + set (COMPIZ_BUILD_TESTING OFF) +endif (NOT GMOCK_LIBRARY OR NOT GMOCK_MAIN_LIBRARY OR NOT GTEST_FOUND) + +include_directories (${GTEST_INCLUDE_DIRS}) + +link_directories (${COMPIZ_LIBRARY_DIRS}) + +add_executable (compiz_test_opengl_glx_tfp_bind + ${CMAKE_CURRENT_SOURCE_DIR}/test-opengl-glx-tfp-bind.cpp) + +target_link_libraries (compiz_test_opengl_glx_tfp_bind + compiz_opengl_glx_tfp_bind + ${GTEST_BOTH_LIBRARIES} + ${GMOCK_LIBRARY} + ${GMOCK_MAIN_LIBRARY} + ${CMAKE_THREAD_LIBS_INIT} # Link in pthread. + ) + +compiz_discover_tests (compiz_test_opengl_glx_tfp_bind COVERAGE compiz_opengl_glx_tfp_bind) diff --git a/plugins/opengl/src/glxtfpbind/tests/test-opengl-glx-tfp-bind.cpp b/plugins/opengl/src/glxtfpbind/tests/test-opengl-glx-tfp-bind.cpp new file mode 100644 index 0000000000000000000000000000000000000000..edd10acbd39b546fd7a4819ccd667c432238a1c9 --- /dev/null +++ b/plugins/opengl/src/glxtfpbind/tests/test-opengl-glx-tfp-bind.cpp @@ -0,0 +1,157 @@ +#include + +#include +#include + +#include +#include "glx-tfp-bind.h" + +using ::testing::InSequence; +using ::testing::NiceMock; +using ::testing::StrictMock; +using ::testing::Return; + +namespace cgl = compiz::opengl; + +namespace +{ + const Pixmap pixmap = 1; + const GLXPixmap glxPixmap = 2; + + void emptyWaitGLX () {} + bool emptyCheckPixmap (Pixmap p) { return true; } + void emptyBindTexImage (GLXPixmap p) {} + + cgl::WaitGLXFunc waitGLX () { return boost::bind (emptyWaitGLX); } + cgl::PixmapCheckValidityFunc pixmapCheckValidity () { return boost::bind (emptyCheckPixmap, _1); } + cgl::BindTexImageEXTFunc bindTexImageEXT () { return boost::bind (emptyBindTexImage, _1); } +} + +class MockWaitGLX +{ + public: + + MOCK_METHOD0 (waitGLX, void ()); +}; + +class MockPixmapCheckValidity +{ + public: + + MOCK_METHOD1 (checkValidity, bool (Pixmap)); +}; + +class MockBindTexImageEXT +{ + public: + + MOCK_METHOD1 (bindTexImageEXT, void (GLXPixmap)); +}; + +class MockServerGrab : + public ServerGrabInterface +{ + public: + + MOCK_METHOD0 (grabServer, void ()); + MOCK_METHOD0 (syncServer, void ()); + MOCK_METHOD0 (ungrabServer, void ()); +}; + +TEST (CompizOpenGLGLXTextureFromPixmapBindTest, TestTakesServerGrab) +{ + MockServerGrab mockServerGrab; + InSequence s; + + EXPECT_CALL (mockServerGrab, grabServer ()); + EXPECT_CALL (mockServerGrab, syncServer ()); + EXPECT_CALL (mockServerGrab, ungrabServer ()); + EXPECT_CALL (mockServerGrab, syncServer ()); + + cgl::bindTexImageGLX (&mockServerGrab, + pixmap, + glxPixmap, + pixmapCheckValidity (), + bindTexImageEXT (), + waitGLX (), + cgl::InternallyManaged); +} + +TEST (CompizOpenGLGLXTextureFromPixmapBindTest, TestCallsWaitGLX) +{ + NiceMock mockServerGrab; + MockWaitGLX mockWaitGLX; + + cgl::WaitGLXFunc waitGLXFuncMock (boost::bind (&MockWaitGLX::waitGLX, &mockWaitGLX)); + + EXPECT_CALL (mockWaitGLX, waitGLX ()); + + cgl::bindTexImageGLX (&mockServerGrab, + pixmap, + glxPixmap, + pixmapCheckValidity (), + bindTexImageEXT (), + waitGLXFuncMock, + cgl::InternallyManaged); +} + +TEST (CompizOpenGLGLXTextureFromPixmapBindTest, TestNoCallToCheckValidityIfInternalAndImmediateBind) +{ + NiceMock mockServerGrab; + StrictMock mockPixmapCheck; + StrictMock mockBindTexImage; + + cgl::PixmapCheckValidityFunc pixmapCheckFunc (boost::bind (&MockPixmapCheckValidity::checkValidity, &mockPixmapCheck, _1)); + cgl::BindTexImageEXTFunc bindTexImageEXTFunc (boost::bind (&MockBindTexImageEXT::bindTexImageEXT, &mockBindTexImage, _1)); + + EXPECT_CALL (mockBindTexImage, bindTexImageEXT (glxPixmap)); + + EXPECT_TRUE (cgl::bindTexImageGLX (&mockServerGrab, + pixmap, + glxPixmap, + pixmapCheckFunc, + bindTexImageEXTFunc, + waitGLX (), + cgl::InternallyManaged)); +} + +TEST (CompizOpenGLGLXTextureFromPixmapBindTest, TestCheckValidityIfExternalNoBindIfInvalid) +{ + NiceMock mockServerGrab; + StrictMock mockPixmapCheck; + StrictMock mockBindTexImage; + + cgl::PixmapCheckValidityFunc pixmapCheckFunc (boost::bind (&MockPixmapCheckValidity::checkValidity, &mockPixmapCheck, _1)); + cgl::BindTexImageEXTFunc bindTexImageEXTFunc (boost::bind (&MockBindTexImageEXT::bindTexImageEXT, &mockBindTexImage, _1)); + + EXPECT_CALL (mockPixmapCheck, checkValidity (pixmap)).WillOnce (Return (false)); + + EXPECT_FALSE (cgl::bindTexImageGLX (&mockServerGrab, + pixmap, + glxPixmap, + pixmapCheckFunc, + bindTexImageEXTFunc, + waitGLX (), + cgl::ExternallyManaged)); +} + +TEST (CompizOpenGLGLXTextureFromPixmapBindTest, TestCheckValidityIfExternalBindIfValid) +{ + NiceMock mockServerGrab; + StrictMock mockPixmapCheck; + StrictMock mockBindTexImage; + + cgl::PixmapCheckValidityFunc pixmapCheckFunc (boost::bind (&MockPixmapCheckValidity::checkValidity, &mockPixmapCheck, _1)); + cgl::BindTexImageEXTFunc bindTexImageEXTFunc (boost::bind (&MockBindTexImageEXT::bindTexImageEXT, &mockBindTexImage, _1)); + + EXPECT_CALL (mockPixmapCheck, checkValidity (pixmap)).WillOnce (Return (true)); + EXPECT_CALL (mockBindTexImage, bindTexImageEXT (glxPixmap)); + + EXPECT_TRUE (cgl::bindTexImageGLX (&mockServerGrab, + pixmap, + glxPixmap, + pixmapCheckFunc, + bindTexImageEXTFunc, + waitGLX (), + cgl::ExternallyManaged)); +} diff --git a/plugins/opengl/src/paint.cpp b/plugins/opengl/src/paint.cpp index 50e27745ed001d0635cc98535bbf1d5d1bd73ac8..55c482515cd1d720712f443094d9b109d446c52b 100644 --- a/plugins/opengl/src/paint.cpp +++ b/plugins/opengl/src/paint.cpp @@ -27,6 +27,7 @@ #include "privates.h" +#include #include #include #include @@ -245,11 +246,11 @@ PrivateGLScreen::paintOutputRegion (const GLMatrix &transform, CompWindow *w; GLWindow *gw; int windowMask, odMask; - CompWindow *fullscreenWindow = NULL; bool status, unredirectFS; bool withOffset = false; GLMatrix vTransform; CompPoint offXY; + std::set unredirected; CompWindowList pl; CompWindowList::reverse_iterator rit; @@ -350,32 +351,40 @@ PrivateGLScreen::paintOutputRegion (const GLMatrix &transform, * beneath them and so neither should be unredirected in that case. */ if (unredirectFS && - !(mask & PAINT_SCREEN_TRANSFORMED_MASK) && - fs.isCoveredBy (w->region (), flags)) + !(mask & PAINT_SCREEN_TRANSFORMED_MASK) && + fs.isCoveredBy (w->region (), flags)) { - fullscreenWindow = w; + unredirected.insert (w); } else { - CompositeWindow *cw = CompositeWindow::get (w); - if (!cw->redirected ()) - { - // 1. GLWindow::release to force gw->priv->needsRebind - gw->release (); - - // 2. GLWindow::bind, which redirects the window, - // rebinds the pixmap, and then rebinds the pixmap - // to a texture. - gw->bind (); - - // 3. Your window is now redirected again with the - // latest pixmap contents. - } + CompositeWindow *cw = CompositeWindow::get (w); + if (!cw->redirected ()) + { + if (fs.allowRedirection (w->region ())) + { + // 1. GLWindow::release to force gw->priv->needsRebind + gw->release (); + + // 2. GLWindow::bind, which redirects the window, + // rebinds the pixmap, and then rebinds the pixmap + // to a texture. + gw->bind (); + + // 3. Your window is now redirected again with the + // latest pixmap contents. + } + else + { + unredirected.insert (w); + } + } } } } - if (fullscreenWindow) + /* Unredirect any redirected fullscreen windows */ + foreach (CompWindow *fullscreenWindow, unredirected) CompositeWindow::get (fullscreenWindow)->unredirect (); if (!(mask & PAINT_SCREEN_NO_BACKGROUND_MASK)) @@ -389,7 +398,7 @@ PrivateGLScreen::paintOutputRegion (const GLMatrix &transform, if (w->destroyed ()) continue; - if (w == fullscreenWindow) + if (unredirected.find (w) != unredirected.end ()) continue; if (!w->shaded ()) diff --git a/plugins/opengl/src/privates.h b/plugins/opengl/src/privates.h index 656c9c678c2618df8d72fb001da212c4aa6e2989..67873919f4dab34db8def05fc16b9b74db311cb7 100644 --- a/plugins/opengl/src/privates.h +++ b/plugins/opengl/src/privates.h @@ -74,6 +74,7 @@ class GLXDoubleBuffer : void blit (const CompRegion ®ion) const; bool fallbackBlitAvailable () const; void fallbackBlit (const CompRegion ®ion) const; + void copyFrontToBack () const; protected: @@ -96,6 +97,7 @@ class EGLDoubleBuffer : void blit (const CompRegion ®ion) const; bool fallbackBlitAvailable () const; void fallbackBlit (const CompRegion ®ion) const; + void copyFrontToBack () const; private: diff --git a/plugins/opengl/src/privatetexture.h b/plugins/opengl/src/privatetexture.h index b3c5a168dd6c35f354cf896aab3717f98e098789..014850f0c1aa007c3dbd16675c1dd68bd7589831 100644 --- a/plugins/opengl/src/privatetexture.h +++ b/plugins/opengl/src/privatetexture.h @@ -79,10 +79,11 @@ class EglTexture : public GLTexture { void enable (Filter filter); - static List bindPixmapToTexture (Pixmap pixmap, - int width, - int height, - int depth); + static List bindPixmapToTexture (Pixmap pixmap, + int width, + int height, + int depth, + compiz::opengl::PixmapSource source); public: bool damaged; @@ -102,16 +103,19 @@ class TfpTexture : public GLTexture { bool bindTexImage (const GLXPixmap &); void releaseTexImage (); - static List bindPixmapToTexture (Pixmap pixmap, - int width, - int height, - int depth); + static List bindPixmapToTexture (Pixmap pixmap, + int width, + int height, + int depth, + compiz::opengl::PixmapSource source); public: - GLXPixmap pixmap; - bool damaged; - Damage damage; - bool updateMipMap; + Pixmap x11Pixmap; + GLXPixmap pixmap; + bool damaged; + Damage damage; + bool updateMipMap; + compiz::opengl::PixmapSource source; }; extern std::map boundPixmapTex; diff --git a/plugins/opengl/src/screen.cpp b/plugins/opengl/src/screen.cpp index c3300b64691bf28c7751866fe5d9ed5cf8cfeba8..ff294cf16bb9d89f77b57a24f8d347bd3aa847c3 100644 --- a/plugins/opengl/src/screen.cpp +++ b/plugins/opengl/src/screen.cpp @@ -869,6 +869,16 @@ GLScreen::GLScreen (CompScreen *s) : glxExtensions = glXQueryExtensionsString (dpy, s->screenNum ()); + if (glxExtensions == NULL) + { + compLogMessage ("opengl", CompLogLevelFatal, + "glXQueryExtensionsString is NULL for screen %d", + s->screenNum ()); + screen->handleCompizEvent ("opengl", "fatal_fallback", o); + setFailed (); + return; + } + if (!strstr (glxExtensions, "GLX_SGIX_fbconfig")) { compLogMessage ("opengl", CompLogLevelFatal, @@ -1722,8 +1732,8 @@ GLDoubleBuffer::GLDoubleBuffer (Display *d, const CompSize &s) : #ifndef USE_GLES -static void -copyFrontToBack() +void +GLXDoubleBuffer::copyFrontToBack() const { int w = screen->width (); int h = screen->height (); @@ -1761,9 +1771,6 @@ GLXDoubleBuffer::swap () const GL::controlSwapVideoSync (setting[VSYNC]); glXSwapBuffers (mDpy, mOutput); - - if (!setting[PERSISTENT_BACK_BUFFER]) - copyFrontToBack (); } bool @@ -1891,6 +1898,11 @@ EGLDoubleBuffer::fallbackBlit (const CompRegion ®ion) const { } +void +EGLDoubleBuffer::copyFrontToBack() const +{ +} + #endif void @@ -2023,13 +2035,15 @@ PrivateGLScreen::paintOutputs (CompOutput::ptrList &outputs, gScreen->glPaintCompositedOutput (screen->region (), scratchFbo, mask); } + bool alwaysSwap = optionGetAlwaysSwapBuffers (); bool fullscreen = useFbo || - optionGetAlwaysSwapBuffers () || + alwaysSwap || ((mask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK) && commonFrontbuffer); doubleBuffer.set (DoubleBuffer::VSYNC, optionGetSyncToVblank ()); - doubleBuffer.set (DoubleBuffer::PERSISTENT_BACK_BUFFER, useFbo); + doubleBuffer.set (DoubleBuffer::HAVE_PERSISTENT_BACK_BUFFER, useFbo); + doubleBuffer.set (DoubleBuffer::NEED_PERSISTENT_BACK_BUFFER, alwaysSwap); doubleBuffer.render (tmpRegion, fullscreen); lastMask = mask; diff --git a/plugins/opengl/src/texture.cpp b/plugins/opengl/src/texture.cpp index ee27b0da67d30dd821ec4c120f7cd2789cf4ae06..970edf07279c4602d49356ba7eb05235c9bfd0eb 100644 --- a/plugins/opengl/src/texture.cpp +++ b/plugins/opengl/src/texture.cpp @@ -31,11 +31,17 @@ #include #include +#include + #include #include #include #include "privates.h" +#include "glx-tfp-bind.h" + +namespace cgl = compiz::opengl; + #ifdef USE_GLES std::map boundPixmapTex; #else @@ -421,23 +427,58 @@ GLTexture::incRef (GLTexture *tex) } GLTexture::List -GLTexture::bindPixmapToTexture (Pixmap pixmap, - int width, - int height, - int depth) +GLTexture::bindPixmapToTexture (Pixmap pixmap, + int width, + int height, + int depth, + compiz::opengl::PixmapSource source) { GLTexture::List rv; foreach (BindPixmapProc &proc, GLScreen::get (screen)->priv->bindPixmap) { if (!proc.empty ()) - rv = proc (pixmap, width, height, depth); + rv = proc (pixmap, width, height, depth, source); if (rv.size ()) return rv; } return GLTexture::List (); } +namespace +{ + bool checkPixmapValidityGLX (Pixmap pixmap) + { + Window windowReturn; + unsigned int uiReturn; + int iReturn; + + if (!XGetGeometry (screen->dpy (), + pixmap, + &windowReturn, + &iReturn, + &iReturn, + &uiReturn, + &uiReturn, + &uiReturn, + &uiReturn)) + return false; + return true; + } + + const cgl::WaitGLXFunc & waitGLXFunc () + { + static const cgl::WaitGLXFunc f (boost::bind (glXWaitX)); + return f; + } + + const cgl::PixmapCheckValidityFunc & checkPixmapValidityFunc () + { + static const cgl::PixmapCheckValidityFunc f (boost::bind (checkPixmapValidityGLX, _1)); + return f; + } +} + #ifdef USE_GLES EglTexture::EglTexture () : damaged (true), @@ -538,6 +579,20 @@ EglTexture::enable (GLTexture::Filter filter) } #else +namespace +{ + const cgl::BindTexImageEXTFunc & bindTexImageEXT () + { + static int *attrib_list = NULL; + static const cgl::BindTexImageEXTFunc f (boost::bind (GL::bindTexImage, + screen->dpy (), + _1, + GLX_FRONT_LEFT_EXT, + attrib_list)); + return f; + } +} + TfpTexture::TfpTexture () : pixmap (0), damaged (true), @@ -569,10 +624,13 @@ TfpTexture::~TfpTexture () bool TfpTexture::bindTexImage (const GLXPixmap &glxPixmap) { - ServerLock sg (screen->serverGrabInterface ()); - glXWaitX (); - (*GL::bindTexImage) (screen->dpy (), glxPixmap, GLX_FRONT_LEFT_EXT, NULL); - return true; + return compiz::opengl::bindTexImageGLX (screen->serverGrabInterface (), + x11Pixmap, + glxPixmap, + checkPixmapValidityFunc (), + bindTexImageEXT (), + waitGLXFunc (), + source); } void @@ -582,10 +640,11 @@ TfpTexture::releaseTexImage () } GLTexture::List -TfpTexture::bindPixmapToTexture (Pixmap pixmap, - int width, - int height, - int depth) +TfpTexture::bindPixmapToTexture (Pixmap pixmap, + int width, + int height, + int depth, + cgl::PixmapSource source) { if ((int) width > GL::maxTextureSize || (int) height > GL::maxTextureSize || !GL::textureFromPixmap) @@ -650,6 +709,19 @@ TfpTexture::bindPixmapToTexture (Pixmap pixmap, attribs[i++] = None; + /* We need to take a server grab here if the pixmap is + * externally managed as we need to be able to query + * if it actually exists */ + boost::scoped_ptr lock; + + if (source == cgl::ExternallyManaged) + { + lock.reset (new ServerLock (screen->serverGrabInterface ())); + + if (!checkPixmapValidityGLX (pixmap)) + return false; + } + glxPixmap = (*GL::createPixmap) (screen->dpy (), config->fbConfig, pixmap, attribs); @@ -711,6 +783,8 @@ TfpTexture::bindPixmapToTexture (Pixmap pixmap, tex->setData (texTarget, matrix, mipmap); tex->setGeometry (0, 0, width, height); tex->pixmap = glxPixmap; + tex->x11Pixmap = pixmap; + tex->source = source; rv[0] = tex; diff --git a/plugins/scale/include/scale/scale.h b/plugins/scale/include/scale/scale.h index fc21f8fe22d0a7574bbaec5f1e2e9079d580fb63..46ace72fc7f157b6dc16b5ecb6ebe916b290c41e 100644 --- a/plugins/scale/include/scale/scale.h +++ b/plugins/scale/include/scale/scale.h @@ -31,7 +31,7 @@ #include #include -#define COMPIZ_SCALE_ABI 2 +#define COMPIZ_SCALE_ABI 3 class ScaleScreen; class PrivateScaleScreen; @@ -93,7 +93,8 @@ class ScaleScreen : State getState () const; ScaleType getType () const; - const Window & getHoveredWindow (); + const Window & getHoveredWindow () const; + const Window & getSelectedWindow () const; const CompMatch & getCustomMatch () const; const WindowList& getWindows () const; diff --git a/plugins/scale/src/privates.h b/plugins/scale/src/privates.h index 5f3ce60795adc9b5ee4a464b8f25ebe53c673604..efa685a20930277bf64d691af65e7092a7bce0b1 100644 --- a/plugins/scale/src/privates.h +++ b/plugins/scale/src/privates.h @@ -91,6 +91,7 @@ class PrivateScaleScreen : bool ensureDndRedirectWindow (); bool selectWindowAt (int x, int y, bool moveInputFocus); + bool selectWindowAt (int x, int y); void moveFocusWindow (int dx, int dy); diff --git a/plugins/scale/src/scale.cpp b/plugins/scale/src/scale.cpp index a8b1a760d33e11b1f9a34484b1588d5bd0271eac..18c3854d1feeee9f469a22ab3112cf9b26cb2e28 100644 --- a/plugins/scale/src/scale.cpp +++ b/plugins/scale/src/scale.cpp @@ -929,7 +929,12 @@ PrivateScaleScreen::donePaint () } } else if (state == ScaleScreen::Out) + { state = ScaleScreen::Wait; + + // When the animation is completed, select the window under mouse + selectWindowAt (pointerX, pointerY); + } } } @@ -1346,11 +1351,17 @@ ScaleWindow::setCurrentPosition (const ScalePosition &newPos) } const Window & -ScaleScreen::getHoveredWindow () +ScaleScreen::getHoveredWindow () const { return priv->hoveredWindow; } +const Window & +ScaleScreen::getSelectedWindow () const +{ + return priv->selectedWindow; +} + bool PrivateScaleScreen::selectWindowAt (int x, int y, @@ -1379,6 +1390,16 @@ PrivateScaleScreen::selectWindowAt (int x, return false; } +bool +PrivateScaleScreen::selectWindowAt (int x, + int y) +{ + CompOption *o = screen->getOption ("click_to_focus"); + bool focus = (o && !o->value ().b ()); + + return selectWindowAt (x, y, focus); +} + void PrivateScaleScreen::moveFocusWindow (int dx, int dy) @@ -1598,15 +1619,7 @@ PrivateScaleScreen::handleEvent (XEvent *event) grabIndex && state != ScaleScreen::In) { - bool focus = false; - CompOption *o = screen->getOption ("click_to_focus"); - - if (o && !o->value ().b ()) - focus = true; - - selectWindowAt (event->xmotion.x_root, - event->xmotion.y_root, - focus); + selectWindowAt (event->xmotion.x_root, event->xmotion.y_root); } break; case DestroyNotify: @@ -1629,12 +1642,6 @@ PrivateScaleScreen::handleEvent (XEvent *event) w = screen->findWindow (event->xclient.window); if (w) { - bool focus = false; - CompOption *o = screen->getOption ("click_to_focus"); - - if (o && !o->value ().b ()) - focus = true; - if (w->id () == dndTarget) sendDndStatusMessage (event->xclient.data.l[0]); @@ -1662,7 +1669,7 @@ PrivateScaleScreen::handleEvent (XEvent *event) hover.start (time, (float) time * 1.2); } - selectWindowAt (pointerX, pointerY, focus); + selectWindowAt (pointerX, pointerY); } else { diff --git a/postinst/CMakeLists.txt b/postinst/CMakeLists.txt index bf884ef7072435a35216fe8c7c48fb7211b1eb2a..e79f934e5fde29735843e10b9c8b9a5303356574 100644 --- a/postinst/CMakeLists.txt +++ b/postinst/CMakeLists.txt @@ -1,10 +1,14 @@ -# Don't allow subdirectories to add schema recompile rule +# Allow setting the recompile rule again set_property (GLOBAL PROPERTY COMPIZ_INHIBIT_ADD_INSTALL_RECOMPILE_RULE FALSE) +set_property (GLOBAL + PROPERTY GSETTINGS_LOCAL_COMPILE_INHIBIT_RULE + FALSE) if (USE_GSETTINGS) compiz_add_install_recompile_gsettings_schemas (${CMAKE_INSTALL_PREFIX}/share/glib-2.0/schemas) + add_all_gsettings_schemas_to_local_recompilation_rule () endif (USE_GSETTINGS) diff --git a/postinst/convert-files/compiz-profile-Default.convert b/postinst/convert-files/compiz-profile-Default.convert index 68ee3720654a812b1f0ffa2aa68a6e4b187661bb..dfffe5eafaf78e65b4cd17fb3240065d65ac6646 100644 --- a/postinst/convert-files/compiz-profile-Default.convert +++ b/postinst/convert-files/compiz-profile-Default.convert @@ -108,63 +108,3 @@ top-edge-threshold = /apps/compizconfig-1/profiles/Default/plugins/grid/screen0/ top-left-corner-action = /apps/compizconfig-1/profiles/Default/plugins/grid/screen0/options/top_left_corner_action top-right-corner-action = /apps/compizconfig-1/profiles/Default/plugins/grid/screen0/options/top_right_corner_action - -[org.compiz.integrated] -run-command-terminal = /apps/metacity/global_keybindings/run_command_terminal -run-command-screenshot = /apps/metacity/global_keybindings/run_command_screenshot -run-command-window-screenshot = /apps/metacity/global_keybindings/run_command_window_screenshot -panel-run-dialog = /apps/metacity/global_keybindings/panel_run_dialog -panel-main-menu = /apps/metacity/global_keybindings/panel_main_menu - - -[org.gnome.desktop.wm.keybindings] -move-to-workspace-1 = /apps/metacity/window_keybindings/move_to_workspace_1 -move-to-workspace-2 = /apps/metacity/window_keybindings/move_to_workspace_2 -move-to-workspace-3 = /apps/metacity/window_keybindings/move_to_workspace_3 -move-to-workspace-4 = /apps/metacity/window_keybindings/move_to_workspace_4 -move-to-workspace-5 = /apps/metacity/window_keybindings/move_to_workspace_5 -move-to-workspace-6 = /apps/metacity/window_keybindings/move_to_workspace_6 -move-to-workspace-7 = /apps/metacity/window_keybindings/move_to_workspace_7 -move-to-workspace-8 = /apps/metacity/window_keybindings/move_to_workspace_8 -move-to-workspace-9 = /apps/metacity/window_keybindings/move_to_workspace_9 -move-to-workspace-10 = /apps/metacity/window_keybindings/move_to_workspace_10 -move-to-workspace-11 = /apps/metacity/window_keybindings/move_to_workspace_11 -move-to-workspace-12 = /apps/metacity/window_keybindings/move_to_workspace_12 -move-to-workspace-left = /apps/metacity/window_keybindings/move_to_workspace_left -move-to-workspace-right = /apps/metacity/window_keybindings/move_to_workspace_right -move-to-workspace-up = /apps/metacity/window_keybindings/move_to_workspace_up -move-to-workspace-down = /apps/metacity/window_keybindings/move_to_workspace_down -switch-windows = /apps/metacity/global_keybindings/switch_windows -switch-group = /apps/metacity/global_keybindings/switch_group -show-desktop = /apps/metacity/global_keybindings/show_desktop -switch-to-workspace-1 = /apps/metacity/global_keybindings/switch_to_workspace_1 -switch-to-workspace-2 = /apps/metacity/global_keybindings/switch_to_workspace_2 -switch-to-workspace-3 = /apps/metacity/global_keybindings/switch_to_workspace_3 -switch-to-workspace-4 = /apps/metacity/global_keybindings/switch_to_workspace_4 -switch-to-workspace-5 = /apps/metacity/global_keybindings/switch_to_workspace_5 -switch-to-workspace-6 = /apps/metacity/global_keybindings/switch_to_workspace_6 -switch-to-workspace-7 = /apps/metacity/global_keybindings/switch_to_workspace_7 -switch-to-workspace-8 = /apps/metacity/global_keybindings/switch_to_workspace_8 -switch-to-workspace-9 = /apps/metacity/global_keybindings/switch_to_workspace_9 -switch-to-workspace-10 = /apps/metacity/global_keybindings/switch_to_workspace_10 -switch-to-workspace-11 = /apps/metacity/global_keybindings/switch_to_workspace_11 -switch-to-workspace-12 = /apps/metacity/global_keybindings/switch_to_workspace_12 -switch-to-workspace-left = /apps/metacity/global_keybindings/switch_to_workspace_left -switch-to-workspace-right = /apps/metacity/global_keybindings/switch_to_workspace_right -switch-to-workspace-up = /apps/metacity/global_keybindings/switch_to_workspace_up -switch-to-workspace-down = /apps/metacity/global_keybindings/switch_to_workspace_down -activate-window-menu = /apps/metacity/window_keybindings/activate_window_menu -toggle-fullscreen = /apps/metacity/window_keybindings/toggle_fullscreen -toggle-maximized = /apps/metacity/window_keybindings/toggle_maximized -maximize = /apps/metacity/window_keybindings/maximize -unmaximize = /apps/metacity/window_keybindings/unmaximize -toggle-shaded = /apps/metacity/window_keybindings/toggle_shaded -close = /apps/metacity/window_keybindings/close -minimize = /apps/metacity/window_keybindings/minimize -begin-move = /apps/metacity/window_keybindings/begin_move -begin-resize = /apps/metacity/window_keybindings/begin_resize -raise = /apps/metacity/window_keybindings/raise -lower = /apps/metacity/window_keybindings/lower -maximize-vertically = /apps/metacity/window_keybindings/maximize_vertically -maximize-horizontally = /apps/metacity/window_keybindings/maximize_horizontally - diff --git a/postinst/convert-files/compiz-profile-active-Default.convert b/postinst/convert-files/compiz-profile-active-Default.convert index 0a8abb768359a65ec9b06a7c56ac79b7786e9ab3..b99637b5eabddbe3421db7de28e70f0b54d28566 100644 --- a/postinst/convert-files/compiz-profile-active-Default.convert +++ b/postinst/convert-files/compiz-profile-active-Default.convert @@ -108,63 +108,3 @@ top-edge-threshold = /apps/compiz-1/plugins/grid/screen0/options/top_edge_thresh top-left-corner-action = /apps/compiz-1/plugins/grid/screen0/options/top_left_corner_action top-right-corner-action = /apps/compiz-1/plugins/grid/screen0/options/top_right_corner_action - -[org.compiz.integrated] -run-command-terminal = /apps/metacity/global_keybindings/run_command_terminal -run-command-screenshot = /apps/metacity/global_keybindings/run_command_screenshot -run-command-window-screenshot = /apps/metacity/global_keybindings/run_command_window_screenshot -panel-run-dialog = /apps/metacity/global_keybindings/panel_run_dialog -panel-main-menu = /apps/metacity/global_keybindings/panel_main_menu - - -[org.gnome.desktop.wm.keybindings] -move-to-workspace-1 = /apps/metacity/window_keybindings/move_to_workspace_1 -move-to-workspace-2 = /apps/metacity/window_keybindings/move_to_workspace_2 -move-to-workspace-3 = /apps/metacity/window_keybindings/move_to_workspace_3 -move-to-workspace-4 = /apps/metacity/window_keybindings/move_to_workspace_4 -move-to-workspace-5 = /apps/metacity/window_keybindings/move_to_workspace_5 -move-to-workspace-6 = /apps/metacity/window_keybindings/move_to_workspace_6 -move-to-workspace-7 = /apps/metacity/window_keybindings/move_to_workspace_7 -move-to-workspace-8 = /apps/metacity/window_keybindings/move_to_workspace_8 -move-to-workspace-9 = /apps/metacity/window_keybindings/move_to_workspace_9 -move-to-workspace-10 = /apps/metacity/window_keybindings/move_to_workspace_10 -move-to-workspace-11 = /apps/metacity/window_keybindings/move_to_workspace_11 -move-to-workspace-12 = /apps/metacity/window_keybindings/move_to_workspace_12 -move-to-workspace-left = /apps/metacity/window_keybindings/move_to_workspace_left -move-to-workspace-right = /apps/metacity/window_keybindings/move_to_workspace_right -move-to-workspace-up = /apps/metacity/window_keybindings/move_to_workspace_up -move-to-workspace-down = /apps/metacity/window_keybindings/move_to_workspace_down -switch-windows = /apps/metacity/global_keybindings/switch_windows -switch-group = /apps/metacity/global_keybindings/switch_group -show-desktop = /apps/metacity/global_keybindings/show_desktop -switch-to-workspace-1 = /apps/metacity/global_keybindings/switch_to_workspace_1 -switch-to-workspace-2 = /apps/metacity/global_keybindings/switch_to_workspace_2 -switch-to-workspace-3 = /apps/metacity/global_keybindings/switch_to_workspace_3 -switch-to-workspace-4 = /apps/metacity/global_keybindings/switch_to_workspace_4 -switch-to-workspace-5 = /apps/metacity/global_keybindings/switch_to_workspace_5 -switch-to-workspace-6 = /apps/metacity/global_keybindings/switch_to_workspace_6 -switch-to-workspace-7 = /apps/metacity/global_keybindings/switch_to_workspace_7 -switch-to-workspace-8 = /apps/metacity/global_keybindings/switch_to_workspace_8 -switch-to-workspace-9 = /apps/metacity/global_keybindings/switch_to_workspace_9 -switch-to-workspace-10 = /apps/metacity/global_keybindings/switch_to_workspace_10 -switch-to-workspace-11 = /apps/metacity/global_keybindings/switch_to_workspace_11 -switch-to-workspace-12 = /apps/metacity/global_keybindings/switch_to_workspace_12 -switch-to-workspace-left = /apps/metacity/global_keybindings/switch_to_workspace_left -switch-to-workspace-right = /apps/metacity/global_keybindings/switch_to_workspace_right -switch-to-workspace-up = /apps/metacity/global_keybindings/switch_to_workspace_up -switch-to-workspace-down = /apps/metacity/global_keybindings/switch_to_workspace_down -activate-window-menu = /apps/metacity/window_keybindings/activate_window_menu -toggle-fullscreen = /apps/metacity/window_keybindings/toggle_fullscreen -toggle-maximized = /apps/metacity/window_keybindings/toggle_maximized -maximize = /apps/metacity/window_keybindings/maximize -unmaximize = /apps/metacity/window_keybindings/unmaximize -toggle-shaded = /apps/metacity/window_keybindings/toggle_shaded -close = /apps/metacity/window_keybindings/close -minimize = /apps/metacity/window_keybindings/minimize -begin-move = /apps/metacity/window_keybindings/begin_move -begin-resize = /apps/metacity/window_keybindings/begin_resize -raise = /apps/metacity/window_keybindings/raise -lower = /apps/metacity/window_keybindings/lower -maximize-vertically = /apps/metacity/window_keybindings/maximize_vertically -maximize-horizontally = /apps/metacity/window_keybindings/maximize_horizontally - diff --git a/postinst/convert-files/compiz-profile-independent-keys.convert b/postinst/convert-files/compiz-profile-independent-keys.convert new file mode 100644 index 0000000000000000000000000000000000000000..b27758b7e08fbe98fb130948b5b517e17250460f --- /dev/null +++ b/postinst/convert-files/compiz-profile-independent-keys.convert @@ -0,0 +1,59 @@ +[org.compiz.integrated] +run-command-terminal = /apps/metacity/global_keybindings/run_command_terminal +run-command-screenshot = /apps/metacity/global_keybindings/run_command_screenshot +run-command-window-screenshot = /apps/metacity/global_keybindings/run_command_window_screenshot +panel-run-dialog = /apps/metacity/global_keybindings/panel_run_dialog +panel-main-menu = /apps/metacity/global_keybindings/panel_main_menu + + +[org.gnome.desktop.wm.keybindings] +move-to-workspace-1 = /apps/metacity/window_keybindings/move_to_workspace_1 +move-to-workspace-2 = /apps/metacity/window_keybindings/move_to_workspace_2 +move-to-workspace-3 = /apps/metacity/window_keybindings/move_to_workspace_3 +move-to-workspace-4 = /apps/metacity/window_keybindings/move_to_workspace_4 +move-to-workspace-5 = /apps/metacity/window_keybindings/move_to_workspace_5 +move-to-workspace-6 = /apps/metacity/window_keybindings/move_to_workspace_6 +move-to-workspace-7 = /apps/metacity/window_keybindings/move_to_workspace_7 +move-to-workspace-8 = /apps/metacity/window_keybindings/move_to_workspace_8 +move-to-workspace-9 = /apps/metacity/window_keybindings/move_to_workspace_9 +move-to-workspace-10 = /apps/metacity/window_keybindings/move_to_workspace_10 +move-to-workspace-11 = /apps/metacity/window_keybindings/move_to_workspace_11 +move-to-workspace-12 = /apps/metacity/window_keybindings/move_to_workspace_12 +move-to-workspace-left = /apps/metacity/window_keybindings/move_to_workspace_left +move-to-workspace-right = /apps/metacity/window_keybindings/move_to_workspace_right +move-to-workspace-up = /apps/metacity/window_keybindings/move_to_workspace_up +move-to-workspace-down = /apps/metacity/window_keybindings/move_to_workspace_down +switch-windows = /apps/metacity/global_keybindings/switch_windows +switch-group = /apps/metacity/global_keybindings/switch_group +show-desktop = /apps/metacity/global_keybindings/show_desktop +switch-to-workspace-1 = /apps/metacity/global_keybindings/switch_to_workspace_1 +switch-to-workspace-2 = /apps/metacity/global_keybindings/switch_to_workspace_2 +switch-to-workspace-3 = /apps/metacity/global_keybindings/switch_to_workspace_3 +switch-to-workspace-4 = /apps/metacity/global_keybindings/switch_to_workspace_4 +switch-to-workspace-5 = /apps/metacity/global_keybindings/switch_to_workspace_5 +switch-to-workspace-6 = /apps/metacity/global_keybindings/switch_to_workspace_6 +switch-to-workspace-7 = /apps/metacity/global_keybindings/switch_to_workspace_7 +switch-to-workspace-8 = /apps/metacity/global_keybindings/switch_to_workspace_8 +switch-to-workspace-9 = /apps/metacity/global_keybindings/switch_to_workspace_9 +switch-to-workspace-10 = /apps/metacity/global_keybindings/switch_to_workspace_10 +switch-to-workspace-11 = /apps/metacity/global_keybindings/switch_to_workspace_11 +switch-to-workspace-12 = /apps/metacity/global_keybindings/switch_to_workspace_12 +switch-to-workspace-left = /apps/metacity/global_keybindings/switch_to_workspace_left +switch-to-workspace-right = /apps/metacity/global_keybindings/switch_to_workspace_right +switch-to-workspace-up = /apps/metacity/global_keybindings/switch_to_workspace_up +switch-to-workspace-down = /apps/metacity/global_keybindings/switch_to_workspace_down +activate-window-menu = /apps/metacity/window_keybindings/activate_window_menu +toggle-fullscreen = /apps/metacity/window_keybindings/toggle_fullscreen +toggle-maximized = /apps/metacity/window_keybindings/toggle_maximized +maximize = /apps/metacity/window_keybindings/maximize +unmaximize = /apps/metacity/window_keybindings/unmaximize +toggle-shaded = /apps/metacity/window_keybindings/toggle_shaded +close = /apps/metacity/window_keybindings/close +minimize = /apps/metacity/window_keybindings/minimize +begin-move = /apps/metacity/window_keybindings/begin_move +begin-resize = /apps/metacity/window_keybindings/begin_resize +raise = /apps/metacity/window_keybindings/raise +lower = /apps/metacity/window_keybindings/lower +maximize-vertically = /apps/metacity/window_keybindings/maximize_vertically +maximize-horizontally = /apps/metacity/window_keybindings/maximize_horizontally + diff --git a/postinst/migration-scripts/03_migrate_profile_independent.py b/postinst/migration-scripts/03_migrate_profile_independent.py new file mode 100755 index 0000000000000000000000000000000000000000..7e0b14c473979b3fb4c21bb457ddb62969d07ed3 --- /dev/null +++ b/postinst/migration-scripts/03_migrate_profile_independent.py @@ -0,0 +1,44 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright (C) 2012 Canonical +# +# Authors: +# Łukasz 'sil2100' Zemczak +# Didier Roche +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation; version 3. +# +# This program is distributed in the hope that it will be useful, but WITHOUTa +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +import gconf +import glib +import subprocess +import os.path + +# this should point to the directory where all the .convert files are stored +CONVERT_PATH = "/usr/lib/compiz/migration/" + +def migrate_file(convert_file): + subprocess.Popen(["gsettings-data-convert", "--file={}{}".format(CONVERT_PATH, convert_file)]).communicate() + +def migrate_gconf_to_gsettings(): + client = gconf.client_get_default() + + if not client: + print "WARNING: no gconf client found. No transitionning will be done" + sys.exit(1) + + print "Will migrate profile independent keys" + migrate_file('compiz-profile-independent-keys.convert') + +if __name__ == '__main__': + migrate_gconf_to_gsettings () diff --git a/src/privatewindow.h b/src/privatewindow.h index e20b3b75b83877d5fe85a8c2722e4cf0b278a984..8553c9c98dcc8ee9abdbf03ce06989d11ac8f453 100644 --- a/src/privatewindow.h +++ b/src/privatewindow.h @@ -35,6 +35,7 @@ #include +#define XWINDOWCHANGES_INIT {0, 0, 0, 0, 0, None, 0} namespace compiz {namespace X11 { diff --git a/src/screen.cpp b/src/screen.cpp index fc0b9a88e9db4e5c3c64ddefd8d39b01985428db..2cc636941b62aeef40c84c2de68a10e6da687ca0 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -3929,7 +3929,7 @@ CompScreenImpl::moveViewport (int tx, int ty, bool sync) { CompWindow* const w(*i); unsigned int valueMask = CWX | CWY; - XWindowChanges xwc; + XWindowChanges xwc= XWINDOWCHANGES_INIT; if (w->onAllViewports ()) continue; diff --git a/src/window.cpp b/src/window.cpp index 45fde9305181815e2ef3e4c9f0534615c5db0cb2..b01fa6864b9dbb715456fd72da1dfaf09a8002a3 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -47,8 +47,6 @@ #include -#define XWINDOWCHANGES_INIT {0, 0, 0, 0, 0, None, 0} - PluginClassStorage::Indices windowPluginClassIndices (0); unsigned int diff --git a/xslt/CMakeLists.txt b/xslt/CMakeLists.txt index 9477d92d0eed8909d50f02a7f9dd3eda8e2e30ce..6e3ea5d84f5378b79e1c0b1c023277fa3462ed6c 100644 --- a/xslt/CMakeLists.txt +++ b/xslt/CMakeLists.txt @@ -7,11 +7,10 @@ compiz_configure_file (compiz_gsettings_schemas.xslt.in compiz_gsettings_schemas if (USE_GCONF) list (APPEND _files compiz_gconf_schemas.xslt) - list (APPEND _files ${CMAKE_CURRENT_BINARY_DIR}/compiz_gsettings_schemas.xslt) endif () if (USE_GSETTINGS) - + list (APPEND _files ${CMAKE_CURRENT_BINARY_DIR}/compiz_gsettings_schemas.xslt) endif () install (