Method for displaying a resized window

A method for displaying a resized window includes receiving a resizing message, generating a window having a second size according to the resizing message and a window having a first size and located at a position corresponding to a first reference point, and displaying the window having the second size at a position different from the position corresponding to the first reference point. After generating the windows, the window having the second size is not displayed at the position corresponding to the first reference point.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to a method for displaying a resized window, and more particularly, to a method which can prevent window flicker when displaying a resized window.

2. Description of the Prior Art

For window scaling, some operating systems take one point of the window as a reference point to draw the scaled window. Suppose that the operating system takes the top-left point as the reference point. If a user scales the window by expanding the top or left side, it is obvious that the window and the content of such would flicker. In this case, the operating system draws the scaled window based on the reference point (the top-left point of the original window), and then moves the top-right point of the scaled window to the top-right point of the original window, so that window scaling is achieved. However, when moving the scaled window, window flicker occurs. This phenomenon is more pronounced when scaling a window containing video.

Please refer toFIGS. 1 and 2.FIG. 1is a diagram of moving a first window10according to the prior art.FIG. 2is a diagram of scaling the first window10to become a second window12according to the prior art. The first window10has a first size, and is located at a position corresponding to a first reference point (the top-left point) P1before being moved or scaled. As shown inFIG. 1, when the first window10is moved, the first window10is re-drawn at a new position (shown in dashed line), remaining at the same window size. InFIG. 2, the first window10is scaled to become a second window12having a second size (shown in dashed line). The second window12(shown in dashed line) is drawn according the first reference point P1. Then, the top-right point of the dashed line area is moved to the top-right point of the first window10, taken as a second reference point P2, so that the scaling process is achieved (as shown by the second window12(in solid line. Please refer toFIG. 3, which is a flowchart of adjusting the first window according to the prior art.

Step102: A message queue receives a message (first message).

Step104: Determine whether the message includes a request for adjusting the first window10. If so, step106is entered. Otherwise, step124is entered.

Step106: The information for an adjustment of the first window10is obtained from the message.

Step108: Determine whether the information obtained from step106includes a command for scaling the first window10. If so, step114is entered; otherwise, step110is entered.

Step110: A new position of the first window10is obtained according to the information obtained in step106.

Step112: As shown inFIG. 1, the first window10is re-drawn at the new position so that the first window10is moved from the original position to the new position, and then step124is entered.

Step114: As shown inFIG. 2, the first window10having the first size is scaled to become the second window12having the second size according to the information obtained in step106.

Step116: As shown by the dashed line area ofFIG. 2, the second window12having the second size is drawn at the position corresponding to the first reference point P1.

Step118: The message queue receives a next message (a second message).

Step120: The information for the adjustment of the first window10is obtained from the next message received in step118.

Step122: As shown inFIG. 2, the second window12having the second size is displayed at the position corresponding to the second reference point P2according to the information of step120, such that the second window12is moved from the position corresponding to the first reference point P1(the dashed line area) to the position corresponding to the second reference point P2.

From the above steps, when the user wants to move the window but not to scale it, the operating system processes the window movement using a message. However, when the user wants to scale the window, the operating system processes the scaling using two messages instead. That is, when the user only moves the window, the operating system obtains the new position where the first window is moved to according the information of step106, and draws the first window10at the new position, accomplishing the movement. Nevertheless, when the user wants to scale the window in steps114and116, the first window10having the first size is scaled to become the second window12having the second size, and the second window12is drawn according to the first reference point P1. In other words, if scaling the first window10by expanding the left side, the second window12is drawn in the dashed line area inFIG. 2(the position corresponding to the first reference point P1). Then, as mentioned in steps118and122, the second window12is displayed at the position corresponding to the second reference point P2according to a second received message, such that the second window12is moved from the dashed line area (the position corresponding to the first reference point P1) to the position corresponding to the second reference point P2. In short, when the user wants to scale the window, the resized window (the second window12) is displayed at the original position (the position corresponding to the first reference point P1), and then moved to the new position (the position corresponding to the second reference point P2). Therefore, when expanding the left side of the window, the window is expanded rightward and then moved leftward. Or, when expanding the top of the window, the window is expanded downward and then moved upward. These result in window flicker, especially when scaling a window contacting video playback.

SUMMARY OF THE INVENTION

It is therefore a primary objective of the claimed invention to provide a method of preventing window flicker when displaying a resized window to solve the above-mentioned problem.

The claimed invention discloses a method for displaying a resized window comprising receiving a first message, generating a window having a second size according to the first message and a window having a first size located at a position corresponding to a first reference point, and displaying the window having the second size at a position different from the position corresponding to the first reference point according to the first message. After step (b), the window having the second size is not displayed at the position corresponding to the first reference point.

DETAILED DESCRIPTION

Please refer toFIG. 4, which is a diagram of an electronic device50capable of displaying a resized window according to the present invention. The electronic device50can be a personal computer, a mobile phone or a personal digital assistant (PDA). The electronic device50comprises a display module52, such as a liquid crystal display (LCD), for displaying windows; an input module54, such as a mouse or a keyboard, for inputting a window-adjusting command to change the position of the window or scale the window; and a logic unit56for controlling the display module52to display the adjusted window after receiving the window-adjusting command from the input module54.

Please refer toFIGS. 5 and 6.FIG. 5is a diagram of moving a first window58on the display module52based on the present invention.FIG. 6is a diagram of scaling the first window58into a second window60on the display module52based on the present invention. InFIG. 5, the first window has a first size, and is located at a position corresponding to a first reference point P1before being moved or scaled. When the first window58is moved, the first window58is re-drawn at a new position (dashed line area), remaining at the same window size. InFIG. 6, the first window58is scaled into a second window60having a second size. The second window60is directly drawn according to the top-right point of the first window58, taken as a second reference point P2, and is displayed at a position corresponding to the second reference point P2, which is different from the position corresponding to the first reference point P1. Please refer toFIG. 7, which is a flowchart of adjusting the first window58according to the present invention.

Step201: A window-adjusting command is input via the input module54.

Step202: The logic unit56processes a message (first message) received by a message queue after receiving the window-adjusting command input by the input module54.

Step204: Determine whether the message includes a request for adjusting the first window58. If so, step206is entered. Otherwise, step220is entered.

Step206: The information for an adjustment of the first window58is obtained from the message.

Step208: Determine whether the information obtained from step206includes a command for scaling the first window58. If so, step214is entered; otherwise, step210is entered.

Step210: A new position of the first window58is obtained according to the information obtained in step206.

Step212: As shown inFIG. 5, the first window58is re-drawn at the new position so that the first window58is moved from the original position to the new position, and then step220is entered.

Step214: According to a predetermined flag, the present invention does not execute a next message (second message). The second message includes moving the second window60from the position corresponding to the first reference point P1to the position corresponding to the second reference point P2. In other words, the flag is used for deleting the next message.

Step216: As shown inFIG. 6, the first window58having the first size is scaled to become the second window60having the second size according to the information obtained in step206.

Step218: As shown inFIG. 6, the second window60having the second size is directly drawn at the position corresponding to the second reference point P2according to the information obtained in step206.

First, the user inputs a window-adjusting command via the input module54to move or scale the window. For example, the user can use a mouse or a keyboard to move the window or scale its size. When the user wants to move the window, but not to scale its size, the operating system only generates a message for the window movement as the prior art does. However, when the user wants to scale the window, the operating system generates two messages for scaling. Steps204to208determine whether the message received by the message queue includes a request for adjusting the first window58, and determine whether the command of adjusting the first window58indicates to move or to scale the first window58. When the user moves the window, the operating system obtains the new position where the first window58is moved to according to the information obtained in step206. Then, the first window58is re-drawn at the new position so that the first window58is moved from the original position to the new position.

When the user wants to scale the window as in steps214and218, a flag is set in a corresponding program of the operating system to tell the operating system not to execute the moving request included in the next message. That is, the second window62is not moved from the position corresponding to the first reference point P1to the position corresponding to the second reference point P2, indicated by the next message. In short, the flag is set to delete the next message, and therefore the moving request included in the next message is not executed. Next, according to the information in step206, the first window58having the first size is scaled to become the second window60having the second size, and the second window60is directly drawn at the position corresponding to the second reference point P2. Therefore, the scaled window is displayed directly at the new position (the position corresponding to the second reference point P2). Since the flag is set, the next message, which requests to move the second window60from the position corresponding to the first reference point P1to the position corresponding to the second reference point P2, is not executed.

In conclusion, when the user wants to scale the window, the prior art displays the scaled window at the original position (the position corresponding to the first reference point P1) according to the first message, and then moves the scaled window to the new position (the position corresponding to the second reference point P2) according to the second message. However, in the present invention, the scaled window (second window60) can be directly displayed at the new position (the position corresponding to the second reference point P2) instead. The present invention ignores the second message, and directly displays the scaled window at the new position during processing the first message. Therefore, when the user drags the window for scaling, window flicker does not occur.