Age | Commit message (Collapse) | Author |
|
(#18785)
* Bring back old HttpHandler for Android
Co-authored-by: Egor Bogatov <egorbo@gmail.com>
|
|
Follow-up to https://github.com/mono/mono/pull/18228 since two parts wasn't enough to fix the size issue on 32bits devices.
We now use three parts.
Fixes https://github.com/mono/mono/issues/18614
|
|
* Use memmove in Buffer.MemoryCopy
* add test case
|
|
Assume we have the following form `MyForm`:
```
using System;
using System.Drawing;
using System.Windows.Forms;
namespace test_TreeView
{
public class MyForm : Form
{
TreeView treeView = new TreeView()
public MyForm()
{
treeView.Nodes.Add("root node");
treeView.Nodes[0].Nodes.Add("first child node");
treeView.BackColor = Color.Gray;
treeView.LineColor = Color.Yellow;
treeView.DrawMode = TreeViewDrawMode.OwnerDrawText;
treeView.DrawNode += treeView_DrawNode;
Controls.Add(treeView);
}
private void treeView_DrawNode(object sender, DrawTreeNodeEventArgs e)
{
var brush = new SolidBrush(Color.FromArgb(100, 255, 0, 0));
e.Graphics.FillRectangle(brush, e.Bounds);
}
}
}
```
The displayed result is
![image](https://user-images.githubusercontent.com/12382656/73263417-92872980-41e1-11ea-8f7c-7cecbb376b60.png)
One can see couple drawing issues:
* White rectangles under each `TreeNode`.
* The area of custom drawing (red rectangles) is shifted with respect to this white rectangles.
Current PR proposes the fix of this issues.
Co-authored-by: monojenkins <jo.shields+jenkins@xamarin.com>
|
|
* Fix Return handling. Ensure correct ClientSize.
When pressing Return / Enter, ensure any target button is both visible
and enabled.
In CreateHandle(), ensure the ClientSize is correct if set. If not,
update it to make it right. Suspend layout while changing it so that
child controls with anchors other than Top Left are not moved.
* Select active control. PerformLayout after updating for client size.
Select the active control with SendControlFocus to avoid upsetting what
is currently selected.
* Improve Form window decoration adjustment handling
Reverts the incorrect attempted fix contained in previous commits.
Basically, when a property is changed that affects window decorations,
ensure the client size stays the same.
* Use UpdateFormStyles on FormBorderStyle too.
|
|
When the user types a letter or digit, KeySearch looks for and selects
an item starting with that character. However, it should not if
SelectionMode is None.
|
|
* [WinForms] Make `ContextMenuStrip` behavior closer to the reference one
* Bump API snapshot submodule
Co-authored-by: monojenkins <jo.shields+jenkins@xamarin.com>
|
|
I've implemented a heap of missing RTF and RichTextBox stuff, and also made some improvements or fixes to various aspects of it. I'm sorry this is so big...
To give an overview of the changes, here's a list:
- Removed the RTF Charcode / Charset handling that wasn't actually used, had a lot of missing functionality and was basically reimplementing character encoding handling, and replaced it with ensuring the correct character encoding is being used (changing when needed).
- Improved RTF handling of objects with object results (process the given object result). Sometimes pictures can be like this.
- Improved line wrapping and alignment
- Added or greatly improved support for:
- paragraph spacing
- line spacing
- paragraph indents (left, right, hanging)
- tabstops (left, centre, right, decimal)
- text background colour (like highlighting)
- superscript / subscript
- character offset (vertical)
- text visibility
- Significantly improved RichTextBox RTF generation
- Cache DPI, rather than doing `CreateGraphics()` every time it is needed
- A variety of other fixes and improvements, with a few I can think of relating to:
- caret position
- replacing text
- invalidation and drawing
- when tags are added or deleted
|
|
|
|
If one click on a `ComboBox` the caret does not appear. This is so because `document.PositionCaret` call hides the caret.
|
|
Current versions of the mono return a null pointer as address of the first
element for empty arrays, i.e.
fixed (byte* ptr = new byte[0]) Console.WriteLine (ptr == null);
will print "true". This causes a problem in the UnixEncoding class where it
triggers a check for null pointers. Fix this by allowing null pointers when
the number of elements is zero.
|
|
Whenever mono opens an X11 window, the application opens a tcp socket for controlling the (non-tcp)-connection to X11. This is bad practice, as a tcp socket is not needed.
This pull request cleans the logic, by replacing the tcp socket with a fifo. That way this loopback connection is not visible from outside the .NET application, and all logic surrounding it should remain unchanged.
|
|
The real change here is, in `XplatUIX11.SetWindowPos()`, simply moving the `SendMessage` call to the end instead of earlier. The problem with it earlier is that any change in bounds from any of the bounds-related events (OnLocationChanged / OnMove, OnSizeChanged / OnResize, OnLayout, OnClientSizeChanged) will be overridden. When `SendMessage` is called, `UpdateBounds` is run, and that raises those events as relevant. After those events finish, `SetWindowPos` continues with setting the size of the window to the value originally specified – which is now potentially wrong. So send the message later on.
There is also no point that I can see in writing the values to `hwnd` twice, because as far as I can see the only one that can be changed is `hwnd.ClientRect` (set by `PerformNCCalc`).
|
|
when it is not enabled and visible. (#18541)
Fixes #18506
|
|
* Validate the address that came from IDE using PointerValue. The IDE can send an invalid address and it was crashing mono.
Fixes #18191
Fixes #15612
Co-authored-by: Aleksey Kliger (λgeek) <akliger@gmail.com>
|
|
* Contributing: fix typos
* fixed encoding and other typos
* fixed encoding and spotted other typos
* Update TransformationRules.cs
|
|
The encoding itself could be null, while encoding_code_page
should always be valid.
|
|
|
|
|
|
charset_stack was never initialised.
|
|
It is not clear if it will fail again or not, but it is not reproducible.
Closes https://github.com/mono/mono/issues/8709
|
|
(#18480)
* [runtime] NOHANDLES for ves_icall_System_Threading_Thread_GetCurrentThread
This function (and its call to mono_handle_new) was showing up in the
flamegraph for some async-heavy benchmarks
|
|
|
|
GroupBox's GetPreferredSize() is not great. I've simply copied the code from Panel, and used that. It uses LayoutEngine.GetPreferredSize(), which does things a lot better than the code this used.
|
|
Previously, if the Label wasn't quite high enough nothing would be drawn as the line didn't quite fit. It should draw the line anyway, clipped if necessary.
|
|
- Ignore key events with vkey == 0. They won't match a real key code so don't try. Besides, trying can cause segfaults on ChromeOS Linux mode.
- Check special-case keys (numpad) before looping to get them. No point leaving them for afterwards...
|
|
- Make the state of Control.CanSelect depend on whether the control is visible and enabled.
- When setting Control.Visible to false, if this control is focused, move the focus to the next control.
|
|
Fixes https://xamarin.github.io/bugzilla-archives/20/20233/bug.html
Previously, on Linux, setting Control.Region just set the clipping for painting, but didn't influence the visibility of other controls behind the one it was set on. This implements this correctly via X11 Shape extension.
|
|
Two small fixes to X11 keyboard handling here:
- For Xutf8LookupString, use the actual buffer size rather than the starting buffer size. Using the previous fixed size made the buffer overflow handing code immediately after the change pointless.
- For XLookupString, handle similar to Xutf8LookupString, getting a byte array. The old was sometimes causing problems where input on the numeric keypad didn't enter text. I believe using a StringBuilder similar to how it was _should_ work, but for some reason I could not get it to work reliably. So I changed it to this, which seems to work well for me. The only question I have is whether it should be Encoding.ASCII like I used, Encoding.Default, or another specific encoding.
|
|
Fixes https://github.com/mono/mono/issues/18418.
|
|
|
|
Particularly, don't call CreateGraphics() in TextBoxBase's constructor.
|
|
|
|
- Use alternative names as a fallback if present.
- Use the untagged name (\fname, name that doesn't
identify charset ) if present.
- Use font codepage or charset correctly to get the correct encoding.
Rip out the old nonfunctional RTF charset handling.
This was not used, and furthermore was fundamentally flawed.
I have replaced it by simply using the correct text Encoding, mentioned
above.
|
|
|
|
|
|
|
|
|
|
CharCount / length was inconsistent about counting line endings. Fixed
to include them all, as that was much easier than the other way.
When shortening a wrapped line, it is necessary to start the recalculate
at the previous line, in case the wrap point has changed.
In CharIndexToLineTag, if there is a line boundary at the specified
index, return the line starting at the index.
Fixed a few other things too.
|
|
|
|
RTF paragraph controls override earlier instructions, rather than
keeping the maximum.
Emit \nosupersub between superscript and subscript text. Missing it out
technically gives a superscript (or subscript) of the subscript (or
superscript), which is not what we want.
rather than keeping the maximum.
|
|
|
|
Floats are now used to preserve paragraph spacing and indents. The RTF
format uses twips (1/20") for these, which is usually less than 1px.
|
|
* RTF.cs: Add support for JPEG and EMF pictures.
Allow for attribute etc. groups inside the picture group.
* Line.cs: In InsertString, ensure that the tag passed in is currently
in the line – not necessarily valid when the passed tag is the
cursor, for instance.
* LineTag.cs: Only break tags for formatting when needed.
* TextControl.cs: Fix invalidating text that isn't left-aligned.
Fix caret stuff:
Positioning after the line ending no longer happens
Up and down when not left-aligned
Tag used when moving left to start of line
Page up / down
Remove empty tags when navigating away from them
Change tag background draw location – I think it is a correction!
When inserting at a position without being given the tag, choose an
empty tag at that position if one exists.
Change ReplaceSelection order back (corrected some formatting and
similar stuff), and format the new text to match the tag.
Change IncrementLines to transverse the tree (using a new function)
rather than repeatedly call GetLine.
* RichTextBox.cs: Don't streamline the line in case it removes tags we
want to keep – we'll skip them ourselves instead.
Emit pictures.
* TextBoxBase.cs: Remove redundant check – a previous check means
value != acutal_border_style, therefore at least one of them !=
BorderStyle.Fixed3D, therefore the if condition was always true.
|
|
two to get the point size.
|
|
Line spacing seems to be working perfectly.
|
|
non-multiline selection.
It was inserting at the start, and then removing what had been inserted +/- whatever length as needed.
|
|
SelectedText doesn't lose formatting.
|
|
The dpi isn't likely to change during the lifetime of the object, so is relatively safe to cache.
Creating a Graphics object each time the dpi is wanted when reading RTF is also rather silly performance-wise.
Even worse, when generating RTF it can cause a recalc, which can mean that some lines <= end_line don't exist.
|
|
In GenerateRTF, check tag != null before trying to generate anything based on it. Not sure
why it hasn't been a problem before, but either way I was getting NullReferenceExceptions
because of it today.
Run ContentSizeChanged() when either width or height changes, irrespective of Multiline status.
This fixes various problems with stuff jumping around vertically.
Correct ContentSizeChanged to consider the left and right margins instead of the left margin twice.
Was probably a typo at an earlier stage, otherwise would have been a * 2.
|