Beispiel #1
0
 public int DefineCursor(XCursor cursor)
 {
     return XDefineCursor (display.Handle, Handle, cursor.Handle);
 }
Beispiel #2
0
        public Mini(string[] args)
        {
            if (args.Length > 0) {
            if (args[0].Equals ("--version")) {
              Console.WriteLine (VERSION_STRING);
              Environment.Exit (0);
            }
              }

              XGCValues gv;
              XSetWindowAttributes sattr;
              focused_client = null;
              focus_model = DEFAULT_FOCUS_MODEL;

              //  for (int i = 0; i < argc; i++)
              //    command_line = command_line + argv[i] + " ";

              try {
            dpy = new XDisplay (":0");

            try {
              font = new XFont (dpy, DEFAULT_FONT);
            } catch {
              font = new XFont (dpy, "Fixed");
            }
              } catch (Exception e) {
            Console.WriteLine ("{0} check your DISPLAY variable.", e.Message);
            Environment.Exit (-1);
              }

              XEvent ev = new XEvent (dpy);
              ev.ErrorHandlerEvent += new ErrorHandler (ErrorHandler);

              // SET UP ATOMS
              atom_wm_state = new XAtom (dpy, "WM_STATE", false);
              atom_wm_change_state = new XAtom (dpy, "WM_CHANGE_STATE", false);
              atom_wm_protos = new XAtom (dpy, "WM_PROTOCOLS", false);
              atom_wm_delete = new XAtom (dpy, "WM_DELETE_WINDOW", false);
              atom_wm_takefocus = new XAtom (dpy, "WM_TAKE_FOCUS", false);

              XSetWindowAttributes pattr = new XSetWindowAttributes ();
              pattr.override_redirect = true;
              _button_proxy_win = new XWindow (dpy, new Rectangle (-80, -80, 24, 24));
              _button_proxy_win.ChangeAttributes (XWindowAttributeFlags.CWOverrideRedirect, pattr);

              // SETUP COLORS USED FOR WINDOW TITLE BARS and WINDOW BORDERS
              fg = new XColor (dpy, DEFAULT_FOREGROUND_COLOR);
              bg = new XColor (dpy, DEFAULT_BACKGROUND_COLOR);
              bd = new XColor (dpy, DEFAULT_BORDER_COLOR);
              fc = new XColor (dpy, DEFAULT_FOCUS_COLOR);
              focused_border = new XColor (dpy, FOCUSED_BORDER_COLOR);
              unfocused_border = new XColor (dpy, UNFOCUSED_BORDER_COLOR);

              //shape = XShapeQueryExtension(dpy, &shape_event, &dummy);

              move_curs = new XCursor (dpy, XCursors.XC_fleur);
              arrow_curs = new XCursor (dpy, XCursors.XC_left_ptr);

              root.DefineCursor (arrow_curs);

              gv.function = XGCFunctionMask.GXcopy;
              gv.foreground = fg.Pixel;
              gv.font = font.FID;
              string_gc = new XGC (dpy, root, XGCValuesMask.GCFunction | XGCValuesMask.GCForeground | XGCValuesMask.GCFont, gv);

              gv.foreground = unfocused_border.Pixel;
              unfocused_gc = new XGC (dpy, root, XGCValuesMask.GCForeground | XGCValuesMask.GCFont, gv);

              gv.foreground = fg.Pixel;
              focused_title_gc = new XGC (dpy, root, XGCValuesMask.GCForeground | XGCValuesMask.GCFont, gv);

              gv.foreground = bd.Pixel;
              gv.line_width = DEFAULT_BORDER_WIDTH;
              border_gc = new XGC (dpy, root, XGCValuesMask.GCFunction | XGCValuesMask.GCForeground | XGCValuesMask.GCLineWidth, gv);

              gv.foreground = fg.Pixel;
              gv.function = XGCFunctionMask.GXinvert;
              gv.subwindow_mode = XSubwindowMode.IncludeInferiors;
              invert_gc = new XGC (dpy, root, XGCValuesMask.GCForeground | XGCValuesMask.GCFunction | XGCValuesMask.GCSubwindowMode | XGCValuesMask.GCLineWidth | XGCValuesMask.GCFont, gv);

              sattr.event_mask = XEventMask.SubstructureRedirectMask | XEventMask.SubstructureNotifyMask | XEventMask.ButtonPressMask | XEventMask.ButtonReleaseMask | XEventMask.FocusChangeMask | XEventMask.EnterWindowMask | XEventMask.LeaveWindowMask | XEventMask.PropertyChangeMask | XEventMask.ButtonMotionMask;

              root.ChangeAttributes (XWindowAttributeFlags.CWEventMask, sattr);

              queryWindowTree ();

              ev.KeyPressHandlerEvent += new KeyPressHandler (handleKeyPressEvent);
              ev.ButtonPressHandlerEvent += new ButtonPressHandler (handleButtonPressEvent);
              ev.ButtonReleaseHandlerEvent += new ButtonReleaseHandler (handleButtonReleaseEvent);
              ev.ConfigureRequestHandlerEvent += new ConfigureRequestHandler (handleConfigureRequestEvent);
              ev.MotionNotifyHandlerEvent += new MotionNotifyHandler (handleMotionNotifyEvent);
              ev.MapRequestHandlerEvent += new MapRequestHandler (handleMapRequestEvent);
              ev.UnmapNotifyHandlerEvent += new UnmapNotifyHandler (handleUnmapNotifyEvent);
              ev.DestroyNotifyHandlerEvent += new DestroyNotifyHandler (handleDestroyNotifyEvent);
              ev.EnterNotifyHandlerEvent += new EnterNotifyHandler (handleEnterNotifyEvent);
              ev.FocusInHandlerEvent += new FocusInHandler (handleFocusInEvent);
              ev.FocusOutHandlerEvent += new FocusOutHandler (handleFocusOutEvent);
              ev.PropertyNotifyHandlerEvent += new PropertyNotifyHandler (handlePropertyNotifyEvent);
              ev.ExposeHandlerEvent += new ExposeHandler (handleExposeEvent);
              ev.ShapeHandlerEvent += new ShapeHandler (handleShapeEvent);
        }