Пример #1
0
        public Rectangle rectangle(String name, String description, 
    Rectangle default_value)
        {
            Rectangle retval = default_value;

            try {
              String opt = option (name);
              if (opt != null) retval = new Rectangle (option (name));

            } catch (Exception e) {
              invalid_names.Append (name + ", ");
              // fall through
            }

            add_spec (name, "Rectangle", description,
              default_value.spec (), retval.spec ());
            return retval;
        }
Пример #2
0
        // opcode 59 - set clip rectangles
        /**
           * @param ordering valid:
           * {@link #UN_SORTED},
           * {@link #Y_SORTED},
           * {@link #YX_SORTED},
           * {@link #YX_BANDED}
           *
           * @see <a href="XSetClipRectangles.html">XSetClipRectangles</a>
           */
        public void set_clip_rectangles(int clip_x_origin, int clip_y_origin,
    Rectangle [] rectangles, int ordering)
        {
            Request request = new Request (display, 59, ordering, 3+2*rectangles.Length);
            request.write4 (id);
            request.write2 (clip_x_origin);
            request.write2 (clip_y_origin);

            for (int i=0; i<rectangles.Length; i++) {
              request.write2 (rectangles [i].x);
              request.write2 (rectangles [i].y);
              request.write2 (rectangles [i].width);
              request.write2 (rectangles [i].height);
            }

            display.send_request (request);
        }
Пример #3
0
        // render opcode 6 - set picture clip rectangles
        /**
           * @see <a href="XRenderSetPictureClipRectangles.html">
           * XRenderSetPictureClipRectangles</a>
           */
        public void set_clip_rectangles(int x_origin, int y_origin,
    Rectangle [] rectangles)
        {
            Request request = new Request (display, render.major_opcode, 7,
              3+2*rectangles.Length);
            request.write4 (id);

            for (int i=0; i<rectangles.Length; i++) {
              request.write2 (rectangles [i].x);
              request.write2 (rectangles [i].y);
              request.write2 (rectangles [i].width);
              request.write2 (rectangles [i].height);
            }
            display.send_request (request);
        }
Пример #4
0
 public void set_geometry_cache(Rectangle r)
 {
     x = r.x;
     y = r.y;
     width = r.width;
     height = r.height;
 }
Пример #5
0
 /**
    * @see #Window(Window, int, int, int, int)
    */
 public Window(Window parent, Rectangle geometry)
     : this(parent, geometry.x, geometry.y, geometry.width, geometry.height)
 {
 }
Пример #6
0
 /**
    * @see <a href="XMoveResizeWindow.html">XMoveResizeWindow</a>
    * @see #configure(Window.Changes)
    */
 public void move_resize(Rectangle rectangle)
 {
     move_resize (rectangle.x, rectangle.y, rectangle.width, rectangle.height);
 }
Пример #7
0
 public bool resized(Rectangle r)
 {
     return r.width != width || r.height != height;
 }
Пример #8
0
 /**
    * @see #poly_rectangle(GC, Rectangle[], bool)
    */
 public void rectangle(GC gc, Rectangle rectangle, bool fill)
 {
     poly_rectangle (gc, new Rectangle [] {rectangle}, fill);
 }
Пример #9
0
     /**
        * @see #Window(Window, int, int, int, int, int, Window.Attributes)
        */
     public Window(Window parent, Rectangle geometry, int border_width,
 Attributes attr)
         : this(parent, geometry.x, geometry.y, geometry.width, geometry.height,
   border_width, attr)
     {
     }
Пример #10
0
     // opcode 67 and 70 - poly (fill) rectangle
     /**
        * This request will be aggregated.
        *
        * @see <a href="XDrawRectangles.html">XDrawRectangles</a>
        * @see <a href="XFillRectangles.html">XFillRectangles</a>
        * @see Request.Aggregate aggregation
        */
     public void poly_rectangle(GC gc, Rectangle [] rectangles, 
 bool fill)
     {
         display.send_request (new Request.Poly.Rectangle (
           this, gc, rectangles, fill));
     }
Пример #11
0
                public override Object next()
                {
                    int x = this.read2 (0);
                      int y = this.read2 (2);
                      int width = this.read2 (4);
                      int height = this.read2 (6);
                      Rectangle rectangle = new Rectangle (x, y, width, height);

                      inc (8);
                      return rectangle;
                }
Пример #12
0
        // shape opcode 1 - rectangles
        /**
           * @param dest_kind valid:
           * {@link #BOUNDING},
           * {@link #CLIP}
           *
           * @param operation valid:
           * {@link #SET},
           * {@link #UNION},
           * {@link #INTERSECT},
           * {@link #SUBTRACT},
           * {@link #INVERT}
           *
           * @param ordering valid:
           * {@link #UN_SORTED},
           * {@link #Y_SORTED},
           * {@link #YX_SORTED},
           * {@link #YX_BANDED}
           *
           * @see <a href="XShapeCombineRectangles.html">XShapeCombineRectangles</a>
           */
        public void combine_rectangles(Window dest, int dest_kind, int x_offset,
    int y_offset, Rectangle [] rectangles, int operation, int ordering)
        {
            Request request = new Request (display, major_opcode, 1,
              4+2*rectangles.Length);
            request.write1 (operation);
            request.write1 (dest_kind);
            request.write1 (ordering);
            request.write1_unused ();
            request.write4 (dest.id);
            request.write2 (x_offset);
            request.write2 (y_offset);

            for (int i=0; i<rectangles.Length; i++) {
              request.write2 (rectangles [i].x);
              request.write2 (rectangles [i].y);
              request.write2 (rectangles [i].width);
              request.write2 (rectangles [i].height);
            }

            display.send_request (request);
        }
Пример #13
0
 public Rectangle within(Rectangle bound)
 {
     int x0 = Math.Max (x, bound.x);
     int y0 = Math.Max (y, bound.y);
     int width0 = Math.Min (width, bound.width);
     int height0 = Math.Min (height, bound.height);
     return new Rectangle (x0, y0, width0, height0);
 }
Пример #14
0
        //throws NotFoundException
        public Puppet(String [] args)
            : base(args)
        {
            Preference.staticInit();

            print_event = option.booleann ("print-event",
              "dump all events for debug", false);

            space = option.rectangle ("space",
              "workspace for normal windows", pref.space ());

            about ("0.1", "puppet window manager",
              "Stephen Tse <*****@*****.**>",
              "http://escher.sourceforge.net/",
              "\nFor bindings, check http://escher.sourceforge.net/"
              + "current/doc/gnu/app/puppet/Puppet.html.");

            if (help_option) return;

            /**
             * addShutdownHook in IBM JDK 1.3 does not seem to work for processing
             * Control-C. It simply ignores TERM signal instead of calling shutdown
             * hooks and then exiting.
             */
            //     Runtime.getRuntime ().addShutdownHook (new Thread () {
            //       public void run () { System.err.println ("shutting down..."); }});

            root = display.default_root;
            Window.NONE.display = display; // for move pointer
            xtest = new XTest (display); // for press button
            registers = new Client [display.input.max_keycode
              - display.input.min_keycode];

            _mit_priority_colors = (Atom) Atom.intern (display, "_MIT_PRIORITY_COLORS");
            wm_change_state = (Atom) Atom.intern (display, "WM_CHANGE_STATE");
            wm_state = (Atom) Atom.intern (display, "WM_STATE");
            wm_colormap_windows = (Atom) Atom.intern (display, "WM_COLORMAP_WINDOWS");
            wm_protocols = (Atom) Atom.intern (display, "WM_PROTOCOLS");
            wm_take_focus = (Atom) Atom.intern (display, "WM_TAKE_FOCUS");
            wm_save_yourself = (Atom) Atom.intern (display, "WM_SAVE_YOURSELF");
            wm_delete_window = (Atom) Atom.intern (display, "WM_DELETE_WINDOW");
            sm_client_id = (Atom) Atom.intern (display, "SM_CLIENT_ID");
            wm_client_leader = (Atom) Atom.intern (display, "WM_CLIENT_LEADER");
            wm_window_role = (Atom) Atom.intern (display, "WM_WINDOW_ROLE");

            control_root_window ();
            scan_children ();

            focus = (Client) Client.intern (root.pointer ().child ());
            focus.set_input_focus ();

            grab_keybut ();
            Console.WriteLine ("Initialization completed.");

            while (!exit_now) read_and_dispatch_event ();
        }