Commit graph

1265 commits

Author SHA1 Message Date
Charlie Brej
69deaaa30a [script] Pass color to the text renderer
We collected the color information before, but did nothing with it.
2009-11-29 02:51:10 +00:00
Charlie Brej
1c6adf70da [label] Add color control
Previously we drew two overlapping labels, one in black and one in white, to
make sure it was vsible on all backgrounds. Now we can pick an appropreate
color for each theme. The default is white. If changing the label color once it
has been shown, it will redraw that part of the screen.
2009-11-29 02:35:10 +00:00
Charlie Brej
7e487da507 [script] Allow setting the position of the windows
Although the windows are set up to in a reasonable default configuration, the
themes may align the windows differently to not crop some important elements.

The Window.SetX and SetY allow positioning the window anywhere on the canvas.
Use this sparingly as it induces a full refresh of all screens.

If there is a desire to have totally different scenes, the second window can be
positioned somewhere far away so there is overlap and a complete different set
of sprites is used. Another sensible configuration is to have the screens side
by side and allow sprites to span the gap. Remember to create password dialogs
for each screen as not all may be visible.
2009-11-29 01:19:37 +00:00
Charlie Brej
d2f16135f0 [script] Handle multiple displays with one script instance
When multiple displays were introduced, each display had its own script plugin
instance. This made things easy as the scripts would not have to be rewritten
for multiple screens. Unfortunately this also meant that each image was loaded
multiple times, and the scripts consumed much more processing power.
Additionally the scripts were not aware of each other.

This patch allows a single script instance to control multiple displays while
maintaining reasonable backward compatibility. All sprites are placed on a
virtual canvas. Displays (or windows) then expose parts of this canvas to the
user.

As a default, window 0 is placed at 0,0. Further windows are placed on top of
the window 0 area matching the centre point so the password dialog (which is
placed in the centre) is visible on all windows. If you target window 0 only
and you place dialogs in the middle of the screen, then everything should work
fine.

Window.GetWidth/GetHeight now takes a window number (if none supplied it will
assume 0). If it replies a NULL, then you accessed beyond the end of the
window set.
2009-11-29 00:20:52 +00:00
Charlie Brej
53563a3fc4 [list] Initialise node in the get Nth function
Typo in the previous patch.
2009-11-28 23:52:53 +00:00
Charlie Brej
59a015b4af [list] Add get Nth node function
Gets the Nth node in the list. If the index is outside the range, it will
return NULL
2009-11-28 23:31:11 +00:00
Charlie Brej
49cb1714cf [list] Add a stable sort
Stable sort sorts but does not change the order of elements which are equal.
This is important in the sprite based plugins where if the level of the sprites
is equal because it may be unimportant which is on top, changing the order
between frames looks bad.
2009-11-28 20:08:09 +00:00
Charlie Brej
0b23228d41 [region] Actually perform the sort when requested
Typo, sort line was missing.
2009-11-28 19:35:38 +00:00
Charlie Brej
2152c8c830 [region] Allow rectangles to be sorted before being fed back
The renderers commit the rectangles derived from the region in a random order.
This gives some tearing as the screen is displayed with a random regions in
their new state. The change sorts the list of rectangles according to their Y
value to commit them from top to bottom. This gives fewer tear lines.
2009-11-28 19:10:53 +00:00
Charlie Brej
ac38fe872a [list] Replace the old sort function with quicksort
It is a simple quicksort implementation which does no randomisation.
2009-11-28 18:51:54 +00:00
Charlie Brej
48b61807ba [list] Adds tests of the sort function
Sorts 100 random integers. Reports any out of order and returns an error code.
2009-11-28 18:47:44 +00:00
Charlie Brej
a8c9973d67 [list] Add test code of the sort function 2009-11-28 18:45:49 +00:00
Ray Strode
5ab7551533 [branch-merge] Improve plymouth -> X hand off
This merges the "no-fbcon" branch to master.

Previously, the way to get a transition between
plymouth and X was for plymouth to quit,
leaving the tty in KD_GRAPHICS mode, and hope
X starts and picks up the peices.  In this
limbo state where plymouth isn't running but X
isn't started yet the user is unable to
switch VTs or really do anything at all.

If X doesn't start then the user is hosed; they
have to reboot.

Now, instead of quitting plymouth before starting
X we "deactivate" it.  This gets plymouth into a
state where X can take over the display, but
plymouth stays running.  Once X has fully started
up or failed to start the display manager can
tell plymouth to quit (with --retain-splash if
X started successfully and without if X started
unsucessfully)
2009-11-28 00:33:06 -05:00
Ray Strode
d52b4efba1 [client] Add new deactivate subcommand
This tells the daemon we're about to start X with -nr and
to get ready for the transition.
2009-11-28 00:24:59 -05:00
Ray Strode
45967baeb0 [daemon] deactivate daemon for X transition
In order for plymouth to be able to stay around until
after X is started, we need to put the daemon into a
"deactivated" state where it makes the splash becomes idle
and relinquishes control of the scan out hardware and keyboard
for X to seize.

This commit listens for deactivation requests in the daemon and
performs the deactivation.

A future commit will implement the client bits needed.
2009-11-28 00:24:59 -05:00
Ray Strode
fe6d25904d [x11] implement new activate/deactivate methods
We disable flushing when inactive.
2009-11-28 00:24:59 -05:00
Ray Strode
92bf5acfa2 [frame-buffer] implement new activate/deactivate methods
We basically just do what we were doing before
implicitly on VT switch, explicitly on activate
and deactivate.
2009-11-28 00:24:59 -05:00
Ray Strode
9f2b4b418a [drm] implement new activate/deactivate methods
We basically just do what we were doing before on
implicitly on VT switch, explicitly on activate
and deactivate.

We also don't scan out the splash to the fbcon
on unmap if the renderer is inactive.
2009-11-28 00:24:59 -05:00
Ray Strode
40f685be7c [renderer] Add new activate and deactivate methods
The point of these methods are to put the renderer in
and out of a state where it is no longer going to
be on screen.

This should cause flush calls to be no-ops and device
specific locks should be dropped.

These methods will be necessary to keep plymouth running
while X is getting started up.
2009-11-28 00:24:58 -05:00
Ray Strode
8bb69cd875 [main] only set keyboard on splash if available
There may be cases where there is no keyboard set.
2009-11-28 00:24:58 -05:00
Ray Strode
1fa4f91a61 [main] make keyboard removal idempotent 2009-11-28 00:24:58 -05:00
Ray Strode
3ab7b2c54e [main] drop stray debugging remnant 2009-11-27 23:40:44 -05:00
Charlie Brej
20e86525c9 [script] Remove some debug code
Testing with it replying random strings to make sure the error cases were
caught. Code accidentally left in.
2009-11-24 23:03:19 +00:00
Charlie Brej
f11988e500 [script] Add string library and the first function "CharAt"
Currently the strings must be manually told to adopt from the library functions
by using String("string").function(). This is temporary and later it should be
possible to apply functions directly to strings.

CharAt gives the a single character string at the index specified. The first
character is at index zero. Characters beyon the end are empty strings, and
errors return NULL. This can be used thusly:

str = "something";
letter = String(str).CharAt(7); # letter = "n"
letter = String(str).CharAt(12); # letter = ""
letter = String(str).CharAt("foo"); # letter = NULL
2009-11-24 22:46:27 +00:00
Charlie Brej
230c0ee847 [script] Use a region to collate all updated areas
Previously, refresh, each sprite would refresh its old area, then its new area.
This, combined with situations where there are many sprites caused the area to
be redrawn many times, each time redrawing each overlapping sprite data.

Now we add all areas which need to be refreshed to a region and this makes a
smaller set of rectangles to refresh, and these are not overlapping.

Also uses the freeze display updates, which should work better now.
2009-11-23 00:41:02 +00:00
Charlie Brej
fea30a08ab [rectangle] Add exact overlap detection
If the width and X position of the two rectangles is the same, we can merge
them together. The new set of exact overlaps detects this and determines the
direction the rectangle should be extended.

The region code now uses this. WARNING, when expanding rectangles, these have
to be merged with the other rectangles down the list as there may be overlap.
2009-11-23 00:23:22 +00:00
Charlie Brej
aea6de4788 [rectangle] Rewrite rectangle_find_overlap function
The previous version had a flaw where it would find the rectangles overlapping
if they spanned a range in one axis. Despite them having no overlap in the
other axis.

Because this version has strange (although correct) behaviour when dealing with
empty rectangles, region only calls the overlap function when both rectangles
are not-empty.

The issue is if an empty rectangle sits on the edge of a full rectangle, the
function reports (possibly correctly) that the edge is overlapped by the empty
rectangle. The region code then nudges the rectangle down one space and
subtracts one from the empty rectangle height. This creates a rectangle with
negative height (bad thing).

If the other version can be fixed I will put it back, but this one is also
useful for the combining two rectangles of equal width.
2009-11-22 23:53:48 +00:00
Charlie Brej
9df80dc483 [region] Remove element only after processing
Now that we cannot rely on the next_node element. We must finish processing the
entry before removing it. Easiest way is to recurse and remove after return.
2009-11-22 22:53:12 +00:00
Charlie Brej
b7c34f1857 [region] Break circular dependency using an extra variable
new_area->width depends on new_area->x and vice versa. Break the dependency by
adding a temp variable.
2009-11-22 22:47:40 +00:00
Charlie Brej
dc11571049 [region] Couple more minor bugs in rectangle merge
Also one redundant line. I think this code was never used in anger. There is a
major bug in the rectangle collision code which makes this detection ad-hoc.
2009-11-22 22:42:13 +00:00
Charlie Brej
645452c099 [region] Overlap top right edge lower rectangle starts right of the old
Probably a typo in the original version.
2009-11-22 22:30:58 +00:00
Charlie Brej
fe46fb8803 [region] Free rectangle if empty
Previously we just returned and did not free.
2009-11-22 22:27:40 +00:00
Charlie Brej
3f2e0b1b22 [region] Do not prefetch next rectangle node while processing list
If we fetch the next node while working on the current node, recursing down the
list may remove the next node. Just to be double sure, we recurse direct to
next node so the current is not damaged.
2009-11-22 22:21:49 +00:00
Charlie Brej
338ed12168 [region] Clarify the testing code
The grids show which parts were not covered, or over covered.
2009-11-22 22:12:58 +00:00
Charlie Brej
f506b1e54d [region] Added test program
This examines the behaviour for correct behavious and performance.
2009-11-22 21:42:12 +00:00
Charlie Brej
6cdb6e330a [script] Fix typo in SetBackgroundBottomColor function name
This is in the compatibility wrappers so it didn't effect anything..
2009-11-22 21:19:52 +00:00
Charlie Brej
d876853867 [x11] Force refresh area to start at 0,0
The x and y values, in area element, were used to determine the position of the
window on the screen. With the x and y not at 0, the full redraw not working
correctly on the second head.
2009-11-21 22:35:55 +00:00
Charlie Brej
57fb558046 [script] Add text to image capability
Enables scripts to display test by converting it into an image. This can then
be shown using a sprite. Function takes a string and the value of the three
colors (red green blue).

new_image = Image.Text("text we want", 1.0, 0.0, 0.0); // gives red text image
2009-11-21 17:45:41 +00:00
Charlie Brej
2dbac8e942 [script] Migrate from image to pixel buffer
The script image is now a pixel buffer. This allows some clever possibilities:
We can now implement text to image.
We can compose images by drawing on them, and record the areas which changed to
avoid refreshing the whole thing.
2009-11-21 16:30:34 +00:00
Charlie Brej
fdfdd822fa [pixel-buffer] Move resize and rotate function from image to pixel buffer
There are comparability versions in image, but these are now deprecated.
2009-11-21 15:51:17 +00:00
Charlie Brej
1056a62695 [image] Allow converting an image to a pixel buffer
A pixel buffer is a much more useful object to manipulate. The image should
only be used when loading from files and never manipulating.
2009-11-21 14:10:23 +00:00
Charlie Brej
481b39155d [fade-throbber] Initialise views before animating
Only run the call to animation after all views are initialised. No visible
changes but this is more correct.
2009-11-21 12:52:48 +00:00
Charlie Brej
74ac719031 [fade-throbber] Move some operations from view to plugin start animation
There were timeouts called once for each view and the first view would cause
is_animating to be set which would stop other views from initialising.
2009-11-21 12:45:45 +00:00
Charlie Brej
ef82eb9a61 [fade-throbber] Move logo opacity value to individual views
When the logo opacity was plugin wide, one view would change its logo, and the
others would not bother. This prevented the logo form showing up on the second
screen.
2009-11-21 12:35:09 +00:00
Charlie Brej
58a28b3eeb [image] Use a pixel buffer to hold the image size and data
The image structure now contains a pixel buffer which holds the data. Some
functions are still within image for compatibility during the migration.
2009-11-19 23:55:22 +00:00
Charlie Brej
c0f5615e24 [image] Remove fd from the image structure
The fd element was only used within the load function so did not need to be in
the structure. Also removes the open and close file functions. Their contents
is inlined.
This is the last cleanup before merging with pixel-buffer.
2009-11-19 23:21:22 +00:00
Charlie Brej
4ae19c65af [image] Remove image layout structure
Simplifies the image structure to make it more similar to the pixel-buffer
2009-11-19 22:47:54 +00:00
Charlie Brej
a903cd4808 [image] Remove size from the image structure
Size was never used. Also removes the ply_image_get_size function.
Clean-up in preparation for merging with pixel-buffer.
2009-11-18 23:13:39 +00:00
Ray Strode
310b58922c Revert "[script] free views before nullifying event loop"
This reverts commit a93b6525b3.

It has unpleasant side-effects, and the real problem was fixed
in the last view commits.

Analysis from Charlie.
2009-11-18 16:51:20 -05:00
Ray Strode
63c94dfc6d [event-loop] Restart front of pending timeout list after dispatch
This is in case a timeout handler invalidates the list while being
dispatched.
2009-11-18 16:32:09 -05:00