Skip to content
Snippets Groups Projects
Select Git revision
  • 3b5bd3848efb99a4f33b02c40ad296ae1ca3ea3c
  • master default protected
  • v1.8.3
  • v1.8.2
  • v1.8.1
  • v1.8.0
  • v1.7.0
  • v1.6.2
  • v1.6.1
  • v1.6.0
  • v1.5.1
  • v1.5.0
  • v1.4.0
  • v1.3.0
  • v1.2.0
  • v1.1.0
  • v1.1.0rc2
  • v1.1.0rc1
  • v1.0.1
  • v1.0.0
  • v1.0.0b1
  • v0.2.0
22 results

setup.py

Blame
  • halflayout.js 7.09 KiB
    /********************************************************************
     KWin - the KDE window manager
     This file is part of the KDE project.
    
    Copyright (C) 2013 Fabian Homborg <FHomborg@gmail.com>
    based on spirallayout.js by Matthias Gottschlag
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
    *********************************************************************/
    
    /**
     * Class which arranges the windows in a spiral with the largest window filling
     * the left half of the screen.
     */
    function HalfLayout(screenRectangle) {
    	print("Creating HalfLayout");
        Layout.call(this, screenRectangle);
    	this.firstWidth = this.screenRectangle.width / 2;
    	this.master = 0;
    };
    
    HalfLayout.name = "Half";
    // TODO: Add an image for the layout switcher
    HalfLayout.image = null;
    
    HalfLayout.prototype = new Layout();
    HalfLayout.prototype.constructor = HalfLayout;
    
    HalfLayout.prototype.resetTileSizes = function() {
    	try {
    		// Simply erase all tiles and recreate them to recompute the initial sizes
    		var tileCount = this.tiles.length;
    		this.tiles.length = 0;
    		for (var i = 0; i < tileCount; i++) {
    			this.addTile();
    		}
    	} catch(err) {
    		print(err, "in HalfLayout.resetTileSizes");
    	}
    };
    
    HalfLayout.prototype.addTile = function() {
    	try {
    		if (this.tiles.length == 0) {
    			// The first tile fills the whole screen
    			var rect = util.copyRect(this.screenRectangle);
    			this._createTile(rect);
    			return;
    		} 
    		if (this.tiles.length == 1) {
    			// The second tile fills the right half of the screen
    			// Also, javascript sucks
    			var firstRect = util.copyRect(this.tiles[0].rectangle);
    			firstRect.width = this.firstWidth;
    			this.tiles[0].rectangle = firstRect;
    			var newRect = new Qt.rect(firstRect.x + firstRect.width,
    								  firstRect.y,
    								  this.screenRectangle.width - firstRect.width,
    								  firstRect.height)