示例#1
0
        public Chinese(String [] args)
            : base(args, 100, 50)
        {
            about("0.1", "test text output with chinese font",
                  "Stephen Tse <*****@*****.**>",
                  "http://escher.sourceforge.net/");

            if (help_option)
            {
                return;
            }

            // check if any big5 font is present
            gnu.x11.Enum fonts = display.fonts("-*-*-*-*-*-*-*-*-*-*-*-*-big5-*", 1);
            if (fonts.count == 0)
            {
                throw new Exception(
                          "No Chinese font defined on this X server");
            }

            GC.Values gv = new GC.Values();
            gv.set_background(display.default_white);
            gv.set_foreground(display.default_black);
            // just pick any of those matching fonts
            gv.set_font((gnu.x11.Font)fonts.next());
            gc = new GC(window, gv);
        }
示例#2
0
文件: Salt.cs 项目: jbnivoit/projects
        public Salt(String [] args)
            : base(args)
        {
            String res_name  = option.option("res-name", "resource name of windows", "");
            String res_class = option.option("res-class", "resource class of windows", "");
            String message   = option.option("message", "message to be sent", "");

            about("0.1", "send string to top-level windows",
                  "Stephen Tse <*****@*****.**>",
                  "http://escher.sourceforge.net/");

            if (help_option)
            {
                return;
            }

            for (gnu.x11.Enum e = display.default_root.tree().children();
                 e.more();)
            {
                Window             window     = (Window)e.next();
                Window.WMClassHint class_hint = window.wm_class_hint();

                if (class_hint == null)
                {
                    continue;
                }
                if (!class_hint.Equals(res_name, res_class))
                {
                    continue;
                }

                if (window.attributes().override_redirect() ||
                    window.attributes().map_state()
                    != Window.AttributesReply.VIEWABLE ||
                    window.wm_name() == null)
                {
                    continue;
                }


                for (int i = 0; i < message.Length; i++)
                {
                    send_key(window, message[i]);
                }

                // keep loop to salt all matched apps
            }

            display.close();
        }