unity-7.2.0+14.04.20140416/0000755000015301777760000000000012323604324015266 5ustar pbusernogroup00000000000000unity-7.2.0+14.04.20140416/tools/0000755000015301777760000000000012323604324016426 5ustar pbusernogroup00000000000000unity-7.2.0+14.04.20140416/tools/autopilot0000755000015301777760000000046312323603360020376 0ustar pbusernogroup00000000000000#!/bin/sh # This script can be removed from the Unity source tree once people are happy # with the new setup. echo "Autopilot has moved! Autopilot used to be part of the unity source tree. It's now it's own launchpad project. Full instructions can be found in the tests/autopilot/README file. " unity-7.2.0+14.04.20140416/tools/coding-guidelines0000755000015301777760000000057212323603360021750 0ustar pbusernogroup00000000000000#!/usr/bin/env python import os import sys import webbrowser curr_dir = os.path.abspath(os.path.dirname(__file__)) branch_root_dir = os.path.dirname(curr_dir) guide_file = os.path.join(branch_root_dir, 'build', 'guides', 'cppguide.html') if not os.path.isfile(guide_file): print "You need to build unity (or the docs) first." sys.exit(1) webbrowser.open(guide_file) unity-7.2.0+14.04.20140416/tools/unity.cmake0000755000015301777760000001746512323603360020617 0ustar pbusernogroup00000000000000#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright (C) 2010 Canonical # # Authors: # 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 glib import glob from optparse import OptionParser import os import shutil import signal import subprocess import sys import time home_dir = os.path.expanduser("~%s" % os.getenv("SUDO_USER")) supported_prefix = "/usr/local" well_known_local_path = ("%s/share/locale/*/LC_MESSAGES/*unity*" % supported_prefix, "%s/share/man/man1/*unity*" % supported_prefix, "%s/lib/*unity*" % supported_prefix, "%s/share/dbus-1/services/*Unity*" % supported_prefix, "%s/bin/*unity*" % supported_prefix, "%s/include/Unity*" % supported_prefix, "%s/lib/pkgconfig/unity*" % supported_prefix, "%s/.compiz-1/*/*networkarearegion*" % home_dir, "%s/.config/compiz-1/gsettings/schemas/*networkarearegion*" % home_dir, "%s/.gconf/schemas/*networkarearegion*" % home_dir, "%s/.compiz-1/*/*unity*" % home_dir, "%s/.config/compiz-1/gsettings/schemas/*unity*" % home_dir, "%s/.gconf/schemas/*unity*" % home_dir, "%s/share/ccsm/icons/*/*/*/*unity*" % supported_prefix, "%s/share/unity" % supported_prefix, "%s/.compiz-1/unity*" % home_dir, "%s/lib/*nux*" % supported_prefix, "%s/lib/pkgconfig/nux*" % supported_prefix, "%s/include/Nux*" % supported_prefix ) def set_unity_env (): '''set variable environnement for unity to run''' os.environ['COMPIZ_CONFIG_PROFILE'] = 'ubuntu' if not 'DISPLAY' in os.environ: # take an optimistic chance and warn about it :) print "WARNING: no DISPLAY variable set, setting it to :0" os.environ['DISPLAY'] = ':0' def reset_launcher_icons (): '''Reset the default launcher icon and restart it.''' subprocess.Popen(["gsettings", "reset" ,"com.canonical.Unity.Launcher" , "favorites"]) def process_and_start_unity (verbose, debug_mode, compiz_path, compiz_args, log_file): '''launch unity under compiz (replace the current shell in any case)''' cli = [] if debug_mode > 0: # we can do more check later as if it's in PATH... if not os.path.isfile('/usr/bin/gdb'): print("ERROR: you don't have gdb in your system. Please install it to run in advanced debug mode.") sys.exit(1) elif debug_mode == 1: cli.extend(['gdb', '-ex', 'run', '-ex', '"bt full"', '--batch', '--args']) elif 'DESKTOP_SESSION' in os.environ: print("ERROR: it seems you are under a graphical environment. That's incompatible with executing advanced-debug option. You should be in a tty.") sys.exit(1) else: cli.extend(['gdb', '--args']) if options.compiz_path: cli.extend([options.compiz_path, '--replace']) else: cli.extend(['compiz', '--replace']) if options.verbose: cli.append("--debug") if args: cli.extend(compiz_args) if log_file: cli.extend(['2>&1', '|', 'tee', log_file]) # kill a previous compiz if was there (this is a hack as compiz can # sometimes get stuck and not exit on --replace) subprocess.call (["pkill", "-9", "compiz"]) # shell = True as it's the simpest way to | tee. # In this case, we need a string and not a list # FIXME: still some bug with 2>&1 not showing everything before wait() return subprocess.Popen(" ".join(cli), env=dict(os.environ), shell=True) def run_unity (verbose, debug, advanced_debug, compiz_path, compiz_args, log_file): '''run the unity shell and handle Ctrl + C''' try: debug_mode = 2 if advanced_debug else 1 if debug else 0 subprocess.call(["stop", "unity-panel-service"]) unity_instance = process_and_start_unity (verbose, debug_mode, compiz_path, compiz_args, log_file) subprocess.call(["start", "unity-panel-service"]) unity_instance.wait() except KeyboardInterrupt, e: try: os.kill(unity_instance.pid, signal.SIGKILL) except: pass unity_instance.wait() sys.exit(unity_instance.returncode) def reset_to_distro(): ''' remove all known default local installation path ''' # check if we are root, we need to be root if os.getuid() != 0: print "Error: You need to be root to remove your local unity installation" return 1 error = False for filedir in well_known_local_path: for elem in glob.glob(filedir): try: shutil.rmtree(elem) except OSError, e: if os.path.isfile(elem) or os.path.islink(elem): os.remove(elem) else: print "ERROR: Cannot remove %s: %s" % (elem, e) error = True if error: print "See above: some error happened and you should clean them before trying to restart unity" return 1 else: print "Unity local install cleaned, you can now restart unity" return 0 if __name__ == '__main__': usage = "usage: %prog [options]" parser = OptionParser(version= "%prog @UNITY_VERSION@", usage=usage) parser.add_option("--advanced-debug", action="store_true", help="Run unity under debugging to help debugging an issue. /!\ Only if devs ask for it.") parser.add_option("--compiz-path", action="store", dest="compiz_path", help="Path to compiz. /!\ Only if devs ask for it.") parser.add_option("--debug", action="store_true", help="Run unity under gdb and print a backtrace on crash. /!\ Only if devs ask for it.") parser.add_option("--distro", action="store_true", help="Remove local build if present with default values to return to the package value (this doesn't run unity and need root access)") parser.add_option("--log", action="store", help="Store log under filename.") parser.add_option("--replace", action="store_true", help="Run unity /!\ This is for compatibility with other desktop interfaces and acts the same as running unity without --replace") parser.add_option("--reset", action="store_true", help="Reset is not supported anymore. Deprecated option") parser.add_option("--reset-icons", action="store_true", help="Reset the default launcher icon.") parser.add_option("-v", "--verbose", action="store_true", help="Get additional debug output from unity.") (options, args) = parser.parse_args() set_unity_env() if options.distro: sys.exit(reset_to_distro()) if options.reset: print ("ERROR: the reset option is now deprecated") sys.exit(1) if options.reset_icons: reset_launcher_icons () if options.replace: print ("WARNING: This is for compatibility with other desktop interfaces please use unity without --replace") run_unity (options.verbose, options.debug, options.advanced_debug, options.compiz_path, args, options.log) unity-7.2.0+14.04.20140416/tools/makebootchart.py0000755000015301777760000001215012323603360021624 0ustar pbusernogroup00000000000000#!/usr/bin/env python # # Copyright (C) 2009 Canonical Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 as # published by the Free Software Foundation. # # 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, see . # # Authored by Gordon Allott # # import os, sys import getopt import cairo import csv import math import random from string import Template from socket import gethostname from datetime import datetime import re import subprocess header = Template("""Unity bootchart for $hostname ($date) uname: $uname CPU: $cpu GPU: $gpu time: $total_time""") def sort_by_domain (x, y): if x["start"] - y["start"] < 0: return -1 else: return +1 def gatherinfo (filename): date = datetime.fromtimestamp(os.path.getmtime(filename)) cpufile = open ("/proc/cpuinfo") cpuinfo = cpufile.read (10024) cpure = re.search (r"^model name\s*: (.*$)", cpuinfo, re.MULTILINE) cpu = cpure.group(1) gpu_prog = subprocess.Popen("glxinfo", stdout=subprocess.PIPE) gpu_prog.wait () gpuinfo = gpu_prog.stdout.read (10024) gpure = re.search (r"^OpenGL renderer string: (.*$)", gpuinfo, re.MULTILINE) gpu = gpure.group (1) return {"hostname":gethostname(), "date": date.strftime("%A, %d. %B %Y %I:%M%p"), "uname": " ".join (os.uname ()), "cpu": cpu, "gpu": gpu, "total_time": "undefined" } width_multiplier = 1000 bar_height = 16 def draw_bg_graph (ctx, seconds, height): total_width = seconds * width_multiplier ctx.set_source_rgba (0.0, 0.0, 0.0, 0.25) ctx.move_to (0, 0) ctx.line_to (total_width, 0) ctx.stroke () per_ten = 0 for pos in xrange (0, int(total_width), int (0.01 * width_multiplier)): ctx.set_line_width (1) ctx.set_source_rgba (0.0, 0.0, 0.0, 0.10) if (not per_ten): ctx.set_line_width (2) ctx.set_source_rgba (0.0, 0.0, 0.0, 0.25) ctx.move_to (pos-6, -2) ctx.show_text (str (pos / float(width_multiplier))) ctx.stroke () ctx.move_to (pos, 0) ctx.line_to (pos, height) ctx.stroke () per_ten += 1 per_ten %= 10 def build_graph (data, filename, info): padding_left = 6 padding_right = 100 padding_top = 6 padding_bottom = 6 total_size = 0.0 for item in data: if item['end'] > total_size: total_size = item['end'] width = total_size * width_multiplier + padding_left + padding_right height = (len(data) * (bar_height)) + 80 + padding_bottom + padding_top surface = cairo.SVGSurface(filename, max (width, 800), max (height, 600)) ctx = cairo.Context (surface) #fill background ctx.set_source_rgb (1, 1, 1) ctx.rectangle (0, 0, max (width, 800), max (height, 600)) ctx.fill () #print header info['total_time'] = "%s secs" % total_size sheader = header.substitute(info) ctx.translate (padding_left, padding_top) ctx.set_source_rgb (0, 0, 0) for line in sheader.split("\n"): ctx.translate (0, 12) ctx.show_text (line) ctx.fill () ctx.translate (6, 12) draw_bg_graph (ctx, total_size + 0.5, max (len (data) * bar_height + 64, 500)) ctx.set_line_width (1) for item in data: x = item['start'] * width_multiplier x1 = (item['end'] - item['start']) * width_multiplier ctx.translate (x, 0) ctx.set_source_rgba (0.35, 0.65, 0.8, 0.5) ctx.rectangle (0, 0, x1, 16) ctx.fill () ctx.set_source_rgba (0.35, 0.65, 0.8, 1.0) ctx.rectangle (0, 0, x1, 16) ctx.stroke () ctx.translate (8, 10) ctx.set_source_rgb (0.0, 0.0, 0.0) ctx.show_text ("%s %.4f seconds" % (item['name'], item["end"] - item["start"])) ctx.fill() ctx.translate (-x-8, 6) def build_data_structure (input): reader = csv.reader(open(input)) structure = [] print "reading", input for row in reader: name = row[0] start = float(row[1]) end = float(row[2]) structure.append ({"name": name, "start": start, "end": end}) structure.sort (sort_by_domain) return structure def usage(): print "use --input=filename.log and --output=filename.svg :)" def main(): try: opts, args = getopt.getopt(sys.argv[1:], "h", ["help", "output=", "input="]) except getopt.GetoptError, err: # print help information and exit: print str(err) # will print something like "option -a not recognized" usage() sys.exit(2) output = None input = None for o, a in opts: if o in ("-h", "--help"): usage() sys.exit() elif o in ("--output"): output = a elif o in ("--input"): input = a else: assert False, "unhandled option" if (not output or not input): usage() sys.exit() data = build_data_structure (input) info = gatherinfo (input) build_graph (data, output, info) return 0 if __name__ == '__main__': main() unity-7.2.0+14.04.20140416/tools/unity-introspection-visualiser.py0000755000015301777760000000713512323603360025242 0ustar pbusernogroup00000000000000#!/usr/bin/env python # # Script to generate a nice PNG file of the currently running unity introspection tree. from argparse import ArgumentParser from os import remove from os.path import splitext import dbus try: from autopilot.emulators.unity import get_state_by_path except ImportError, e: print "Error: could not import the autopilot python module." print "Make sure the autopilot module is in your $PYTHONPATH." exit(1) try: import pydot except ImportError: print "Error: the 'pydot' module is required to run this script." print "Try installing the 'python-pydot' package." exit(1) NEXT_NODE_ID=1 NODE_BLACKLIST=["Result"] def string_rep(dbus_type): """Get a string representation of various dbus types.""" if type(dbus_type) == dbus.Boolean: return repr(bool(dbus_type)) if type(dbus_type) == dbus.String: return dbus_type.encode('ascii', errors='ignore') if type(dbus_type) in (dbus.Int16, dbus.UInt16, dbus.Int32, dbus.UInt32, dbus.Int64, dbus.UInt64): return repr(int(dbus_type)) if type(dbus_type) == dbus.Double: return repr(float(dbus_type)) if type(dbus_type) == dbus.Array: return ', '.join([string_rep(i) for i in dbus_type]) else: return repr(dbus_type) def escape(s): """Escape a string so it can be use in a dot label.""" return pydot.quote_if_necessary(s).replace('<','\\<').replace('>', '\\>').replace("'", "\\'") def traverse_tree(state, parent, graph): """Recursively traverse state tree, building dot graph as we go.""" global NEXT_NODE_ID lbl = parent.get_comment() + "|" # first, set labels for this node: bits = ["%s=%s" % (k, string_rep(state[k])) for k in sorted(state.keys()) if k != 'Children'] lbl += "\l".join(bits) parent.set_label(escape('"{' + lbl + '}"')) if state.has_key('Children'): # Add all array nodes as children of this node. for child_name, child_state in state['Children']: if child_name in NODE_BLACKLIST: continue child = pydot.Node(str(NEXT_NODE_ID)) NEXT_NODE_ID+=1 child.set_comment(child_name) graph.add_node(child) graph.add_edge(pydot.Edge(parent, child)) traverse_tree(child_state, child, graph) if __name__ == '__main__': parser = ArgumentParser() mg = parser.add_mutually_exclusive_group(required=True) mg.add_argument('-o', '--output', nargs=1, help='Store output in specified file on disk.') mg.add_argument('-d','--display', action='store_true', help='Display output in image viewer.') args = parser.parse_args() introspection_tree = get_state_by_path('/') graph = pydot.Dot() graph.set_simplify(False) graph.set_node_defaults(shape='Mrecord') graph.set_fontname('Ubuntu') graph.set_fontsize('10') gnode_unity = pydot.Node("Unity") gnode_unity.set_comment("Unity") traverse_tree(introspection_tree[0], gnode_unity, graph) if args.output: base, extension = splitext(args.output[0]) write_method_name = 'write_' + extension[1:] if hasattr(graph, write_method_name): getattr(graph, write_method_name)(args.output[0]) else: print "Error: unsupported format: '%s'" % (extension) elif args.display: from tempfile import NamedTemporaryFile from subprocess import call tf = NamedTemporaryFile(suffix='.png', delete=False) tf.write(graph.create_png()) tf.close() call(["eog", tf.name]) remove(tf.name) else: print 'unknown output mode!' unity-7.2.0+14.04.20140416/tools/apply_unity_formatting.sh0000755000015301777760000000073712323603360023602 0ustar pbusernogroup00000000000000astyle --options=astyle-formatter \ ../UnityCore/*.cpp \ ../UnityCore/*.h \ ../plugins/networkarearegion/src/*.cpp \ ../plugins/networkarearegion/src/*.h \ ../plugins/unitydialog/src/*.cpp \ ../plugins/unitydialog/src/*.h \ ../plugins/unity-mt-grab-handles/src/*.cpp \ ../plugins/unity-mt-grab-handles/src/*.h \ ../plugins/unityshell/src/*.cpp \ ../plugins/unityshell/src/*.h \ ../tests/*.cpp \ ../tests/*.h \ ../tests/unit/*.cpp \ ../tests/unit/*.h unity-7.2.0+14.04.20140416/tools/build-compiz-glib0000755000015301777760000001043112323603360021663 0ustar pbusernogroup00000000000000#!/bin/bash # # A script to build compiz++ by Scott Moreau oreaus@gmail.com # Modifications by Jason Smith jason.smith@canonical.com # # Make sure we're being ran in bash if [[ -z "$BASH_VERSION" ]]; then echo "Please run this script in a bash environment." exit 1 fi # Don't run it as root if [[ "$EUID" = 0 ]]; then echo "Run as user, without sudo and not as root." exit 1 fi SRC_DIR=$HOME/staging/build/compiz/script-src PLUGIN_DIR=$SRC_DIR/plugins PREFIX=$HOME/staging/ PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig LD_LIBRARY_PATH=$PREFIX/lib # These are the dependencies for ubuntu. This script should work on other distros provided the dependencies are met DEPENDENCIES="git-core cmake libcairo2-dev librsvg2-dev libglib2.0-dev libpng12-dev libdbus-1-dev libboost-dev libboost-serialization-dev libxml2-dev libgl1-mesa-dev libglu1-mesa-dev libwnck-dev libgconf2-dev libx11-xcb-dev libxslt1-dev libnotify-dev libprotobuf-dev libmetacity-dev libgnome-window-settings-dev gnome-control-center-dev intltool cython python2.6-dev" COMPONENTS=(core libcompizconfig compizconfig-python ccsm compizconfig-backend-gconf plugins-main plugins-extra plugins-unsupported) echo "Installing dependencies..." sudo apt-get install $DEPENDENCIES mkdir -p $SRC_DIR for COMPONENT in "${COMPONENTS[@]}"; do cd $SRC_DIR if [[ ! -d $SRC_DIR/$COMPONENT ]]; then if [[ "$COMPONENT" = "libcompizconfig" || "$COMPONENT" = "compizconfig-python" || "$COMPONENT" = "ccsm" || "$COMPONENT" = "compizconfig-backend-gconf" ]]; then echo "COMPONENT = $COMPONENT" git clone git://anongit.compiz.org/compiz/compizconfig/$COMPONENT elif [ "$COMPONENT" = "core" ]; then git clone git://anongit.compiz.org/users/dbo/compiz-with-glib-mainloop core else git clone git://anongit.compiz.org/compiz/$COMPONENT fi else cd $SRC_DIR/$COMPONENT git checkout master git reset --hard master git clean -fd git pull fi if [[ "$COMPONENT" = "plugins-main" || "$COMPONENT" = "plugins-extra" || "$COMPONENT" = "plugins-unsupported" ]]; then cd $SRC_DIR/$COMPONENT git submodule init git submodule update fi if [[ "$COMPONENT" = "compizconfig-python" ]]; then cd $SRC_DIR/$COMPONENT echo "Installing $COMPONENT..." PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig python ./setup.py install --prefix=$PREFIX elif [[ "$COMPONENT" = "ccsm" ]]; then cd $SRC_DIR/$COMPONENT echo "Installing $COMPONENT..." ./setup.py install --prefix=$PREFIX else mkdir -p $SRC_DIR/$COMPONENT/build cd $SRC_DIR/$COMPONENT/build echo "Building $COMPONENT..." cmake .. -DCMAKE_INSTALL_PREFIX=$PREFIX -DCMAKE_BUILD_TYPE=Debug -DCOMPIZ_PLUGIN_INSTALL_TYPE=compiz make clean make -j5 echo "Installing $COMPONENT..." make install fi if [[ "$COMPONENT" = "core" ]]; then sudo make findcompiz_install fi if [[ "$COMPONENT" = "libcompizconfig" ]]; then sudo make findcompizconfig_install fi done cd $SRC_DIR if [[ ! -f $PREFIX/bin/ccsm++ ]]; then cat << EOF > ccsm++ #!/bin/bash PREFIX=$PREFIX # Hack to fix ccsm from complaining and causing incorrect plugin config option ordering rm -rf $HOME/.cache/compizconfig-1 2&1>/dev/null LD_LIBRARY_PATH=\$PREFIX/lib/ PYTHONPATH=\$PREFIX/lib/python2.6/site-packages \$PREFIX/bin/ccsm EOF chmod +x ccsm++ echo "Installing ccsm++ starter script to $PREFIX/bin/" cp ccsm++ $PREFIX/bin/ fi if [[ ! -f $PREFIX/bin/compiz++ ]]; then cat < compiz++ #!/bin/bash PREFIX=$PREFIX # Kill all decorators in case an incompatible (0.8) decorator is running if ps ax | grep gtk-window-decorator | grep -v grep 2>&1>/dev/null; then echo "Killing gtk-window-decorator" killall gtk-window-decorator 2>&1>/dev/null fi if ps ax | grep kde4-window-decorator | grep -v grep 2>&1>/dev/null; then echo "Killing kde4-window-decorator" killall kde4-window-decorator 2>&1>/dev/null fi if ps ax | grep emerald | grep -v grep 2>&1>/dev/null; then echo "Killing emerald" killall emerald 2>&1>/dev/null fi # Kill ccsm pkill ccsm LD_LIBRARY_PATH=\$PREFIX/lib/ \$PREFIX/bin/compiz --replace ccp & \$PREFIX/bin/gtk-window-decorator & \$PREFIX/bin/ccsm++ & EOF chmod +x compiz++ echo "Installing compiz++ starter script to $PREFIX/bin/" cp compiz++ $PREFIX/bin/ fi echo "Done. Run $PREFIX/bin/compiz++ to start compiz or $PREFIX/bin/ccsm++ to start ccsm." unity-7.2.0+14.04.20140416/tools/astyle-formatter0000644000015301777760000000026412323603360021654 0ustar pbusernogroup00000000000000--indent=spaces -s2 --style=bsd --indent-switches --min-conditional-indent=0 --unpad-paren --pad-oper --pad-header --convert-tabs --align-pointer=type --max-instatement-indent=80 unity-7.2.0+14.04.20140416/tools/migration-scripts/0000755000015301777760000000000012323604324022104 5ustar pbusernogroup00000000000000unity-7.2.0+14.04.20140416/tools/migration-scripts/02_unity_setup_text_scale_factor0000755000015301777760000000334412323603360030477 0ustar pbusernogroup00000000000000#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright (C) 2014 Canonical # # Authors: # Marco Trevisan # # 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 from gi.repository import Gio import os,sys GNOME_UI_SETTINGS = "org.gnome.desktop.interface"; GNOME_TEXT_SCALE_FACTOR = "text-scaling-factor"; UNITY_UI_SETTINGS = "com.canonical.Unity.Interface"; UNITY_UI_SETTINGS_PATH = "/com/canonical/unity/interface/" UNITY_TEXT_SCALE_FACTOR = "text-scale-factor"; if GNOME_UI_SETTINGS not in Gio.Settings.list_schemas(): print("No gnome desktop interface schemas found, no migration needed") sys.exit(0) text_scale_factor = Gio.Settings(schema=GNOME_UI_SETTINGS).get_double(GNOME_TEXT_SCALE_FACTOR) # gsettings doesn't work directly, the key is somewhat reverted. Work one level under then: dconf! # Gio.Settings(schema=UNITY_UI_SETTINGS).set_int(UNITY_TEXT_SCALE_FACTOR, text_scale_factor) from subprocess import Popen, PIPE, STDOUT p = Popen(("dconf load "+UNITY_UI_SETTINGS_PATH).split(), stdout=PIPE, stdin=PIPE, stderr=STDOUT) p.communicate(input="[/]\n"+UNITY_TEXT_SCALE_FACTOR+"={}".format(text_scale_factor).encode('utf-8')) unity-7.2.0+14.04.20140416/tools/migration-scripts/01_unity_change_dconf_path0000755000015301777760000000014712323603360027175 0ustar pbusernogroup00000000000000set -ex dconf dump /desktop/unity/ | dconf load /com/canonical/unity/ dconf reset -f /desktop/unity/ unity-7.2.0+14.04.20140416/tools/CMakeLists.txt0000644000015301777760000000070212323603360021164 0ustar pbusernogroup00000000000000# # Some unity tools # install(FILES makebootchart.py PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/unity/) configure_file (${CMAKE_CURRENT_SOURCE_DIR}/unity.cmake ${CMAKE_BINARY_DIR}/bin/unity) install(FILES ${CMAKE_BINARY_DIR}/bin/unity PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE DESTINATION bin) unity-7.2.0+14.04.20140416/tools/eclipse-c++-google-style.xml0000644000015301777760000004213712323603360023560 0ustar pbusernogroup00000000000000 unity-7.2.0+14.04.20140416/tools/convert-files/0000755000015301777760000000000012323604324021206 5ustar pbusernogroup00000000000000unity-7.2.0+14.04.20140416/tools/convert-files/compiz-profile-unity.convert0000644000015301777760000003457312323603360026730 0ustar pbusernogroup00000000000000[org.compiz.unityshell:/org/compiz/profiles/unity/plugins/unityshell/] launcher-switcher-prev = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/launcher_switcher_prev shortcut-overlay = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/shortcut_overlay panel-opacity-maximized-toggle = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/panel_opacity_maximized_toggle launcher-switcher-forward = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/launcher_switcher_forward overcome-pressure = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/overcome_pressure launch-animation = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/launch_animation alt-tab-timeout = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/alt_tab_timeout panel-opacity = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/panel_opacity show-minimized-windows = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/show_minimized_windows num-launchers = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/num_launchers alt-tab-right = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/alt_tab_right show-hud = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/show_hud launcher-hide-mode = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/launcher_hide_mode alt-tab-forward = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/alt_tab_forward alt-tab-left = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/alt_tab_left launcher-capture-mouse = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/launcher_capture_mouse alt-tab-detail-stop = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/alt_tab_detail_stop urgent-animation = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/urgent_animation keyboard-focus = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/keyboard_focus alt-tab-prev = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/alt_tab_prev reveal-pressure = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/reveal_pressure decay-rate = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/decay_rate stop-velocity = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/stop_velocity autohide-animation = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/autohide_animation alt-tab-bias-viewport = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/alt_tab_bias_viewport edge-responsiveness = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/edge_responsiveness automaximize-value = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/automaximize_value background-color = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/background_color alt-tab-forward-all = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/alt_tab_forward_all alt-tab-prev-all = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/alt_tab_prev_all menus-discovery-fadein = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/menus_discovery_fadein execute-command = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/execute_command dash-blur-experimental = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/dash_blur_experimental menus-discovery-duration = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/menus_discovery_duration alt-tab-prev-window = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/alt_tab_prev_window reveal-trigger = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/reveal_trigger panel-first-menu = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/panel_first_menu icon-size = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/icon_size backlight-mode = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/backlight_mode menus-fadein = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/menus_fadein alt-tab-detail-start = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/alt_tab_detail_start show-desktop-icon = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/show_desktop_icon alt-tab-next-window = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/alt_tab_next_window launcher-opacity = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/launcher_opacity show-launcher = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/show_launcher menus-discovery-fadeout = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/menus_discovery_fadeout menus-fadeout = /apps/compizconfig-1/profiles/unity/plugins/unityshell/screen0/options/menus_fadeout [org.compiz.core:/org/compiz/profiles/unity/plugins/core/] active-plugins = /apps/compizconfig-1/profiles/unity/plugins/core/screen0/options/active_plugins vsize = /apps/compizconfig-1/profiles/unity/plugins/core/screen0/options/vsize hsize = /apps/compizconfig-1/profiles/unity/plugins/core/screen0/options/vsize close-window-button = /apps/compizconfig-1/profiles/unity/plugins/core/screen0/options/close_window_button close-window-key = /apps/compizconfig-1/profiles/unity/plugins/core/screen0/options/close_window_key lower-window-button = /apps/compizconfig-1/profiles/unity/plugins/core/screen0/options/lower_window_button lower-window-key = /apps/compizconfig-1/profiles/unity/plugins/core/screen0/options/lower_window_key maximize-window-horizontally-key = /apps/compizconfig-1/profiles/unity/plugins/core/screen0/options/maximize_window_horizontally_key maximize-window-key = /apps/compizconfig-1/profiles/unity/plugins/core/screen0/options/maximize_window_key maximize-window-vertically-key = /apps/compizconfig-1/profiles/unity/plugins/core/screen0/options/maximize_window_vertically_key minimize-window-button = /apps/compizconfig-1/profiles/unity/plugins/core/screen0/options/minimize_window_button minimize-window-key = /apps/compizconfig-1/profiles/unity/plugins/core/screen0/options/minimize_window_key raise-window-button = /apps/compizconfig-1/profiles/unity/plugins/core/screen0/options/raise_window_button raise-window-key = /apps/compizconfig-1/profiles/unity/plugins/core/screen0/options/raise_window_key show-desktop-edge = /apps/compizconfig-1/profiles/unity/plugins/core/screen0/options/show_desktop_edge show-desktop-key = /apps/compizconfig-1/profiles/unity/plugins/core/screen0/options/show_desktop_key toggle-window-maximized-button = /apps/compizconfig-1/profiles/unity/plugins/core/screen0/options/toggle_window_maximized_button toggle-window-maximized-horizontally-key = /apps/compizconfig-1/profiles/unity/plugins/core/screen0/options/toggle_window_maximized_horizontally_key toggle-window-maximized-key = /apps/compizconfig-1/profiles/unity/plugins/core/screen0/options/toggle_window_maximized_key toggle-window-maximized-vertically-key = /apps/compizconfig-1/profiles/unity/plugins/core/screen0/options/toggle_window_maximized_vertically_key toggle-window-shaded-key = /apps/compizconfig-1/profiles/unity/plugins/core/screen0/options/toggle_window_shaded_key unmaximize-window-key = /apps/compizconfig-1/profiles/unity/plugins/core/screen0/options/unmaximize_window_key window-menu-button = /apps/compizconfig-1/profiles/unity/plugins/core/screen0/options/window_menu_button window-menu-key = /apps/compizconfig-1/profiles/unity/plugins/core/screen0/options/window_menu_key [org.compiz.composite:/org/compiz/profiles/unity/plugins/composite/] detect-refresh-rate = /apps/compizconfig-1/profiles/unity/plugins/composite/screen0/options/detect_refres_rate refresh-rate = /apps/compizconfig-1/profiles/unity/plugins/composite/screen0/options/refres_rate [org.compiz.opengl:/org/compiz/profiles/unity/plugins/opengl/] lighting = /apps/compizconfig-1/profiles/unity/plugins/opengl/screen0/options/lighting sync-to-vblank = /apps/compizconfig-1/profiles/unity/plugins/opengl/screen0/options/sync_to_vblank texture-compression = /apps/compizconfig-1/profiles/unity/plugins/opengl/screen0/options/texture_compression texture-filter = /apps/compizconfig-1/profiles/unity/plugins/opengl/screen0/options/texture_filter [org.compiz.wall:/org/compiz/profiles/unity/plugins/wall/] down-button = /apps/compizconfig-1/profiles/unity/plugins/wall/screen0/options/down_button down-key = /apps/compizconfig-1/profiles/unity/plugins/wall/screen0/options/down_button down-window-key = /apps/compizconfig-1/profiles/unity/plugins/wall/screen0/options/down_button edgeflip-dnd = /apps/compizconfig-1/profiles/unity/plugins/wall/screen0/options/edgeflip_dnd edgeflip-move = /apps/compizconfig-1/profiles/unity/plugins/wall/screen0/options/edgeflip_move edgeflip-pointer = /apps/compizconfig-1/profiles/unity/plugins/wall/screen0/options/edgeflip_pointer edge-radius = /apps/compizconfig-1/profiles/unity/plugins/wall/screen0/options/edge_radius flip-down-edge = /apps/compizconfig-1/profiles/unity/plugins/wall/screen0/options/flip_down_edge flip-left-edge = /apps/compizconfig-1/profiles/unity/plugins/wall/screen0/options/flip_left_edge flip-right-edge = /apps/compizconfig-1/profiles/unity/plugins/wall/screen0/options/flip_right_edge flip-up-edge = /apps/compizconfig-1/profiles/unity/plugins/wall/screen0/options/flip_up_edge left-button = /apps/compizconfig-1/profiles/unity/plugins/wall/screen0/options/left_button left-key = /apps/compizconfig-1/profiles/unity/plugins/wall/screen0/options/left_key left-window-key = /apps/compizconfig-1/profiles/unity/plugins/wall/screen0/options/left_window_key next-button = /apps/compizconfig-1/profiles/unity/plugins/wall/screen0/options/next_button next-key = /apps/compizconfig-1/profiles/unity/plugins/wall/screen0/options/next_key prev-button = /apps/compizconfig-1/profiles/unity/plugins/wall/screen0/options/prev_button prev-key =/apps/compizconfig-1/profiles/unity/plugins/wall/screen0/options/prev_key right-button = /apps/compizconfig-1/profiles/unity/plugins/wall/screen0/options/right_button right-key = /apps/compizconfig-1/profiles/unity/plugins/wall/screen0/options/right_key right-window-key = /apps/compizconfig-1/profiles/unity/plugins/wall/screen0/options/right_window_key up-button = /apps/compizconfig-1/profiles/unity/plugins/wall/screen0/options/up_button up-key = /apps/compizconfig-1/profiles/unity/plugins/wall/screen0/options/up_key up-window-key = /apps/compizconfig-1/profiles/unity/plugins/wall/screen0/options/up_window_key [org.compiz.expo:/org/compiz/profiles/unity/plugins/expo/] exit-button = /apps/compizconfig-1/profiles/unity/plugins/expo/screen0/options/exit_button expo-edge = /apps/compizconfig-1/profiles/unity/plugins/expo/screen0/options/expo_edge expo-key = /apps/compizconfig-1/profiles/unity/plugins/expo/screen0/options/expo_key expo-immediate-move = /apps/compizconfig-1/profiles/unity/plugins/expo/screen0/options/expo_immediate_move next-vp-button = /apps/compizconfig-1/profiles/unity/plugins/expo/screen0/options/next_vp_button prev-vp-button = /apps/compizconfig-1/profiles/unity/plugins/expo/screen0/options/prev_vp_button [org.compiz.move:/org/compiz/profiles/unity/plugins/move/] initiate-button = /apps/compizconfig-1/profiles/unity/plugins/move/screen0/options/initiate_button initiate-key = /apps/compizconfig-1/profiles/unity/plugins/move/screen0/options/initiate_key [org.compiz.grid:/org/compiz/profiles/unity/plugins/grid/] bottom-edge-action = /apps/compizconfig-1/profiles/unity/plugins/grid/screen0/options/bottom_edge_action bottom-edge-threshold = /apps/compizconfig-1/profiles/unity/plugins/grid/screen0/options/bottom_edge_threshold bottom-left-corner-action = /apps/compizconfig-1/profiles/unity/plugins/grid/screen0/options/bottom_left_corner_action bottom-right-corner-action = /apps/compizconfig-1/profiles/unity/plugins/grid/screen0/options/bottom_right_corner_action draw-indicator = /apps/compizconfig-1/profiles/unity/plugins/grid/screen0/options/draw_indicator fill-color = /apps/compizconfig-1/profiles/unity/plugins/grid/screen0/options/fill_color left-edge-action = /apps/compizconfig-1/profiles/unity/plugins/grid/screen0/options/left_edge_action left-edge-threshold = /apps/compizconfig-1/profiles/unity/plugins/grid/screen0/options/left_edge_threshold outline-color = /apps/compizconfig-1/profiles/unity/plugins/grid/screen0/options/outline_color put-bottom-key = /apps/compizconfig-1/profiles/unity/plugins/grid/screen0/options/put_bottom_key put-bottomleft-key = /apps/compizconfig-1/profiles/unity/plugins/grid/screen0/options/put_bottomleft_key put-bottomright-key = /apps/compizconfig-1/profiles/unity/plugins/grid/screen0/options/put_bottomright_key put-center-key = /apps/compizconfig-1/profiles/unity/plugins/grid/screen0/options/put_center_key put-left-key = /apps/compizconfig-1/profiles/unity/plugins/grid/screen0/options/put_left_key put-maximize-key = /apps/compizconfig-1/profiles/unity/plugins/grid/screen0/options/put_maximize_key put-restore-key = /apps/compizconfig-1/profiles/unity/plugins/grid/screen0/options/put_restore_key put-right-key = /apps/compizconfig-1/profiles/unity/plugins/grid/screen0/options/put_right_key put-top-key = /apps/compizconfig-1/profiles/unity/plugins/grid/screen0/options/put_top_key put-topleft-key = /apps/compizconfig-1/profiles/unity/plugins/grid/screen0/options/put_topleft_key put-topright-key = /apps/compizconfig-1/profiles/unity/plugins/grid/screen0/options/put_topright_key right-edge-action = /apps/compizconfig-1/profiles/unity/plugins/grid/screen0/options/right_edge_action right-edge-threshold = /apps/compizconfig-1/profiles/unity/plugins/grid/screen0/options/right_edge_threshold snapback-windows = /apps/compizconfig-1/profiles/unity/plugins/grid/screen0/options/snapback_windows snapoff-maximized = /apps/compizconfig-1/profiles/unity/plugins/grid/screen0/options/snapoff_maximized top-edge-action = /apps/compizconfig-1/profiles/unity/plugins/grid/screen0/options/top_edge_action top-edge-threshold = /apps/compizconfig-1/profiles/unity/plugins/grid/screen0/options/top_edge_threshold top-left-corner-action = /apps/compizconfig-1/profiles/unity/plugins/grid/screen0/options/top_left_corner_action top-right-corner-action = /apps/compizconfig-1/profiles/unity/plugins/grid/screen0/options/top_right_corner_action unity-7.2.0+14.04.20140416/tools/convert-files/compiz-profile-active-unity.convert0000644000015301777760000002707612323603360030201 0ustar pbusernogroup00000000000000[org.compiz.unityshell:/org/compiz/profiles/unity/plugins/unityshell/] launcher-switcher-prev = /apps/compiz-1/plugins/unityshell/screen0/options/launcher_switcher_prev shortcut-overlay = /apps/compiz-1/plugins/unityshell/screen0/options/shortcut_overlay panel-opacity-maximized-toggle = /apps/compiz-1/plugins/unityshell/screen0/options/panel_opacity_maximized_toggle launcher-switcher-forward = /apps/compiz-1/plugins/unityshell/screen0/options/launcher_switcher_forward overcome-pressure = /apps/compiz-1/plugins/unityshell/screen0/options/overcome_pressure launch-animation = /apps/compiz-1/plugins/unityshell/screen0/options/launch_animation alt-tab-timeout = /apps/compiz-1/plugins/unityshell/screen0/options/alt_tab_timeout panel-opacity = /apps/compiz-1/plugins/unityshell/screen0/options/panel_opacity show-minimized-windows = /apps/compiz-1/plugins/unityshell/screen0/options/show_minimized_windows num-launchers = /apps/compiz-1/plugins/unityshell/screen0/options/num_launchers alt-tab-right = /apps/compiz-1/plugins/unityshell/screen0/options/alt_tab_right show-hud = /apps/compiz-1/plugins/unityshell/screen0/options/show_hud launcher-hide-mode = /apps/compiz-1/plugins/unityshell/screen0/options/launcher_hide_mode alt-tab-forward = /apps/compiz-1/plugins/unityshell/screen0/options/alt_tab_forward alt-tab-left = /apps/compiz-1/plugins/unityshell/screen0/options/alt_tab_left launcher-capture-mouse = /apps/compiz-1/plugins/unityshell/screen0/options/launcher_capture_mouse alt-tab-detail-stop = /apps/compiz-1/plugins/unityshell/screen0/options/alt_tab_detail_stop urgent-animation = /apps/compiz-1/plugins/unityshell/screen0/options/urgent_animation keyboard-focus = /apps/compiz-1/plugins/unityshell/screen0/options/keyboard_focus alt-tab-prev = /apps/compiz-1/plugins/unityshell/screen0/options/alt_tab_prev reveal-pressure = /apps/compiz-1/plugins/unityshell/screen0/options/reveal_pressure decay-rate = /apps/compiz-1/plugins/unityshell/screen0/options/decay_rate stop-velocity = /apps/compiz-1/plugins/unityshell/screen0/options/stop_velocity autohide-animation = /apps/compiz-1/plugins/unityshell/screen0/options/autohide_animation alt-tab-bias-viewport = /apps/compiz-1/plugins/unityshell/screen0/options/alt_tab_bias_viewport edge-responsiveness = /apps/compiz-1/plugins/unityshell/screen0/options/edge_responsiveness automaximize-value = /apps/compiz-1/plugins/unityshell/screen0/options/automaximize_value background-color = /apps/compiz-1/plugins/unityshell/screen0/options/background_color alt-tab-forward-all = /apps/compiz-1/plugins/unityshell/screen0/options/alt_tab_forward_all alt-tab-prev-all = /apps/compiz-1/plugins/unityshell/screen0/options/alt_tab_prev_all menus-discovery-fadein = /apps/compiz-1/plugins/unityshell/screen0/options/menus_discovery_fadein execute-command = /apps/compiz-1/plugins/unityshell/screen0/options/execute_command dash-blur-experimental = /apps/compiz-1/plugins/unityshell/screen0/options/dash_blur_experimental menus-discovery-duration = /apps/compiz-1/plugins/unityshell/screen0/options/menus_discovery_duration alt-tab-prev-window = /apps/compiz-1/plugins/unityshell/screen0/options/alt_tab_prev_window reveal-trigger = /apps/compiz-1/plugins/unityshell/screen0/options/reveal_trigger panel-first-menu = /apps/compiz-1/plugins/unityshell/screen0/options/panel_first_menu icon-size = /apps/compiz-1/plugins/unityshell/screen0/options/icon_size backlight-mode = /apps/compiz-1/plugins/unityshell/screen0/options/backlight_mode menus-fadein = /apps/compiz-1/plugins/unityshell/screen0/options/menus_fadein alt-tab-detail-start = /apps/compiz-1/plugins/unityshell/screen0/options/alt_tab_detail_start show-desktop-icon = /apps/compiz-1/plugins/unityshell/screen0/options/show_desktop_icon alt-tab-next-window = /apps/compiz-1/plugins/unityshell/screen0/options/alt_tab_next_window launcher-opacity = /apps/compiz-1/plugins/unityshell/screen0/options/launcher_opacity show-launcher = /apps/compiz-1/plugins/unityshell/screen0/options/show_launcher menus-discovery-fadeout = /apps/compiz-1/plugins/unityshell/screen0/options/menus_discovery_fadeout menus-fadeout = /apps/compiz-1/plugins/unityshell/screen0/options/menus_fadeout [org.compiz.core:/org/compiz/profiles/unity/plugins/core/] active-plugins = /apps/compiz-1/plugins/core/screen0/options/active_plugins vsize = /apps/compiz-1/plugins/core/screen0/options/vsize hsize = /apps/compiz-1/plugins/core/screen0/options/vsize close-window-button = /apps/compiz-1/plugins/core/screen0/options/close_window_button close-window-key = /apps/compiz-1/plugins/core/screen0/options/close_window_key lower-window-button = /apps/compiz-1/plugins/core/screen0/options/lower_window_button lower-window-key = /apps/compiz-1/plugins/core/screen0/options/lower_window_key maximize-window-horizontally-key = /apps/compiz-1/plugins/core/screen0/options/maximize_window_horizontally_key maximize-window-key = /apps/compiz-1/plugins/core/screen0/options/maximize_window_key maximize-window-vertically-key = /apps/compiz-1/plugins/core/screen0/options/maximize_window_vertically_key minimize-window-button = /apps/compiz-1/plugins/core/screen0/options/minimize_window_button minimize-window-key = /apps/compiz-1/plugins/core/screen0/options/minimize_window_key raise-window-button = /apps/compiz-1/plugins/core/screen0/options/raise_window_button raise-window-key = /apps/compiz-1/plugins/core/screen0/options/raise_window_key show-desktop-edge = /apps/compiz-1/plugins/core/screen0/options/show_desktop_edge show-desktop-key = /apps/compiz-1/plugins/core/screen0/options/show_desktop_key toggle-window-maximized-button = /apps/compiz-1/plugins/core/screen0/options/toggle_window_maximized_button toggle-window-maximized-horizontally-key = /apps/compiz-1/plugins/core/screen0/options/toggle_window_maximized_horizontally_key toggle-window-maximized-key = /apps/compiz-1/plugins/core/screen0/options/toggle_window_maximized_key toggle-window-maximized-vertically-key = /apps/compiz-1/plugins/core/screen0/options/toggle_window_maximized_vertically_key toggle-window-shaded-key = /apps/compiz-1/plugins/core/screen0/options/toggle_window_shaded_key unmaximize-window-key = /apps/compiz-1/plugins/core/screen0/options/unmaximize_window_key window-menu-button = /apps/compiz-1/plugins/core/screen0/options/window_menu_button window-menu-key = /apps/compiz-1/plugins/core/screen0/options/window_menu_key [org.compiz.composite:/org/compiz/profiles/unity/plugins/composite/] detect-refresh-rate = /apps/compiz-1/plugins/composite/screen0/options/detect_refres_rate refresh-rate = /apps/compiz-1/plugins/composite/screen0/options/refres_rate [org.compiz.opengl:/org/compiz/profiles/unity/plugins/opengl/] lighting = /apps/compiz-1/plugins/opengl/screen0/options/lighting sync-to-vblank = /apps/compiz-1/plugins/opengl/screen0/options/sync_to_vblank texture-compression = /apps/compiz-1/plugins/opengl/screen0/options/texture_compression texture-filter = /apps/compiz-1/plugins/opengl/screen0/options/texture_filter [org.compiz.wall:/org/compiz/profiles/unity/plugins/wall/] down-button = /apps/compiz-1/plugins/wall/screen0/options/down_button down-key = /apps/compiz-1/plugins/wall/screen0/options/down_button down-window-key = /apps/compiz-1/plugins/wall/screen0/options/down_button edgeflip-dnd = /apps/compiz-1/plugins/wall/screen0/options/edgeflip_dnd edgeflip-move = /apps/compiz-1/plugins/wall/screen0/options/edgeflip_move edgeflip-pointer = /apps/compiz-1/plugins/wall/screen0/options/edgeflip_pointer edge-radius = /apps/compiz-1/plugins/wall/screen0/options/edge_radius flip-down-edge = /apps/compiz-1/plugins/wall/screen0/options/flip_down_edge flip-left-edge = /apps/compiz-1/plugins/wall/screen0/options/flip_left_edge flip-right-edge = /apps/compiz-1/plugins/wall/screen0/options/flip_right_edge flip-up-edge = /apps/compiz-1/plugins/wall/screen0/options/flip_up_edge left-button = /apps/compiz-1/plugins/wall/screen0/options/left_button left-key = /apps/compiz-1/plugins/wall/screen0/options/left_key left-window-key = /apps/compiz-1/plugins/wall/screen0/options/left_window_key next-button = /apps/compiz-1/plugins/wall/screen0/options/next_button next-key = /apps/compiz-1/plugins/wall/screen0/options/next_key prev-button = /apps/compiz-1/plugins/wall/screen0/options/prev_button prev-key =/apps/compiz-1/plugins/wall/screen0/options/prev_key right-button = /apps/compiz-1/plugins/wall/screen0/options/right_button right-key = /apps/compiz-1/plugins/wall/screen0/options/right_key right-window-key = /apps/compiz-1/plugins/wall/screen0/options/right_window_key up-button = /apps/compiz-1/plugins/wall/screen0/options/up_button up-key = /apps/compiz-1/plugins/wall/screen0/options/up_key up-window-key = /apps/compiz-1/plugins/wall/screen0/options/up_window_key [org.compiz.expo:/org/compiz/profiles/unity/plugins/expo/] exit-button = /apps/compiz-1/plugins/expo/screen0/options/exit_button expo-edge = /apps/compiz-1/plugins/expo/screen0/options/expo_edge expo-key = /apps/compiz-1/plugins/expo/screen0/options/expo_key expo-immediate-move = /apps/compiz-1/plugins/expo/screen0/options/expo_immediate_move next-vp-button = /apps/compiz-1/plugins/expo/screen0/options/next_vp_button prev-vp-button = /apps/compiz-1/plugins/expo/screen0/options/prev_vp_button [org.compiz.move:/org/compiz/profiles/unity/plugins/move/] initiate-button = /apps/compiz-1/plugins/move/screen0/options/initiate_button initiate-key = /apps/compiz-1/plugins/move/screen0/options/initiate_key [org.compiz.grid:/org/compiz/profiles/unity/plugins/grid/] bottom-edge-action = /apps/compiz-1/plugins/grid/screen0/options/bottom_edge_action bottom-edge-threshold = /apps/compiz-1/plugins/grid/screen0/options/bottom_edge_threshold bottom-left-corner-action = /apps/compiz-1/plugins/grid/screen0/options/bottom_left_corner_action bottom-right-corner-action = /apps/compiz-1/plugins/grid/screen0/options/bottom_right_corner_action draw-indicator = /apps/compiz-1/plugins/grid/screen0/options/draw_indicator fill-color = /apps/compiz-1/plugins/grid/screen0/options/fill_color left-edge-action = /apps/compiz-1/plugins/grid/screen0/options/left_edge_action left-edge-threshold = /apps/compiz-1/plugins/grid/screen0/options/left_edge_threshold outline-color = /apps/compiz-1/plugins/grid/screen0/options/outline_color put-bottom-key = /apps/compiz-1/plugins/grid/screen0/options/put_bottom_key put-bottomleft-key = /apps/compiz-1/plugins/grid/screen0/options/put_bottomleft_key put-bottomright-key = /apps/compiz-1/plugins/grid/screen0/options/put_bottomright_key put-center-key = /apps/compiz-1/plugins/grid/screen0/options/put_center_key put-left-key = /apps/compiz-1/plugins/grid/screen0/options/put_left_key put-maximize-key = /apps/compiz-1/plugins/grid/screen0/options/put_maximize_key put-restore-key = /apps/compiz-1/plugins/grid/screen0/options/put_restore_key put-right-key = /apps/compiz-1/plugins/grid/screen0/options/put_right_key put-top-key = /apps/compiz-1/plugins/grid/screen0/options/put_top_key put-topleft-key = /apps/compiz-1/plugins/grid/screen0/options/put_topleft_key put-topright-key = /apps/compiz-1/plugins/grid/screen0/options/put_topright_key right-edge-action = /apps/compiz-1/plugins/grid/screen0/options/right_edge_action right-edge-threshold = /apps/compiz-1/plugins/grid/screen0/options/right_edge_threshold snapback-windows = /apps/compiz-1/plugins/grid/screen0/options/snapback_windows snapoff-maximized = /apps/compiz-1/plugins/grid/screen0/options/snapoff_maximized top-edge-action = /apps/compiz-1/plugins/grid/screen0/options/top_edge_action top-edge-threshold = /apps/compiz-1/plugins/grid/screen0/options/top_edge_threshold 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 unity-7.2.0+14.04.20140416/decorations/0000755000015301777760000000000012323604323017577 5ustar pbusernogroup00000000000000unity-7.2.0+14.04.20140416/decorations/DecorationsSlidingLayout.cpp0000644000015301777760000000756212323603360025277 0ustar pbusernogroup00000000000000// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- /* * Copyright (C) 2014 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * 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, see . * * Authored by: Marco Trevisan */ #include #include "DecorationsSlidingLayout.h" #include "AnimationUtils.h" namespace unity { namespace decoration { namespace { enum ItemRole { INPUT = 0, MAIN }; } SlidingLayout::SlidingLayout() : fadein(100) , fadeout(120) , fade_animator_(fadein()) { items_.resize(2); fade_animator_.updated.connect(sigc::hide(sigc::mem_fun(this, &SlidingLayout::Damage))); mouse_owner.changed.connect([this] (bool owner) { if (items_[ItemRole::INPUT]) { fade_animator_.SetDuration(owner ? fadein() : fadeout()); animation::StartOrReverseIf(fade_animator_, owner); } }); } void SlidingLayout::SetMainItem(Item::Ptr const& main) { auto& main_item_ = items_[ItemRole::MAIN]; if (main_item_ == main) return; if (main_item_) main_item_->SetParent(nullptr); main_item_ = main; if (main_item_) { main_item_->SetParent(shared_from_this()); main_item_->focused = focused(); main_item_->scale = scale(); } Relayout(); } void SlidingLayout::SetInputItem(Item::Ptr const& input) { auto& input_item_ = items_[ItemRole::INPUT]; if (input_item_ == input) return; if (input_item_) input_item_->SetParent(nullptr); input_item_ = input; if (input_item_) { input_item_->SetParent(shared_from_this()); input_item_->focused = focused(); input_item_->scale = scale(); } Relayout(); } void SlidingLayout::DoRelayout() { nux::Size contents; for (auto const& item : items_) { if (!item || !item->visible()) continue; item->SetX(rect_.x()); item->SetMinWidth(item->GetNaturalWidth()); item->SetMaxWidth(max_.width); item->SetMinHeight(item->GetNaturalHeight()); item->SetMaxHeight(max_.height); auto const& geo = item->Geometry(); contents.width = std::max(contents.width, geo.width()); contents.height = std::max(contents.height, geo.height()); } for (auto const& item : items_) { if (!item || !item->visible()) continue; item->SetY(rect_.y() + (contents.height - item->Geometry().height())/2); } rect_.setWidth(contents.width); rect_.setHeight(contents.height); } void SlidingLayout::Draw(GLWindow* ctx, GLMatrix const& transformation, GLWindowPaintAttrib const& attrib, CompRegion const& clip, unsigned mask) { auto& main_item_ = items_[ItemRole::MAIN]; auto& input_item_ = items_[ItemRole::INPUT]; if (!input_item_) { if (main_item_) main_item_->Draw(ctx, transformation, attrib, clip, mask); return; } if (fade_animator_.CurrentState() == na::Animation::State::Running) { auto new_attrib = attrib; double animation_value = fade_animator_.GetCurrentValue(); new_attrib.opacity = animation_value * std::numeric_limits::max(); input_item_->Draw(ctx, transformation, new_attrib, clip, mask); new_attrib.opacity = (1.0f - animation_value) * std::numeric_limits::max(); main_item_->Draw(ctx, transformation, new_attrib, clip, mask); } else { auto const& draw_area = mouse_owner() ? input_item_ : main_item_; draw_area->Draw(ctx, transformation, attrib, clip, mask); } } } // decoration namespace } // unity namespace unity-7.2.0+14.04.20140416/decorations/DecorationsGrabEdge.h0000644000015301777760000000331512323603360023605 0ustar pbusernogroup00000000000000// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- /* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * 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, see . * * Authored by: Marco Trevisan */ #ifndef UNITY_DECORATIONS_GRAB_EDGE #define UNITY_DECORATIONS_GRAB_EDGE #include #include "DecorationsEdge.h" namespace unity { namespace decoration { class GrabEdge : public Edge { public: GrabEdge(CompWindow* win, bool always_wait_grab_timeout = false); bool IsMaximizable() const; bool IsGrabbed() const; int ButtonDown() const; CompPoint const& ClickedPoint() const; void ButtonDownEvent(CompPoint const&, unsigned button, Time) override; void ButtonUpEvent(CompPoint const&, unsigned button, Time) override; void MotionEvent(CompPoint const&, Time) override; protected: void AddProperties(debug::IntrospectionData&); void PerformWMAction(CompPoint const&, unsigned button, Time); private: Time last_click_time_; CompPoint last_click_pos_; int button_down_; bool always_wait_grab_timeout_; glib::Source::UniquePtr button_down_timer_; }; } // decoration namespace } // unity namespace #endif // UNITY_DECORATIONS_GRAB_EDGE unity-7.2.0+14.04.20140416/decorations/DecorationsInputMixer.h0000644000015301777760000000361112323603360024250 0ustar pbusernogroup00000000000000// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- /* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * 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, see . * * Authored by: Marco Trevisan */ #ifndef UNITY_DECORATION_INPUT_MIXER #define UNITY_DECORATION_INPUT_MIXER #include "DecorationsWidgets.h" namespace unity { namespace decoration { class InputMixer { public: typedef std::shared_ptr Ptr; InputMixer(); void PushToFront(Item::Ptr const&); void PushToBack(Item::Ptr const&); void Remove(Item::Ptr const&); Item::List const& Items() const; Item::Ptr const& GetMouseOwner() const; void EnterEvent(CompPoint const&); void MotionEvent(CompPoint const&, Time); void LeaveEvent(CompPoint const&); void ButtonDownEvent(CompPoint const&, unsigned button, Time); void ButtonUpEvent(CompPoint const&, unsigned button, Time); void UngrabPointer(); void ForceMouseOwnerCheck(); private: InputMixer(InputMixer const&) = delete; InputMixer& operator=(InputMixer const&) = delete; void UpdateMouseOwner(CompPoint const&); void UnsetMouseOwner(); Item::Ptr GetMatchingItem(CompPoint const&); Item::Ptr GetMatchingItemRecursive(Item::List const&, CompPoint const&); Item::List items_; Item::Ptr last_mouse_owner_; bool mouse_down_; bool recheck_owner_; }; } // decoration namespace } // unity namespace #endif unity-7.2.0+14.04.20140416/decorations/DecorationsMenuLayout.cpp0000644000015301777760000001404612323603360024605 0ustar pbusernogroup00000000000000// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- /* * Copyright (C) 2014 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * 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, see . * * Authored by: Marco Trevisan */ #include "DecorationsMenuLayout.h" #include "DecorationsMenuEntry.h" #include "DecorationsMenuDropdown.h" namespace unity { namespace decoration { using namespace indicator; MenuLayout::MenuLayout(menu::Manager::Ptr const& menu, CompWindow* win) : active(false) , show_now(false) , menu_manager_(menu) , win_(win) , last_pointer_(-1, -1) , dropdown_(std::make_shared(menu_manager_->Indicators(), win)) {} void MenuLayout::Setup() { // This function is needed, because we can't use shared_from_this() in the ctor items_.clear(); if (!menu_manager_->HasAppMenu()) { Relayout(); return; } auto ownership_cb = sigc::mem_fun(this, &MenuLayout::OnEntryMouseOwnershipChanged); auto active_cb = sigc::mem_fun(this, &MenuLayout::OnEntryActiveChanged); auto show_now_cb = sigc::mem_fun(this, &MenuLayout::OnEntryShowNowChanged); dropdown_->mouse_owner.changed.connect(ownership_cb); dropdown_->active.changed.connect(active_cb); dropdown_->show_now.changed.connect(show_now_cb); for (auto const& entry : menu_manager_->AppMenu()->GetEntries()) { auto menu = std::make_shared(entry, win_); menu->mouse_owner.changed.connect(ownership_cb); menu->active.changed.connect(active_cb); menu->show_now.changed.connect(show_now_cb); menu->focused = focused(); menu->scale = scale(); menu->SetParent(shared_from_this()); items_.push_back(menu); } if (!items_.empty()) Relayout(); } bool MenuLayout::ActivateMenu(std::string const& entry_id) { MenuEntry::Ptr target; bool activated = false; for (auto const& item : items_) { auto const& menu_entry = std::static_pointer_cast(item); if (menu_entry->Id() == entry_id) { target = menu_entry; if (item->visible() && item->sensitive()) { menu_entry->ShowMenu(0); activated = true; } break; } } if (!activated) activated = dropdown_->ActivateChild(target); if (activated) { // Since this generally happens on keyboard activation we need to avoid that // the mouse position would interfere with this last_pointer_.set(pointerX, pointerY); } return activated; } void MenuLayout::OnEntryMouseOwnershipChanged(bool owner) { mouse_owner = owner; } void MenuLayout::OnEntryShowNowChanged(bool show) { if (!show) { show_now_timeout_.reset(); show_now = false; } else { show_now_timeout_.reset(new glib::Timeout(menu_manager_->show_menus_wait())); show_now_timeout_->Run([this] { show_now = true; show_now_timeout_.reset(); return false; }); } } void MenuLayout::OnEntryActiveChanged(bool actived) { active = actived; if (active && !pointer_tracker_ && items_.size() > 1) { pointer_tracker_.reset(new glib::Timeout(16)); pointer_tracker_->Run([this] { Window win; int i, x, y; unsigned int ui; XQueryPointer(screen->dpy(), screen->root(), &win, &win, &x, &y, &i, &i, &ui); if (last_pointer_.x() != x || last_pointer_.y() != y) { last_pointer_.set(x, y); for (auto const& item : items_) { if (!item->visible() || !item->sensitive()) continue; if (item->Geometry().contains(last_pointer_)) { std::static_pointer_cast(item)->ShowMenu(1); break; } } } return true; }); } else if (!active) { pointer_tracker_.reset(); } } void MenuLayout::ChildrenGeometries(EntryLocationMap& map) const { for (auto const& item : items_) { if (item->visible()) { auto const& entry = std::static_pointer_cast(item); auto const& geo = item->Geometry(); map.insert({entry->Id(), {geo.x(), geo.y(), geo.width(), geo.height()}}); } } } void MenuLayout::DoRelayout() { float scale = this->scale(); int inner_padding = this->inner_padding().CP(scale); int left_padding = this->left_padding().CP(scale); int right_padding = this->right_padding().CP(scale); int dropdown_width = dropdown_->GetNaturalWidth(); int accumolated_width = dropdown_width + left_padding + right_padding - inner_padding; int max_width = max_.width; std::list to_hide; for (auto const& item : items_) { if (!item->visible() || item == dropdown_) continue; accumolated_width += item->GetNaturalWidth() + inner_padding; if (accumolated_width > max_width) to_hide.push_front(std::static_pointer_cast(item)); } // No need to hide an item if there's space that we considered for the dropdown if (dropdown_->Empty() && to_hide.size() == 1) { if (accumolated_width - dropdown_width < max_width) to_hide.clear(); } // There's just one hidden entry, it might fit in the space we have if (to_hide.empty() && dropdown_->Size() == 1) accumolated_width -= dropdown_width; if (accumolated_width < max_width) { while (!dropdown_->Empty() && dropdown_->Top()->GetNaturalWidth() < (max_width - accumolated_width)) dropdown_->Pop(); if (dropdown_->Empty()) Remove(dropdown_); } else if (!to_hide.empty()) { if (dropdown_->Empty()) Append(dropdown_); for (auto const& hidden : to_hide) dropdown_->Push(hidden); } Layout::DoRelayout(); } } // decoration namespace } // unity namespace unity-7.2.0+14.04.20140416/decorations/DecorationsMenuDropdown.cpp0000644000015301777760000000720312323603360025121 0ustar pbusernogroup00000000000000// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- /* * Copyright (C) 2014 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * 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, see . * * Authored by: Marco Trevisan */ #include "DecorationsMenuDropdown.h" #include "DecorationStyle.h" namespace unity { namespace decoration { namespace { const std::string ICON_NAME = "go-down-symbolic"; const unsigned ICON_SIZE = 10; } using namespace indicator; MenuDropdown::MenuDropdown(Indicators::Ptr const& indicators, CompWindow* win) : MenuEntry(std::make_shared("LIM-dropdown"), win) , indicators_(indicators) { natural_.width = ICON_SIZE; natural_.height = ICON_SIZE; entry_->set_image(1, ICON_NAME, true, true); } void MenuDropdown::ShowMenu(unsigned button) { if (active) return; active = true; auto const& geo = Geometry(); Indicator::Entries entries; for (auto const& child : children_) entries.push_back(child->GetEntry()); indicators_->ShowEntriesDropdown(entries, active_, 0, geo.x(), geo.y2()); } bool MenuDropdown::ActivateChild(MenuEntry::Ptr const& child) { if (!child || std::find(children_.begin(), children_.end(), child) == children_.end()) return false; active_ = child->GetEntry(); ShowMenu(0); active_.reset(); return true; } void MenuDropdown::Push(MenuEntry::Ptr const& child) { if (!child) return; if (std::find(children_.begin(), children_.end(), child) != children_.end()) return; int size_diff = (child->GetNaturalHeight() - GetNaturalHeight()) / scale(); if (size_diff > 0) { natural_.height += (size_diff % 2); vertical_padding = vertical_padding() + (size_diff / 2); } children_.push_front(child); child->GetEntry()->add_parent(entry_); child->in_dropdown = true; } MenuEntry::Ptr MenuDropdown::Pop() { if (children_.empty()) return nullptr; auto child = children_.front(); child->GetEntry()->rm_parent(entry_); child->in_dropdown = false; children_.pop_front(); return child; } MenuEntry::Ptr MenuDropdown::Top() const { return (!children_.empty()) ? children_.front() : nullptr; } size_t MenuDropdown::Size() const { return children_.size(); } bool MenuDropdown::Empty() const { return children_.empty(); } void MenuDropdown::RenderTexture() { WidgetState state = active() ? WidgetState::PRELIGHT : WidgetState::NORMAL; cu::CairoContext icon_ctx(GetNaturalWidth(), GetNaturalHeight(), scale()); if (state == WidgetState::PRELIGHT) Style::Get()->DrawMenuItem(state, icon_ctx, icon_ctx.width() / scale(), icon_ctx.height() / scale()); cairo_save(icon_ctx); cairo_translate(icon_ctx, horizontal_padding(), vertical_padding()); cairo_save(icon_ctx); cairo_scale(icon_ctx, 1.0f/scale(), 1.0f/scale()); Style::Get()->DrawMenuItemIcon(ICON_NAME, state, icon_ctx, ICON_SIZE * scale()); cairo_restore(icon_ctx); cairo_restore(icon_ctx); SetTexture(icon_ctx); } debug::Introspectable::IntrospectableList MenuDropdown::GetIntrospectableChildren() { IntrospectableList list; for (auto const& child : children_) list.push_back(child.get()); return list; } } // decoration namespace } // unity namespace unity-7.2.0+14.04.20140416/decorations/DecorationsDataPool.cpp0000644000015301777760000001410712323603360024204 0ustar pbusernogroup00000000000000// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- /* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * 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, see . * * Authored by: Marco Trevisan */ #include #include #include #include "glow_texture.h" #include "DecorationsDataPool.h" #include "UnitySettings.h" #include "UScreen.h" namespace unity { namespace decoration { namespace { DECLARE_LOGGER(logger, "unity.decoration.datapool"); static DataPool::Ptr instance_; const std::string PLUGIN_NAME = "unityshell"; const int BUTTONS_SIZE = 16; const int BUTTONS_PADDING = 1; const cu::SimpleTexture::Ptr EMPTY_BUTTON; unsigned EdgeTypeToCursorShape(Edge::Type type) { switch (type) { case Edge::Type::TOP: return XC_top_side; case Edge::Type::TOP_LEFT: return XC_top_left_corner; case Edge::Type::TOP_RIGHT: return XC_top_right_corner; case Edge::Type::LEFT: return XC_left_side; case Edge::Type::RIGHT: return XC_right_side; case Edge::Type::BOTTOM: return XC_bottom_side; case Edge::Type::BOTTOM_LEFT: return XC_bottom_left_corner; case Edge::Type::BOTTOM_RIGHT: return XC_bottom_right_corner; default: return XC_left_ptr; } } } DataPool::DataPool() { SetupCursors(); SetupTextures(); CompSize glow_size(texture::GLOW_SIZE, texture::GLOW_SIZE); glow_texture_ = std::make_shared(GLTexture::imageDataToTexture(texture::GLOW, glow_size, GL_RGBA, GL_UNSIGNED_BYTE)); auto cb = sigc::mem_fun(this, &DataPool::SetupTextures); Style::Get()->theme.changed.connect(sigc::hide(cb)); unity::Settings::Instance().dpi_changed.connect(cb); } DataPool::~DataPool() { auto* dpy = screen->dpy(); for (auto cursor : edge_cursors_) XFreeCursor(dpy, cursor); } DataPool::Ptr const& DataPool::Get() { if (instance_) return instance_; instance_.reset(new DataPool); return instance_; } void DataPool::Reset() { instance_.reset(); } void DataPool::SetupCursors() { auto* dpy = screen->dpy(); for (unsigned c = 0; c < edge_cursors_.size(); ++c) edge_cursors_[c] = XCreateFontCursor(dpy, EdgeTypeToCursorShape(Edge::Type(c))); } Cursor DataPool::EdgeCursor(Edge::Type type) const { return edge_cursors_[unsigned(type)]; } void DataPool::SetupTextures() { auto const& style = Style::Get(); unsigned monitors = UScreen::GetDefault()->GetPluggedMonitorsNumber(); auto& settings = Settings::Instance(); bool found_normal = false; nux::Size size; scaled_window_buttons_.clear(); for (unsigned monitor = 0; monitor < monitors; ++monitor) { double scale = settings.em(monitor)->DPIScale(); bool scaled = (scale != 1.0f); if (!scaled) { if (found_normal) continue; found_normal = true; } auto& destination = scaled ? scaled_window_buttons_[scale] : window_buttons_; for (unsigned button = 0; button < window_buttons_.size(); ++button) { for (unsigned state = 0; state < window_buttons_[button].size(); ++state) { glib::Error error; auto const& file = style->WindowButtonFile(WindowButtonType(button), WidgetState(state)); gdk_pixbuf_get_file_info(file.c_str(), &size.width, &size.height); size.width = std::round(size.width * scale); size.height = std::round(size.height * scale); glib::Object pixbuf(gdk_pixbuf_new_from_file_at_size(file.c_str(), size.width, size.height, &error)); if (pixbuf) { LOG_DEBUG(logger) << "Loading texture " << file; cu::CairoContext ctx(size.width, size.height); gdk_cairo_set_source_pixbuf(ctx, pixbuf, 0, 0); cairo_paint(ctx); destination[button][state] = ctx; } else { LOG_WARN(logger) << "Impossible to load local button texture file: " << error << "; falling back to cairo generated one."; int button_size = std::round((BUTTONS_SIZE + BUTTONS_PADDING * 2) * scale); cu::CairoContext ctx(button_size, button_size, scale); cairo_translate(ctx, BUTTONS_PADDING, BUTTONS_PADDING); style->DrawWindowButton(WindowButtonType(button), WidgetState(state), ctx, BUTTONS_SIZE, BUTTONS_SIZE); destination[button][state] = ctx; } } } } } cu::SimpleTexture::Ptr const& DataPool::GlowTexture() const { return glow_texture_; } cu::SimpleTexture::Ptr const& DataPool::ButtonTexture(WindowButtonType wbt, WidgetState ws) const { if (wbt >= WindowButtonType::Size || ws >= WidgetState::Size) { LOG_ERROR(logger) << "It has been requested an invalid button texture " << "WindowButtonType: " << unsigned(wbt) << ", WidgetState: " << unsigned(ws); return EMPTY_BUTTON; } return window_buttons_[unsigned(wbt)][unsigned(ws)]; } cu::SimpleTexture::Ptr const& DataPool::ButtonTexture(double scale, WindowButtonType wbt, WidgetState ws) const { if (wbt >= WindowButtonType::Size || ws >= WidgetState::Size) { LOG_ERROR(logger) << "It has been requested an invalid button texture " << "WindowButtonType: " << unsigned(wbt) << ", WidgetState: " << unsigned(ws); return EMPTY_BUTTON; } if (scale == 1.0f) return window_buttons_[unsigned(wbt)][unsigned(ws)]; auto it = scaled_window_buttons_.find(scale); if (it == scaled_window_buttons_.end()) return EMPTY_BUTTON; return it->second[unsigned(wbt)][unsigned(ws)]; } } // decoration namespace } // unity namespace unity-7.2.0+14.04.20140416/decorations/DecorationsTitle.cpp0000644000015301777760000000703412323603360023563 0ustar pbusernogroup00000000000000// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- /* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * 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, see . * * Authored by: Marco Trevisan */ #include #include "DecorationsTitle.h" #include "DecorationStyle.h" namespace unity { namespace decoration { Title::Title() { text.changed.connect(sigc::mem_fun(this, &Title::OnTextChanged)); focused.changed.connect(sigc::hide(sigc::mem_fun(this, &Title::RenderTexture))); scale.changed.connect([this] (double) { text.changed.emit(text()); }); Style::Get()->title_font.changed.connect(sigc::mem_fun(this, &Title::OnFontChanged)); } void Title::OnTextChanged(std::string const& new_text) { bool damaged = false; auto real_size = Style::Get()->TitleNaturalSize(new_text); real_size.width *= scale(); real_size.height *= scale(); if (GetNaturalWidth() > real_size.width || GetNaturalHeight() > real_size.height) { Damage(); damaged = true; } SetSize(real_size.width, real_size.height); texture_size_ = nux::Size(); if (!damaged) Damage(); } void Title::OnFontChanged(std::string const&) { text.changed.emit(text()); } void Title::RenderTexture() { if (!texture_size_.width || !texture_size_.height) { SetTexture(nullptr); return; } auto state = focused() ? WidgetState::NORMAL : WidgetState::BACKDROP; cu::CairoContext text_ctx(texture_size_.width, texture_size_.height, scale()); nux::Rect bg_geo(0, 0, texture_size_.width, texture_size_.height); if (BasicContainer::Ptr const& top = GetTopParent()) { auto const& top_geo = top->Geometry(); auto const& geo = Geometry(); bg_geo.Set(top_geo.x() - geo.x(), top_geo.y() - geo.y(), top_geo.width(), top_geo.height()); } Style::Get()->DrawTitle(text(), state, text_ctx, texture_size_.width / scale(), texture_size_.height / scale(), bg_geo * (1.0/scale)); SetTexture(text_ctx); } void Title::SetX(int x) { float alignment = Style::Get()->TitleAlignmentValue(); if (alignment > 0) { if (BasicContainer::Ptr const& top = GetTopParent()) { auto const& top_geo = top->ContentGeometry(); x = std::max(x, top_geo.x() + (top_geo.width() - GetNaturalWidth()) * alignment); } } TexturedItem::SetX(x); } int Title::GetNaturalWidth() const { return Item::GetNaturalWidth(); } int Title::GetNaturalHeight() const { return Item::GetNaturalHeight(); } void Title::Draw(GLWindow* ctx, GLMatrix const& transformation, GLWindowPaintAttrib const& attrib, CompRegion const& clip, unsigned mask) { auto const& geo = Geometry(); nux::Size tex_size(geo.width(), geo.height()); if (texture_size_ != tex_size) { texture_size_ = tex_size; RenderTexture(); } TexturedItem::Draw(ctx, transformation, attrib, clip, mask); } void Title::AddProperties(debug::IntrospectionData& data) { TexturedItem::AddProperties(data); data.add("text", text()) .add("texture_size", texture_size_); } } // decoration namespace } // unity namespace unity-7.2.0+14.04.20140416/decorations/DecorationsEdge.h0000644000015301777760000000302512323603360023007 0ustar pbusernogroup00000000000000// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- /* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * 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, see . * * Authored by: Marco Trevisan */ #ifndef UNITY_DECORATIONS_EDGE #define UNITY_DECORATIONS_EDGE #include "DecorationsWidgets.h" namespace unity { namespace decoration { class Edge : public SimpleItem { public: enum class Type { // The order of this enum is important to define the priority of each Edge // when parsing the input events (in case two areas overlap) GRAB = 0, TOP_LEFT, TOP_RIGHT, TOP, BOTTOM_LEFT, BOTTOM_RIGHT, BOTTOM, LEFT, RIGHT, Size }; Edge(CompWindow* win, Type t); Type GetType() const; CompWindow* Window() const; void ButtonDownEvent(CompPoint const&, unsigned button, Time) override; protected: std::string GetName() const; CompWindow* win_; Type type_; }; } // decoration namespace } // unity namespace #endif // UNITY_DECORATIONS_EDGE unity-7.2.0+14.04.20140416/decorations/DecorationsWidgets.h0000644000015301777760000001217712323603360023561 0ustar pbusernogroup00000000000000// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- /* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * 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, see . * * Authored by: Marco Trevisan */ #ifndef UNITY_DECORATION_WIDGETS #define UNITY_DECORATION_WIDGETS #include #include #include #include #include "Introspectable.h" #include "CompizUtils.h" #include "RawPixel.h" namespace unity { namespace decoration { namespace cu = compiz_utils; class BasicContainer; class Item : public sigc::trackable, public debug::Introspectable { public: typedef std::shared_ptr Ptr; typedef unity::uweak_ptr WeakPtr; typedef std::deque List; Item(); virtual ~Item() = default; nux::Property visible; nux::Property focused; nux::Property sensitive; nux::Property mouse_owner; nux::Property scale; CompRect const& Geometry() const; virtual int GetNaturalWidth() const; virtual int GetNaturalHeight() const; virtual void SetCoords(int x, int y); virtual void SetX(int x) { SetCoords(x, Geometry().y()); } virtual void SetY(int y) { SetCoords(Geometry().x(), y); } virtual void SetSize(int width, int height); virtual void SetWidth(int width) { SetSize(width, Geometry().height()); } virtual void SetHeight(int height) { SetSize(Geometry().width(), height); }; virtual void SetMaxWidth(int max_width); virtual void SetMaxHeight(int max_height); virtual void SetMinWidth(int min_width); virtual void SetMinHeight(int min_height); int GetMaxWidth() const; int GetMaxHeight() const; int GetMinWidth() const; int GetMinHeight() const; void SetParent(std::shared_ptr const&); std::shared_ptr GetParent() const; std::shared_ptr GetTopParent() const; void Damage(); virtual void Draw(GLWindow*, GLMatrix const&, GLWindowPaintAttrib const&, CompRegion const&, unsigned mask) {} protected: virtual CompRect& InternalGeo() = 0; sigc::signal geo_parameters_changed; virtual bool IsContainer() const { return false; } void RequestRelayout(); friend class InputMixer; virtual void MotionEvent(CompPoint const&, Time) {} virtual void ButtonDownEvent(CompPoint const&, unsigned button, Time) {} virtual void ButtonUpEvent(CompPoint const&, unsigned button, Time) {} std::string GetName() const { return "Item"; } void AddProperties(debug::IntrospectionData&); private: Item(Item const&) = delete; Item& operator=(Item const&) = delete; protected: nux::Size max_; nux::Size min_; nux::Size natural_; private: unity::uweak_ptr parent_; }; class SimpleItem : public Item { protected: CompRect& InternalGeo() { return rect_; } CompRect rect_; }; class TexturedItem : public Item { public: typedef std::shared_ptr Ptr; void SetTexture(cu::SimpleTexture::Ptr const&); void Draw(GLWindow*, GLMatrix const&, GLWindowPaintAttrib const&, CompRegion const&, unsigned mask); void SetCoords(int x, int y); int GetNaturalWidth() const; int GetNaturalHeight() const; protected: std::string GetName() const { return "TexturedItem"; } CompRect& InternalGeo(); cu::SimpleTextureQuad texture_; }; class BasicContainer : public SimpleItem, public std::enable_shared_from_this { public: typedef std::shared_ptr Ptr; BasicContainer(); Item::List const& Items() const { return items_; } virtual CompRect ContentGeometry() const; protected: friend class Item; void Relayout(); bool IsContainer() const { return true; } std::string GetName() const { return "BasicContainer"; } void AddProperties(debug::IntrospectionData&); IntrospectableList GetIntrospectableChildren(); Item::List items_; private: virtual void DoRelayout() = 0; bool relayouting_; }; class Layout : public BasicContainer { public: typedef std::shared_ptr Ptr; Layout(); nux::Property inner_padding; nux::Property left_padding; nux::Property right_padding; nux::Property top_padding; nux::Property bottom_padding; void Append(Item::Ptr const&); void Remove(Item::Ptr const&); CompRect ContentGeometry() const; void Draw(GLWindow*, GLMatrix const&, GLWindowPaintAttrib const&, CompRegion const&, unsigned mask); protected: std::string GetName() const { return "Layout"; } void AddProperties(debug::IntrospectionData&); void DoRelayout(); private: bool SetPadding(RawPixel& target, RawPixel const& new_value); }; } // decoration namespace } // unity namespace #endif unity-7.2.0+14.04.20140416/decorations/DecorationsEdgeBorders.cpp0000644000015301777760000000652412323603360024672 0ustar pbusernogroup00000000000000// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- /* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * 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, see . * * Authored by: Marco Trevisan */ #include "DecorationsEdgeBorders.h" #include "DecorationsGrabEdge.h" namespace unity { namespace decoration { namespace { const int MIN_CORNER_EDGE = 10; } EdgeBorders::EdgeBorders(CompWindow* win) { items_.resize(size_t(Edge::Type::Size)); for (unsigned i = 0; i < unsigned(Edge::Type::Size); ++i) { auto type = Edge::Type(i); if (type == Edge::Type::GRAB) items_[i] = std::make_shared(win); else items_[i] = std::make_shared(win, type); } Relayout(); } void EdgeBorders::DoRelayout() { auto const& grab_edge = items_[unsigned(Edge::Type::GRAB)]; CompWindow* win = std::static_pointer_cast(grab_edge)->Window(); auto const& b = win->border(); auto const& ib = win->input(); using namespace compiz::window::extents; Extents edges(std::max(ib.left, MIN_CORNER_EDGE), std::max(ib.right, MIN_CORNER_EDGE), std::max(ib.top, MIN_CORNER_EDGE), std::max(ib.bottom, MIN_CORNER_EDGE)); auto item = items_[unsigned(Edge::Type::TOP)]; item->SetCoords(rect_.x() + edges.left, rect_.y()); item->SetSize(rect_.width() - edges.left - edges.right, edges.top - b.top); item = items_[unsigned(Edge::Type::TOP_LEFT)]; item->SetCoords(rect_.x(), rect_.y()); item->SetSize(edges.left, edges.top); item = items_[unsigned(Edge::Type::TOP_RIGHT)]; item->SetCoords(rect_.x2() - edges.right, rect_.y()); item->SetSize(edges.right, edges.top); item = items_[unsigned(Edge::Type::LEFT)]; item->SetCoords(rect_.x(), rect_.y() + edges.top); item->SetSize(edges.left, rect_.height() - edges.top - edges.bottom); item = items_[unsigned(Edge::Type::RIGHT)]; item->SetCoords(rect_.x2() - edges.right, rect_.y() + edges.top); item->SetSize(edges.right, rect_.height() - edges.top - edges.bottom); item = items_[unsigned(Edge::Type::BOTTOM)]; item->SetCoords(rect_.x() + edges.left, rect_.y2() - edges.bottom); item->SetSize(rect_.width() - edges.left - edges.right, edges.bottom); item = items_[unsigned(Edge::Type::BOTTOM_LEFT)]; item->SetCoords(rect_.x(), rect_.y2() - edges.bottom); item->SetSize(edges.left, edges.bottom); item = items_[unsigned(Edge::Type::BOTTOM_RIGHT)]; item->SetCoords(rect_.x2() - edges.right, rect_.y2() - edges.bottom); item->SetSize(edges.right, edges.bottom); item = items_[unsigned(Edge::Type::GRAB)]; item->SetCoords(rect_.x() + ib.left, rect_.y() + ib.top - b.top); item->SetSize(rect_.width() - ib.left - ib.right, b.top); } Item::Ptr const& EdgeBorders::GetEdge(Edge::Type type) const { return items_[unsigned(type)]; } } // decoration namespace } // unity namespace unity-7.2.0+14.04.20140416/decorations/pch/0000755000015301777760000000000012323604323020351 5ustar pbusernogroup00000000000000unity-7.2.0+14.04.20140416/decorations/pch/decorations_pch.hh0000644000015301777760000000223012323603360024033 0ustar pbusernogroup00000000000000// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- /* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * 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, see . * * Authored by: Marco Trevisan */ /* * These are the precompiled header includes for this module. * Only system header files can be listed here. */ #include #include #include #include #include #include #include #include #include #include #include #include unity-7.2.0+14.04.20140416/decorations/DecorationsInputMixer.cpp0000644000015301777760000001047012323603360024604 0ustar pbusernogroup00000000000000// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- /* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * 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, see . * * Authored by: Marco Trevisan */ #include #include "DecorationsInputMixer.h" namespace unity { namespace decoration { namespace { DECLARE_LOGGER(logger, "unity.decorations.inputmixer"); } InputMixer::InputMixer() : mouse_down_(false) , recheck_owner_(false) {} void InputMixer::PushToFront(Item::Ptr const& item) { if (!item) return; auto it = std::find(items_.begin(), items_.end(), item); if (it != items_.end()) items_.erase(it); items_.push_front(item); } void InputMixer::PushToBack(Item::Ptr const& item) { if (!item) return; auto it = std::find(items_.begin(), items_.end(), item); if (it != items_.end()) items_.erase(it); items_.push_back(item); } void InputMixer::Remove(Item::Ptr const& item) { if (item == last_mouse_owner_) UnsetMouseOwner(); auto it = std::find(items_.begin(), items_.end(), item); if (it != items_.end()) items_.erase(it); } Item::List const& InputMixer::Items() const { return items_; } void InputMixer::ForceMouseOwnerCheck() { if (!mouse_down_) { UpdateMouseOwner(CompPoint(pointerX, pointerY)); } else { recheck_owner_ = true; } } Item::Ptr InputMixer::GetMatchingItemRecursive(Item::List const& items, CompPoint const& point) { for (auto const& item : items) { if (item && item->visible() && item->Geometry().contains(point)) { if (!item->IsContainer()) return item->sensitive() ? item : nullptr; auto const& container = std::static_pointer_cast(item); auto const& child = GetMatchingItemRecursive(container->Items(), point); if (child) return child; } } return nullptr; } Item::Ptr InputMixer::GetMatchingItem(CompPoint const& point) { return GetMatchingItemRecursive(items_, point); } void InputMixer::UpdateMouseOwner(CompPoint const& point) { if (Item::Ptr const& item = GetMatchingItem(point)) { if (item != last_mouse_owner_) { UnsetMouseOwner(); last_mouse_owner_ = item; item->mouse_owner = true; } } else { UnsetMouseOwner(); } } void InputMixer::UnsetMouseOwner() { if (!last_mouse_owner_) return; last_mouse_owner_->mouse_owner = false; last_mouse_owner_ = nullptr; } void InputMixer::UngrabPointer() { mouse_down_ = false; UnsetMouseOwner(); } Item::Ptr const& InputMixer::GetMouseOwner() const { return last_mouse_owner_; }; void InputMixer::EnterEvent(CompPoint const& point) { if (!mouse_down_) UpdateMouseOwner(point); } void InputMixer::LeaveEvent(CompPoint const& point) { if (!mouse_down_) UnsetMouseOwner(); } void InputMixer::MotionEvent(CompPoint const& point, Time timestamp) { if (!mouse_down_) UpdateMouseOwner(point); if (last_mouse_owner_) last_mouse_owner_->MotionEvent(point, timestamp); } void InputMixer::ButtonDownEvent(CompPoint const& point, unsigned button, Time timestamp) { mouse_down_ = true; if (last_mouse_owner_) last_mouse_owner_->ButtonDownEvent(point, button, timestamp); } void InputMixer::ButtonUpEvent(CompPoint const& point, unsigned button, Time timestamp) { mouse_down_ = false; if (last_mouse_owner_) { // This event might cause the LastMouseOwner to be deleted, so we protect using a weak_ptr Item::WeakPtr weak_last_mouse_owner(last_mouse_owner_); last_mouse_owner_->ButtonUpEvent(point, button, timestamp); if (weak_last_mouse_owner && !last_mouse_owner_->Geometry().contains(point)) { UpdateMouseOwner(point); } else if (recheck_owner_) { recheck_owner_ = false; UpdateMouseOwner(point); } } } } // decoration namespace } // unity namespace unity-7.2.0+14.04.20140416/decorations/DecorationsMenuLayout.h0000644000015301777760000000347612323603360024257 0ustar pbusernogroup00000000000000// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- /* * Copyright (C) 2014 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * 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, see . * * Authored by: Marco Trevisan */ #ifndef UNITY_DECORATIONS_MENU_LAYOUT #define UNITY_DECORATIONS_MENU_LAYOUT #include #include "DecorationsWidgets.h" #include "MenuManager.h" namespace unity { namespace decoration { class MenuDropdown; class MenuLayout : public Layout { public: typedef std::shared_ptr Ptr; MenuLayout(menu::Manager::Ptr const&, CompWindow*); nux::Property active; nux::Property show_now; void Setup(); bool ActivateMenu(std::string const& entry_id); void ChildrenGeometries(indicator::EntryLocationMap&) const; protected: void DoRelayout() override; std::string GetName() const override { return "MenuLayout"; } private: void OnEntryMouseOwnershipChanged(bool); void OnEntryActiveChanged(bool); void OnEntryShowNowChanged(bool); menu::Manager::Ptr menu_manager_; CompWindow* win_; CompPoint last_pointer_; glib::Source::UniquePtr pointer_tracker_; glib::Source::UniquePtr show_now_timeout_; std::shared_ptr dropdown_; }; } // decoration namespace } // unity namespace #endif // UNITY_DECORATIONS_MENU_LAYOUT unity-7.2.0+14.04.20140416/decorations/DecorationsMenuEntry.cpp0000644000015301777760000001246012323603360024427 0ustar pbusernogroup00000000000000// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- /* * Copyright (C) 2014 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * 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, see . * * Authored by: Marco Trevisan */ #include #include "DecorationsMenuEntry.h" #include "DecorationStyle.h" #include "UnitySettings.h" namespace unity { namespace decoration { using namespace indicator; MenuEntry::MenuEntry(Entry::Ptr const& entry, CompWindow* win) : horizontal_padding(5) , vertical_padding(3) , active(entry->active()) , show_now(entry->show_now()) , in_dropdown(false) , entry_(entry) , grab_(win, true) { entry_->updated.connect(sigc::mem_fun(this, &MenuEntry::EntryUpdated)); horizontal_padding.changed.connect(sigc::hide(sigc::mem_fun(this, &MenuEntry::RenderTexture))); vertical_padding.changed.connect(sigc::hide(sigc::mem_fun(this, &MenuEntry::RenderTexture))); scale.changed.connect(sigc::hide(sigc::mem_fun(this, &MenuEntry::RenderTexture))); in_dropdown.changed.connect([this] (bool in) { visible = entry_->visible() && !in; }); EntryUpdated(); } std::string const& MenuEntry::Id() const { return entry_->id(); } void MenuEntry::EntryUpdated() { sensitive = entry_->label_sensitive() || entry_->image_sensitive(); visible = entry_->visible() && !in_dropdown(); active = entry_->active(); show_now = entry_->show_now(); RenderTexture(); } void MenuEntry::RenderTexture() { WidgetState state = WidgetState::NORMAL; if (show_now()) state = WidgetState::PRESSED; if (active()) state = WidgetState::PRELIGHT; natural_ = Style::Get()->MenuItemNaturalSize(entry_->label()); cu::CairoContext text_ctx(GetNaturalWidth(), GetNaturalHeight(), scale()); if (state == WidgetState::PRELIGHT) Style::Get()->DrawMenuItem(state, text_ctx, text_ctx.width() / scale(), text_ctx.height() / scale()); nux::Rect bg_geo(-(horizontal_padding()*scale()), -(vertical_padding()*scale()), GetNaturalWidth(), GetNaturalHeight()); if (state != WidgetState::PRELIGHT) { if (BasicContainer::Ptr const& top = GetTopParent()) { auto const& top_geo = top->Geometry(); auto const& geo = Geometry(); bg_geo.Set(top_geo.x() - geo.x(), top_geo.y() - geo.y(), top_geo.width(), top_geo.height()); } } cairo_save(text_ctx); cairo_translate(text_ctx, horizontal_padding(), vertical_padding()); Style::Get()->DrawMenuItemEntry(entry_->label(), state, text_ctx, natural_.width, natural_.height, bg_geo * (1.0/scale)); cairo_restore(text_ctx); SetTexture(text_ctx); } void MenuEntry::ShowMenu(unsigned button) { if (active) return; active = true; auto const& geo = Geometry(); entry_->ShowMenu(grab_.Window()->id(), geo.x(), geo.y2(), button); } int MenuEntry::GetNaturalWidth() const { return (natural_.width + horizontal_padding() * 2) * scale(); } int MenuEntry::GetNaturalHeight() const { return (natural_.height + vertical_padding() * 2) * scale(); } void MenuEntry::ButtonDownEvent(CompPoint const& p, unsigned button, Time timestamp) { button_up_timer_.reset(); grab_.ButtonDownEvent(p, button, timestamp); } void MenuEntry::ButtonUpEvent(CompPoint const& p, unsigned button, Time timestamp) { if (button == 1 && !grab_.IsGrabbed()) { unsigned double_click_wait = Settings::Instance().lim_double_click_wait(); if (grab_.IsMaximizable() && double_click_wait > 0) { button_up_timer_.reset(new glib::Timeout(double_click_wait)); button_up_timer_->Run([this, button] { ShowMenu(button); return false; }); } else { ShowMenu(button); } } if (button == 2 || button == 3) { ShowMenu(button); } grab_.ButtonUpEvent(p, button, timestamp); } void MenuEntry::MotionEvent(CompPoint const& p, Time timestamp) { bool ignore_movement = false; if (!grab_.IsGrabbed()) { if (Geometry().contains(p)) { int move_threshold = Settings::Instance().lim_movement_thresold(); auto const& clicked = grab_.ClickedPoint(); if (std::abs(p.x() - clicked.x()) < move_threshold && std::abs(p.y() - clicked.y()) < move_threshold) { ignore_movement = true; } } } if (!ignore_movement) grab_.MotionEvent(p, timestamp); } indicator::Entry::Ptr const& MenuEntry::GetEntry() const { return entry_; } void MenuEntry::AddProperties(debug::IntrospectionData& data) { TexturedItem::AddProperties(data); data.add("entry_id", Id()) .add("label", entry_->label()) .add("label_visible", entry_->label_visible()) .add("label_sensitive", entry_->label_sensitive()) .add("active", entry_->active()) .add("in_dropdown", in_dropdown()); } debug::Introspectable::IntrospectableList MenuEntry::GetIntrospectableChildren() { return IntrospectableList({&grab_}); } } // decoration namespace } // unity namespace unity-7.2.0+14.04.20140416/decorations/DecorationsForceQuitDialog.h0000644000015301777760000000247612323603360025175 0ustar pbusernogroup00000000000000// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- /* * Copyright (C) 2014 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * 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, see . * * Authored by: Marco Trevisan */ #ifndef __UNITY_DECORATIONS_FORCE_QUIT_DIALOG__ #define __UNITY_DECORATIONS_FORCE_QUIT_DIALOG__ #include #include "CompizUtils.h" namespace unity { namespace decoration { class ForceQuitDialog { public: typedef std::shared_ptr Ptr; ForceQuitDialog(CompWindow*, Time); ~ForceQuitDialog(); nux::Property