You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After merging #88, I encountered issues while executing fbdev. To identify the source of the error, I conducted several experiments. I observed that the error originates from the twin_screen_update function, as I was able to successfully execute fbdev using the original twin_screen_update function.
To resolve this issue, I modified the code introduced in #88 to ensure that the updated twin_screen_update function is compatible with fbdev. Below are the modifications I made:
static twin_pixmap_t *twin_active_pixmap(twin_screen_t *screen,
twin_pixmap_t **active_pix)
{
twin_pixmap_t *p = NULL, *prev_active_pix = NULL;
/*
* Identify the previously active pixel map and the currently active pixel
* map, which is on the topmost layer.
*/
for (p = screen->bottom; p; p = p->up) {
if (p->window->active == true) {
prev_active_pix = p;
prev_active_pix->window->active = false;
}
(*active_pix) = p;
}
+ if(*active_pix)+ (*active_pix)->window->active = true;- (*active_pix)->window->active = true;
return prev_active_pix;
}
...
prev_active_pix = twin_active_pixmap(screen, &active_pix);
//active_pix = prev_active_pix;
/*
* Mark the previously active pixel map as damaged to update its
* changes.
*/
- if (prev_active_pix && active_pix != prev_active_pix)+ if ((prev_active_pix && active_pix != prev_active_pix) && prev_active_pix){
twin_pixmap_damage(prev_active_pix, 0, 0, prev_active_pix->width, prev_active_pix->height);
twin_window_draw(prev_active_pix->window);
}
/* Mark the active pixel map as damaged to update its changes. */
+ if(active_pix){+ twin_pixmap_damage(active_pix, 0, 0, active_pix->width,active_pix->height);+ twin_window_draw(active_pix->window);+ }- twin_pixmap_damage(active_pix, 0, 0, active_pix->width,active_pix->height);- twin_window_draw(active_pix->window);
The condition if(*active_pix) ensures that *active_pix is valid, as I previously encountered failures in this part of the code. Similarly, if(active_pix) verifies that active_pix is not NULL. These modifications are designed to prevent unexpected situations from occurring. Finally, I obtained the output from my VM.
If I eliminate the code below, I am able to successfully run fbdev.
/* Mark the active pixel map as damaged to update its changes. */
- twin_pixmap_damage(active_pix, 0, 0, active_pix->width,- active_pix->height);- twin_window_draw(active_pix->window);
Modification.mp4
The text was updated successfully, but these errors were encountered:
Remove the inefficiently function twin_active_pixmap(). This function
finds the currently and previously active window pixel map by traversing
the list of pixel maps. This function will be called every time the
screen needs to be updated. Set the active variable of the window only
when the window's event TwinEventButtonDown is triggered to avoid
redundant operations. Additionally, implement the function
twin_window_active_paint() to only repaint the title bar instead of
calling the function twin_window_draw() to indirectly call the function
twin_window_frame to repaint the title bar of the window.
Closesysprog21#92
Signed-off-by: Wei-Hsin Yeh <[email protected]>
After merging #88, I encountered issues while executing fbdev. To identify the source of the error, I conducted several experiments. I observed that the error originates from the
twin_screen_update
function, as I was able to successfully execute fbdev using the originaltwin_screen_update
function.To resolve this issue, I modified the code introduced in #88 to ensure that the updated
twin_screen_update
function is compatible with fbdev. Below are the modifications I made:The condition
if(*active_pix)
ensures that*active_pix
is valid, as I previously encountered failures in this part of the code. Similarly,if(active_pix)
verifies thatactive_pix
is not NULL. These modifications are designed to prevent unexpected situations from occurring. Finally, I obtained the output from my VM.If I eliminate the code below, I am able to successfully run fbdev.
Modification.mp4
The text was updated successfully, but these errors were encountered: