Exemplo n.º 1
0
 public XPixmap(XDisplay dpy)
 {
     display = dpy;
 }
Exemplo n.º 2
0
 public XPointer(XDisplay dpy)
 {
     display = dpy;
 }
Exemplo n.º 3
0
 public XGC(XDisplay dpy, XWindow d, XGCValuesMask valuemask, XGCValues values)
 {
     InitGC (dpy, d.Handle, valuemask, values);
 }
Exemplo n.º 4
0
 private void InitGC(XDisplay dpy, IntPtr d, XGCValuesMask valuemask, XGCValues values)
 {
     display = dpy;
       Handle = XCreateGC (display.Handle, d, valuemask, ref values);
       is_default_gc = false;
 }
Exemplo n.º 5
0
        public XWindow(XDisplay dpy, Rectangle geom)
        {
            display = dpy;

              Handle = XCreateSimpleWindow (display.Handle, Root, geom.X, geom.Y, geom.Width, geom.Height, 1, display.Screen.BlackPixel (), display.Screen.WhitePixel ());
        }
Exemplo n.º 6
0
 static LinuxController()
 {
     dsp = new XDisplay(null);
     root_window = new XWindow(dsp);
 }
Exemplo n.º 7
0
        public XEvent(XDisplay dpy)
        {
            display = dpy;

              Handle = Marshal.AllocHGlobal (Marshal.SizeOf (typeof(_XEvent)));

              SetErrorHandler ();
        }
Exemplo n.º 8
0
 public XWindow(XDisplay dpy)
 {
     display = dpy;
       Handle = Root;
 }
Exemplo n.º 9
0
 public XColor(XDisplay dpy, Color color)
     : this(dpy, ColorTranslator.ToHtml (Color.FromArgb (color.R, color.G, color.B)))
 {
 }
Exemplo n.º 10
0
 public XCursor(XDisplay dpy, XCursors shape)
 {
     display = dpy;
       Handle = XCreateFontCursor(display.Handle, Convert.ToInt32(shape));
 }
Exemplo n.º 11
0
        public XColor(XDisplay dpy, string name)
        {
            IntPtr fg, dummyc;

              display = dpy;

              fg = Marshal.AllocHGlobal (Marshal.SizeOf (typeof(_XColor)));
              dummyc = Marshal.AllocHGlobal (Marshal.SizeOf (typeof(_XColor)));

              XAllocNamedColor (display.Handle, display.Screen.DefaultColormap (), name, fg, dummyc);

              Handle = fg;

              named_color = (_XColor)Marshal.PtrToStructure (Handle, typeof(_XColor));

              Marshal.FreeHGlobal (fg);
              Marshal.FreeHGlobal (dummyc);
        }
Exemplo n.º 12
0
        public XAtom(XDisplay dpy, string atom_name, bool only_if_exists)
        {
            display = dpy;

              atom = XInternAtom (display.Handle, atom_name, only_if_exists);
        }
Exemplo n.º 13
0
        public WindowResizeTest()
        {
            t = new Timer ();

              dpy = new XDisplay ();
              s = new XScreen (dpy);
              ev = new XEvent (dpy);
              pointer = new XPointer (dpy);
              gc = new XGC (dpy);

              //XShape shape = new XShape(dpy);
              //shape.Query();
              //Console.WriteLine("Shape Event Type Number = {0}", shape.Type.ToString());

              //atom = new XAtom (dpy, "_MAJYK_HINT", false);

              // Used to test the XPM function that reads a pixmap from a char**
            //      pix_data = new string[] {
            //            "16 16 16 1",
            //            "   c None",
            //            ". c #323232",
            //            "+  c #535353",
            //            "@  c #4A8A8E",
            //            "#  c #DEE2E2",
            //            "$  c #7E827A",
            //            "%  c #8A9292",
            //            "&  c #D6D6D6",
            //            "*  c #36767E",
            //            "=  c #9E9E9E",
            //            "-  c #FAFAFA",
            //            ";  c #B2B2B2",
            //            ">  c #DEEEEA",
            //            ",  c #464646",
            //            "'  c #5EA2A2",
            //            ")  c #52969A",
            //            "                ",
            //            "                ",
            //            " --#>>>>>>#-#-; ",
            //            " -&%')))))=&=&+ ",
            //            " >;$@*****=;%;+ ",
            //            " &$$$$$$$$$$$$, ",
            //            " &;;;;;;;;;;;;+ ",
            //            " &;;;;;;;;;;;;+ ",
            //            " #;;;;;;;;;;;;+ ",
            //            " &;;;;;;;;;;;;+ ",
            //            " #;;;;;;;;;;;;+ ",
            //            " #;;;;;;;;;;;;+ ",
            //            " &;;;;;;;;;;;;+ ",
            //            " $............. ",
            //            "                ",
            //            "                "
            //      };

              bg_color = new XColor (dpy, "#AAAAAA");
              handle_color = new XColor (dpy, "#FF0000");

              //bg_color = new XColor(dpy, Color.FromArgb(200, 200, 200));
              //handle_color = new XColor(dpy, Color.FromArgb(0, 255, 0));

              main_win = new XWindow (dpy, new Rectangle (5, 5, 640, 480), 0, s.BlackPixel (), s.WhitePixel ());

              main_win.Name = "Window Resize Test";
              main_win.SelectInput (XEventMask.KeyPressMask | XEventMask.ExposureMask);

              resize_main_win = new XWindow (dpy, main_win, new Rectangle (resize_win_x, resize_win_y, resize_win_width, resize_win_height), 1, s.BlackPixel (), bg_color.Pixel);
              resize_top_left_win = new XWindow (dpy, resize_main_win, new Rectangle (0, 0, resize_handle_width, resize_handle_height), 1, s.BlackPixel (), handle_color.Pixel);
              resize_top_right_win = new XWindow (dpy, resize_main_win, new Rectangle (0, 0, resize_handle_width, resize_handle_height), 1, s.BlackPixel (), handle_color.Pixel);
              resize_bottom_left_win = new XWindow (dpy, resize_main_win, new Rectangle (0, 0, resize_handle_width, resize_handle_height), 1, s.BlackPixel (), handle_color.Pixel);
              resize_bottom_right_win = new XWindow (dpy, resize_main_win, new Rectangle (0, 0, resize_handle_width, resize_handle_height), 1, s.BlackPixel (), handle_color.Pixel);

              //string foo="MAJYK!";
              //resize_main_win.ChangeProperty(atom, atom, 8, PropMode.PropModeReplace, Marshal.StringToHGlobalAnsi(foo), foo.Length);

              //int return_type=0;
              //int actual_format=0;
              //int nitems=0;
              //int bytes_return=0;
              //IntPtr data = IntPtr.Zero;

              //resize_main_win.GetProperty(atom, 0, 2, false, atom, out return_type, out actual_format, out nitems, out bytes_return, out data);

              //string z = Marshal.PtrToStringAnsi(data);
              //Console.WriteLine("nitems = {0}, z = {1}", nitems, z);

              //pix = new XPixmap (dpy);

              //if (pix.ReadPixmapFromData (resize_main_win, pix_data)) {
              //  resize_main_win.SetBackgroundPixmap (pix);

              //  Console.WriteLine ("pixmap w = {0} | h = {1}", pix.Width.ToString (), pix.Height.ToString ());
              //}

              resize_main_win.SetBackgroundColor (Color.Gray);

              // Test TransientFor
              //resize_main_win.SetTransientForHint(main_win);
              //Window foo = resize_main_win.GetTransientForHint();
              //Console.WriteLine("resize_main_win = {0} | foo.transient_for = {1} | main_win = {2}", resize_main_win.ID.ToString(), foo.ID.ToString(), main_win.ID.ToString());

              XEventMask mask = XEventMask.ButtonPressMask | XEventMask.ButtonReleaseMask;

              resize_main_win.SelectInput (mask);
              resize_top_left_win.SelectInput (mask);
              resize_top_right_win.SelectInput (mask);
              resize_bottom_left_win.SelectInput (mask);
              resize_bottom_right_win.SelectInput (mask);

              PlaceHandles ();

              resize_main_win.MapSubwindows ();
              main_win.MapSubwindows ();
              main_win.Map ();

              ev.KeyPressHandlerEvent += new KeyPressHandler (HandleKeyPress);
              ev.MotionNotifyHandlerEvent += new MotionNotifyHandler (HandleMotionNotify);
              ev.ButtonPressHandlerEvent += new ButtonPressHandler (HandleButtonPress);
              ev.ButtonReleaseHandlerEvent += new ButtonReleaseHandler (HandleButtonRelease);
              ev.ExposeHandlerEvent += new ExposeHandler (HandleExpose);

              t.Interval = 1000;
              t.Enabled = true;
              t.Elapsed += new ElapsedEventHandler (UpdateClock);
              t.Start ();

              ev.Loop ();
        }
Exemplo n.º 14
0
        public XScreen(XDisplay dpy)
        {
            display = dpy;

              if (display.Handle == IntPtr.Zero)
            throw new NullReferenceException ("Display pointer is null");

              Handle = XDefaultScreenOfDisplay (display.Handle);
        }
Exemplo n.º 15
0
        public XFont(XDisplay dpy, string name)
        {
            display = dpy;
              Handle = XLoadQueryFont (display.Handle, name);

              if(Handle!=IntPtr.Zero)
            font = (XFontStruct)Marshal.PtrToStructure (Handle, typeof(XFontStruct));
              else
            throw new Exception("Font could not be loaded!");

              //Console.WriteLine("Ascent = {0} | Descent = {1}", font.ascent.ToString(), font.descent.ToString());
        }
Exemplo n.º 16
0
        public XShape(XDisplay dpy)
        {
            display = dpy;

              has_shape_ext = Query ();
        }
Exemplo n.º 17
0
 public XGC(XDisplay dpy)
 {
     display = dpy;
       Handle = XDefaultGC (display.Handle, display.Screen.Number);
       is_default_gc = true;
 }
Exemplo n.º 18
0
 public XWindow(XDisplay dpy, IntPtr handle)
 {
     display = dpy;
       Handle = handle;
 }
Exemplo n.º 19
0
 public XGC(XDisplay dpy, XGCValuesMask valuemask, XGCValues values)
 {
     InitGC (dpy, new IntPtr (dpy.Root), valuemask, values);
 }
Exemplo n.º 20
0
        public XWindow(XDisplay dpy, XWindow parent, Rectangle geom, int border_width, int border_color, int background_color)
        {
            display = dpy;

              Handle = XCreateSimpleWindow (display.Handle, parent.Handle, geom.X, geom.Y, geom.Width, geom.Height, border_width, border_color, background_color);
        }
Exemplo n.º 21
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);
        }