Embodiment
Fig. 1 is a multi-window system of the present inventionAssemblySynoptic diagram.At multi-window managing of the present invention system, can take out some basic modules: video memory, screen, window and function element wherein have:
Video memory: be the display buffer that provides by system, corresponding one by one with pixel on the display screen, refresh the data in the display buffer, just can change the displaying contents on the display screen, finish picture refreshing.
Screen: being equivalent to a virtual video memory in internal memory, and managing current all windows of opening, is the carrier of window.
Window: being the set of one group of function element, is the carrier of element.It is made up of background, frame, title block and function element.Can be divided into system's window (windows such as desktop, taskbar, shortcut menu, information indicating) and pop-up window.
Function element: comprise static (character, picture etc.), button, edit box, scroll bar, animation, display list and the self-defined element etc. of showing.By the custom interface that system provides, other function element can realize with the primary element customization.As drop-down menu, can be by button and pop-up window customization, radio box, check box and progress bar then can customize by button.Function element can related one group of data, and associated data can be obtained from server end, also can obtain from this locality.By associated data, just can intercom mutually between each function element, to finish the logic of various complexity.
Fig. 2 is eachAssemblyConcrete composition synoptic diagram.Wherein common data comprises: viewing area, display buffer.
The viewing area is the rectangular area of assembly under respective coordinates system.
The display buffer: the displaying contents that memory module is current can be divided into element display buffer, window display buffer, screen display buffer zone and video memory buffer zone by level.When picture refreshing, the display buffer is refreshed successively by level, and final video memory buffer zone is refreshed, and so just finishes a picture refreshing operation.
Dirty area queue: the zone that need refresh is provided by dirty area queue.It has write down the zone that assembly need refresh, and when refreshing, efficient is refreshed with raising in these zones of correspondence in the update displayed buffer zone.
As can be seen from Figure 2, screen display buffer zone and video memory buffer zone constitute the double buffering display mode, have avoided the flicker problem of display screen in the refresh process.
Fig. 3 has provided the synoptic diagram of relation between screen coordinate system and the window coordinates system, and specifically, the viewing area of element belongs to window coordinates system; The viewing area of window belongs to screen coordinate system.The viewing area of screen and video memory is the same, all the size of corresponding display screen.
Fig. 4 then is a display buffer level synoptic diagram.So-called display buffer is meant that memory module is at current displaying contents.Can be divided into element display buffer, window display buffer, screen display buffer zone and video memory buffer zone by level.When picture refreshing, the display buffer is refreshed successively by level, and final video memory buffer zone is refreshed, and so just finishes a picture refreshing operation.
When building component, hide, when closing, or the displaying contents of assembly, display position can register to the viewing area in the dirty area queue of next layer assembly object when changing.In conjunction with the signal of Fig. 4, the element viewing area will be registered to the dirty area queue of window, and the window viewing area then can be registered to the dirty area queue of screen.
As shown in Figure 5, suppose that the shown zone of button B is X=Rb, the viewing area of window W is Y=Rw, and then Fy (x) is the zone of return area x under the coordinate system of regional y place, i.e. R ' b=F_Rw (Rb).As shown in Figure 5, when button B is pressed, button area can be registered to the dirty area queue of window W, and the button area that will be transformed into screen S registers to the dirty area queue of screen.
As shown in Figure 6, suppose that it is Rw that window W moves preceding viewing area, moving the viewing area, back is R ' w, when window moves, can with before moving and the window area after moving all register to the dirty area queue of screen.
Fig. 7 is a simple windows model synoptic diagram, has opened window W1, W2, W3, W11, W12, W13 and W121 on the screen S, wherein, the W1 desktop, W2 taskbar, W3 shortcut menu are system's windows, W11, W12, W13 are the ejection subwindows of W1, and W121 is the ejection subwindow of W12.
Fig. 8 is corresponding designs simplification synoptic diagram.
In conjunction with Fig. 2 and Fig. 8, screen is used for managing the window that all are opened, formation of maintenance system window and pop-up window formation.
System's window formation is the root window formation, and the window traversing operation is carried out from here on.System's window comprises windows such as desktop, taskbar, shortcut menu and information indicating.Similar with the Windows window system, desktop window occupies whole screen size, and pop-up window is here created.
The taskbar window shows the window icons of pop-up window, can easily focus be switched to target window and minimize, maximizes target window by these icons.Simultaneously can show system informations such as CPU usage, memory usage.The shortcut menu window provides some common function elements.Information indicating window prompt system abnormal information.
All pop-up windows of opening of pop-up window queue record.
Formation of window management element and the formation of ejection subwindow, the element queue record is carried out one group of function element of correlation function, and all subwindows that subwindow Z preface record current window ejects are pressed in the subwindow formation.
Window attribute comprises: frame, background, title, transparency and window type (monopolize, follow, top layer and bottom etc.).
The Dram that garbage collector was used in the management window lifetime (closing from being opened to) uses, and the user can customize suitable garbage collector according to actual conditions, improves memory management efficient, avoids problems such as internal memory leakage, memory fragmentation.
Function element is to carry out the assembly of concrete function, but as the button pop-up window, but the edit box input information, scroll bar can change data in given range, and animation can regularly change displaying contents or the like.
Component attributes mainly is a functional parameter, as pop-up window number, but the input character number, rolling scope etc.Interface display finger element displaying contents mainly is information such as bitmap or character.
Above-described window and component data (mainly being viewing area, window attribute, component attributes etc.) can be stored in the flash memory, also can generate in program.
Fig. 9 is a simple case of window data storage, and the window concordance list is the offset table of window data, and the element concordance list is the offset table of component data.
More than introduce the conceptual abstraction and the data organization of window system, will introduce the main modular of multi-window managing of the present invention system below.
Figure 10 has provided a kind of multi-window managing system that is used for embedded system of the present invention, and it can be used for embedded system, comprises the operation of front-end operations and rear end:
Message processing module is carried out front-end operations, is used for process user message and the basic device region change information of window is exported in dirty area queue mode;
Picture refreshing module execution rear end operation is used for resolving transmitting the dirty area queue of coming, and the up-to-date area information of assembly is delivered to the screen display buffer zone, finishes demonstration and refreshes.
The characteristics of multi-window managing of the present invention system are to take a process, and all window operations are all finished in this process, and this process is carried out a cycling.
The present invention is divided into front-end operations and rear end operation two parts with window operation:
Front-end operations is carried out correlation function by message processing module, is characterized in that operand is little, moves as window, only needs to change the window viewing area; The switch window focus only needs to adjust the subwindow formation; Because the front-end operations execution time is very short, guaranteed the relatively-stationary response time, so real-time is higher.
The picture refreshing module is carried out the rear end operation, mainly comprises refreshing of displaying contents, is characterized in that operand is bigger.The rear end operation mainly is the bigger picture refreshing operation of operand, and these two modules are connected by dirty area queue.
The picture refreshing module adopts layer mode to carry out refresh operation, refreshes efficient with raising.As shown in Figure 4, the displaying contents of assembly is stored in the assembly display buffer, when refreshing, refresh successively according to dirty area queue: promptly window display buffer, screen display buffer zone and video memory buffer zone refresh successively, and refreshing at fore-end of element display buffer promptly finished in the message processing module; After the video memory buffer zone is refreshed, just finished a picture refreshing operation.Therefore picture refreshing mainly comprises refreshing of window display buffer and refreshing of screen display buffer zone.
Owing to adopt the method for refreshing and the optimized dirty area queue algorithm of layering, the operand of refresh operation is dropped to minimum, and support window garbage collector, so the present invention has higher efficient.Owing to adopt the display mechanism of double buffering, problem is shielded in the sudden strain of a muscle when having avoided picture refreshing, so the present invention has good display again.
Message processing module is used to import message, and the picture refreshing module is then exported demonstration, and therefore, multi-window managing of the present invention system further comprises:
The message input interface, for example mouse, touch-control or button etc., the message input interface is imported message with the user and is write message queue;
Show output interface, for example video memory or similar video memory.The present invention will show that output interface is abstract in basic module, and mutual by with other assemblies finished the picture refreshing operation.Picture refreshing is meant when the displaying contents of assembly changes, shows synchronously on display screen.
As seen, multi-window manager of the present invention is input with the user message, is shown as output with picture, is the window system of message-driven type.
What Figure 11 provided is optimized dirty area queue algorithm, and dirty optimization of region comprises dirty optimization of region of window and the dirty optimization of region of screen.
The dirty optimization of region of so-called window, promptly dirty regional union operation.Suppose that registration zone R to dirty area queue Q, travels through dirty area queue Q then,, then finish traversal if traveled through dirty area queue Q; When not traveled through dirty area queue Q, judged whether area coincidence, if having, then merge and overlap the back, zone and continue traversal; If no, then continue traversal.
The dirty optimization of region of so-called screen specifies as follows:
In the present invention, because of screen-refresh relates to a large amount of memory copying operations, therefore optimizing the dirty area queue of screen seems particularly important, can further improve and refreshes efficient.The following thinking of main employing: before the screen-refresh operation, merge the dirty zone of screen as much as possible, remove the overlapping region; And during screen-refresh, calculate the actual zone that copies of needing of current window, and carry out copy function by this zone.Specific algorithm is as follows: establishing RX is the set of regions of actual need copy, Rw is the current window zone, RS is the dirty set of regions of screen after merging, and RU is the parent window set of regions (except hide window and the translucent window) of current window, comprises subwindow and upper strata brother's window.Then, RX=(Rw﹠amp; RS)-RU promptly, target window actual copy zone is that the dirty set of regions after the merging and the common factor in current window zone deduct the parent window set of regions.
Figure 12 is the disposal route of multi-window managing of the present invention, as shown in figure 12, at first whether the query messages formation has input message, if have, just take out a piece of news, and the message call processing module is handled this message and is listed it in dirty area queue, then, whether the query messages formation is empty again, if be not empty, just continue the message call processing module and handles.Until having traveled through message queue.
Inquire about dirty area queue,, then carry out picture refreshing successively if dirty area queue is not empty; When dirty area queue was sky, then picture refreshing finished.
After picture refreshing finishes, then restart the query messages formation of next round.
Figure 13 has at length provided the treatment scheme of message processing module.
Begin to travel through the subwindow formation from root window, specific practice is:
From root window, distribution and processing messages are distributed to message in order each subwindow earlier and handle, if there is subwindow to handle successfully, then Message Processing finishes, and handles otherwise message will be distributed to current window, judge earlier that whether current window is hidden, if hide, then returns " failure "; Do you if current window is not hidden, judge further that then message is in the current window zone? if in the current window zone, then travel through element formation and processing messages, return " success ", if not in the current window zone, then return " failure ".
In the message processing procedure, in case message is successfully handled by certain window, then Message Processing finishes.Otherwise continue to give other windows, up to having traveled through all windows with message distribution.
Figure 14 is used to illustrate the basic step of picture refreshing: mainly comprise: the formation of Ergodic Theory window also refreshes window, and formation of Ergodic Theory window and clear screen, refreshes the video memory buffer zone according to the dirty area queue of screen.
Figure 15 is used for illustrating " formation of Ergodic Theory window also refreshes window " step of Figure 14.
When window refreshed, from root window, the cycling among windows formation according to the dirty area queue of window, refreshed all window display buffers.When refreshing the window display buffer, in conjunction with shown in Figure 17, travel through all element formations of this window, copy the element display buffer to the window display buffer; How copying, then referring to shown in Figure 19, Figure 19 shows the display effect that element M refreshes window W display buffer (dirty region R), i.e. window W '.
Figure 16 is used for illustrating " formation of Ergodic Theory window and clear screen " step of Figure 14.
During screen-refresh, from root window, the dirty area queue of cycling among windows is according to the dirty area queue of window, clear screen display buffer.In conjunction with Figure 18, when the clear screen display buffer, need the dirty area queue of traversal screen.Specific practice is: takes out one of them dirty zone, judges whether window is translucent, if not, then the display buffer with current window copies the screen display buffer zone to, finishes the translucent operation of window simultaneously.Continuing to finish traversal then all is translucent until all windows.
Suppose screen S, target window W, viewing area R, translucence X, span is [0,1], then translucent operation is as follows:
S’(r)=S(r)*X+W(r)*(1-X)r∈R
Annotate: r be on the R more arbitrarily, W (r) be window W at a pixel value at r place, S (r) be translucent forth screen S at a pixel value at r place, S ' is that translucent screen S afterwards is at a pixel value at r place (r).
More than introduce the specific implementation of window system, will introduce the basic operation of window system below.The basic operation of window comprise open, close, move, maximize, minimize, convergent-divergent and focus switching etc.
The front-end operations process flow diagram that Figure 20 opens for window;
Window is opened, and is meant opening of pop-up window.
New window object (by memory management module such as garbage collector management Dram) at first, the initialization window data; As window attribute, component data etc., can from flash memory, read, also can in program, dynamically generate;
Then target window is inserted the subwindow formation of parent window, so that when Message Processing and picture refreshing, can traverse;
Then insert the formation of screen pop-up window, be convenient to search fast pop-up window;
Window icons is registered to the taskbar window, and taskbar is with regard to the icon of energy display-object window like this;
Register the viewing area at last to the dirty area queue of screen, during picture refreshing new window is shown.
Figure 21 is the front-end operations process flow diagram of close;
Close is opened (in conjunction with Figure 20) with window flow process is just opposite, after cancelling window icons and removing target window from the window formation, destroys window object and also discharges the window resource.
The front-end operations process flow diagram that Figure 22 moves for window;
Window moves, and refers generally to moving of pop-up window.At first change the viewing area of target window according to the moving displacement value, and register to the dirty area queue of screen, this step can be with reference to Fig. 6; Use the same method then, take out a word window, judged whether to follow attribute, use the same method then, move all and follow the subwindow of attribute.
Figure 23 switches the front-end operations process flow diagram for the window focus.
The window focus is switched, and the focus that refers generally between the pop-up window is switched.Earlier from the subwindow formation of parent window, remove target window, insert the top layer of the subwindow formation of parent window then, then parent window (pop-up window type) recurrence is carried out the focus blocked operation.
Window maximized, minimizing operating process and window, to move flow process similar.Window zoom operations flow process is simpler, can be according to the convergent-divergent shift value, and change the viewing area of target window and refresh picture and get final product.
Basic composition, specific implementation and the basic operation of this window system have been elaborated above.Above embodiment further specifies the multi-window managing system and has higher real-time and carry out efficient, favorable expansibility and transplantability, friendly operation interface.
Though embodiment has illustrated the present invention, the present invention is not limited to above embodiment, but can according to practical application request, make corresponding modify under the prerequisite that does not break away from inventive concept.For example:
Above embodiment, acquiescence is finished having under the platform of operating system, and in fact, the present invention is applicable to the system platform that all possess the message input interface and show output interface;
If system memory resource is relatively more nervous, then can removes the screen display buffer zone in the window system, even can also remove the element display buffer;
Above embodiment is managed a plurality of windows with two-way circle queue data structure, also can manage with binary tree;
Above embodiment, many places relate to recurrence and carry out, and on the platform of not supporting recursive operation, available iterative operation replaces.