diff --git a/Makefile b/Makefile index a212f31..f66ef24 100644 --- a/Makefile +++ b/Makefile @@ -97,6 +97,7 @@ SRC = src/version.vala \ src/main.vala \ src/app.vala \ src/neo-window.vala \ + src/scaling-image.vala \ src/config-manager.vala ifeq ($(WIN),) @@ -172,8 +173,6 @@ info: " none: Disables icon$(NL)$(NL)" \ " Use 'BUILD_TYPE=[release|debug] make' to switch build type$(NL)$(NL)" \ -src/version.vala: Makefile gen_version - gen_version: @/bin/echo -e "namespace NeoLayoutViewer{$(NL)" \ "public const string RELEASE_VERSION = \"$(RELEASE_VERSION)\";$(NL)" \ @@ -182,6 +181,8 @@ gen_version: "}" \ > src/version.vala +src/version.vala: Makefile gen_version + "$(BINDIR)": @test -d "$(BINDIR)" || \ (mkdir -p "$(BINDIR)" && ln -s ../assets "$(BINDIR)/assets") diff --git a/src/app.vala b/src/app.vala index 66de67f..a53a0cb 100644 --- a/src/app.vala +++ b/src/app.vala @@ -1,3 +1,6 @@ +/* vim: set tabstop=2:softtabstop=2:shiftwidth=2:noexpandtab */ +// modules: Gtk + using Gtk; namespace NeoLayoutViewer{ @@ -52,28 +55,28 @@ namespace NeoLayoutViewer{ } private void bind_shortcuts(){ - manager = new KeybindingManager(this.neo_win); - var show_shortcut = configm.getConfig().get("show_shortcut").strip(); - var move_shortcut = configm.getConfig().get("move_shortcut").strip(); - var monitor_shortcut = configm.getConfig().get("monitor_shortcut").strip(); + manager = new KeybindingManager(this.neo_win); + var show_shortcut = configm.getConfig().get("show_shortcut").strip(); + var move_shortcut = configm.getConfig().get("move_shortcut").strip(); + var monitor_shortcut = configm.getConfig().get("monitor_shortcut").strip(); - if (move_shortcut.length > 0){ - manager.bind(move_shortcut, ()=>{this.neo_win.numkeypad_move(0);}); + if (move_shortcut.length > 0){ + manager.bind(move_shortcut, ()=>{this.neo_win.numkeypad_move(0);}); + } + + if (show_shortcut == monitor_shortcut){ + // combination of show + monitor move + debug("Use combined shortcut for window showing and monitor switching."); + manager.bind(monitor_shortcut, ()=>{this.neo_win.monitor_move(-1, true);}); + + }else{ + if (monitor_shortcut.length > 0){ + manager.bind(monitor_shortcut, ()=>{this.neo_win.monitor_move();}); } - - if (show_shortcut == monitor_shortcut){ - // combination of show + monitor move - debug("Use combined shortcut for window show and monitor switch."); - manager.bind(monitor_shortcut, ()=>{this.neo_win.monitor_move(-1, true);}); - - }else{ - if (monitor_shortcut.length > 0){ - manager.bind(monitor_shortcut, ()=>{this.neo_win.monitor_move();}); - } - if (show_shortcut.length > 0){ - manager.bind(show_shortcut, ()=>{this.neo_win.toggle();}); - } + if (show_shortcut.length > 0){ + manager.bind(show_shortcut, ()=>{this.neo_win.toggle();}); } + } } public override void open (File[] files, string hint) { diff --git a/src/config-manager.vala b/src/config-manager.vala index 215c499..4ce82f1 100644 --- a/src/config-manager.vala +++ b/src/config-manager.vala @@ -1,3 +1,5 @@ +/* vim: set tabstop=2:softtabstop=2:shiftwidth=2:noexpandtab */ +// modules: Gtk namespace NeoLayoutViewer { @@ -95,14 +97,21 @@ namespace NeoLayoutViewer { addSetting("position_cycle", "2 3 6 1 3 9 4 7 8 | 12 13 16 11 13 19 14 17 18 |", """List of positions (num pad orientation) # The number on the n-th index marks the next position of the window. +# Default cycle: 7 ← 8 ← 9 +# ↓ ↑ +# 4 5 6 +# ↓ ↘ ↑ +# 1 → 2 → 3 # -# Examples: -# pos. index 1 2 3 4 5 6 7 8 9 | 11 12 13 14 15 18 17 18 19 | … -# position_cycle = 2 3 6 1 3 9 4 7 8 | 12 13 16 11 13 19 14 17 18 |(counter clockwise, default) -# position_cycle = 3 3 9 1 3 9 1 7 7 | 13 13 19 11 13 19 11 17 17 |(corners only) -# position_cycle =3 3 11 1 3 9 1 7 7 | 13 13 19 11 13 19 9 17 17 |(cycle over two monitors)"""); +# position_cycle = 2 3 6 1 3 9 4 7 8 | 12 13 16 11 13 19 14 17 18 |… +# +# Further examples: +# monitor 1 2 +# position 1 2 3 4 5 6 7 8 9 | 11 12 13 14 15 18 17 18 19 |… +# position_cycle = 3 3 9 1 3 9 1 7 7 | 13 13 19 11 13 19 11 17 17 |… (corners only) +# position_cycle =3 3 11 1 3 9 1 7 7 | 13 13 19 11 13 19 9 17 17 |… (cycle over two monitors)"""); - addSetting("display_numpad", "1", null); + addSetting("display_numpad", "1", null); addSetting("display_function_keys", "0", null); addSetting("window_selectable", "0", "Disable window selection to use the program as virtual keyboard."); addSetting("window_decoration", "0", "Show window decoration/border (not recommended)."); @@ -110,6 +119,7 @@ namespace NeoLayoutViewer { addSetting("screen_height", "auto", "Set the resolution of your screen manually, if the automatic detection fails."); addSetting("show_on_startup", "1", "Show window on startup."); addSetting("asset_folder", "./assets", "Default lookup folder image data."); + addSetting("color_event_boxes", "0", "(Debugging) Show event boxes of virtual keyboard."); } /* diff --git a/src/indicator.vala b/src/indicator.vala index e206434..60f6015 100644 --- a/src/indicator.vala +++ b/src/indicator.vala @@ -1,3 +1,6 @@ +/* vim: set tabstop=2:softtabstop=2:shiftwidth=2:noexpandtab */ +// modules: Gtk + using Gtk; namespace NeoLayoutViewer { @@ -14,7 +17,7 @@ namespace NeoLayoutViewer { indicator = new AppIndicator.Indicator.with_path("Neo Layout Viewer", "Neo-Icon", AppIndicator.IndicatorCategory.APPLICATION_STATUS, configm.getConfig().get("asset_folder")+"/icons/"); - //"./assets/icons/" ); + //"./assets/icons/" ); create_menuMain(); indicator.set_menu(this.menuMain); diff --git a/src/key-overlay.vala b/src/key-overlay.vala index 692a070..0b68544 100644 --- a/src/key-overlay.vala +++ b/src/key-overlay.vala @@ -1,3 +1,6 @@ +/* vim: set tabstop=2:softtabstop=2:shiftwidth=2:noexpandtab */ +// modules: Gtk Gdk X Posix + /* Known Problems: - Tab, Shift+Tab, Shift+Space, Numblock not implemented @@ -11,642 +14,781 @@ using Posix;//system-call namespace NeoLayoutViewer { - public class ArrayBox { - public uint[] val; + /* Use Layout instead of Fixed because size of Layout content does not + influence the window size. (=> No feedback loop) */ + public class KeyOverlay : Gtk.Layout { - public ArrayBox(uint[] val){ - this.val = val; - } - } - - public class KeyOverlay : Box { - - public Gee.HashMap keyBoxes; - public Gee.HashMap keysyms; + private Gee.HashMap keysyms; private NeoWindow winMain; + private Gee.HashMap eventCells; + bool color_event_boxes = true; // for debugging + private int __move_id; + private int _width; + private int _height; + public KeyOverlay(NeoWindow winMain) { - this.set_orientation(Gtk.Orientation.VERTICAL); - this.set_homogeneous(false); - this.set_spacing(0); this.winMain = winMain; - this.keysyms = generateKeysyms(); - this.keyBoxes = new Gee.HashMap(); + this.keysyms = generateKeysyms(); + this.eventCells = new Gee.HashMap(); - generateKeyevents(); + this._width = this.winMain.get_allocated_width(); + this._height = this.winMain.get_allocated_height(); + this.set_size_request(_width, _height); + this.set_size(_width, _height); - this.show(); + this.color_event_boxes = (winMain.config.get("color_event_boxes") == "1"); + + generateCells(); + + this.winMain.check_resize.connect(main_resized); } - public Gee.HashMap generateKeysyms(){ - keysyms = new Gee.HashMap(); + private void main_resized(){ + + int width = this.winMain.get_allocated_width(); + int height = this.winMain.get_allocated_height(); + + if( this._width == width && this._height == height ){ + return; // to avoid infinite resize live lock... + } + debug(@"Window resize signal. New width/height: $(width)/$(height)\n"); + + if( width == 1 && height == 1){ + return; // (1,1) send if user show/hides window very fast. + } + + this._width = width; + this._height = height; + + + // Propagate new window width/height to this grid. (Redundant?!) + this.set_size_request(width, height); + + debug("Move cells"); + move_and_scale_cells(); - /* Define keyboard layout. this object maps the keycodes to the list of keycodes of each keyboard layer. */ - keysyms.set(8, new ArrayBox({})); - keysyms.set( 9, new ArrayBox({ XK_Escape, XK_Escape, XK_Escape, XK_Escape, XK_Escape })); - keysyms.set( 10, new ArrayBox({ XK_1, XK_degree, XK_onesuperior, XK_onesubscript, XK_ordfeminine, XK_notsign, 0 /*NoSymbol*/ })); - keysyms.set( 11, new ArrayBox({ XK_2, XK_section, XK_twosuperior, XK_twosubscript, XK_masculine, XK_logicalor, 0 /*NoSymbol*/ })); - keysyms.set( 12, new ArrayBox({ XK_3, (uint)X.string_to_keysym("U2113"), XK_threesuperior, XK_threesubscript, XK_numerosign, XK_logicaland, 0 /*NoSymbol*/ })); - keysyms.set( 13, new ArrayBox({ XK_4, XK_guillemotright, (uint)X.string_to_keysym("U203A"), XK_femalesymbol, 0 /*NoSymbol*/, (uint)X.string_to_keysym("U22A5"), 0 /*NoSymbol*/ })); - keysyms.set( 14, new ArrayBox({ XK_5, XK_guillemotleft, (uint)X.string_to_keysym("U2039"), XK_malesymbol, XK_periodcentered, (uint)X.string_to_keysym("U2221"), 0 /*NoSymbol*/ })); - keysyms.set( 15, new ArrayBox({ XK_6, XK_dollar, XK_cent, (uint)X.string_to_keysym("U26A5"), XK_sterling, (uint)X.string_to_keysym("U2225"), 0 /*NoSymbol*/ })); - keysyms.set( 16, new ArrayBox({ XK_7, XK_EuroSign, XK_yen, (uint)X.string_to_keysym("U03F0"), XK_currency, XK_rightarrow, 0 /*NoSymbol*/ })); - keysyms.set( 17, new ArrayBox({ XK_8, XK_doublelowquotemark, XK_singlelowquotemark, (uint)X.string_to_keysym("U27E8"), XK_Tab, (uint)X.string_to_keysym("U221E"), 0 /*NoSymbol*/ })); - keysyms.set( 18, new ArrayBox({ XK_9, XK_leftdoublequotemark, XK_leftsinglequotemark, (uint)X.string_to_keysym("U27E9"), XK_KP_Divide, XK_variation, 0 /*NoSymbol*/ })); - keysyms.set( 19, new ArrayBox({ XK_0, XK_rightdoublequotemark, XK_rightsinglequotemark, XK_zerosubscript, XK_KP_Multiply, XK_emptyset, 0 /*NoSymbol*/ })); - keysyms.set( 20, new ArrayBox({ XK_minus, XK_emdash, 0 /*NoSymbol*/, (uint)X.string_to_keysym("U2011"), XK_KP_Subtract, XK_hyphen, 0 /*NoSymbol*/ })); - keysyms.set( 21, new ArrayBox({ XK_dead_grave, XK_dead_cedilla, XK_dead_abovering, XK_dead_abovereversedcomma, XK_dead_diaeresis, XK_dead_macron, 0 /*NoSymbol*/ })); - keysyms.set( 22, new ArrayBox({ XK_BackSpace, XK_BackSpace, XK_BackSpace, XK_BackSpace, XK_BackSpace })); - keysyms.set( 23, new ArrayBox({ XK_Tab, XK_ISO_Left_Tab, XK_Multi_key, XK_ISO_Level5_Lock, 0 /*NoSymbol*/, 0 /*NoSymbol*/, XK_ISO_Level5_Lock })); - keysyms.set( 24, new ArrayBox({ XK_x, XK_X, XK_ellipsis, XK_Greek_xi, XK_Prior, XK_Greek_XI, 0 /*NoSymbol*/ })); - keysyms.set( 25, new ArrayBox({ XK_v, XK_V, XK_underscore, 0 /*NoSymbol*/, XK_BackSpace, XK_radical, 0 /*NoSymbol*/ })); - keysyms.set( 26, new ArrayBox({ XK_l, XK_L, XK_bracketleft, XK_Greek_lamda, XK_Up, XK_Greek_LAMDA, 0 /*NoSymbol*/ })); - keysyms.set( 27, new ArrayBox({ XK_c, XK_C, XK_bracketright, XK_Greek_chi, XK_Delete, (uint)X.string_to_keysym("U2102"), 0 /*NoSymbol*/ })); - keysyms.set( 28, new ArrayBox({ XK_w, XK_W, XK_asciicircum, XK_Greek_omega, XK_Next, XK_Greek_OMEGA, 0 /*NoSymbol*/ })); - keysyms.set( 29, new ArrayBox({ XK_k, XK_K, XK_exclam, XK_Greek_kappa, XK_exclamdown, XK_multiply, 0 /*NoSymbol*/ })); - keysyms.set( 30, new ArrayBox({ XK_h, XK_H, XK_less, XK_Greek_psi, XK_KP_7, XK_Greek_PSI, 0 /*NoSymbol*/ })); - keysyms.set( 31, new ArrayBox({ XK_g, XK_G, XK_greater, XK_Greek_gamma, XK_KP_8, XK_Greek_GAMMA, 0 /*NoSymbol*/ })); - keysyms.set( 32, new ArrayBox({ XK_f, XK_F, XK_equal, XK_Greek_phi, XK_KP_9, XK_Greek_PHI, 0 /*NoSymbol*/ })); - keysyms.set( 33, new ArrayBox({ XK_q, XK_Q, XK_ampersand, (uint)X.string_to_keysym("U03D5"), XK_KP_Add, (uint)X.string_to_keysym("U211A"), 0 /*NoSymbol*/ })); - keysyms.set( 34, new ArrayBox({ XK_ssharp, (uint)X.string_to_keysym("U1E9E"), (uint)X.string_to_keysym("U017F"), XK_Greek_finalsmallsigma, (uint)X.string_to_keysym("U2212"), XK_jot, 0 /*NoSymbol*/ })); - keysyms.set( 35, new ArrayBox({ XK_dead_acute, XK_dead_tilde, XK_dead_stroke, XK_dead_abovecomma, XK_dead_doubleacute, XK_dead_breve, 0 /*NoSymbol*/ })); - keysyms.set( 36, new ArrayBox({ XK_Return, XK_Return, XK_Return, XK_Return, XK_Return })); - keysyms.set( 37, new ArrayBox({ XK_Control_L, XK_Control_L, XK_Control_L, XK_Control_L, XK_Control_L })); - keysyms.set( 38, new ArrayBox({ XK_u, XK_U, XK_backslash, 0 /*NoSymbol*/, XK_Home, XK_includedin, 0 /*NoSymbol*/ })); - keysyms.set( 39, new ArrayBox({ XK_i, XK_I, XK_slash, XK_Greek_iota, XK_Left, XK_integral, 0 /*NoSymbol*/ })); - keysyms.set( 40, new ArrayBox({ XK_a, XK_A, XK_braceleft, XK_Greek_alpha, XK_Down, (uint)X.string_to_keysym("U2200"), 0 /*NoSymbol*/ })); - keysyms.set( 41, new ArrayBox({ XK_e, XK_E, XK_braceright, XK_Greek_epsilon, XK_Right, (uint)X.string_to_keysym("U2203"), 0 /*NoSymbol*/ })); - keysyms.set( 42, new ArrayBox({ XK_o, XK_O, XK_asterisk, XK_Greek_omicron, XK_End, XK_elementof, 0 /*NoSymbol*/ })); - keysyms.set( 43, new ArrayBox({ XK_s, XK_S, XK_question, XK_Greek_sigma, XK_questiondown, XK_Greek_SIGMA, 0 /*NoSymbol*/ })); - keysyms.set( 44, new ArrayBox({ XK_n, XK_N, XK_parenleft, XK_Greek_nu, XK_KP_4, (uint)X.string_to_keysym("U2115"), 0 /*NoSymbol*/ })); - keysyms.set( 45, new ArrayBox({ XK_r, XK_R, XK_parenright, XK_Greek_rho, XK_KP_5, (uint)X.string_to_keysym("U211D"), 0 /*NoSymbol*/ })); - keysyms.set( 46, new ArrayBox({ XK_t, XK_T, XK_minus, XK_Greek_tau, XK_KP_6, XK_partialderivative, 0 /*NoSymbol*/ })); - keysyms.set( 47, new ArrayBox({ XK_d, XK_D, XK_colon, XK_Greek_delta, XK_KP_Separator, XK_Greek_DELTA, 0 /*NoSymbol*/ })); - keysyms.set( 48, new ArrayBox({ XK_y, XK_Y, XK_at, XK_Greek_upsilon, XK_period, XK_nabla, 0 /*NoSymbol*/ })); - keysyms.set( 49, new ArrayBox({ XK_dead_circumflex, XK_dead_caron, (uint)X.string_to_keysym("U21BB"), (uint)X.string_to_keysym("U02DE"), XK_dead_abovedot, XK_dead_belowdot, 0 /*NoSymbol*/ })); - keysyms.set( 50, new ArrayBox({ XK_Shift_L, XK_Caps_Lock })); - keysyms.set( 51, new ArrayBox({ XK_ISO_Level3_Shift })); - keysyms.set( 52, new ArrayBox({ XK_udiaeresis, XK_Udiaeresis, XK_numbersign, 0 /*NoSymbol*/, XK_Escape, XK_union, 0 /*NoSymbol*/ })); - keysyms.set( 53, new ArrayBox({ XK_odiaeresis, XK_Odiaeresis, XK_dollar, (uint)X.string_to_keysym("U03F5"), XK_Tab, XK_intersection, 0 /*NoSymbol*/ })); - keysyms.set( 54, new ArrayBox({ XK_adiaeresis, XK_Adiaeresis, XK_bar, XK_Greek_eta, XK_Insert, (uint)X.string_to_keysym("U2135"), 0 /*NoSymbol*/ })); - keysyms.set( 55, new ArrayBox({ XK_p, XK_P, XK_asciitilde, XK_Greek_pi, XK_Return, XK_Greek_PI, 0 /*NoSymbol*/ })); - keysyms.set( 56, new ArrayBox({ XK_z, XK_Z, XK_grave, XK_Greek_zeta, XK_Undo, (uint)X.string_to_keysym("U2124"), 0 /*NoSymbol*/ })); - keysyms.set( 57, new ArrayBox({ XK_b, XK_B, XK_plus, XK_Greek_beta, XK_colon, (uint)X.string_to_keysym("U21D0"), 0 /*NoSymbol*/ })); - keysyms.set( 58, new ArrayBox({ XK_m, XK_M, XK_percent, XK_Greek_mu, XK_KP_1, XK_ifonlyif, 0 /*NoSymbol*/ })); - keysyms.set( 59, new ArrayBox({ XK_comma, XK_endash, XK_quotedbl, (uint)X.string_to_keysym("U03F1"), XK_KP_2, (uint)X.string_to_keysym("U21D2"), 0 /*NoSymbol*/ })); - keysyms.set( 60, new ArrayBox({ XK_period, XK_enfilledcircbullet, XK_apostrophe, (uint)X.string_to_keysym("U03D1"), XK_KP_3, (uint)X.string_to_keysym("U21A6"), 0 /*NoSymbol*/ })); - keysyms.set( 61, new ArrayBox({ XK_j, XK_J, XK_semicolon, XK_Greek_theta, XK_semicolon, XK_Greek_THETA, 0 /*NoSymbol*/ })); - keysyms.set( 62, new ArrayBox({ XK_Shift_R, XK_Caps_Lock })); - keysyms.set( 63, new ArrayBox({ XK_KP_Multiply, XK_KP_Multiply, (uint)X.string_to_keysym("U2219"), (uint)X.string_to_keysym("U2299"), XK_multiply, (uint)X.string_to_keysym("U2297"), 0 /*NoSymbol*/ })); - keysyms.set( 64, new ArrayBox({ XK_Alt_L, XK_Alt_L, XK_Alt_L, XK_Alt_L, XK_Alt_L, XK_Alt_L })); - keysyms.set( 65, new ArrayBox({ XK_space, XK_space, XK_space, XK_nobreakspace, XK_KP_0, (uint)X.string_to_keysym("U202F"), 0 /*NoSymbol*/ })); - keysyms.set( 66, new ArrayBox({ XK_ISO_Level3_Shift })); - keysyms.set( 67, new ArrayBox({ XK_F1, 0 /*XK_XF86_Switch_VT_1*/ })); - keysyms.set( 68, new ArrayBox({ XK_F2, 0 /*XK_XF86_Switch_VT_2*/ })); - keysyms.set( 69, new ArrayBox({ XK_F3, 0 /*XK_XF86_Switch_VT_3*/ })); - keysyms.set( 70, new ArrayBox({ XK_F4, 0 /*XK_XF86_Switch_VT_4*/ })); - keysyms.set( 71, new ArrayBox({ XK_F5, 0 /*XK_XF86_Switch_VT_5*/ })); - keysyms.set( 72, new ArrayBox({ XK_F6, 0 /*XK_XF86_Switch_VT_6*/ })); - keysyms.set( 73, new ArrayBox({ XK_F7, 0 /*XK_XF86_Switch_VT_7*/ })); - keysyms.set( 74, new ArrayBox({ XK_F8, 0 /*XK_XF86_Switch_VT_8*/ })); - keysyms.set( 75, new ArrayBox({ XK_F9, 0 /*XK_XF86_Switch_VT_9*/ })); - keysyms.set( 76, new ArrayBox({ XK_F10, 0 /*XK_XF86_Switch_VT_10*/ })); - keysyms.set( 77, new ArrayBox({ XK_Tab, XK_ISO_Left_Tab, XK_equal, XK_approxeq, XK_notequal, XK_identical, 0 /*NoSymbol*/ })); - keysyms.set( 78, new ArrayBox({ XK_Scroll_Lock, XK_Scroll_Lock, XK_Scroll_Lock, XK_Scroll_Lock, XK_Scroll_Lock })); - keysyms.set( 79, new ArrayBox({ XK_KP_7, (uint)X.string_to_keysym("U2714"), (uint)X.string_to_keysym("U2195"), (uint)X.string_to_keysym("U226A"), XK_KP_Home, XK_upstile, 0 /*NoSymbol*/ })); - keysyms.set( 80, new ArrayBox({ XK_KP_8, (uint)X.string_to_keysym("U2718"), XK_uparrow, XK_intersection, XK_KP_Up, (uint)X.string_to_keysym("U22C2"), - 0 /*NoSymbol*/ })); - keysyms.set( 81, new ArrayBox({ XK_KP_9, XK_dagger, (uint)X.string_to_keysym("U20D7"), (uint)X.string_to_keysym("U226B"), XK_KP_Prior, (uint)X.string_to_keysym("U2309"), 0 /*NoSymbol*/ })); - keysyms.set( 82, new ArrayBox({ XK_KP_Subtract, XK_KP_Subtract, (uint)X.string_to_keysym("U2212"), (uint)X.string_to_keysym("U2296"), (uint)X.string_to_keysym("U2216"), (uint)X.string_to_keysym("U2238"), 0 /*NoSymbol*/ })); - keysyms.set( 83, new ArrayBox({ XK_KP_4, XK_club, XK_leftarrow, XK_includedin, XK_KP_Left, (uint)X.string_to_keysym("U2286"), 0 /*NoSymbol*/ })); - keysyms.set( 84, new ArrayBox({ XK_KP_5, XK_EuroSign, XK_colon, (uint)X.string_to_keysym("U22B6"), XK_KP_Begin, (uint)X.string_to_keysym("U22B7"), 0 /*NoSymbol*/ })); - keysyms.set( 85, new ArrayBox({ XK_KP_6, (uint)X.string_to_keysym("U2023"), XK_rightarrow, XK_includes, XK_KP_Right, (uint)X.string_to_keysym("U2287"), 0 /*NoSymbol*/ })); - keysyms.set( 86, new ArrayBox({ XK_KP_Add, XK_KP_Add, XK_plusminus, (uint)X.string_to_keysym("U2295"), (uint)X.string_to_keysym("U2213"), (uint)X.string_to_keysym("U2214"), 0 /*NoSymbol*/ })); - keysyms.set( 87, new ArrayBox({ XK_KP_1, XK_diamond, (uint)X.string_to_keysym("U2194"), XK_lessthanequal, XK_KP_End, XK_downstile, 0 /*NoSymbol*/ })); - keysyms.set( 88, new ArrayBox({ XK_KP_2, XK_heart, XK_downarrow, XK_union, XK_KP_Down, (uint)X.string_to_keysym("U22C3"), 0 /*NoSymbol*/ })); - keysyms.set( 89, new ArrayBox({ XK_KP_3, (uint)X.string_to_keysym("U2660"), (uint)X.string_to_keysym("U21CC"), XK_greaterthanequal, XK_KP_Next, (uint)X.string_to_keysym("U230B"), 0 /*NoSymbol*/ })); - keysyms.set( 90, new ArrayBox({ XK_KP_0, (uint)X.string_to_keysym("U2423"), XK_percent, (uint)X.string_to_keysym("U2030"), XK_KP_Insert, (uint)X.string_to_keysym("U25A1"), 0 /*NoSymbol*/ })); - keysyms.set( 91, new ArrayBox({ XK_KP_Separator, XK_period, XK_comma, XK_minutes, XK_KP_Delete, XK_seconds, 0 /*NoSymbol*/ })); - keysyms.set( 92, new ArrayBox({ XK_ISO_Level3_Shift })); - keysyms.set( 93, new ArrayBox({ })); - keysyms.set( 94, new ArrayBox({ XK_ISO_Level5_Shift, XK_ISO_Level5_Shift, XK_ISO_Level5_Shift, XK_ISO_Level5_Shift, XK_ISO_Level5_Lock, XK_ISO_Level5_Lock, XK_ISO_Level5_Lock })); - keysyms.set( 95, new ArrayBox({ XK_F11, 0 /*XK_XF86_Switch_VT_11*/ })); - keysyms.set( 96, new ArrayBox({ XK_F12, 0 /*XK_XF86_Switch_VT_12*/ })); - keysyms.set( 97, new ArrayBox({ })); - keysyms.set( 98, new ArrayBox({ XK_Katakana })); - keysyms.set( 99, new ArrayBox({ XK_Hiragana })); - keysyms.set(100, new ArrayBox({ XK_Henkan_Mode })); - keysyms.set(101, new ArrayBox({ XK_Hiragana_Katakana })); - keysyms.set(102, new ArrayBox({ XK_Muhenkan })); - keysyms.set(103, new ArrayBox({ })); - keysyms.set(104, new ArrayBox({ XK_KP_Enter, XK_KP_Enter, XK_KP_Enter, XK_KP_Enter, XK_KP_Enter, XK_KP_Enter, 0 /*NoSymbol*/ })); - keysyms.set(105, new ArrayBox({ XK_Control_R, XK_Control_R, XK_Control_R, XK_Control_R, XK_Control_R })); - keysyms.set(106, new ArrayBox({ XK_KP_Divide, XK_KP_Divide, XK_division, (uint)X.string_to_keysym("U2300"), (uint)X.string_to_keysym("U2215"), (uint)X.string_to_keysym("U2223"), 0 /*NoSymbol*/ })); - keysyms.set(107, new ArrayBox({ XK_Print, XK_Sys_Req })); - keysyms.set(108, new ArrayBox({ XK_ISO_Level5_Shift, XK_ISO_Level5_Shift, XK_ISO_Level5_Shift, XK_ISO_Level5_Shift, XK_ISO_Level5_Lock, XK_ISO_Level5_Lock, XK_ISO_Level5_Lock })); - keysyms.set(109, new ArrayBox({ XK_Linefeed, XK_Linefeed, XK_Linefeed, XK_Linefeed, XK_Linefeed })); - keysyms.set(110, new ArrayBox({ XK_Home, XK_Home, XK_Home, XK_Home, XK_Home })); - keysyms.set(111, new ArrayBox({ XK_Up, XK_Up, XK_Up, XK_Up, XK_Up })); - keysyms.set(112, new ArrayBox({ XK_Prior, XK_Prior, XK_Prior, XK_Prior, XK_Prior })); - keysyms.set(113, new ArrayBox({ XK_Left, XK_Left, XK_Left, XK_Left, XK_Left })); - keysyms.set(114, new ArrayBox({ XK_Right, XK_Right, XK_Right, XK_Right, XK_Right })); - keysyms.set(115, new ArrayBox({ XK_End, XK_End, XK_End, XK_End, XK_End })); - keysyms.set(116, new ArrayBox({ XK_Down, XK_Down, XK_Down, XK_Down, XK_Down })); - keysyms.set(117, new ArrayBox({ XK_Next, XK_Next, XK_Next, XK_Next, XK_Next })); - keysyms.set(118, new ArrayBox({ XK_Insert, XK_Insert, XK_Insert, XK_Insert, XK_Insert })); - keysyms.set(119, new ArrayBox({ XK_Delete, XK_Delete, XK_Delete, XK_Delete, XK_Delete })); - keysyms.set(120, new ArrayBox({ })); - keysyms.set(121, new ArrayBox({ 0 /*XK_XF86AudioMute*/ })); - keysyms.set(122, new ArrayBox({ 0 /*XK_XF86AudioLowerVolume*/ })); - keysyms.set(123, new ArrayBox({ 0 /*XK_XF86AudioRaiseVolume*/ })); - keysyms.set(124, new ArrayBox({ 0 /*XK_XF86PowerOff*/ })); - keysyms.set(125, new ArrayBox({ XK_KP_Equal, 0 /*NoSymbol*/, 0 /*NoSymbol*/, 0 /*NoSymbol*/, 0 /*NoSymbol*/, 0 /*NoSymbol*/, 0 /*NoSymbol*/ })); - keysyms.set(126, new ArrayBox({ XK_plusminus })); - keysyms.set(127, new ArrayBox({ XK_Pause, XK_Break })); - keysyms.set(128, new ArrayBox({ 0 /*XK_XF86LaunchA*/ })); - keysyms.set(129, new ArrayBox({ XK_KP_Decimal })); - keysyms.set(130, new ArrayBox({ XK_Hangul })); - keysyms.set(131, new ArrayBox({ XK_Hangul_Hanja })); - keysyms.set(132, new ArrayBox({ })); - keysyms.set(133, new ArrayBox({ XK_Super_L })); - keysyms.set(134, new ArrayBox({ XK_Super_R })); - keysyms.set(135, new ArrayBox({ XK_Menu })); - keysyms.set(136, new ArrayBox({ XK_Cancel })); - keysyms.set(137, new ArrayBox({ XK_Redo })); - keysyms.set(138, new ArrayBox({ 0 /*XK_SunProps*/ })); - keysyms.set(139, new ArrayBox({ XK_Undo })); - keysyms.set(140, new ArrayBox({ 0 /*XK_SunFront*/ })); - keysyms.set(141, new ArrayBox({ 0 /*XK_XF86Copy*/ })); - keysyms.set(142, new ArrayBox({ 0 /*XK_SunOpen*/ })); - keysyms.set(143, new ArrayBox({ 0 /*XK_XF86Paste*/ })); - keysyms.set(144, new ArrayBox({ XK_Find })); - keysyms.set(145, new ArrayBox({ 0 /*XK_XF86Cut*/ })); - keysyms.set(146, new ArrayBox({ XK_Help })); - keysyms.set(147, new ArrayBox({ 0 /*XK_XF86MenuKB*/ })); - keysyms.set(148, new ArrayBox({ 0 /*XK_XF86Calculator*/ })); - keysyms.set(149, new ArrayBox({ })); - keysyms.set(150, new ArrayBox({ 0 /*XK_XF86Sleep*/ })); - keysyms.set(151, new ArrayBox({ 0 /*XK_XF86WakeUp*/ })); - keysyms.set(152, new ArrayBox({ 0 /*XK_XF86Explorer*/ })); - keysyms.set(153, new ArrayBox({ 0 /*XK_XF86Send*/ })); - keysyms.set(154, new ArrayBox({ })); - keysyms.set(155, new ArrayBox({ 0 /*XK_XF86Xfer*/ })); - keysyms.set(156, new ArrayBox({ 0 /*XK_XF86Launch1*/ })); - keysyms.set(157, new ArrayBox({ 0 /*XK_XF86Launch2*/ })); - keysyms.set(158, new ArrayBox({ 0 /*XK_XF86WWW*/ })); - keysyms.set(159, new ArrayBox({ 0 /*XK_XF86DOS*/ })); - keysyms.set(160, new ArrayBox({ 0 /*XK_XF86ScreenSaver*/ })); - keysyms.set(161, new ArrayBox({ })); - keysyms.set(162, new ArrayBox({ 0 /*XK_XF86RotateWindows*/ })); - keysyms.set(163, new ArrayBox({ 0 /*XK_XF86Mail*/ })); - keysyms.set(164, new ArrayBox({ 0 /*XK_XF86Favorites*/ })); - keysyms.set(165, new ArrayBox({ 0 /*XK_XF86MyComputer*/ })); - keysyms.set(166, new ArrayBox({ 0 /*XK_XF86Back*/ })); - keysyms.set(167, new ArrayBox({ 0 /*XK_XF86Forward*/ })); - keysyms.set(168, new ArrayBox({ })); - keysyms.set(169, new ArrayBox({ 0 /*XK_XF86Eject*/ })); - keysyms.set(170, new ArrayBox({ 0 /*XK_XF86Eject*/, 0 /*XK_XF86Eject*/ })); - keysyms.set(171, new ArrayBox({ 0 /*XK_XF86AudioNext*/ })); - keysyms.set(172, new ArrayBox({ 0 /*XK_XF86AudioPlay*/, 0 /*XK_XF86AudioPause*/ })); - keysyms.set(173, new ArrayBox({ 0 /*XK_XF86AudioPrev*/ })); - keysyms.set(174, new ArrayBox({ 0 /*XK_XF86AudioStop*/, 0 /*XK_XF86Eject*/ })); - keysyms.set(175, new ArrayBox({ 0 /*XK_XF86AudioRecord*/ })); - keysyms.set(176, new ArrayBox({ 0 /*XK_XF86AudioRewind*/ })); - keysyms.set(177, new ArrayBox({ 0 /*XK_XF86Phone*/ })); - keysyms.set(178, new ArrayBox({ })); - keysyms.set(179, new ArrayBox({ 0 /*XK_XF86Tools*/ })); - keysyms.set(180, new ArrayBox({ 0 /*XK_XF86HomePage*/ })); - keysyms.set(181, new ArrayBox({ 0 /*XK_XF86Reload*/ })); - keysyms.set(182, new ArrayBox({ 0 /*XK_XF86Close*/ })); - keysyms.set(183, new ArrayBox({ })); - keysyms.set(184, new ArrayBox({ })); - keysyms.set(185, new ArrayBox({ 0 /*XK_XF86ScrollUp*/ })); - keysyms.set(186, new ArrayBox({ 0 /*XK_XF86ScrollDown*/ })); - keysyms.set(187, new ArrayBox({ XK_parenleft })); - keysyms.set(188, new ArrayBox({ XK_parenright })); - keysyms.set(189, new ArrayBox({ 0 /*XK_XF86New*/ })); - keysyms.set(190, new ArrayBox({ XK_Redo })); - keysyms.set(191, new ArrayBox({ 0 /*XK_XF86Tools*/ })); - keysyms.set(192, new ArrayBox({ 0 /*XK_XF86Launch5*/ })); - keysyms.set(193, new ArrayBox({ 0 /*XK_XF86MenuKB*/ })); - keysyms.set(194, new ArrayBox({ })); - keysyms.set(195, new ArrayBox({ })); - keysyms.set(196, new ArrayBox({ })); - keysyms.set(197, new ArrayBox({ })); - keysyms.set(198, new ArrayBox({ })); - keysyms.set(199, new ArrayBox({ })); - keysyms.set(200, new ArrayBox({ 0 /*XK_XF86TouchpadToggle*/ })); - keysyms.set(201, new ArrayBox({ })); - keysyms.set(202, new ArrayBox({ })); - keysyms.set(203, new ArrayBox({ XK_ISO_Level5_Shift, XK_ISO_Level5_Shift, XK_ISO_Level5_Shift, XK_ISO_Level5_Shift, XK_ISO_Level5_Shift })); - keysyms.set(204, new ArrayBox({ XK_Alt_L })); - keysyms.set(205, new ArrayBox({ XK_Alt_L })); - keysyms.set(206, new ArrayBox({ XK_Super_L })); - keysyms.set(207, new ArrayBox({ })); - keysyms.set(208, new ArrayBox({ 0 /*XK_XF86AudioPlay*/ })); - keysyms.set(209, new ArrayBox({ 0 /*XK_XF86AudioPause*/ })); - keysyms.set(210, new ArrayBox({ 0 /*XK_XF86Launch3*/ })); - keysyms.set(211, new ArrayBox({ 0 /*XK_XF86Launch4*/ })); - keysyms.set(212, new ArrayBox({ 0 /*XK_XF86LaunchB*/ })); - keysyms.set(213, new ArrayBox({ 0 /*XK_XF86Suspend*/ })); - keysyms.set(214, new ArrayBox({ 0 /*XK_XF86Close*/ })); - keysyms.set(215, new ArrayBox({ 0 /*XK_XF86AudioPlay*/ })); - keysyms.set(216, new - ArrayBox({ 0 /*XK_XF86AudioForward*/ })); - keysyms.set(217, new ArrayBox({ })); - keysyms.set(218, new ArrayBox({ XK_Print })); - keysyms.set(219, new ArrayBox({ })); - keysyms.set(220, new ArrayBox({ 0 /*XK_XF86WebCam*/ })); - keysyms.set(221, new ArrayBox({ })); - keysyms.set(222, new ArrayBox({ })); - keysyms.set(223, new ArrayBox({ 0 /*XK_XF86Mail*/ })); - keysyms.set(224, new ArrayBox({ })); - keysyms.set(225, new ArrayBox({ 0 /*XK_XF86Search*/ })); - keysyms.set(226, new ArrayBox({ })); - keysyms.set(227, new ArrayBox({ 0 /*XK_XF86Finance*/ })); - keysyms.set(228, new ArrayBox({ })); - keysyms.set(229, new ArrayBox({ 0 /*XK_XF86Shop*/ })); - keysyms.set(230, new ArrayBox({ })); - keysyms.set(231, new ArrayBox({ XK_Cancel })); - keysyms.set(232, new ArrayBox({ 0 /*XK_XF86MonBrightnessDown*/ })); - keysyms.set(233, new ArrayBox({ 0 /*XK_XF86MonBrightnessUp*/ })); - keysyms.set(234, new ArrayBox({ 0 /*XK_XF86AudioMedia*/ })); - keysyms.set(235, new ArrayBox({ 0 /*XK_XF86Display*/ })); - keysyms.set(236, new ArrayBox({ 0 /*XK_XF86KbdLightOnOff*/ })); - keysyms.set(237, new ArrayBox({ 0 /*XK_XF86KbdBrightnessDown*/ })); - keysyms.set(238, new ArrayBox({ 0 /*XK_XF86KbdBrightnessUp*/ })); - keysyms.set(239, new ArrayBox({ 0 /*XK_XF86Send*/ })); - keysyms.set(240, new ArrayBox({ 0 /*XK_XF86Reply*/ })); - keysyms.set(241, new ArrayBox({ 0 /*XK_XF86MailForward*/ })); - keysyms.set(242, new ArrayBox({ 0 /*XK_XF86Save*/ })); - keysyms.set(243, new ArrayBox({ 0 /*XK_XF86Documents*/ })); - keysyms.set(244, new ArrayBox({ 0 /*XK_XF86Battery*/ })); - keysyms.set(245, new ArrayBox({ 0 /*XK_XF86Bluetooth*/ })); - keysyms.set(246, new ArrayBox({ 0 /*XK_XF86WLAN*/ })); - keysyms.set(247, new ArrayBox({ })); - keysyms.set(248, new ArrayBox({ })); - keysyms.set(249, new ArrayBox({ })); - keysyms.set(250, new ArrayBox({ })); - keysyms.set(251, new ArrayBox({ })); - keysyms.set(252, new ArrayBox({ })); - keysyms.set(253, new ArrayBox({ })); - keysyms.set(254, new ArrayBox({ })); - keysyms.set(255, new ArrayBox({ })); - return keysyms; } - private Box genHBox(){ - Box b = new Box(Gtk.Orientation.HORIZONTAL, 0); - b.set_homogeneous(false); - return b; - } + /* Generate for every key an EventBox and add it to this grid. - public void generateKeyevents() { + The cell size will grow/shrink with the window size and + must match to the background image of the window. + */ + public void generateCells() { - Box[] hboxes = { - genHBox(), // top row (1,2,3,…) - genHBox(), // upper row (x,v,l,…) - genHBox(), // home row (u,i,a,…) - genHBox(), // lower row (ü,ö,ä,…) - genHBox(), // space row - genHBox() //function key row - }; - - if (winMain.config.get("display_function_keys") != "0") { - this.pack_start( hboxes[5], false, true, 0 ); - } - - this.pack_start( hboxes[0], false, true, 0 ); - this.pack_start( hboxes[1], false, true, 0 ); - this.pack_start( hboxes[2], false, true, 0 ); - this.pack_start( hboxes[3], false, true, 0 ); - this.pack_start( hboxes[4], false, true, 0 ); - - foreach( var hbox in hboxes ) { - hbox.show(); - } - - double winWidthUnscaled = 1000.0; - double winHeightUnscaled = 250.0; - - if (winMain.config.get("display_function_keys") == "0") { - winHeightUnscaled -= winMain.function_keys_height; - } - - if (winMain.config.get("display_numpad") == "0") { - winWidthUnscaled -= winMain.numpad_width; - } + double width_unscaled = (double) winMain.get_unscaled_width(); + double height_unscaled = (double) winMain.get_unscaled_height(); int width, height; - winMain.get_size2(out width, out height); + winMain.get_size(out width, out height); - double scaleX = width/winWidthUnscaled; - double scaleY = height/winHeightUnscaled; + double scaleX = width/width_unscaled; + double scaleY = height/height_unscaled; - double posXUnscaled = 0.0; - double posYUnscaled = 0.0; - int posX = 0; - int posY = 0; + double x_unscaled = 0.0; + double y_unscaled = 0.0; + int x = 0; + int y = 0; + //debug(@"XXXX width=$(width), height=$(height)"); + //debug(@"XXXX width_unscaled=$(width_unscaled), height_unscaled=$(height_unscaled)"); + //debug(@"XXXX scaleX=$(scaleX), scaleY=$(scaleY)"); + + //++ function key row ++ if (winMain.config.get("display_function_keys") != "0") { //esc - scaledBox(44.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 9, false, winMain, hboxes[5], 0); + gridCell(44.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 9, false, 0); //free space - scaledBox(44.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , -1 , false, winMain, hboxes[5], -1); + gridCell(44.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, -1, false, -1); // F1-F4 - scaledBox(44.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 67, false, winMain, hboxes[5], 0); - scaledBox(44.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 68, false, winMain, hboxes[5], 0); - scaledBox(44.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 69, false, winMain, hboxes[5], 0); - scaledBox(44.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 70, false, winMain, hboxes[5], 0); + gridCell(44.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 67, false, 0); + gridCell(44.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 68, false, 0); + gridCell(44.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 69, false, 0); + gridCell(44.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 70, false, 0); //free space - scaledBox(22.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , -1 , false, winMain, hboxes[5], -1); + gridCell(22.0-5.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, -1, false, -1); // F5-F8 - scaledBox(44.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 71, false, winMain, hboxes[5], 0); - scaledBox(44.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 72, false, winMain, hboxes[5], 0); - scaledBox(44.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 73, false, winMain, hboxes[5], 0); - scaledBox(44.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 74, false, winMain, hboxes[5], 0); + gridCell(44.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 71, false, 0); + gridCell(44.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 72, false, 0); + gridCell(44.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 73, false, 0); + gridCell(44.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 74, false, 0); //free space - scaledBox(22.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , -1 , false, winMain, hboxes[5], -1); + gridCell(22.0-5.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, -1, false, -1); // F9-F11 - scaledBox(44.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 75, false, winMain, hboxes[5], 0); - scaledBox(44.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 76, false, winMain, hboxes[5], 0); - scaledBox(44.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 95, false, winMain, hboxes[5], 0); + gridCell(44.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 75, false, 0); + gridCell(44.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 76, false, 0); + gridCell(44.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 95, false, 0); if (winMain.config.get("display_numpad") != "0") { //F12 - scaledBox(44.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 96, false, winMain, hboxes[5], 0); + gridCell(44.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 96, false, 0); //free space - scaledBox(22.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , -1 , false, winMain, hboxes[5], -1); + gridCell(22.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, -1, false, -1); // print,scroll,break - scaledBox(44.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 107, true, winMain, hboxes[5], 0); - scaledBox(44.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 78, true, winMain, hboxes[5], 0); - scaledBox(44.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 127, true, winMain, hboxes[5], 0); + gridCell(44.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 107, false, 0); + gridCell(44.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 78, false, 0); + gridCell(44.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 127, true, 0); } else { //F12 - scaledBox(44.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 96, true, winMain, hboxes[5], 0); + gridCell(44.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 96, true, 0); } - //Reset right shift. - posXUnscaled = 0.0; - posX = 0; - } + //debug(@"x=$(x) y=$(y)"); - //++ Top row ++ - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 49, false, winMain, hboxes[0], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 10, false, winMain, hboxes[0], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 11, false, winMain, hboxes[0], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 12, false, winMain, hboxes[0], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 13, false, winMain, hboxes[0], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 14, false, winMain, hboxes[0], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 15, false, winMain, hboxes[0], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 16, false, winMain, hboxes[0], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 17, false, winMain, hboxes[0], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 18, false, winMain, hboxes[0], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 19, false, winMain, hboxes[0], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 20, false, winMain, hboxes[0], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 21 , false, winMain, hboxes[0], 0); + //Reset right shift. + x_unscaled = 0.0; + x = 0; + } + //++ END function key row ++ + + //++ top row ++ + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 49, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 10, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 11, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 12, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 13, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 14, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 15, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 16, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 17, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 18, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 19, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 20, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 21, false, 0); if (winMain.config.get("display_numpad") != "0") { - scaledBox(78.0-1.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 22 , false, winMain, hboxes[0], 0); + gridCell(78.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 22, false, 0); //free space - scaledBox(22.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , -1 , false, winMain, hboxes[0], -1); + gridCell(22.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, -1, false, -1); //ins home page_up - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 118 , false, winMain, hboxes[0], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 110 , false, winMain, hboxes[0], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 112 , false, winMain, hboxes[0], 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 118, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 110, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 112, false, 0); //free space - scaledBox(22.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , -1 , false, winMain, hboxes[0], -1); + gridCell(22.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, -1, false, -1); //num key, divide, times, and minus - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 77 , false, winMain, hboxes[0], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 106 , false, winMain, hboxes[0], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 63 , false, winMain, hboxes[0], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 82 , true, winMain, hboxes[0], 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 77, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 106, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 63, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 82, true, 0); } else { - scaledBox(78.0-1.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 22 , true, winMain, hboxes[0], 0); + gridCell(78.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 22, true, 0); } - //Reset right shift. - posXUnscaled = 0.0; - posX = 0; + + //debug(@"x=$(x) y=$(y)"); + //Reset right shift. + x_unscaled = 0.0; + x = 0; //++ End top row ++ - //++ Second row ++ - scaledBox(60.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 23 , false, winMain, hboxes[1], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 24 , false, winMain, hboxes[1], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 25 , false, winMain, hboxes[1], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 26 , false, winMain, hboxes[1], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 27 , false, winMain, hboxes[1], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 28 , false, winMain, hboxes[1], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 29 , false, winMain, hboxes[1], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 30 , false, winMain, hboxes[1], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 31 , false, winMain, hboxes[1], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 32 , false, winMain, hboxes[1], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 33 , false, winMain, hboxes[1], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 34 , false, winMain, hboxes[1], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 35 , false, winMain, hboxes[1], 0); + + //++ upper row ++ + gridCell(60.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 23, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 24, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 25, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 26, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 27, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 28, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 29, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 30, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 31, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 32, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 33, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 34, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 35, false, 0); if (winMain.config.get("display_numpad") != "0") { //Halve of Return/Enter - scaledBox(62.0-1,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 36 , false, winMain, hboxes[1], 0); + gridCell(62.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 36, false, 0); //free space - scaledBox(22.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , -1 , false, winMain, hboxes[1], -1); + gridCell(22.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, -1, false, -1); //entf end page_down - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 119 , false, winMain, hboxes[1], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 115 , false, winMain, hboxes[1], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 117 , false, winMain, hboxes[1], 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 119, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 115, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 117, false, 0); //free space - scaledBox(22.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , -1 , false, winMain, hboxes[1], -1); + gridCell(22.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, -1, false, -1); //7, 8, 9, and halve of plus - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 79 , false, winMain, hboxes[1], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 80 , false, winMain, hboxes[1], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 81 , false, winMain, hboxes[1], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 86 , true, winMain, hboxes[1], 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 79, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 80, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 81, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 86, true, 0); } else { //Halve of Return/Enter - scaledBox(62.0-1,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 36 , true, winMain, hboxes[1], 0); + gridCell(62.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 36, true, 0); } - //Reset right shift. - posXUnscaled = 0.0; - posX = 0; - + //debug(@"x=$(x) y=$(y)"); + //Reset right shift. + x_unscaled = 0.0; + x = 0; //++ End upper row ++ + //++ home row ++ //left mod3 - scaledBox(73.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 2/*37*/ , false, winMain, hboxes[2], 1); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 38 , false, winMain, hboxes[2], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 39 , false, winMain, hboxes[2], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 40 , false, winMain, hboxes[2], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 41 , false, winMain, hboxes[2], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 42 , false, winMain, hboxes[2], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 43 , false, winMain, hboxes[2], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 44 , false, winMain, hboxes[2], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 45 , false, winMain, hboxes[2], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 46 , false, winMain, hboxes[2], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 47 , false, winMain, hboxes[2], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 48 , false, winMain, hboxes[2], 0); + gridCell(73.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 2/*37*/, false, 1); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 38, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 39, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 40, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 41, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 42, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 43, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 44, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 45, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 46, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 47, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 48, false, 0); //right mod3 - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 2/*51*/ , false, winMain, hboxes[2], 1); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 2/*51*/, false, 1); if (winMain.config.get("display_numpad") != "0") { //Second halve of Enter/Return - scaledBox(49.0-1,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 36 , false, winMain, hboxes[2], 0); + gridCell(49.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 36, false, 0); //free space - scaledBox(174.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , -1 , false, winMain, hboxes[2], -1); + gridCell(174.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, -1, false, -1); //4, 5, 6, and halve of plus - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 83 , false, winMain, hboxes[2], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 84 , false, winMain, hboxes[2], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 85 , false, winMain, hboxes[2], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 86 , true, winMain, hboxes[2], 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 83, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 84, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 85, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 86, true, 0); } else { //Second halve of Enter/Return - scaledBox(49.0-1,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 36 , true, winMain, hboxes[2], 0); + gridCell(49.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 36, true, 0); } - //Reset right shift. - posXUnscaled = 0.0; - posX = 0; + //debug(@"x=$(x) y=$(y)"); + //Reset right shift. + x_unscaled = 0.0; + x = 0; //++ End home row ++ + //++ lower row ++ //left shift - scaledBox(52.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 1/*50*/ , false, winMain, hboxes[3], 1); + gridCell(52.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 1/*50*/, false, 1); //mod4 - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 3/*94*/ , false, winMain, hboxes[3], 1); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 52 , false, winMain, hboxes[3], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 53 , false, winMain, hboxes[3], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 54 , false, winMain, hboxes[3], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 55 , false, winMain, hboxes[3], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 56 , false, winMain, hboxes[3], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 57 , false, winMain, hboxes[3], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 58 , false, winMain, hboxes[3], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 59 , false, winMain, hboxes[3], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 60 , false, winMain, hboxes[3], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 61 , false, winMain, hboxes[3], 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 3/*94*/, false, 1); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 52, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 53, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 54, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 55, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 56, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 57, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 58, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 59, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 60, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 61, false, 0); if (winMain.config.get("display_numpad") != "0") { //right shift - scaledBox(114.0-1,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 1 /*62*/ , false, winMain, hboxes[3], 1); + gridCell(114.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 1 /*62*/, false, 1); //free space - scaledBox(66.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , -1 , false, winMain, hboxes[3], -1); + gridCell(66.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, -1, false, -1); // up - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 111 , false, winMain, hboxes[3], 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 111, false, 0); //free space - scaledBox(66.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , -1 , false, winMain, hboxes[3], -1); - //1, 2, 3, and halve of enter - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 87 , false, winMain, hboxes[3], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 88 , false, winMain, hboxes[3], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 89 , false, winMain, hboxes[3], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 104 , true, winMain, hboxes[3], 0); + gridCell(66.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, -1, false, -1); + //1, 2, 3, and halve of enter + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 87, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 88, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 89, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 104, true, 0); } else { //right shift - scaledBox(114.0-1,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 1 /*62*/ , true, winMain, hboxes[3], 1); + gridCell(114.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 1 /*62*/, true, 1); } - //Reset right shift. - posXUnscaled = 0.0; - posX = 0; + + //debug(@"x=$(x) y=$(y)"); + //Reset right shift. + x_unscaled = 0.0; + x = 0; //++ End lower row ++ + //++ last/space row ++ //left ctrl, 37 - scaledBox(61.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 4/*37*/ , false, winMain, hboxes[4], 2); + gridCell(61.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 4/*37*/, false, 2); //free space - scaledBox(48.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , -1 , false, winMain, hboxes[4], -1); + gridCell(48.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, -1, false, -1); //alt - scaledBox(61.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 5/*64*/ , false, winMain, hboxes[4], 4); + gridCell(61.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 5/*64*/, false, 4); //space - scaledBox(316.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 65 , false, winMain, hboxes[4], 0); + gridCell(316.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 65, false, 0); //mod4 - scaledBox(61.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 3/*94*/ , false, winMain, hboxes[4], 1); + gridCell(61.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 3/*94*/, false, 1); //free space - scaledBox(40.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , -1 , false, winMain, hboxes[4], -1); + gridCell(40.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, -1, false, -1); if (winMain.config.get("display_numpad") != "0") { // right ctrl - scaledBox(61.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 4/*105*/ , false, winMain, hboxes[4], 3); + gridCell(61.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 4/*105*/, false, 3); //free space - scaledBox(22.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , -1 , false, winMain, hboxes[4], -1); + gridCell(22.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, -1, false, -1); //left, down, right - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 113 , false, winMain, hboxes[4], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 116 , false, winMain, hboxes[4], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 114 , false, winMain, hboxes[4], 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 113, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 116, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 114, false, 0); //free space - scaledBox(22.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , -1 , false, winMain, hboxes[4], -1); - //0, comma, and halve of enter - scaledBox(88.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 90 , false, winMain, hboxes[4], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 91 , false, winMain, hboxes[4], 0); - scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 104 , false, winMain, hboxes[4], 0); - } else { + gridCell(22.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, -1, false, -1); + //0, comma, and halve of enter + gridCell(88.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 90, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 91, false, 0); + gridCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 104, true, 0); + } else { // right ctrl - scaledBox(61.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 4/*105*/ , false, winMain, hboxes[4], 3); + gridCell(61.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, 4/*105*/, true, 3); } + //debug(@"x=$(x) y=$(y)"); //++ End last/space row ++ + } + public void move_and_scale_cells() { - /* - Gibt skalierte EventBox zurück. Damit sich die Rundungfehler durch int-Cast nicht aufzusummieren, - basieren die Werte auf der bis zu diesem Zeitpunkt zu erwartenden Gesamtbreite/höhe. - */ - private KeyEventBox scaledBox(double widthUnscaled, double heightUnscaled, - ref double posXUnscaled, ref double posYUnscaled, - ref int posX, ref int posY, - double scaleX, double scaleY, - int keycode, bool vertical, NeoWindow winMain, Box box, int boxtype) { + double width_unscaled = (double) winMain.get_unscaled_width(); + double height_unscaled = (double) winMain.get_unscaled_height(); - int width = (int)GLib.Math.floor((posXUnscaled + widthUnscaled) * scaleX - posX ); - int height = (int)GLib.Math.floor((posYUnscaled + heightUnscaled) * scaleY - posY); + int width, height; + winMain.get_size(out width, out height); - if (vertical) { - posYUnscaled += heightUnscaled; - posY += height; + double scaleX = width/width_unscaled; + double scaleY = height/height_unscaled; + + double x_unscaled = 0.0; + double y_unscaled = 0.0; + int x = 0; + int y = 0; + + // detach cells from grid + /*foreach (KeyEventCell w in this.eventCells.values){ + this.remove(w); + }*/ + // Reset id. Number will increased in ever moveCell call + this.__move_id = 0; + + //debug(@"YYYY width=$(width), height=$(height)"); + //debug(@"YYYY width_unscaled=$(width_unscaled), height_unscaled=$(height_unscaled)"); + //debug(@"YYYY scaleX=$(scaleX), scaleY=$(scaleY)"); + + //++ function key row ++ + if (winMain.config.get("display_function_keys") != "0") { + //esc + moveCell(44.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + //free space + moveCell(44.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + // F1-F4 + moveCell(44.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + //free space + moveCell(22.0-5.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + // F5-F8 + moveCell(44.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + //free space + moveCell(22.0-5.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + // F9-F11 + moveCell(44.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + + if (winMain.config.get("display_numpad") != "0") { + //F12 + moveCell(44.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + //free space + moveCell(22.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + // print,scroll,break + moveCell(44.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, true); + + } else { + //F12 + moveCell(44.0, 30.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, true); + } + + //debug(@"x=$(x) y=$(y)"); + + //Reset right shift. + x_unscaled = 0.0; + x = 0; + } + //++ END function key row ++ + + //++ top row ++ + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + + if (winMain.config.get("display_numpad") != "0") { + moveCell(78.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + //free space + moveCell(22.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + //ins home page_up + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + //free space + moveCell(22.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + //num key, divide, times, and minus + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, true); } else { - posXUnscaled += widthUnscaled; - posX += width; + moveCell(78.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, true); } - KeyEventBox keybox; - switch (boxtype) { + //debug(@"x=$(x) y=$(y)"); + //Reset right shift. + x_unscaled = 0.0; + x = 0; + //++ End top row ++ + + //++ upper row ++ + moveCell(60.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + + if (winMain.config.get("display_numpad") != "0") { + //Halve of Return/Enter + moveCell(62.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + //free space + moveCell(22.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + //entf end page_down + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + //free space + moveCell(22.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + //7, 8, 9, and halve of plus + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, true); + } else { + //Halve of Return/Enter + moveCell(62.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, true); + } + + //debug(@"x=$(x) y=$(y)"); + //Reset right shift. + x_unscaled = 0.0; + x = 0; + //++ End upper row ++ + + //++ home row ++ + //left mod3 + moveCell(73.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + //right mod3 + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + + if (winMain.config.get("display_numpad") != "0") { + //Second halve of Enter/Return + moveCell(49.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + //free space + moveCell(174.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + //4, 5, 6, and halve of plus + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, true); + } else { + //Second halve of Enter/Return + moveCell(49.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, true); + } + + //debug(@"x=$(x) y=$(y)"); + //Reset right shift. + x_unscaled = 0.0; + x = 0; + //++ End home row ++ + + //++ lower row ++ + //left shift + moveCell(52.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + //mod4 + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + + if (winMain.config.get("display_numpad") != "0") { + //right shift + moveCell(114.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + //free space + moveCell(66.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + // up + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + //free space + moveCell(66.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + //1, 2, 3, and halve of enter + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, true); + } else { + //right shift + moveCell(114.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, true); + } + + //debug(@"x=$(x) y=$(y)"); + //Reset right shift. + x_unscaled = 0.0; + x = 0; + //++ End lower row ++ + + //++ last/space row ++ + //left ctrl, 37 + moveCell(61.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + //free space + moveCell(48.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + //alt + moveCell(61.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + //space + moveCell(316.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + //mod4 + moveCell(61.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + //free space + moveCell(41.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + + if (winMain.config.get("display_numpad") != "0") { + // right ctrl + moveCell(61.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + //free space + moveCell(22.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + //left, down, right + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + //free space + moveCell(22.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + //0, comma, and halve of enter + moveCell(88.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, false); + moveCell(44.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, true); + } else { + // right ctrl + moveCell(61.0, 44.0, ref x_unscaled, ref y_unscaled, ref x, ref y, scaleX, scaleY, true); + } + + //debug(@"x=$(x) y=$(y)"); + //++ End last/space row ++ + + } + + private void gridCell( + double width_unscaled, double height_unscaled, + ref double x_unscaled, ref double y_unscaled, + ref int x, ref int y, + double scaleX, double scaleY, + int keycode, bool vertical, + int cell_type) + { + + // Truncate cell width if too wide for current window size (to omit rescaling) + // Not required for Gtk.Layout + /* + double win_width_unscaled = (double) winMain.get_unscaled_width(); + double win_height_unscaled = (double) winMain.get_unscaled_height(); + int win_width, win_height; + winMain.get_size(out win_width, out win_height); + + int width; + int height; + + if( x_unscaled + width_unscaled > win_width_unscaled){ + debug(@"AAAA cell too wide! Change from $(width_unscaled) to $(win_width_unscaled-x_unscaled)"); + width_unscaled = win_width_unscaled - x_unscaled; + width = win_width - x; + }else{ + width = (int)GLib.Math.floor((x_unscaled + width_unscaled) * scaleX - x ); + } + + if( y_unscaled + height_unscaled > win_height_unscaled){ + debug(@"AAAA cell too tall! Change from $(height_unscaled) to $(win_height_unscaled-y_unscaled)"); + height_unscaled = win_height_unscaled - y_unscaled; + height = win_height - y; + }else{ + height = (int)GLib.Math.floor((y_unscaled + height_unscaled) * scaleY - y ); + } + */ + int width = (int)GLib.Math.floor((x_unscaled + width_unscaled) * scaleX - x ); + int height = (int)GLib.Math.floor((y_unscaled + height_unscaled) * scaleY - y ); + + KeyEventCell cell; + switch (cell_type) { case 0: // Normale Taste - ArrayBox ks = this.keysyms.get(keycode); - keybox = new KeyEventBox(winMain, width, height, ref ks.val ); - this.keyBoxes.set(keycode, keybox); - box.pack_start(keybox, false, true, 0 ); + KeycodeArray ks = this.keysyms.get(keycode); + cell = new KeyEventCell(winMain, width, height, width, height, ref ks.val ); break; case 1: // Modifier, die andere Buchstabenebenen aktivieren. Zusätzlich Ebenen-Bild einblenden. - keybox = new KeyEventBox.modifier(winMain, width, height, keycode /*=modifier array index*/ ); - this.keyBoxes.set(keycode, keybox); - box.pack_start(keybox, false, true, 0 ); + cell = new KeyEventCell.modifier(winMain, width, height, width, height, keycode /*=modifier array index*/ ); break; //Andere Modifier (CTRL, Alt,... ) case 2: //left ctrl - keybox = new KeyEventBox.modifier2(winMain, width, height, keycode /*modifier array index */, "tastatur_ctrl_left_2.png" ); - this.keyBoxes.set(keycode, keybox); - box.pack_start(keybox, false, true, 0 ); + //cell = new KeyEventCell.modifier(winMain, width, height, width, height, keycode ); + cell = new KeyEventCell.modifier2(winMain, width, height, width, height, keycode /*modifier array index */, "tastatur_ctrl_left_2.png" ); break; case 3: //right ctrl - keybox = new KeyEventBox.modifier2(winMain, width, height, keycode /*modifier array index */, "tastatur_ctrl_right_2.png" ); - this.keyBoxes.set(keycode, keybox); - box.pack_start(keybox, false, true, 0 ); + //cell = new KeyEventCell.modifier(winMain, width, height, width, height, keycode ); + cell = new KeyEventCell.modifier2(winMain, width, height, width, height, keycode /*modifier array index */, "tastatur_ctrl_right_2.png" ); break; case 4: //left alt - keybox = new KeyEventBox.modifier2(winMain, width, height, keycode /*modifier array index */, "tastatur_alt_left_2.png" ); - this.keyBoxes.set(keycode, keybox); - box.pack_start(keybox, false, true, 0 ); + //cell = new KeyEventCell.modifier(winMain, width, height, width, height, keycode ); + cell = new KeyEventCell.modifier2(winMain, width, height, width, height, keycode /*modifier array index */, "tastatur_alt_left_2.png" ); break; default: // Fläche ohne Funktion - keybox = new KeyEventBox.freeArea(winMain, width, height ); - this.keyBoxes.set(keycode, keybox); - box.pack_start(keybox, false, true, 0 ); + cell = new KeyEventCell.freeArea(winMain, width, height, width, height ); break; - } + } + // Let eventbox fill the whole grid cell. + /* + cell.set_hexpand(true); + cell.set_vexpand(true); + cell.set_halign(Gtk.Align.FILL); + cell.set_valign(Gtk.Align.FILL); + */ + cell.set_hexpand(false); + cell.set_vexpand(false); + cell.set_halign(Gtk.Align.CENTER); + cell.set_valign(Gtk.Align.CENTER); + + // Add cell to list (required to handle window resizing + this.eventCells.set(this.__move_id, cell); + this.__move_id += 1; + + //debug(@"x=$(x) y=$(y)"); + + cell.set_size_request(width, height); + cell.show(); + this.put(cell, x, y); + + x_unscaled += width_unscaled; + x += width; + if (vertical) { + y_unscaled += height_unscaled; + y += height; + } + + // TODO + if (this.color_event_boxes && cell.get_children().length() == 0){ + Label l = new Label(""); // do not use non-empty string + l.show(); + + cell.add(l); + + Gdk.RGBA color = Gdk.RGBA(); + color.parse("#ebccd1"); + color.blue = (double) ((keycode*232437)%230)/255.0; + color.red = (double) ((keycode*12393)%230)/255.0; + color.green = (double) ((keycode*58283)%230)/255.0; + color.alpha = 0.5; + l.override_background_color(Gtk.StateFlags.NORMAL, color); + } + + } + + private void moveCell( + double width_unscaled, double height_unscaled, + ref double x_unscaled, ref double y_unscaled, + ref int x, ref int y, + double scaleX, double scaleY, + bool vertical) + { + + // Truncate cell width if too wide for current window size (to omit rescaling) + // Not required for Gtk.Layout + /* + double win_width_unscaled = (double) winMain.get_unscaled_width(); + double win_height_unscaled = (double) winMain.get_unscaled_height(); + int win_width, win_height; + winMain.get_size(out win_width, out win_height); + + int width; + int height; + + if( x_unscaled + width_unscaled > win_width_unscaled){ + debug(@"AAAA cell too wide! Change from $(width_unscaled) to $(win_width_unscaled-x_unscaled)"); + width_unscaled = win_width_unscaled - x_unscaled; + width = win_width - x; + }else{ + width = (int)GLib.Math.floor((x_unscaled + width_unscaled) * scaleX - x ); + } + + if( y_unscaled + height_unscaled > win_height_unscaled){ + debug(@"AAAA cell too tall! Change from $(height_unscaled) to $(win_height_unscaled-y_unscaled)"); + height_unscaled = win_height_unscaled - y_unscaled; + height = win_height - y; + }else{ + height = (int)GLib.Math.floor((y_unscaled + height_unscaled) * scaleY - y ); + } + */ + int width = (int)GLib.Math.floor((x_unscaled + width_unscaled) * scaleX - x ); + int height = (int)GLib.Math.floor((y_unscaled + height_unscaled) * scaleY - y ); + + KeyEventCell cell = this.eventCells.get(this.__move_id); + this.__move_id += 1; + GLib.assert( cell != null ); + + cell.set_size_request(width, height); // No effect if scaling down?! + this.move(cell, x, y); + + x_unscaled += width_unscaled; + x += width; + if (vertical) { + y_unscaled += height_unscaled; + y += height; + } - return keybox; } @@ -654,7 +796,7 @@ namespace NeoLayoutViewer { - public class KeyEventBox : EventBox{ + public class KeyEventCell : EventBox{ private uint[] keysym;// or private int modifier_index; @@ -662,7 +804,12 @@ namespace NeoLayoutViewer { private NeoWindow winMain; private int width; private int height; - private Gtk.Image image; + //private Gtk.Image image; + private ScalingImage image; + private string image_source_id; + + public double unscaled_width; + public double unscaled_height; /* Die Reihenfolge der Zeichen in keysyms passt nicht @@ -673,99 +820,126 @@ namespace NeoLayoutViewer { */ private const short[] layer_permutation = {0,1,2,3,5,4,6}; - private KeyEventBox.all(NeoWindow winMain, int width, int height) { + private KeyEventCell.all(NeoWindow winMain, double unscaled_width, double unscaled_height, int width, int height) { this.winMain = winMain; this.width = width; this.height = height; + this.unscaled_width = unscaled_width; + this.unscaled_height = unscaled_height; - this.set_visible_window(false); + this.image = null; + this.image_source_id = null; + + this.set_visible_window(false); // ?! + //debug(@"Init with $(width), $(height)"); this.show(); } - public KeyEventBox(NeoWindow winMain, int width, int height , ref uint[] keysym) { - this.all(winMain, width, height); + public KeyEventCell(NeoWindow winMain, double unscaled_width, double unscaled_height, int width, int height, ref uint[] keysym) { + this.all(winMain, unscaled_width, unscaled_height, width, height); this.keysym = keysym; this.button_press_event.connect ((event) => { - if (event.button != 1){ + if (event.button != 1){ return false; - } + } - uint ks = this.keysym[NeoLayoutViewer.KeyEventBox.layer_permutation[winMain.layer] - 1]; - int modi = winMain.getActiveModifierMask({4,5}); //ctrl+alt mask - if (ks < 1) return false; + uint ks = this.keysym[NeoLayoutViewer.KeyEventCell.layer_permutation[winMain.layer] - 1]; + int modi = winMain.getActiveModifierMask({4,5}); //ctrl+alt mask + if (ks < 1) return false; #if _NO_WIN - if (modi == 0 || true) { + if (modi == 0 || true) { // Alt-Mask do not work :-( keysend(ks,modi); - } else { + } else { //debug("Variante mit zweitem Modifier."); keysend2(ks,modi & Gdk.ModifierType.CONTROL_MASK, modi & Gdk.ModifierType.MOD1_MASK); - } + } #endif - //GLib.stdout.printf(@"Key: $(ks)\n"); GLib.stdout.flush(); + //GLib.stdout.printf(@"Key: $(ks)\n"); GLib.stdout.flush(); - return false; + return false; }); } - public KeyEventBox.modifier(NeoWindow winMain, int width, int height , int modifier_index) { - this.all(winMain, width, height); + public KeyEventCell.modifier(NeoWindow winMain, double unscaled_width, double unscaled_height, int width, int height, int modifier_index) { + this.all(winMain, unscaled_width, unscaled_height, width, height); this.modifier_index = modifier_index; this.button_press_event.connect ((event) => { if (winMain.active_modifier_by_mouse[this.modifier_index] == 0) { - winMain.change_active_modifier( this.modifier_index, false, 1 ); - //winMain.status.set_label(@"Activate\nModifier $(this.modifier_index)"); + winMain.change_active_modifier( this.modifier_index, false, 1 ); + //winMain.status.set_label(@"Activate\nModifier $(this.modifier_index)"); } else { - winMain.change_active_modifier( this.modifier_index, false, 0 ); - //winMain.status.set_label(@"Deactivate\nModifier $(this.modifier_index)"); + winMain.change_active_modifier( this.modifier_index, false, 0 ); + //winMain.status.set_label(@"Deactivate\nModifier $(this.modifier_index)"); } winMain.redraw(); return false; - }); + }); } - public KeyEventBox.modifier2(NeoWindow winMain, int width, int height , int modifier_index, string pressed_key_image ){ - this.all(winMain, width, height); + public KeyEventCell.modifier2(NeoWindow winMain, double unscaled_width, double unscaled_height, int width, int height, int modifier_index, string pressed_key_image ){ + this.all(winMain, unscaled_width, unscaled_height, width, height); this.modifier_index = modifier_index; + this.image_source_id = @"modifier_$(pressed_key_image)"; + + // Setup of modifier image + Gdk.Pixbuf[] modifier_pixbufs; + if (!winMain.image_buffer.has_key(this.image_source_id)) { + // Image of pressed Button + modifier_pixbufs = { + winMain.open_image_str( + @"$(winMain.config.get("asset_folder"))/neo2.0/" + + @"$(pressed_key_image)") + }; + + // store unscaled variant (TODO: redundant) + winMain.image_buffer.set(this.image_source_id, modifier_pixbufs[0]); + }else{ + modifier_pixbufs = { + winMain.image_buffer.get(this.image_source_id) + }; + } + var w = modifier_pixbufs[0].width; + var h = modifier_pixbufs[0].height; + + this.image = new ScalingImage( + w, h, winMain, + winMain.get_unscaled_width(), winMain.get_unscaled_height(), + modifier_pixbufs); + this.button_press_event.connect ((event) => { if (winMain.active_modifier_by_mouse[this.modifier_index] == 0) { - winMain.change_active_modifier( 1, false, 0 ); - winMain.change_active_modifier( 2, false, 0 ); - winMain.change_active_modifier( 3, false, 0 ); - winMain.change_active_modifier( this.modifier_index, false, 1 ); - this.image.show(); + winMain.change_active_modifier( 1, false, 0 ); + winMain.change_active_modifier( 2, false, 0 ); + winMain.change_active_modifier( 3, false, 0 ); + winMain.change_active_modifier( this.modifier_index, false, 1 ); + this.image.show(); } else { - winMain.change_active_modifier( this.modifier_index, false, 0 ); - this.image.hide(); + winMain.change_active_modifier( this.modifier_index, false, 0 ); + this.image.hide(); } winMain.redraw(); return false; - }); + }); - // Image of pressed Button - Gdk.Pixbuf image_buffer = winMain.open_image_str(@"$(winMain.config.get("asset_folder"))/neo2.0/$(pressed_key_image)"); - var w = image_buffer.width; - var h = image_buffer.height; - image_buffer = image_buffer.scale_simple(width, h*width/w,Gdk.InterpType.BILINEAR); - - this.image = new Gtk.Image(); - this.image.set_from_pixbuf(image_buffer); - this.image.hide(); add(this.image); - winMain.modifier_key_images.add( new Modkey(ref this.image, this.modifier_index) ); + Modkey mod_key = new Modkey(this.image, this.modifier_index); + winMain.modifier_key_images.add( mod_key ); + + // TODO: Handle resize event and re-evaluate this.image } - public KeyEventBox.freeArea(NeoWindow winMain, int width, int height) { - this.all(winMain, width, height); + public KeyEventCell.freeArea(NeoWindow winMain, double unscaled_width, double unscaled_height, int width, int height) { + this.all(winMain, unscaled_width, unscaled_height, width, height); } /* @@ -783,6 +957,273 @@ namespace NeoLayoutViewer { natural_height = height; } + } //End Class KeyEventCell + + // Wrapper to store array into hash map?! + public class KeycodeArray { + public uint[] val; + public KeycodeArray(uint[] val){ + this.val = val; + } } + + public Gee.HashMap generateKeysyms(){ + Gee.HashMap keysyms = new Gee.HashMap(); + + /* Define keyboard layout. this object maps the keycodes to the list of keycodes of each keyboard layer. */ + keysyms.set(8, new KeycodeArray({})); + keysyms.set( 9, new KeycodeArray({ XK_Escape, XK_Escape, XK_Escape, XK_Escape, XK_Escape })); + keysyms.set( 10, new KeycodeArray({ XK_1, XK_degree, XK_onesuperior, XK_onesubscript, XK_ordfeminine, XK_notsign, 0 /*NoSymbol*/ })); + keysyms.set( 11, new KeycodeArray({ XK_2, XK_section, XK_twosuperior, XK_twosubscript, XK_masculine, XK_logicalor, 0 /*NoSymbol*/ })); + keysyms.set( 12, new KeycodeArray({ XK_3, (uint)X.string_to_keysym("U2113"), XK_threesuperior, XK_threesubscript, XK_numerosign, XK_logicaland, 0 /*NoSymbol*/ })); + keysyms.set( 13, new KeycodeArray({ XK_4, XK_guillemotright, (uint)X.string_to_keysym("U203A"), XK_femalesymbol, 0 /*NoSymbol*/, (uint)X.string_to_keysym("U22A5"), 0 /*NoSymbol*/ })); + keysyms.set( 14, new KeycodeArray({ XK_5, XK_guillemotleft, (uint)X.string_to_keysym("U2039"), XK_malesymbol, XK_periodcentered, (uint)X.string_to_keysym("U2221"), 0 /*NoSymbol*/ })); + keysyms.set( 15, new KeycodeArray({ XK_6, XK_dollar, XK_cent, (uint)X.string_to_keysym("U26A5"), XK_sterling, (uint)X.string_to_keysym("U2225"), 0 /*NoSymbol*/ })); + keysyms.set( 16, new KeycodeArray({ XK_7, XK_EuroSign, XK_yen, (uint)X.string_to_keysym("U03F0"), XK_currency, XK_rightarrow, 0 /*NoSymbol*/ })); + keysyms.set( 17, new KeycodeArray({ XK_8, XK_doublelowquotemark, XK_singlelowquotemark, (uint)X.string_to_keysym("U27E8"), XK_Tab, (uint)X.string_to_keysym("U221E"), 0 /*NoSymbol*/ })); + keysyms.set( 18, new KeycodeArray({ XK_9, XK_leftdoublequotemark, XK_leftsinglequotemark, (uint)X.string_to_keysym("U27E9"), XK_KP_Divide, XK_variation, 0 /*NoSymbol*/ })); + keysyms.set( 19, new KeycodeArray({ XK_0, XK_rightdoublequotemark, XK_rightsinglequotemark, XK_zerosubscript, XK_KP_Multiply, XK_emptyset, 0 /*NoSymbol*/ })); + keysyms.set( 20, new KeycodeArray({ XK_minus, XK_emdash, 0 /*NoSymbol*/, (uint)X.string_to_keysym("U2011"), XK_KP_Subtract, XK_hyphen, 0 /*NoSymbol*/ })); + keysyms.set( 21, new KeycodeArray({ XK_dead_grave, XK_dead_cedilla, XK_dead_abovering, XK_dead_abovereversedcomma, XK_dead_diaeresis, XK_dead_macron, 0 /*NoSymbol*/ })); + keysyms.set( 22, new KeycodeArray({ XK_BackSpace, XK_BackSpace, XK_BackSpace, XK_BackSpace, XK_BackSpace })); + keysyms.set( 23, new KeycodeArray({ XK_Tab, XK_ISO_Left_Tab, XK_Multi_key, XK_ISO_Level5_Lock, 0 /*NoSymbol*/, 0 /*NoSymbol*/, XK_ISO_Level5_Lock })); + keysyms.set( 24, new KeycodeArray({ XK_x, XK_X, XK_ellipsis, XK_Greek_xi, XK_Prior, XK_Greek_XI, 0 /*NoSymbol*/ })); + keysyms.set( 25, new KeycodeArray({ XK_v, XK_V, XK_underscore, 0 /*NoSymbol*/, XK_BackSpace, XK_radical, 0 /*NoSymbol*/ })); + keysyms.set( 26, new KeycodeArray({ XK_l, XK_L, XK_bracketleft, XK_Greek_lamda, XK_Up, XK_Greek_LAMDA, 0 /*NoSymbol*/ })); + keysyms.set( 27, new KeycodeArray({ XK_c, XK_C, XK_bracketright, XK_Greek_chi, XK_Delete, (uint)X.string_to_keysym("U2102"), 0 /*NoSymbol*/ })); + keysyms.set( 28, new KeycodeArray({ XK_w, XK_W, XK_asciicircum, XK_Greek_omega, XK_Next, XK_Greek_OMEGA, 0 /*NoSymbol*/ })); + keysyms.set( 29, new KeycodeArray({ XK_k, XK_K, XK_exclam, XK_Greek_kappa, XK_exclamdown, XK_multiply, 0 /*NoSymbol*/ })); + keysyms.set( 30, new KeycodeArray({ XK_h, XK_H, XK_less, XK_Greek_psi, XK_KP_7, XK_Greek_PSI, 0 /*NoSymbol*/ })); + keysyms.set( 31, new KeycodeArray({ XK_g, XK_G, XK_greater, XK_Greek_gamma, XK_KP_8, XK_Greek_GAMMA, 0 /*NoSymbol*/ })); + keysyms.set( 32, new KeycodeArray({ XK_f, XK_F, XK_equal, XK_Greek_phi, XK_KP_9, XK_Greek_PHI, 0 /*NoSymbol*/ })); + keysyms.set( 33, new KeycodeArray({ XK_q, XK_Q, XK_ampersand, (uint)X.string_to_keysym("U03D5"), XK_KP_Add, (uint)X.string_to_keysym("U211A"), 0 /*NoSymbol*/ })); + keysyms.set( 34, new KeycodeArray({ XK_ssharp, (uint)X.string_to_keysym("U1E9E"), (uint)X.string_to_keysym("U017F"), XK_Greek_finalsmallsigma, (uint)X.string_to_keysym("U2212"), XK_jot, 0 /*NoSymbol*/ })); + keysyms.set( 35, new KeycodeArray({ XK_dead_acute, XK_dead_tilde, XK_dead_stroke, XK_dead_abovecomma, XK_dead_doubleacute, XK_dead_breve, 0 /*NoSymbol*/ })); + keysyms.set( 36, new KeycodeArray({ XK_Return, XK_Return, XK_Return, XK_Return, XK_Return })); + keysyms.set( 37, new KeycodeArray({ XK_Control_L, XK_Control_L, XK_Control_L, XK_Control_L, XK_Control_L })); + keysyms.set( 38, new KeycodeArray({ XK_u, XK_U, XK_backslash, 0 /*NoSymbol*/, XK_Home, XK_includedin, 0 /*NoSymbol*/ })); + keysyms.set( 39, new KeycodeArray({ XK_i, XK_I, XK_slash, XK_Greek_iota, XK_Left, XK_integral, 0 /*NoSymbol*/ })); + keysyms.set( 40, new KeycodeArray({ XK_a, XK_A, XK_braceleft, XK_Greek_alpha, XK_Down, (uint)X.string_to_keysym("U2200"), 0 /*NoSymbol*/ })); + keysyms.set( 41, new KeycodeArray({ XK_e, XK_E, XK_braceright, XK_Greek_epsilon, XK_Right, (uint)X.string_to_keysym("U2203"), 0 /*NoSymbol*/ })); + keysyms.set( 42, new KeycodeArray({ XK_o, XK_O, XK_asterisk, XK_Greek_omicron, XK_End, XK_elementof, 0 /*NoSymbol*/ })); + keysyms.set( 43, new KeycodeArray({ XK_s, XK_S, XK_question, XK_Greek_sigma, XK_questiondown, XK_Greek_SIGMA, 0 /*NoSymbol*/ })); + keysyms.set( 44, new KeycodeArray({ XK_n, XK_N, XK_parenleft, XK_Greek_nu, XK_KP_4, (uint)X.string_to_keysym("U2115"), 0 /*NoSymbol*/ })); + keysyms.set( 45, new KeycodeArray({ XK_r, XK_R, XK_parenright, XK_Greek_rho, XK_KP_5, (uint)X.string_to_keysym("U211D"), 0 /*NoSymbol*/ })); + keysyms.set( 46, new KeycodeArray({ XK_t, XK_T, XK_minus, XK_Greek_tau, XK_KP_6, XK_partialderivative, 0 /*NoSymbol*/ })); + keysyms.set( 47, new KeycodeArray({ XK_d, XK_D, XK_colon, XK_Greek_delta, XK_KP_Separator, XK_Greek_DELTA, 0 /*NoSymbol*/ })); + keysyms.set( 48, new KeycodeArray({ XK_y, XK_Y, XK_at, XK_Greek_upsilon, XK_period, XK_nabla, 0 /*NoSymbol*/ })); + keysyms.set( 49, new KeycodeArray({ XK_dead_circumflex, XK_dead_caron, (uint)X.string_to_keysym("U21BB"), (uint)X.string_to_keysym("U02DE"), XK_dead_abovedot, XK_dead_belowdot, 0 /*NoSymbol*/ })); + keysyms.set( 50, new KeycodeArray({ XK_Shift_L, XK_Caps_Lock })); + keysyms.set( 51, new KeycodeArray({ XK_ISO_Level3_Shift })); + keysyms.set( 52, new KeycodeArray({ XK_udiaeresis, XK_Udiaeresis, XK_numbersign, 0 /*NoSymbol*/, XK_Escape, XK_union, 0 /*NoSymbol*/ })); + keysyms.set( 53, new KeycodeArray({ XK_odiaeresis, XK_Odiaeresis, XK_dollar, (uint)X.string_to_keysym("U03F5"), XK_Tab, XK_intersection, 0 /*NoSymbol*/ })); + keysyms.set( 54, new KeycodeArray({ XK_adiaeresis, XK_Adiaeresis, XK_bar, XK_Greek_eta, XK_Insert, (uint)X.string_to_keysym("U2135"), 0 /*NoSymbol*/ })); + keysyms.set( 55, new KeycodeArray({ XK_p, XK_P, XK_asciitilde, XK_Greek_pi, XK_Return, XK_Greek_PI, 0 /*NoSymbol*/ })); + keysyms.set( 56, new KeycodeArray({ XK_z, XK_Z, XK_grave, XK_Greek_zeta, XK_Undo, (uint)X.string_to_keysym("U2124"), 0 /*NoSymbol*/ })); + keysyms.set( 57, new KeycodeArray({ XK_b, XK_B, XK_plus, XK_Greek_beta, XK_colon, (uint)X.string_to_keysym("U21D0"), 0 /*NoSymbol*/ })); + keysyms.set( 58, new KeycodeArray({ XK_m, XK_M, XK_percent, XK_Greek_mu, XK_KP_1, XK_ifonlyif, 0 /*NoSymbol*/ })); + keysyms.set( 59, new KeycodeArray({ XK_comma, XK_endash, XK_quotedbl, (uint)X.string_to_keysym("U03F1"), XK_KP_2, (uint)X.string_to_keysym("U21D2"), 0 /*NoSymbol*/ })); + keysyms.set( 60, new KeycodeArray({ XK_period, XK_enfilledcircbullet, XK_apostrophe, (uint)X.string_to_keysym("U03D1"), XK_KP_3, (uint)X.string_to_keysym("U21A6"), 0 /*NoSymbol*/ })); + keysyms.set( 61, new KeycodeArray({ XK_j, XK_J, XK_semicolon, XK_Greek_theta, XK_semicolon, XK_Greek_THETA, 0 /*NoSymbol*/ })); + keysyms.set( 62, new KeycodeArray({ XK_Shift_R, XK_Caps_Lock })); + keysyms.set( 63, new KeycodeArray({ XK_KP_Multiply, XK_KP_Multiply, (uint)X.string_to_keysym("U2219"), (uint)X.string_to_keysym("U2299"), XK_multiply, (uint)X.string_to_keysym("U2297"), 0 /*NoSymbol*/ })); + keysyms.set( 64, new KeycodeArray({ XK_Alt_L, XK_Alt_L, XK_Alt_L, XK_Alt_L, XK_Alt_L, XK_Alt_L })); + keysyms.set( 65, new KeycodeArray({ XK_space, XK_space, XK_space, XK_nobreakspace, XK_KP_0, (uint)X.string_to_keysym("U202F"), 0 /*NoSymbol*/ })); + keysyms.set( 66, new KeycodeArray({ XK_ISO_Level3_Shift })); + keysyms.set( 67, new KeycodeArray({ XK_F1, 0 /*XK_XF86_Switch_VT_1*/ })); + keysyms.set( 68, new KeycodeArray({ XK_F2, 0 /*XK_XF86_Switch_VT_2*/ })); + keysyms.set( 69, new KeycodeArray({ XK_F3, 0 /*XK_XF86_Switch_VT_3*/ })); + keysyms.set( 70, new KeycodeArray({ XK_F4, 0 /*XK_XF86_Switch_VT_4*/ })); + keysyms.set( 71, new KeycodeArray({ XK_F5, 0 /*XK_XF86_Switch_VT_5*/ })); + keysyms.set( 72, new KeycodeArray({ XK_F6, 0 /*XK_XF86_Switch_VT_6*/ })); + keysyms.set( 73, new KeycodeArray({ XK_F7, 0 /*XK_XF86_Switch_VT_7*/ })); + keysyms.set( 74, new KeycodeArray({ XK_F8, 0 /*XK_XF86_Switch_VT_8*/ })); + keysyms.set( 75, new KeycodeArray({ XK_F9, 0 /*XK_XF86_Switch_VT_9*/ })); + keysyms.set( 76, new KeycodeArray({ XK_F10, 0 /*XK_XF86_Switch_VT_10*/ })); + keysyms.set( 77, new KeycodeArray({ XK_Tab, XK_ISO_Left_Tab, XK_equal, XK_approxeq, XK_notequal, XK_identical, 0 /*NoSymbol*/ })); + keysyms.set( 78, new KeycodeArray({ XK_Scroll_Lock, XK_Scroll_Lock, XK_Scroll_Lock, XK_Scroll_Lock, XK_Scroll_Lock })); + keysyms.set( 79, new KeycodeArray({ XK_KP_7, (uint)X.string_to_keysym("U2714"), (uint)X.string_to_keysym("U2195"), (uint)X.string_to_keysym("U226A"), XK_KP_Home, XK_upstile, 0 /*NoSymbol*/ })); + keysyms.set( 80, new KeycodeArray({ XK_KP_8, (uint)X.string_to_keysym("U2718"), XK_uparrow, XK_intersection, XK_KP_Up, (uint)X.string_to_keysym("U22C2"), + 0 /*NoSymbol*/ })); + keysyms.set( 81, new KeycodeArray({ XK_KP_9, XK_dagger, (uint)X.string_to_keysym("U20D7"), (uint)X.string_to_keysym("U226B"), XK_KP_Prior, (uint)X.string_to_keysym("U2309"), 0 /*NoSymbol*/ })); + keysyms.set( 82, new KeycodeArray({ XK_KP_Subtract, XK_KP_Subtract, (uint)X.string_to_keysym("U2212"), (uint)X.string_to_keysym("U2296"), (uint)X.string_to_keysym("U2216"), (uint)X.string_to_keysym("U2238"), 0 /*NoSymbol*/ })); + keysyms.set( 83, new KeycodeArray({ XK_KP_4, XK_club, XK_leftarrow, XK_includedin, XK_KP_Left, (uint)X.string_to_keysym("U2286"), 0 /*NoSymbol*/ })); + keysyms.set( 84, new KeycodeArray({ XK_KP_5, XK_EuroSign, XK_colon, (uint)X.string_to_keysym("U22B6"), XK_KP_Begin, (uint)X.string_to_keysym("U22B7"), 0 /*NoSymbol*/ })); + keysyms.set( 85, new KeycodeArray({ XK_KP_6, (uint)X.string_to_keysym("U2023"), XK_rightarrow, XK_includes, XK_KP_Right, (uint)X.string_to_keysym("U2287"), 0 /*NoSymbol*/ })); + keysyms.set( 86, new KeycodeArray({ XK_KP_Add, XK_KP_Add, XK_plusminus, (uint)X.string_to_keysym("U2295"), (uint)X.string_to_keysym("U2213"), (uint)X.string_to_keysym("U2214"), 0 /*NoSymbol*/ })); + keysyms.set( 87, new KeycodeArray({ XK_KP_1, XK_diamond, (uint)X.string_to_keysym("U2194"), XK_lessthanequal, XK_KP_End, XK_downstile, 0 /*NoSymbol*/ })); + keysyms.set( 88, new KeycodeArray({ XK_KP_2, XK_heart, XK_downarrow, XK_union, XK_KP_Down, (uint)X.string_to_keysym("U22C3"), 0 /*NoSymbol*/ })); + keysyms.set( 89, new KeycodeArray({ XK_KP_3, (uint)X.string_to_keysym("U2660"), (uint)X.string_to_keysym("U21CC"), XK_greaterthanequal, XK_KP_Next, (uint)X.string_to_keysym("U230B"), 0 /*NoSymbol*/ })); + keysyms.set( 90, new KeycodeArray({ XK_KP_0, (uint)X.string_to_keysym("U2423"), XK_percent, (uint)X.string_to_keysym("U2030"), XK_KP_Insert, (uint)X.string_to_keysym("U25A1"), 0 /*NoSymbol*/ })); + keysyms.set( 91, new KeycodeArray({ XK_KP_Separator, XK_period, XK_comma, XK_minutes, XK_KP_Delete, XK_seconds, 0 /*NoSymbol*/ })); + keysyms.set( 92, new KeycodeArray({ XK_ISO_Level3_Shift })); + keysyms.set( 93, new KeycodeArray({ })); + keysyms.set( 94, new KeycodeArray({ XK_ISO_Level5_Shift, XK_ISO_Level5_Shift, XK_ISO_Level5_Shift, XK_ISO_Level5_Shift, XK_ISO_Level5_Lock, XK_ISO_Level5_Lock, XK_ISO_Level5_Lock })); + keysyms.set( 95, new KeycodeArray({ XK_F11, 0 /*XK_XF86_Switch_VT_11*/ })); + keysyms.set( 96, new KeycodeArray({ XK_F12, 0 /*XK_XF86_Switch_VT_12*/ })); + keysyms.set( 97, new KeycodeArray({ })); + keysyms.set( 98, new KeycodeArray({ XK_Katakana })); + keysyms.set( 99, new KeycodeArray({ XK_Hiragana })); + keysyms.set(100, new KeycodeArray({ XK_Henkan_Mode })); + keysyms.set(101, new KeycodeArray({ XK_Hiragana_Katakana })); + keysyms.set(102, new KeycodeArray({ XK_Muhenkan })); + keysyms.set(103, new KeycodeArray({ })); + keysyms.set(104, new KeycodeArray({ XK_KP_Enter, XK_KP_Enter, XK_KP_Enter, XK_KP_Enter, XK_KP_Enter, XK_KP_Enter, 0 /*NoSymbol*/ })); + keysyms.set(105, new KeycodeArray({ XK_Control_R, XK_Control_R, XK_Control_R, XK_Control_R, XK_Control_R })); + keysyms.set(106, new KeycodeArray({ XK_KP_Divide, XK_KP_Divide, XK_division, (uint)X.string_to_keysym("U2300"), (uint)X.string_to_keysym("U2215"), (uint)X.string_to_keysym("U2223"), 0 /*NoSymbol*/ })); + keysyms.set(107, new KeycodeArray({ XK_Print, XK_Sys_Req })); + keysyms.set(108, new KeycodeArray({ XK_ISO_Level5_Shift, XK_ISO_Level5_Shift, XK_ISO_Level5_Shift, XK_ISO_Level5_Shift, XK_ISO_Level5_Lock, XK_ISO_Level5_Lock, XK_ISO_Level5_Lock })); + keysyms.set(109, new KeycodeArray({ XK_Linefeed, XK_Linefeed, XK_Linefeed, XK_Linefeed, XK_Linefeed })); + keysyms.set(110, new KeycodeArray({ XK_Home, XK_Home, XK_Home, XK_Home, XK_Home })); + keysyms.set(111, new KeycodeArray({ XK_Up, XK_Up, XK_Up, XK_Up, XK_Up })); + keysyms.set(112, new KeycodeArray({ XK_Prior, XK_Prior, XK_Prior, XK_Prior, XK_Prior })); + keysyms.set(113, new KeycodeArray({ XK_Left, XK_Left, XK_Left, XK_Left, XK_Left })); + keysyms.set(114, new KeycodeArray({ XK_Right, XK_Right, XK_Right, XK_Right, XK_Right })); + keysyms.set(115, new KeycodeArray({ XK_End, XK_End, XK_End, XK_End, XK_End })); + keysyms.set(116, new KeycodeArray({ XK_Down, XK_Down, XK_Down, XK_Down, XK_Down })); + keysyms.set(117, new KeycodeArray({ XK_Next, XK_Next, XK_Next, XK_Next, XK_Next })); + keysyms.set(118, new KeycodeArray({ XK_Insert, XK_Insert, XK_Insert, XK_Insert, XK_Insert })); + keysyms.set(119, new KeycodeArray({ XK_Delete, XK_Delete, XK_Delete, XK_Delete, XK_Delete })); + keysyms.set(120, new KeycodeArray({ })); + keysyms.set(121, new KeycodeArray({ 0 /*XK_XF86AudioMute*/ })); + keysyms.set(122, new KeycodeArray({ 0 /*XK_XF86AudioLowerVolume*/ })); + keysyms.set(123, new KeycodeArray({ 0 /*XK_XF86AudioRaiseVolume*/ })); + keysyms.set(124, new KeycodeArray({ 0 /*XK_XF86PowerOff*/ })); + keysyms.set(125, new KeycodeArray({ XK_KP_Equal, 0 /*NoSymbol*/, 0 /*NoSymbol*/, 0 /*NoSymbol*/, 0 /*NoSymbol*/, 0 /*NoSymbol*/, 0 /*NoSymbol*/ })); + keysyms.set(126, new KeycodeArray({ XK_plusminus })); + keysyms.set(127, new KeycodeArray({ XK_Pause, XK_Break })); + keysyms.set(128, new KeycodeArray({ 0 /*XK_XF86LaunchA*/ })); + keysyms.set(129, new KeycodeArray({ XK_KP_Decimal })); + keysyms.set(130, new KeycodeArray({ XK_Hangul })); + keysyms.set(131, new KeycodeArray({ XK_Hangul_Hanja })); + keysyms.set(132, new KeycodeArray({ })); + keysyms.set(133, new KeycodeArray({ XK_Super_L })); + keysyms.set(134, new KeycodeArray({ XK_Super_R })); + keysyms.set(135, new KeycodeArray({ XK_Menu })); + keysyms.set(136, new KeycodeArray({ XK_Cancel })); + keysyms.set(137, new KeycodeArray({ XK_Redo })); + keysyms.set(138, new KeycodeArray({ 0 /*XK_SunProps*/ })); + keysyms.set(139, new KeycodeArray({ XK_Undo })); + keysyms.set(140, new KeycodeArray({ 0 /*XK_SunFront*/ })); + keysyms.set(141, new KeycodeArray({ 0 /*XK_XF86Copy*/ })); + keysyms.set(142, new KeycodeArray({ 0 /*XK_SunOpen*/ })); + keysyms.set(143, new KeycodeArray({ 0 /*XK_XF86Paste*/ })); + keysyms.set(144, new KeycodeArray({ XK_Find })); + keysyms.set(145, new KeycodeArray({ 0 /*XK_XF86Cut*/ })); + keysyms.set(146, new KeycodeArray({ XK_Help })); + keysyms.set(147, new KeycodeArray({ 0 /*XK_XF86MenuKB*/ })); + keysyms.set(148, new KeycodeArray({ 0 /*XK_XF86Calculator*/ })); + keysyms.set(149, new KeycodeArray({ })); + keysyms.set(150, new KeycodeArray({ 0 /*XK_XF86Sleep*/ })); + keysyms.set(151, new KeycodeArray({ 0 /*XK_XF86WakeUp*/ })); + keysyms.set(152, new KeycodeArray({ 0 /*XK_XF86Explorer*/ })); + keysyms.set(153, new KeycodeArray({ 0 /*XK_XF86Send*/ })); + keysyms.set(154, new KeycodeArray({ })); + keysyms.set(155, new KeycodeArray({ 0 /*XK_XF86Xfer*/ })); + keysyms.set(156, new KeycodeArray({ 0 /*XK_XF86Launch1*/ })); + keysyms.set(157, new KeycodeArray({ 0 /*XK_XF86Launch2*/ })); + keysyms.set(158, new KeycodeArray({ 0 /*XK_XF86WWW*/ })); + keysyms.set(159, new KeycodeArray({ 0 /*XK_XF86DOS*/ })); + keysyms.set(160, new KeycodeArray({ 0 /*XK_XF86ScreenSaver*/ })); + keysyms.set(161, new KeycodeArray({ })); + keysyms.set(162, new KeycodeArray({ 0 /*XK_XF86RotateWindows*/ })); + keysyms.set(163, new KeycodeArray({ 0 /*XK_XF86Mail*/ })); + keysyms.set(164, new KeycodeArray({ 0 /*XK_XF86Favorites*/ })); + keysyms.set(165, new KeycodeArray({ 0 /*XK_XF86MyComputer*/ })); + keysyms.set(166, new KeycodeArray({ 0 /*XK_XF86Back*/ })); + keysyms.set(167, new KeycodeArray({ 0 /*XK_XF86Forward*/ })); + keysyms.set(168, new KeycodeArray({ })); + keysyms.set(169, new KeycodeArray({ 0 /*XK_XF86Eject*/ })); + keysyms.set(170, new KeycodeArray({ 0 /*XK_XF86Eject*/, 0 /*XK_XF86Eject*/ })); + keysyms.set(171, new KeycodeArray({ 0 /*XK_XF86AudioNext*/ })); + keysyms.set(172, new KeycodeArray({ 0 /*XK_XF86AudioPlay*/, 0 /*XK_XF86AudioPause*/ })); + keysyms.set(173, new KeycodeArray({ 0 /*XK_XF86AudioPrev*/ })); + keysyms.set(174, new KeycodeArray({ 0 /*XK_XF86AudioStop*/, 0 /*XK_XF86Eject*/ })); + keysyms.set(175, new KeycodeArray({ 0 /*XK_XF86AudioRecord*/ })); + keysyms.set(176, new KeycodeArray({ 0 /*XK_XF86AudioRewind*/ })); + keysyms.set(177, new KeycodeArray({ 0 /*XK_XF86Phone*/ })); + keysyms.set(178, new KeycodeArray({ })); + keysyms.set(179, new KeycodeArray({ 0 /*XK_XF86Tools*/ })); + keysyms.set(180, new KeycodeArray({ 0 /*XK_XF86HomePage*/ })); + keysyms.set(181, new KeycodeArray({ 0 /*XK_XF86Reload*/ })); + keysyms.set(182, new KeycodeArray({ 0 /*XK_XF86Close*/ })); + keysyms.set(183, new KeycodeArray({ })); + keysyms.set(184, new KeycodeArray({ })); + keysyms.set(185, new KeycodeArray({ 0 /*XK_XF86ScrollUp*/ })); + keysyms.set(186, new KeycodeArray({ 0 /*XK_XF86ScrollDown*/ })); + keysyms.set(187, new KeycodeArray({ XK_parenleft })); + keysyms.set(188, new KeycodeArray({ XK_parenright })); + keysyms.set(189, new KeycodeArray({ 0 /*XK_XF86New*/ })); + keysyms.set(190, new KeycodeArray({ XK_Redo })); + keysyms.set(191, new KeycodeArray({ 0 /*XK_XF86Tools*/ })); + keysyms.set(192, new KeycodeArray({ 0 /*XK_XF86Launch5*/ })); + keysyms.set(193, new KeycodeArray({ 0 /*XK_XF86MenuKB*/ })); + keysyms.set(194, new KeycodeArray({ })); + keysyms.set(195, new KeycodeArray({ })); + keysyms.set(196, new KeycodeArray({ })); + keysyms.set(197, new KeycodeArray({ })); + keysyms.set(198, new KeycodeArray({ })); + keysyms.set(199, new KeycodeArray({ })); + keysyms.set(200, new KeycodeArray({ 0 /*XK_XF86TouchpadToggle*/ })); + keysyms.set(201, new KeycodeArray({ })); + keysyms.set(202, new KeycodeArray({ })); + keysyms.set(203, new KeycodeArray({ XK_ISO_Level5_Shift, XK_ISO_Level5_Shift, XK_ISO_Level5_Shift, XK_ISO_Level5_Shift, XK_ISO_Level5_Shift })); + keysyms.set(204, new KeycodeArray({ XK_Alt_L })); + keysyms.set(205, new KeycodeArray({ XK_Alt_L })); + keysyms.set(206, new KeycodeArray({ XK_Super_L })); + keysyms.set(207, new KeycodeArray({ })); + keysyms.set(208, new KeycodeArray({ 0 /*XK_XF86AudioPlay*/ })); + keysyms.set(209, new KeycodeArray({ 0 /*XK_XF86AudioPause*/ })); + keysyms.set(210, new KeycodeArray({ 0 /*XK_XF86Launch3*/ })); + keysyms.set(211, new KeycodeArray({ 0 /*XK_XF86Launch4*/ })); + keysyms.set(212, new KeycodeArray({ 0 /*XK_XF86LaunchB*/ })); + keysyms.set(213, new KeycodeArray({ 0 /*XK_XF86Suspend*/ })); + keysyms.set(214, new KeycodeArray({ 0 /*XK_XF86Close*/ })); + keysyms.set(215, new KeycodeArray({ 0 /*XK_XF86AudioPlay*/ })); + keysyms.set(216, new + KeycodeArray({ 0 /*XK_XF86AudioForward*/ })); + keysyms.set(217, new KeycodeArray({ })); + keysyms.set(218, new KeycodeArray({ XK_Print })); + keysyms.set(219, new KeycodeArray({ })); + keysyms.set(220, new KeycodeArray({ 0 /*XK_XF86WebCam*/ })); + keysyms.set(221, new KeycodeArray({ })); + keysyms.set(222, new KeycodeArray({ })); + keysyms.set(223, new KeycodeArray({ 0 /*XK_XF86Mail*/ })); + keysyms.set(224, new KeycodeArray({ })); + keysyms.set(225, new KeycodeArray({ 0 /*XK_XF86Search*/ })); + keysyms.set(226, new KeycodeArray({ })); + keysyms.set(227, new KeycodeArray({ 0 /*XK_XF86Finance*/ })); + keysyms.set(228, new KeycodeArray({ })); + keysyms.set(229, new KeycodeArray({ 0 /*XK_XF86Shop*/ })); + keysyms.set(230, new KeycodeArray({ })); + keysyms.set(231, new KeycodeArray({ XK_Cancel })); + keysyms.set(232, new KeycodeArray({ 0 /*XK_XF86MonBrightnessDown*/ })); + keysyms.set(233, new KeycodeArray({ 0 /*XK_XF86MonBrightnessUp*/ })); + keysyms.set(234, new KeycodeArray({ 0 /*XK_XF86AudioMedia*/ })); + keysyms.set(235, new KeycodeArray({ 0 /*XK_XF86Display*/ })); + keysyms.set(236, new KeycodeArray({ 0 /*XK_XF86KbdLightOnOff*/ })); + keysyms.set(237, new KeycodeArray({ 0 /*XK_XF86KbdBrightnessDown*/ })); + keysyms.set(238, new KeycodeArray({ 0 /*XK_XF86KbdBrightnessUp*/ })); + keysyms.set(239, new KeycodeArray({ 0 /*XK_XF86Send*/ })); + keysyms.set(240, new KeycodeArray({ 0 /*XK_XF86Reply*/ })); + keysyms.set(241, new KeycodeArray({ 0 /*XK_XF86MailForward*/ })); + keysyms.set(242, new KeycodeArray({ 0 /*XK_XF86Save*/ })); + keysyms.set(243, new KeycodeArray({ 0 /*XK_XF86Documents*/ })); + keysyms.set(244, new KeycodeArray({ 0 /*XK_XF86Battery*/ })); + keysyms.set(245, new KeycodeArray({ 0 /*XK_XF86Bluetooth*/ })); + keysyms.set(246, new KeycodeArray({ 0 /*XK_XF86WLAN*/ })); + keysyms.set(247, new KeycodeArray({ })); + keysyms.set(248, new KeycodeArray({ })); + keysyms.set(249, new KeycodeArray({ })); + keysyms.set(250, new KeycodeArray({ })); + keysyms.set(251, new KeycodeArray({ })); + keysyms.set(252, new KeycodeArray({ })); + keysyms.set(253, new KeycodeArray({ })); + keysyms.set(254, new KeycodeArray({ })); + keysyms.set(255, new KeycodeArray({ })); + + return keysyms; + } + } diff --git a/src/keybinding-manager.vala b/src/keybinding-manager.vala index 2995cbb..9e15f99 100644 --- a/src/keybinding-manager.vala +++ b/src/keybinding-manager.vala @@ -1,3 +1,6 @@ +/* vim: set tabstop=2:softtabstop=2:shiftwidth=2:noexpandtab */ +// modules: X + using X; namespace NeoLayoutViewer { @@ -189,8 +192,8 @@ namespace NeoLayoutViewer { } /* - Checks periodically which modifier are pressed. - */ + Checks periodically which modifier are pressed. + */ private bool modifier_timer(){ unowned X.Display display = Gdk.X11.get_default_xdisplay(); @@ -198,7 +201,7 @@ namespace NeoLayoutViewer { // Convert modifier keys to modifier/layer neo_win.change_active_modifier(1, true, (int)((modifier_pressed[0] | modifier_pressed[1]) - != (checkCapsLock(display) ? 1 : 0)) ); + != (checkCapsLock(display) ? 1 : 0)) ); neo_win.change_active_modifier(2, true, (int)(modifier_pressed[2] | modifier_pressed[3])); neo_win.change_active_modifier(3, true, (int)(modifier_pressed[4] | modifier_pressed[5])); neo_win.change_active_modifier(4, true, (int)(modifier_pressed[6] | modifier_pressed[7])); diff --git a/src/main.vala b/src/main.vala index 7fe34f8..1781d0e 100644 --- a/src/main.vala +++ b/src/main.vala @@ -1,3 +1,6 @@ +/* vim: set tabstop=2:softtabstop=2:shiftwidth=2:noexpandtab */ +// modules: X + using X; namespace NeoLayoutViewer{ @@ -61,20 +64,20 @@ namespace NeoLayoutViewer{ about.set_program_name("Neo2.0 Ebenenanzeige"); about.set_comments("""Erleichtert das Nachschlagen von Tastenkombinationen im Neo 2.0-Layout. - Olaf Schulz - funwithkinect@googlemail.com + Olaf Schulz + funwithkinect@googlemail.com -Tastenkombinationen: - Ein-/Ausblenden - %s - Bewegen - %s - Beenden (sofern Fenster selektiert) - q + Tastenkombinationen: + Ein-/Ausblenden - %s + Bewegen - %s + Beenden (sofern Fenster selektiert) - q - Verwendete Konfigurationsdatei: - %s""".printf( - app.neo_win.config.get("show_shortcut"), - app.neo_win.config.get("move_shortcut"), - configm.used_config_path) + Verwendete Konfigurationsdatei: + %s""".printf( + app.neo_win.config.get("show_shortcut"), + app.neo_win.config.get("move_shortcut"), + configm.used_config_path) ); about.set_copyright("LGPLv3"); center_window(about); diff --git a/src/neo-window.vala b/src/neo-window.vala index 3720bf0..caca75f 100644 --- a/src/neo-window.vala +++ b/src/neo-window.vala @@ -1,7 +1,11 @@ +/* vim: set tabstop=2:softtabstop=2:shiftwidth=2:noexpandtab */ +// modules: Gtk Gdk X Posix + using Gtk; using Gdk; using X; //keysym.h -using Posix;//system-calls +using Posix; //system-calls +using Cairo; namespace NeoLayoutViewer { @@ -14,7 +18,7 @@ namespace NeoLayoutViewer { public int modifier_index; public int active; - public Modkey(ref Gtk.Image i, int m) { + public Modkey(Gtk.Image i, int m) { this.modKeyImage = i; this.modifier_index = m; this.active = 0; @@ -33,9 +37,16 @@ namespace NeoLayoutViewer { public class NeoWindow : Gtk.ApplicationWindow { - private Gtk.Image image; - public Gtk.Label status; - private Gdk.Pixbuf[] image_buffer; + private ScalingImage image; + +#if _NO_WIN + private KeyOverlay key_overlay; +#endif + + public Gee.Map image_buffer; + private Gdk.Pixbuf[] layer_pixbufs; + private int monitor_w = -1; + public Gee.List modifier_key_images; // for modifier which didn't toggle a layout layer. I.e. ctrl, alt. public Gee.Map config; @@ -120,10 +131,9 @@ namespace NeoLayoutViewer { this.config = app.configm.getConfig(); this.minimized = true; - /* Set window type to let tiling window manager the chance - * to float the window automatically. + /* Set window type to let tiling window manager, i.e. i3-wm, + * the chance to float the window automatically. */ - //this.type_hint = Gdk.WindowTypeHint.SPLASHSCREEN; this.type_hint = Gdk.WindowTypeHint.UTILITY; this.NEO_MODIFIER_MASK = { @@ -156,8 +166,8 @@ namespace NeoLayoutViewer { string[] split = non_numeral.split(this.config.get("position_cycle")); /* Create array which can hold the parsed integers, but also some - unused indizes (0th. entry, 10th entry, …) - */ + unused indizes (0th. entry, 10th entry, …) + */ var min_len = ((position_num-1)/10 + 1)*10; position_cycle = new int[int.max(min_len, ( (split.length-1)/10 + 1)*10)]; // multiple of 10 and > 0 @@ -189,6 +199,9 @@ namespace NeoLayoutViewer { } catch (RegexError e) { fill_position_cycle_default(ref position_cycle); } + for (int i = 0;i < position_cycle.length; i++) { + GLib.stdout.printf(@"$(i)=> $(position_cycle[i])\n"); + } if (app.start_layer > 0 ){ this.fix_layer = true; @@ -199,7 +212,7 @@ namespace NeoLayoutViewer { } // Crawl dimensions of screen/display/monitor - // Should be done before load_image_buffer() is called. + // Should be done before load_images() is called. screen_dim_auto[0] = (this.config.get("screen_width") == "auto"); screen_dim_auto[1] = (this.config.get("screen_height") == "auto"); @@ -217,31 +230,46 @@ namespace NeoLayoutViewer { this.screen_dim[1] = int.max(1, int.parse(this.config.get("screen_height"))); } + // Load pngs of all six layers, etc + this.image_buffer = new Gee.HashMap(); + this.load_images(); - // Load pngs of all six layers - this.load_image_buffer(); - this.image = new Gtk.Image();//.from_pixbuf(this.image_buffer[layer]); + this.layer_pixbufs = { + this.image_buffer["unscaled_1"], + this.image_buffer["unscaled_2"], + this.image_buffer["unscaled_3"], + this.image_buffer["unscaled_4"], + this.image_buffer["unscaled_5"], + this.image_buffer["unscaled_6"], + }; + // Setup background image. + int backgroundW_unscaled = this.get_unscaled_width(); + int backgroundH_unscaled = this.get_unscaled_height(); + + this.image = new ScalingImage( + backgroundW_unscaled, backgroundH_unscaled, + this, backgroundW_unscaled, backgroundH_unscaled, + layer_pixbufs, 0); + + this.monitor_w = this.screen_dim[0]; + + // Setup startup size of window + int win_width = get_image_width_for_monitor(this.monitor_w); + int win_height = (backgroundH_unscaled * win_width)/ backgroundW_unscaled; + + this.resize(win_width, win_height); image.show(); - render_page(); var fixed = new Fixed(); - fixed.put(this.image, 0, 0); #if _NO_WIN - fixed.put(new KeyOverlay(this), 0, 0); + this.key_overlay = new KeyOverlay(this); + this.key_overlay.show(); + fixed.put(this.key_overlay, 0, 0); #endif - this.status = new Label(""); - status.show(); - int width; - int height; - this.get_size2(out width, out height); - - //bad position, if numpad not shown... - fixed.put( status, (int) ( (0.66)*width), (int) (0.40*height) ); - add(fixed); fixed.show(); @@ -255,7 +283,7 @@ namespace NeoLayoutViewer { this.skip_taskbar_hint = true; //Icon des Fensters - this.icon = this.image_buffer[0]; + this.icon = this.image_buffer["icon"]; //Nicht selektierbar (für virtuelle Tastatur) this.set_accept_focus((this.config.get("window_selectable") != "0")); @@ -309,25 +337,8 @@ namespace NeoLayoutViewer { return this.minimized; } - /* Falsche Werte bei „Tiled Window Managern“. */ - public void get_size2(out int width, out int height){ - width = this.image_buffer[1].width; - height = this.image_buffer[1].height; - } - public void numkeypad_move(int pos){ - if( (pos%10) <= 0 ){ - /* Resolve next position */ - pos = this.position_cycle[this.position_num]; - } - - GLib.assert( (pos%10) > 0 ); - if ( pos <= 0 || pos >= this.position_cycle.length ){ - GLib.stdout.printf("======= Positioning error! ======\n"); - pos = 5; - } - var display = Gdk.Display.get_default(); //var screen = Gdk.Screen.get_default(); var screen = display.get_default_screen(); @@ -335,7 +346,7 @@ namespace NeoLayoutViewer { //var monitor = display.get_monitor_at_window(screen.get_active_window()); #if GTK_MAJOR_VERSION == 2 || GTK_MINOR_VERSION == 18 || GTK_MINOR_VERSION == 19 || GTK_MINOR_VERSION == 20 || GTK_MINOR_VERSION == 21 - // Old variant for ubuntu 16.04 (Glib version < 3.22) + // Old variant for ubuntu 16.04 (Glib version < 3.22) var n_monitors = screen.get_n_monitors(); #else var n_monitors = display.get_n_monitors(); // Könnte n_1+n_2+…n_k sein mit k Screens?! @@ -343,13 +354,32 @@ namespace NeoLayoutViewer { debug(@"Number of monitors: $(n_monitors)"); GLib.assert(n_monitors > 0); + + // Automatic set of next position + if( (pos%10) == 0 ){ + /* Resolve next position */ + pos = this.position_cycle[this.position_num]; + } + GLib.assert( (pos%10) > 0 ); + + // Validate input for manual set of position. + // Note that 'extra monitors', which are not respected in position_cycle, will be ignored. + if ( pos >= this.position_cycle.length ){ + pos %= 10; // go back to first monitor + } + + if ( pos < 1 ){ + GLib.stdout.printf(@"Positioning error! Can not handle $(pos). Fall back on pos=5.\n"); + pos = 5; + } + GLib.assert(pos >= 0); /* Positions supports multiple screens, now. - 1-9 on monitor 0, 11-19 on monitor 1, … + 1-9 on monitor 0, 11-19 on monitor 1, … - This line shift indicies of non connected monitors to a available one. - */ + This line shift indicies of non connected monitors to a available one. + */ pos %= 10 * n_monitors; // Get monitor for this position @@ -365,14 +395,25 @@ namespace NeoLayoutViewer { Gdk.Rectangle monitor_rect_dest; screen.get_monitor_geometry(monitor_index, out monitor_rect_dest); - debug(@"Monitor($(monitor_index)) values: x=$(monitor_rect_dest.width), " + - @"y=$(monitor_rect_dest.y), w=$(monitor_rect_dest.width), h=$(monitor_rect_dest.height)\n"); + debug(@"Monitor($(monitor_index)) values: x=$(monitor_rect_dest.x), " + + @"y=$(monitor_rect_dest.y), w=$(monitor_rect_dest.width), h=$(monitor_rect_dest.height)\n"); - //int screen_width = this.get_screen_width(); - //int screen_height = this.get_screen_height(); + + // Check images of layers need to be rescaled + if (monitor_rect_dest.width != this.monitor_w && true){ + this.monitor_w = monitor_rect_dest.width; + + int width; + int height; + width = get_image_width_for_monitor(this.monitor_w); + height = get_unscaled_height() * width / get_unscaled_width(); + + this.resize(width, height); + } int x, y, w, h; - this.get_size(out w, out h); + this.get_size(out w, out h); // wrong if resolution changed?! TODO: Edit comment + //this.get_size2(out w, out h); // this reflect resolution changes switch(pos_on_screen) { case 0: //Zur nächsten Position wechseln @@ -441,12 +482,12 @@ namespace NeoLayoutViewer { if ( i_monitor < 0 ){ numkeypad_move(this.position_num + 10); }else{ - numkeypad_move(i_monitor + (this.position_num % 10)); + numkeypad_move( 10 * i_monitor + (this.position_num % 10)); } debug(@"New position: $(this.position_num)"); if( hide_after_latest && this.position_num < 10 ){ - // First monitor reached again + // First monitor reached again debug(@"Hide window. $(this.position_num)"); this.hide(); } @@ -465,44 +506,79 @@ namespace NeoLayoutViewer { } } - public void load_image_buffer () { - this.image_buffer = new Gdk.Pixbuf[7]; - this.image_buffer[0] = open_image_str(@"$(config.get("asset_folder"))/icons/Neo-Icon.png"); + public void load_images () { + this.image_buffer["icon"] = open_image_str( + @"$(config.get("asset_folder"))/icons/Neo-Icon.png"); - int screen_width = this.get_screen_width(); //Gdk.Screen.width(); - int max_width = (int) (double.parse(this.config.get("max_width")) * screen_width); - int min_width = (int) (double.parse(this.config.get("min_width")) * screen_width); - int width = int.min(int.max(int.parse(this.config.get("width")), min_width), max_width); - int w, h; + /* + int screen_width = this.get_screen_width(); //Gdk.Screen.width(); + int max_width = (int) (double.parse(this.config.get("max_width")) * screen_width); + int min_width = (int) (double.parse(this.config.get("min_width")) * screen_width); + int width = int.min(int.max(int.parse(this.config.get("width")), min_width), max_width); + int w, h; + */ this.numpad_width = int.parse(this.config.get("numpad_width")); this.function_keys_height = int.parse(this.config.get("function_keys_height")); for (int i = 1; i < 7; i++) { - this.image_buffer[i] = open_image(i); + Gdk.Pixbuf layer = open_image(i); - //Funktionstasten ausblennden, falls gefordert. + //Funktionstasten ausblenden, falls gefordert. if (this.config.get("display_function_keys") == "0") { - var tmp = new Gdk.Pixbuf(image_buffer[i].colorspace, image_buffer[i].has_alpha, image_buffer[i].bits_per_sample, image_buffer[i].width , image_buffer[i].height-function_keys_height); - this.image_buffer[i].copy_area(0, function_keys_height, tmp.width, tmp.height, tmp, 0, 0); - this.image_buffer[i] = tmp; + var tmp = new Gdk.Pixbuf(layer.colorspace, layer.has_alpha, layer.bits_per_sample, layer.width , layer.height-function_keys_height); + layer.copy_area(0, function_keys_height, tmp.width, tmp.height, tmp, 0, 0); + layer = tmp; } //Numpad-Teil abschneiden, falls gefordert. if (this.config.get("display_numpad") == "0") { - var tmp = new Gdk.Pixbuf(image_buffer[i].colorspace, image_buffer[i].has_alpha, image_buffer[i].bits_per_sample, image_buffer[i].width-numpad_width , image_buffer[i].height); - this.image_buffer[i].copy_area(0, 0, tmp.width, tmp.height, tmp, 0, 0); - this.image_buffer[i] = tmp; + var tmp = new Gdk.Pixbuf(layer.colorspace, layer.has_alpha, layer.bits_per_sample, layer.width-numpad_width , layer.height); + layer.copy_area(0, 0, tmp.width, tmp.height, tmp, 0, 0); + layer = tmp; } - //Bilder einmaling beim Laden skalieren. (Keine spätere Skalierung durch Größenänderung des Fensters) - w = this.image_buffer[i].width; - h = this.image_buffer[i].height; - this.image_buffer[i] = this.image_buffer[i].scale_simple(width, h * width / w, Gdk.InterpType.BILINEAR); + string id = @"unscaled_$(i)"; + this.image_buffer.set(id, layer); } } + /* + private void scale_images(int width, int height=-1) { + + int w, h; + for (int i = 1; i < 7; i++) { + Gdk.Pixbuf layer = this.image_buffer.get(@"unscaled_$(i)"); + w = layer.width; + h = layer.height; + + if( height < 0 ){ // keep aspect ratio + height = h * width / w; + } + var id = @"layer_$(i)_$(monitor_w)"; + debug(@"Generate image $(id)"); + this.image_buffer.set(id, + layer.scale_simple(width, height, Gdk.InterpType.BILINEAR)); + } + } + private int scale_images_for_monitor (int monitor_w) { + int width = get_image_width_for_monitor(monitor_w); + this.scale_images(width); + return width; + } + */ + + private int get_image_width_for_monitor (int monitor_w) { + + //int screen_width = this.get_screen_width(); //Gdk.Screen.width(); + int max_width = (int) (double.parse(this.config.get("max_width")) * monitor_w); + int min_width = (int) (double.parse(this.config.get("min_width")) * monitor_w); + int width = int.min(int.max(int.parse(this.config.get("width")), min_width), max_width); + + return width; + } + private bool on_key_pressed (Widget source, Gdk.EventKey key) { // If the key pressed was q, quit, else show the next page if (key.str == "q") { @@ -541,27 +617,27 @@ namespace NeoLayoutViewer { this.active_modifier_by_mouse[mod_index], new_mod_state, this.active_modifier_by_mouse[mod_index] - ]; - this.active_modifier_by_mouse[mod_index] = MODIFIER_KEYBOARD_MOUSE_MAP[ - this.active_modifier_by_mouse[mod_index], - old_mod_state, - this.active_modifier_by_mouse[mod_index], - new_mod_state + ]; + this.active_modifier_by_mouse[mod_index] = MODIFIER_KEYBOARD_MOUSE_MAP[ + this.active_modifier_by_mouse[mod_index], + old_mod_state, + this.active_modifier_by_mouse[mod_index], + new_mod_state ]; } else { //Mouseclick on shift button etc. - old_mod_state = this.active_modifier_by_mouse[mod_index]; + old_mod_state = this.active_modifier_by_mouse[mod_index]; this.active_modifier_by_mouse[mod_index] = MODIFIER_KEYBOARD_MOUSE_MAP[ old_mod_state, this.active_modifier_by_keyboard[mod_index], new_mod_state, this.active_modifier_by_keyboard[mod_index] - ]; - this.active_modifier_by_keyboard[mod_index] = MODIFIER_KEYBOARD_MOUSE_MAP[ - this.active_modifier_by_keyboard[mod_index], - old_mod_state, - this.active_modifier_by_keyboard[mod_index], - new_mod_state + ]; + this.active_modifier_by_keyboard[mod_index] = MODIFIER_KEYBOARD_MOUSE_MAP[ + this.active_modifier_by_keyboard[mod_index], + old_mod_state, + this.active_modifier_by_keyboard[mod_index], + new_mod_state ]; } @@ -615,11 +691,11 @@ namespace NeoLayoutViewer { private void render_page () { - this.image.set_from_pixbuf(this.image_buffer[this.layer]); + this.image.select_pixbuf(this.layer-1); } public Gdk.Pixbuf getIcon() { - return this.image_buffer[0]; + return this.image_buffer["icon"]; } public void external_key_press(int iet1, int modifier_mask) { @@ -676,6 +752,22 @@ namespace NeoLayoutViewer { return screen_dim[0]; } + public int get_unscaled_height() { + int backgroundH_unscaled = 250; + if (this.config.get("display_function_keys") == "0") { + backgroundH_unscaled -= this.function_keys_height; + } + return backgroundH_unscaled; + } + + public int get_unscaled_width() { + int backgroundW_unscaled = 1000; + if (this.config.get("display_numpad") == "0") { + backgroundW_unscaled -= this.numpad_width; + } + return backgroundW_unscaled; + } + public int get_screen_height(){ // Return value derived from config.get("screen_height")) or Gdk.Screen.height() @@ -705,21 +797,21 @@ namespace NeoLayoutViewer { private void fill_position_cycle_default(ref int[] positions){ /* Position Next position o ← o ← o - 9 8 9 4 7 8 ↓ ↑ - 6 5 6 ====> 1 3 9 o o o - 3 2 3 2 3 6 ↓ ↘ ↑ - o → o → o + 9 8 9 4 7 8 ↓ ↑ + 6 5 6 ====> 1 3 9 o o o + 3 2 3 2 3 6 ↓ ↘ ↑ + o → o → o - Values for monitor 4 are 11,…,19 and so on. + Values for monitor 4 are 11,…,19 and so on. - Example output: - positions = { - -1, 3, 3, 9, 1, 3, 9, 1, 7, 7, - -11, 13, 13, 19, 11, 13, 19, 11, 17, 17, - -21, 23, 23, 29, 21, 23, 29, 21, 27, 27, - -31, 33, 33, 39, 31, 33, 39, 31, 37, 37, - }; - */ + Example output: + positions = { + -1, 3, 3, 9, 1, 3, 9, 1, 7, 7, + -11, 13, 13, 19, 11, 13, 19, 11, 17, 17, + -21, 23, 23, 29, 21, 23, 29, 21, 27, 27, + -31, 33, 33, 39, 31, 33, 39, 31, 37, 37, + }; + */ GLib.assert( positions.length%10 == 0 && positions.length > 0); int n_monitors = positions.length/10; @@ -739,5 +831,4 @@ namespace NeoLayoutViewer { } } //End class NeoWindow - } diff --git a/src/scaling-image.vala b/src/scaling-image.vala new file mode 100644 index 0000000..6a4d405 --- /dev/null +++ b/src/scaling-image.vala @@ -0,0 +1,115 @@ +/* vim: set tabstop=2:softtabstop=2:shiftwidth=2:noexpandtab */ +// modules: Gtk Gdk + +using Gtk; +using Gdk; + +namespace NeoLayoutViewer { + + /* Reacts on window size changes. + * + */ + class ScalingImage: Gtk.Image { + + private Gtk.Window winMain; + private Gdk.Pixbuf[] source_pixbufs; + private Gdk.Pixbuf[] scaled_pixbufs; + private int width = -1; + private int height = -1; + private int start_width; + private int start_height; + private int reference_w; + private int reference_h; + private int win_width; + private int win_height; + private int source_index; + private static int __id = 0; + private int id; + + public ScalingImage( + int start_width, int start_height, + Gtk.Window winMain, int reference_w, int reference_h, + Gdk.Pixbuf[] source_pixbufs, + int start_source_index = 0 + ) + { + this.id = ScalingImage.__id++; + this.winMain = winMain; + this.start_width = start_width; + this.start_height = start_height; + this.width = start_width; + this.height = start_height; + this.reference_w = reference_w; + this.reference_h = reference_h; + + this.win_width = this.winMain.get_allocated_width(); + this.win_height = this.winMain.get_allocated_height(); + + this.source_pixbufs = source_pixbufs; + this.scaled_pixbufs = new Gdk.Pixbuf[source_pixbufs.length]; + + this.source_index = start_source_index; + GLib.assert(this.source_index >= 0); + GLib.assert(this.source_index < this.source_pixbufs.length); + + this.winMain.check_resize.connect(main_resized); + } + + private void main_resized(){ + + // Get new window size + int win_width2 = this.winMain.get_allocated_width(); + int win_height2 = this.winMain.get_allocated_height(); + + if (win_width == win_width2 && win_height == win_height2) { + //debug(@"(ScalingImage $(this.id)) same width $(win_width)"); + return; + } + + debug(@"Window resize signal. New width/height: $(width)/$(height)\n"); + + if( win_width2 == 1 && win_height2 == 1){ + return; // (1,1) send if user show/hides window very fast. + } + + // Eval new image size + GLib.assert(this.win_width > 0); + GLib.assert(this.win_height > 0); + + this.width = (this.start_width * win_width2)/this.reference_w; + this.height = (this.start_height * win_height2)/this.reference_h; + + // Overwrite old window size + this.win_width = win_width2; + this.win_height = win_height2; + + this.select_pixbuf(this.source_index); + } + + public void select_pixbuf(int new_source_index) + { + GLib.assert(new_source_index >= 0); + GLib.assert(new_source_index < this.source_pixbufs.length); + GLib.assert(this.source_pixbufs.length == this.scaled_pixbufs.length); + + this.source_index = new_source_index; + int i = new_source_index; + + // Scale pixbuf if required + if (this.scaled_pixbufs[i] == null || + this.width != this.scaled_pixbufs[i].width || + this.height != this.scaled_pixbufs[i].height) { + //debug(@"(ScalingImage $(this.id)) scaling to $(this.width)x$(this.height)"); + + this.scaled_pixbufs[i] = this.source_pixbufs[i].scale_simple( + this.width, this.height, Gdk.InterpType.BILINEAR); + } + + // Update displayed image + //debug(@"(ScalingImage $(this.id)) draw image"); + this.set_from_pixbuf(this.scaled_pixbufs[i]); + } + + } // End class ScalingImage +} + diff --git a/src/tray.vala b/src/tray.vala index 0a01646..bb7d741 100644 --- a/src/tray.vala +++ b/src/tray.vala @@ -1,3 +1,6 @@ +/* vim: set tabstop=2:softtabstop=2:shiftwidth=2:noexpandtab */ +// modules: Gtk + using Gtk; namespace NeoLayoutViewer { @@ -38,30 +41,30 @@ namespace NeoLayoutViewer { menuMain.append(menuQuit); #else - var aboutBox = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 2); + var aboutBox = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 2); var aboutIcon = new Gtk.Image.from_icon_name( "help-about", IconSize.SMALL_TOOLBAR); - var aboutLabel = new Gtk.Label.with_mnemonic("_About"); - var aboutMenuItem = new Gtk.MenuItem(); - aboutLabel.set_use_underline(true); - aboutLabel.set_xalign(0.0f); - aboutBox.pack_start(aboutIcon, false, false, 0); - aboutBox.pack_end(aboutLabel, true, true, 0); - aboutMenuItem.add(aboutBox); + var aboutLabel = new Gtk.Label.with_mnemonic("_About"); + var aboutMenuItem = new Gtk.MenuItem(); + aboutLabel.set_use_underline(true); + aboutLabel.set_xalign(0.0f); + aboutBox.pack_start(aboutIcon, false, false, 0); + aboutBox.pack_end(aboutLabel, true, true, 0); + aboutMenuItem.add(aboutBox); aboutMenuItem.activate.connect(NeoLayoutViewer.about_dialog); - menuMain.append(aboutMenuItem); + menuMain.append(aboutMenuItem); - var quitBox = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 2); + var quitBox = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 2); var quitIcon = new Gtk.Image.from_icon_name( "application-exit", IconSize.SMALL_TOOLBAR); - var quitLabel = new Gtk.Label.with_mnemonic("_QUIT"); - var quitMenuItem = new Gtk.MenuItem(); - quitLabel.set_use_underline(true); - quitLabel.set_xalign(0.0f); - quitBox.pack_start(quitIcon, false, false, 0); - quitBox.pack_end(quitLabel, true, true, 0); - quitMenuItem.add(quitBox); + var quitLabel = new Gtk.Label.with_mnemonic("_QUIT"); + var quitMenuItem = new Gtk.MenuItem(); + quitLabel.set_use_underline(true); + quitLabel.set_xalign(0.0f); + quitBox.pack_start(quitIcon, false, false, 0); + quitBox.pack_end(quitLabel, true, true, 0); + quitMenuItem.add(quitBox); //quitMenuItem.activate.connect(Gtk.main_quit); quitMenuItem.activate.connect(NeoLayoutViewer.quit); - menuMain.append(quitMenuItem); + menuMain.append(quitMenuItem); #endif menuMain.show_all();