From 7975dc2450afd9348e77f37948aef25a6a6c5331 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jean-Philippe=20Bruy=C3=A8re?= Date: Fri, 30 Nov 2018 21:47:39 +0100 Subject: [PATCH] various fixes --- Crow.csproj | 2 +- CrowIDE/src/CrowIDE.cs | 4 +- CrowIDE/src/DesignInterface.cs | 3 +- CrowIDE/src/Editors/CodeBuffer/TextEditor.cs | 54 +++++++++-------- CrowIDE/src/Editors/ImlVisualEditor.cs | 5 +- CrowIDE/src/Editors/SourceEditor.cs | 58 +++++++++---------- CrowIDE/ui/IDE.style | 1 - CrowIDE/ui/TabItem.template | 3 +- CrowIDE/ui/editors/EditPane.template | 2 +- CrowIDE/ui/editors/IMLEdit.itemp | 8 +-- Default.style | 3 +- Templates/ScrollBar.template | 6 +- Tests/BasicTests.cs | 15 ++++- .../Experimental/DockWindow.template | 34 +++++++++++ Tests/Interfaces/Experimental/testDock.crow | 7 ++- Tests/Tests.csproj | 3 + src/GraphicObjects/DockStack.cs | 21 +++++-- src/GraphicObjects/DockWindow.cs | 6 +- src/GraphicObjects/GraphicObject.cs | 6 +- src/GraphicObjects/MenuItem.cs | 5 +- src/GraphicObjects/TabItem.cs | 16 ++++- src/GraphicObjects/TemplatedGroup.cs | 8 +-- src/Interface.cs | 16 +++-- src/backends/xcb/XCBKeyboard.cs | 5 +- 24 files changed, 181 insertions(+), 110 deletions(-) create mode 100755 Tests/Interfaces/Experimental/DockWindow.template diff --git a/Crow.csproj b/Crow.csproj index 6ad0c309..0afb1db9 100644 --- a/Crow.csproj +++ b/Crow.csproj @@ -32,7 +32,7 @@ true false $(SolutionDir)build\Debug - DEBUG_LOG;XLIB_BACKEND0;DESIGN_MODE;DEBUG_UPDATE0;DEBUG_FOCUS0;DEBUG_DISPOSE0;TRACE0;DEBUG;MEASURE_TIME;DEBUG_LOAD0;DEBUG_BINDING0;DEBUG_CLIP_RECTANGLE0 + DEBUG_DRAGNDROP0;DEBUG_LOG0;XLIB_BACKEND0;DESIGN_MODE;DEBUG_UPDATE0;DEBUG_FOCUS0;DEBUG_DISPOSE0;TRACE0;DEBUG;MEASURE_TIME;DEBUG_LOAD0;DEBUG_BINDING0;DEBUG_CLIP_RECTANGLE0 diff --git a/CrowIDE/src/CrowIDE.cs b/CrowIDE/src/CrowIDE.cs index 89bcdcab..235b077f 100644 --- a/CrowIDE/src/CrowIDE.cs +++ b/CrowIDE/src/CrowIDE.cs @@ -122,11 +122,11 @@ namespace Crow.Coding { Console.WriteLine((byte)e.Key); //#if DEBUG_LOG - switch (e.Key) { + /*switch (e.Key) { case Key.F2: DebugLog.save (app); break; - } + }*/ //#endif } diff --git a/CrowIDE/src/DesignInterface.cs b/CrowIDE/src/DesignInterface.cs index d5ac7664..5f979782 100644 --- a/CrowIDE/src/DesignInterface.cs +++ b/CrowIDE/src/DesignInterface.cs @@ -53,7 +53,7 @@ namespace Crow.Coding } #endregion - public DesignInterface () + public DesignInterface () : base() { } @@ -63,7 +63,6 @@ namespace Crow.Coding protected override void InitBackend () { surf = CrowIDE.MainIFace.surf.CreateSimilar (Cairo.Content.ColorAlpha, 100, 100); - //base.initX (); } public override void ProcessResize (Rectangle bounds) { diff --git a/CrowIDE/src/Editors/CodeBuffer/TextEditor.cs b/CrowIDE/src/Editors/CodeBuffer/TextEditor.cs index 8067ffed..d5d9240a 100644 --- a/CrowIDE/src/Editors/CodeBuffer/TextEditor.cs +++ b/CrowIDE/src/Editors/CodeBuffer/TextEditor.cs @@ -530,14 +530,14 @@ namespace Crow.Text Key key = e.Key; - if (e.Control) { + if (IFace.Keyboard.Ctrl) { switch (key) { case Key.S: projFile.Save (); break; case Key.W: editorMutex.EnterWriteLock (); - if (e.Shift) + if (IFace.Keyboard.Shift) projFile.Redo (null); else projFile.Undo (null); @@ -551,7 +551,7 @@ namespace Crow.Text switch (key) { - case Key.Back: + case Key.BackSpace: buffer.Delete (); break; case Key.Clear: @@ -563,8 +563,8 @@ namespace Crow.Text // IFace.Clipboard = buffer.SelectedText; buffer.Delete (); break; - case Key.Enter: - case Key.KeypadEnter: + case Key.ISO_Enter: + case Key.KP_Enter: if (!buffer.SelectionIsEmpty) buffer.Delete (); buffer.InsertLineBreak (); @@ -573,46 +573,46 @@ namespace Crow.Text buffer.ResetSelection (); break; case Key.Home: - if (e.Shift) { + if (IFace.Keyboard.Shift) { if (buffer.SelectionIsEmpty) buffer.SetSelStartPos (); - if (e.Control) + if (IFace.Keyboard.Ctrl) buffer.CurrentLine = 0; buffer.CurrentColumn = 0; buffer.SetSelEndPos (); break; } buffer.ResetSelection (); - if (e.Control) + if (IFace.Keyboard.Ctrl) buffer.CurrentLine = 0; buffer.CurrentColumn = 0; break; case Key.End: - if (e.Shift) { + if (IFace.Keyboard.Shift) { if (buffer.SelectionIsEmpty) buffer.SetSelStartPos (); - if (e.Control) + if (IFace.Keyboard.Ctrl) buffer.CurrentLine = int.MaxValue; buffer.CurrentColumn = int.MaxValue; buffer.SetSelEndPos (); break; } buffer.ResetSelection (); - if (e.Control) + if (IFace.Keyboard.Ctrl) buffer.CurrentLine = int.MaxValue; buffer.CurrentColumn = int.MaxValue; break; case Key.Insert: - if (e.Shift) + if (IFace.Keyboard.Shift) buffer.InsertAt (IFace.Clipboard); - else if (e.Control && !buffer.SelectionIsEmpty) + else if (IFace.Keyboard.Ctrl && !buffer.SelectionIsEmpty) IFace.Clipboard = buffer.SelectedText; break; case Key.Left: - if (e.Shift) { + if (IFace.Keyboard.Shift) { if (buffer.SelectionIsEmpty) buffer.SetSelStartPos (); - if (e.Control) + if (IFace.Keyboard.Ctrl) buffer.GotoWordStart (); else buffer.MoveLeft (); @@ -620,16 +620,16 @@ namespace Crow.Text break; } buffer.ResetSelection (); - if (e.Control) + if (IFace.Keyboard.Ctrl) buffer.GotoWordStart (); else buffer.MoveLeft(); break; case Key.Right: - if (e.Shift) { + if (IFace.Keyboard.Shift) { if (buffer.SelectionIsEmpty) buffer.SetSelStartPos (); - if (e.Control) + if (IFace.Keyboard.Ctrl) buffer.GotoWordEnd (); else buffer.MoveRight (); @@ -637,13 +637,13 @@ namespace Crow.Text break; } buffer.ResetSelection (); - if (e.Control) + if (IFace.Keyboard.Ctrl) buffer.GotoWordEnd (); else buffer.MoveRight (); break; case Key.Up: - if (e.Shift) { + if (IFace.Keyboard.Shift) { if (buffer.SelectionIsEmpty) buffer.SetSelStartPos (); CurrentLine--; @@ -654,7 +654,7 @@ namespace Crow.Text CurrentLine--; break; case Key.Down: - if (e.Shift) { + if (IFace.Keyboard.Shift) { if (buffer.SelectionIsEmpty) buffer.SetSelStartPos (); CurrentLine++; @@ -666,10 +666,10 @@ namespace Crow.Text break; case Key.Menu: break; - case Key.NumLock: + case Key.Num_Lock: break; - case Key.PageDown: - if (e.Shift) { + case Key.Page_Down: + if (IFace.Keyboard.Shift) { if (buffer.SelectionIsEmpty) buffer.SetSelStartPos (); CurrentLine += visibleLines; @@ -679,8 +679,8 @@ namespace Crow.Text buffer.ResetSelection (); CurrentLine += visibleLines; break; - case Key.PageUp: - if (e.Shift) { + case Key.Page_Up: + if (IFace.Keyboard.Shift) { if (buffer.SelectionIsEmpty) buffer.SetSelStartPos (); CurrentLine -= visibleLines; @@ -690,8 +690,6 @@ namespace Crow.Text buffer.ResetSelection (); CurrentLine -= visibleLines; break; - case Key.RWin: - break; case Key.Tab: buffer.InsertAt ("\t"); break; diff --git a/CrowIDE/src/Editors/ImlVisualEditor.cs b/CrowIDE/src/Editors/ImlVisualEditor.cs index a7b59c39..3cb4f866 100644 --- a/CrowIDE/src/Editors/ImlVisualEditor.cs +++ b/CrowIDE/src/Editors/ImlVisualEditor.cs @@ -279,6 +279,7 @@ namespace Crow.Coding SelectedItem = go; } catch (Exception ex) { Error = ex; + Debug.WriteLine ("Error Loading ui in Design iface\n" + ex.ToString ()); if (Monitor.IsEntered(imlVE.UpdateMutex)) Monitor.Exit (imlVE.UpdateMutex); } @@ -295,9 +296,9 @@ namespace Crow.Coding lock (imlVE.RenderMutex) isDirty = imlVE.IsDirty; - if (isDirty) { + if (isDirty) { lock (IFace.UpdateMutex) - RegisterForRedraw (); + RegisterForRedraw (); } } #endregion diff --git a/CrowIDE/src/Editors/SourceEditor.cs b/CrowIDE/src/Editors/SourceEditor.cs index 586c5f9f..3cf422b9 100644 --- a/CrowIDE/src/Editors/SourceEditor.cs +++ b/CrowIDE/src/Editors/SourceEditor.cs @@ -1008,14 +1008,14 @@ namespace Crow.Coding Key key = e.Key; - if (e.Control) { + if (IFace.Keyboard.Ctrl) { switch (key) { case Key.S: projFile.Save (); break; case Key.W: editorMutex.EnterWriteLock (); - if (e.Shift) + if (IFace.Keyboard.Shift) projFile.Redo (null); else projFile.Undo (null); @@ -1029,7 +1029,7 @@ namespace Crow.Coding switch (key) { - case Key.Back: + case Key.BackSpace: buffer.DeleteChar (); break; case Key.Clear: @@ -1037,12 +1037,12 @@ namespace Crow.Coding case Key.Delete: if (buffer.SelectionIsEmpty) MoveRight (); - else if (e.Shift) + else if (IFace.Keyboard.Shift) IFace.Clipboard = buffer.SelectedText; buffer.DeleteChar (); break; - case Key.Enter: - case Key.KeypadEnter: + case Key.Return: + case Key.KP_Enter: if (!buffer.SelectionIsEmpty) buffer.DeleteChar (); buffer.InsertLineBreak (); @@ -1051,46 +1051,46 @@ namespace Crow.Coding buffer.ResetSelection (); break; case Key.Home: - if (e.Shift) { + if (IFace.Keyboard.Shift) { if (buffer.SelectionIsEmpty) buffer.SetSelStartPos (); - if (e.Control) + if (IFace.Keyboard.Ctrl) buffer.CurrentLine = 0; buffer.CurrentColumn = 0; buffer.SetSelEndPos (); break; } buffer.ResetSelection (); - if (e.Control) + if (IFace.Keyboard.Ctrl) buffer.CurrentLine = 0; buffer.CurrentColumn = 0; break; case Key.End: - if (e.Shift) { + if (IFace.Keyboard.Shift) { if (buffer.SelectionIsEmpty) buffer.SetSelStartPos (); - if (e.Control) + if (IFace.Keyboard.Ctrl) buffer.CurrentLine = int.MaxValue; buffer.CurrentColumn = int.MaxValue; buffer.SetSelEndPos (); break; } buffer.ResetSelection (); - if (e.Control) + if (IFace.Keyboard.Ctrl) buffer.CurrentLine = int.MaxValue; buffer.CurrentColumn = int.MaxValue; break; case Key.Insert: - if (e.Shift) + if (IFace.Keyboard.Shift) buffer.Insert (IFace.Clipboard); - else if (e.Control && !buffer.SelectionIsEmpty) + else if (IFace.Keyboard.Ctrl && !buffer.SelectionIsEmpty) IFace.Clipboard = buffer.SelectedText; break; case Key.Left: - if (e.Shift) { + if (IFace.Keyboard.Shift) { if (buffer.SelectionIsEmpty) buffer.SetSelStartPos (); - if (e.Control) + if (IFace.Keyboard.Ctrl) buffer.GotoWordStart (); else MoveLeft (); @@ -1098,16 +1098,16 @@ namespace Crow.Coding break; } buffer.ResetSelection (); - if (e.Control) + if (IFace.Keyboard.Ctrl) buffer.GotoWordStart (); else MoveLeft(); break; case Key.Right: - if (e.Shift) { + if (IFace.Keyboard.Shift) { if (buffer.SelectionIsEmpty) buffer.SetSelStartPos (); - if (e.Control) + if (IFace.Keyboard.Ctrl) buffer.GotoWordEnd (); else MoveRight (); @@ -1115,13 +1115,13 @@ namespace Crow.Coding break; } buffer.ResetSelection (); - if (e.Control) + if (IFace.Keyboard.Ctrl) buffer.GotoWordEnd (); else MoveRight (); break; case Key.Up: - if (e.Shift) { + if (IFace.Keyboard.Shift) { if (buffer.SelectionIsEmpty) buffer.SetSelStartPos (); PrintedCurrentLine--; @@ -1132,7 +1132,7 @@ namespace Crow.Coding PrintedCurrentLine--; break; case Key.Down: - if (e.Shift) { + if (IFace.Keyboard.Shift) { if (buffer.SelectionIsEmpty) buffer.SetSelStartPos (); PrintedCurrentLine++; @@ -1144,10 +1144,10 @@ namespace Crow.Coding break; case Key.Menu: break; - case Key.NumLock: + case Key.Num_Lock: break; - case Key.PageDown: - if (e.Shift) { + case Key.Page_Down: + if (IFace.Keyboard.Shift) { if (buffer.SelectionIsEmpty) buffer.SetSelStartPos (); PrintedCurrentLine += visibleLines; @@ -1157,8 +1157,8 @@ namespace Crow.Coding buffer.ResetSelection (); PrintedCurrentLine += visibleLines; break; - case Key.PageUp: - if (e.Shift) { + case Key.Page_Up: + if (IFace.Keyboard.Shift) { if (buffer.SelectionIsEmpty) buffer.SetSelStartPos (); PrintedCurrentLine -= visibleLines; @@ -1168,10 +1168,8 @@ namespace Crow.Coding buffer.ResetSelection (); PrintedCurrentLine -= visibleLines; break; - case Key.RWin: - break; case Key.Tab: - if (e.Shift) { + if (IFace.Keyboard.Shift) { if (buffer.SelectionIsEmpty || (buffer.SelectionStart.Y == buffer.SelectionEnd.Y)) { //TODO diff --git a/CrowIDE/ui/IDE.style b/CrowIDE/ui/IDE.style index 5afbaf7d..506bb9e9 100644 --- a/CrowIDE/ui/IDE.style +++ b/CrowIDE/ui/IDE.style @@ -33,7 +33,6 @@ WinSchema { } TabItem { AllowDrag="false"; - Background="Jet"; } TreeItemBorder { CornerRadius="2"; diff --git a/CrowIDE/ui/TabItem.template b/CrowIDE/ui/TabItem.template index 66caeb0c..42530597 100644 --- a/CrowIDE/ui/TabItem.template +++ b/CrowIDE/ui/TabItem.template @@ -1,6 +1,5 @@  - - + diff --git a/CrowIDE/ui/editors/IMLEdit.itemp b/CrowIDE/ui/editors/IMLEdit.itemp index 290a9c6f..d0dae076 100644 --- a/CrowIDE/ui/editors/IMLEdit.itemp +++ b/CrowIDE/ui/editors/IMLEdit.itemp @@ -1,7 +1,7 @@  - + - + - + TextAlignment="TopLeft" Multiline="true"/> diff --git a/Default.style b/Default.style index 29b5edea..9709eef9 100644 --- a/Default.style +++ b/Default.style @@ -128,13 +128,14 @@ DockStack { //EndDrag="{Background=Jet}"; } DockWindow { - Background = "Onyx"; + //Background = "Onyx"; Focusable = "true"; AllowDrag = "true"; AlwaysOnTop = "true"; Margin="0"; Width="200"; Height="200"; + //MinimumSize="50,50"; } FileDialog { Template = "#Crow.FileDialog.template"; diff --git a/Templates/ScrollBar.template b/Templates/ScrollBar.template index c19b5680..de1eaf3b 100755 --- a/Templates/ScrollBar.template +++ b/Templates/ScrollBar.template @@ -1,5 +1,5 @@ - + + Background="hgradient|0:DimGrey|0.1:Grey|0.95:Grey|1:White"/> \ No newline at end of file diff --git a/Tests/BasicTests.cs b/Tests/BasicTests.cs index 4f9fd128..c3d3a781 100644 --- a/Tests/BasicTests.cs +++ b/Tests/BasicTests.cs @@ -23,7 +23,16 @@ namespace tests //app.AddWidget (@"Interfaces/Container/0.crow").DataSource = app; //app.AddWidget (@"Interfaces/Divers/colorPicker.crow").DataSource = app; //app.AddWidget ("Interfaces/Divers/perfMeasures.crow").DataSource = app; - app.AddWidget ("#Tests.ui.dbgLog.crow").DataSource = app; + //app.AddWidget ("#Tests.ui.dbgLog.crow").DataSource = app; + app.AddWidget (@"Interfaces/Experimental/testDock.crow").DataSource = app; + + app.LoadIMLFragment (@""); + app.LoadIMLFragment (@""); + app.LoadIMLFragment (@""); + /*app.LoadIMLFragment (@""); + app.LoadIMLFragment (@""); + app.LoadIMLFragment (@"");*/ + while (true) { #if MEASURE_TIME @@ -55,11 +64,11 @@ namespace tests { Console.WriteLine((byte)e.Key); //#if DEBUG_LOG - switch (e.Key) { + /*switch (e.Key) { case Key.F2: DebugLog.save (app); break; - } + }*/ //#endif } } diff --git a/Tests/Interfaces/Experimental/DockWindow.template b/Tests/Interfaces/Experimental/DockWindow.template new file mode 100755 index 00000000..2d39bd4b --- /dev/null +++ b/Tests/Interfaces/Experimental/DockWindow.template @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + diff --git a/Tests/Interfaces/Experimental/testDock.crow b/Tests/Interfaces/Experimental/testDock.crow index 0b05e76d..62a5203c 100644 --- a/Tests/Interfaces/Experimental/testDock.crow +++ b/Tests/Interfaces/Experimental/testDock.crow @@ -1,8 +1,9 @@  - - + + + - diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj index 0aef448b..049ab6f9 100644 --- a/Tests/Tests.csproj +++ b/Tests/Tests.csproj @@ -420,6 +420,9 @@ Crow.TabItem.template + + Crow.DockWindow.template + diff --git a/src/GraphicObjects/DockStack.cs b/src/GraphicObjects/DockStack.cs index ae8b9c89..f2174024 100644 --- a/src/GraphicObjects/DockStack.cs +++ b/src/GraphicObjects/DockStack.cs @@ -25,6 +25,7 @@ // THE SOFTWARE. using System; using Crow.IML; +using System.Linq; namespace Crow { @@ -36,6 +37,13 @@ namespace Crow public DockStack (Interface iface) : base (iface) {} #endregion + /*static int color = 10; + + protected override void onInitialized (object sender, EventArgs e) + { + base.onInitialized (sender, e); + Background = Color.ColorDic.Values.ToList()[color++]; + }*/ public override void AddChild (GraphicObject g) { base.AddChild (g); @@ -68,8 +76,9 @@ namespace Crow return false; } } + childrenRWLock.ExitReadLock (); } - childrenRWLock.ExitReadLock (); + return Slot.ContainsOrIsEqual(m); } @@ -172,8 +181,8 @@ namespace Crow protected override void onDragLeave (object sender, DragDropEventArgs e) { DockWindow dw = e.DragSource as DockWindow; - if (dw != null) - dw.DockingPosition = Alignment.Undefined; + //if (dw != null) + // dw.DockingPosition = Alignment.Undefined; base.onDragLeave (sender, e); RegisterForGraphicUpdate (); } @@ -307,14 +316,16 @@ namespace Crow break; } } - public void Undock (DockWindow dw){ + public void Undock (DockWindow dw){ int idx = Children.IndexOf(dw); + Console.WriteLine ("undocking child index: {0} ; name={1}; pos:{2} ; childcount:{3}",idx, dw.Name, dw.DockingPosition, Children.Count); + RemoveChild(dw); if (Children.Count == 0) return; - + if (dw.DockingPosition == Alignment.Left || dw.DockingPosition == Alignment.Top) { RemoveChild (idx); if (stretchedChild == dw) { diff --git a/src/GraphicObjects/DockWindow.cs b/src/GraphicObjects/DockWindow.cs index ca4b93f4..1ae3b0b4 100644 --- a/src/GraphicObjects/DockWindow.cs +++ b/src/GraphicObjects/DockWindow.cs @@ -109,8 +109,8 @@ namespace Crow undockingMousePosOrig = e.Position; } public bool CheckUndock (Point mousePos) { - if (DockingPosition == Alignment.Center) - return false; + //if (DockingPosition == Alignment.Center) + // return false; if (Math.Abs (mousePos.X - undockingMousePosOrig.X) < undockThreshold || Math.Abs (mousePos.X - undockingMousePosOrig.X) < undockThreshold) return false; @@ -126,7 +126,7 @@ namespace Crow } protected override void onDrop (object sender, DragDropEventArgs e) { - if (!isDocked && DockingPosition != Alignment.Undefined) + if (!isDocked && DockingPosition != Alignment.Undefined && e.DropTarget is DockStack) Dock (e.DropTarget as DockStack); base.onDrop (sender, e); } diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs index e67b3523..2bf20f27 100644 --- a/src/GraphicObjects/GraphicObject.cs +++ b/src/GraphicObjects/GraphicObject.cs @@ -1386,7 +1386,7 @@ namespace Crow [MethodImpl(MethodImplOptions.AggressiveInlining)] public void RegisterForRedraw () { - //IsDirty = true; + IsDirty = true; if (RegisteredLayoutings == LayoutingType.None) IFace.EnqueueForRepaint (this); } @@ -1789,8 +1789,6 @@ namespace Crow Debug.WriteLine("MOUSE DOWN => " + this.ToString()); #endif - if (IFace.ActiveWidget == null) - IFace.ActiveWidget = this; if (this.Focusable && !Interface.FocusOnHover) { BubblingMouseButtonEventArg be = e as BubblingMouseButtonEventArg; if (be.Focused == null) { @@ -1956,7 +1954,7 @@ namespace Crow #if DEBUG_LAYOUTING return Name == "unamed" ? tmp + "." + this.GetType ().Name + GraphicObjects.IndexOf(this).ToString(): tmp + "." + Name; #else - return Name == "unamed" ? tmp + "." + this.GetType ().Name : tmp + "." + Name; + return string.IsNullOrEmpty(Name) ? tmp + "." + this.GetType ().Name : tmp + "." + Name; #endif } /// diff --git a/src/GraphicObjects/MenuItem.cs b/src/GraphicObjects/MenuItem.cs index 5c9665fb..47bd978f 100644 --- a/src/GraphicObjects/MenuItem.cs +++ b/src/GraphicObjects/MenuItem.cs @@ -164,7 +164,10 @@ namespace Crow public override void onMouseEnter (object sender, MouseMoveEventArgs e) { base.onMouseEnter (sender, e); - if ((LogicalParent as Menu).AutomaticOpenning && items.Children.Count>0) + Menu menu = LogicalParent as Menu; + if (menu == null) + return; + if (menu.AutomaticOpenning && items.Children.Count>0) IsOpened = true; } public override void onMouseLeave (object sender, MouseMoveEventArgs e) diff --git a/src/GraphicObjects/TabItem.cs b/src/GraphicObjects/TabItem.cs index 473fc313..8ddd7a8e 100644 --- a/src/GraphicObjects/TabItem.cs +++ b/src/GraphicObjects/TabItem.cs @@ -148,8 +148,13 @@ namespace Crow gr.LineWidth = 1; Foreground.SetAsSource (gr); gr.StrokePreserve (); - gr.Clip (); + gr.ClipPreserve (); + + Background.SetAsSource (gr); + gr.Fill (); + base.onDraw (gr); + gr.Restore (); } @@ -157,7 +162,14 @@ namespace Crow int dragThreshold = 16; int dis = 128; internal TabView savedParent = null; - + public override Fill Background { + get { + return base.Background; + } + set { + base.Background = value; + } + } void makeFloating (TabView tv) { lock (IFace.UpdateMutex) { ImageSurface di = new ImageSurface (Format.Argb32, dis, dis); diff --git a/src/GraphicObjects/TemplatedGroup.cs b/src/GraphicObjects/TemplatedGroup.cs index f7c93763..73681b9d 100644 --- a/src/GraphicObjects/TemplatedGroup.cs +++ b/src/GraphicObjects/TemplatedGroup.cs @@ -154,17 +154,17 @@ namespace Crow if (value == _selectedIndex) return; - if (_selectedIndex >= 0 && Items.Count > _selectedIndex) { + /*if (_selectedIndex >= 0 && Items.Count > _selectedIndex) { Items[_selectedIndex].Foreground = Color.Transparent; Items[_selectedIndex].Background = Color.Transparent; - } + }*/ _selectedIndex = value; - if (_selectedIndex >= 0 && Items.Count > _selectedIndex) { + /*if (_selectedIndex >= 0 && Items.Count > _selectedIndex) { Items[_selectedIndex].Foreground = SelectionForeground; Items[_selectedIndex].Background = SelectionBackground; - } + }*/ NotifyValueChanged ("SelectedIndex", _selectedIndex); NotifyValueChanged ("SelectedItem", SelectedItem); diff --git a/src/Interface.cs b/src/Interface.cs index 743bbb0f..77137761 100644 --- a/src/Interface.cs +++ b/src/Interface.cs @@ -128,6 +128,9 @@ namespace Crow Keyboard.KeyUp += Keyboard_KeyUp; Keyboard.KeyPress += Keyboard_KeyPress; + initTooltip (); + initContextMenus (); + Thread t = new Thread (interfaceThread); t.IsBackground = true; t.Start (); @@ -161,7 +164,7 @@ namespace Crow // keyboardRepeatThread = new Thread (keyboardRepeatThreadFunc); // keyboardRepeatThread.IsBackground = true; // keyboardRepeatThread.Start (); - } + } void interfaceThread() { @@ -212,8 +215,6 @@ namespace Crow //loadCursors (); loadStyling (); findAvailableTemplates (); - //initTooltip (); - //initContextMenus (); #if MEASURE_TIME PerfMeasures.Add (updateMeasure); @@ -500,9 +501,9 @@ namespace Crow } } /// - /// Add the content of the IML fragment to the graphic tree of this interface + /// Create an instantiator bound to this interface from the IML fragment /// - /// return the new instance for convenience, may be ignored + /// return the new instantiator /// a valid IML string public Instantiator CreateITorFromIMLFragment (string imlFragment) { return Instantiator.CreateFromImlFragment (this, imlFragment); @@ -816,7 +817,7 @@ namespace Crow clipping = new Region (); //} //surf.WriteToPng (@"/mnt/data/test.png"); - surf.Flush(); + backend?.Flush (); } } @@ -1125,6 +1126,9 @@ namespace Crow if (FocusedWidget == null) return true; + + ActiveWidget = FocusedWidget; + if (!FocusedWidget.MouseRepeat) return true; mouseRepeatThread = new Thread (mouseRepeatThreadFunc); diff --git a/src/backends/xcb/XCBKeyboard.cs b/src/backends/xcb/XCBKeyboard.cs index c5e68654..c7484f50 100644 --- a/src/backends/xcb/XCBKeyboard.cs +++ b/src/backends/xcb/XCBKeyboard.cs @@ -2548,9 +2548,10 @@ namespace Crow.XKB Marshal.Copy (ptrKeySyms, keySyms, 0, nbKeySyms); uint utf32 = xkb_state_key_get_utf32 (xkbState, keycode); + char c = char.ConvertFromUtf32 ((int)utf32) [0]; - if (utf32 > 0) - KeyPress.Raise (this, new KeyPressEventArgs (char.ConvertFromUtf32 ((int)utf32) [0])); + if (!char.IsControl(c)) + KeyPress.Raise (this, new KeyPressEventArgs (c)); } else { keyDir = xkb_key_direction.KEY_UP; KeyUp.Raise (this, new KeyEventArgs ((Key)ks, false)); -- 2.47.3