mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-28 14:59:41 +03:00
Implemented caret redraw.
This commit is contained in:
parent
cecccf09ed
commit
c0e6cf6590
@ -75,7 +75,6 @@ LDFLAGS += -L$(GCCSDK_INSTALL_ENV)/lib
|
||||
# S_ATARI are sources purely for the Atari FreeMiNT build
|
||||
S_ATARI := \
|
||||
bitmap.c \
|
||||
caret.c \
|
||||
clipboard.c \
|
||||
findfile.c \
|
||||
filetype.c \
|
||||
|
@ -30,8 +30,11 @@
|
||||
|
||||
|
||||
/*
|
||||
bpp: bits per pixel,
|
||||
|
||||
* param bpp bits per pixel,
|
||||
* param w width of the buffer (in pixel)
|
||||
* param h height of the buffer (in pixel)
|
||||
* param flags MFDB_FLAG_NOALLOC | MFDB_FLAG_ZEROMEM | MFDB_FLAG_STAND
|
||||
* returns size of the fd_addr buffer required or allocated
|
||||
*/
|
||||
int init_mfdb(int bpp, int w, int h, uint32_t flags, MFDB * out )
|
||||
{
|
||||
|
129
atari/caret.c
129
atari/caret.c
@ -1,129 +0,0 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "desktop/plot_style.h"
|
||||
#include "atari/plot/plot.h"
|
||||
#include "atari/caret.h"
|
||||
|
||||
extern struct s_vdi_sysinfo vdi_sysinfo;
|
||||
|
||||
static void caret_restore_background(struct s_caret *c, VdiHdl vh, GRECT *clip);
|
||||
|
||||
void caret_show(struct s_caret *caret, VdiHdl vh, GRECT *dimensions, GRECT *clip)
|
||||
{
|
||||
GRECT visible, old_dim;
|
||||
MFDB screen;
|
||||
short pxy[8];
|
||||
|
||||
struct rect old_clip;
|
||||
|
||||
return;
|
||||
|
||||
|
||||
|
||||
plot_get_clip(&old_clip);
|
||||
plot_get_dimensions(&old_dim);
|
||||
|
||||
|
||||
// store background:
|
||||
visible = *dimensions;
|
||||
visible.g_x += clip->g_x;
|
||||
visible.g_y += clip->g_y;
|
||||
|
||||
if(!rc_intersect(clip, &visible)){
|
||||
printf("no isect...\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// TODO: do not alloc / free on each move...
|
||||
if (caret->background.fd_addr != NULL) {
|
||||
//caret_restore_background(caret, vh, clip);
|
||||
}
|
||||
|
||||
plot_lock();
|
||||
plot_set_dimensions(clip->g_x, clip->g_y, clip->g_w, clip->g_h);
|
||||
|
||||
caret->dimensions.g_x = dimensions->g_x;
|
||||
caret->dimensions.g_y = dimensions->g_y;
|
||||
caret->dimensions.g_w = visible.g_w;
|
||||
caret->dimensions.g_h = visible.g_h;
|
||||
|
||||
dbg_grect("clip", clip);
|
||||
dbg_grect("visible", &visible);
|
||||
// TODO: do not alloc / free on every redraw...
|
||||
init_mfdb(vdi_sysinfo.scr_bpp, visible.g_w, visible.g_h, 0,
|
||||
&caret->background);
|
||||
init_mfdb(0, visible.g_w, visible.g_h, 0, &screen);
|
||||
pxy[0] = visible.g_x;
|
||||
pxy[1] = visible.g_y;
|
||||
pxy[2] = visible.g_x + visible.g_w;
|
||||
pxy[3] = visible.g_y + visible.g_h;
|
||||
pxy[4] = 0;
|
||||
pxy[5] = 0;
|
||||
pxy[6] = visible.g_w;
|
||||
pxy[7] = visible.g_h;
|
||||
vro_cpyfm (vh, S_ONLY, pxy, &screen, &caret->background);
|
||||
|
||||
plot_line(dimensions->g_x, dimensions->g_y, dimensions->g_x,
|
||||
dimensions->g_y + dimensions->g_h, plot_style_caret);
|
||||
|
||||
plot_set_dimensions(old_clip.x0, old_clip.y0, old_clip.x1, old_clip.y1);
|
||||
plot_clip(&old_clip);
|
||||
|
||||
plot_unlock();
|
||||
caret->visible = true;
|
||||
}
|
||||
|
||||
void caret_hide(struct s_caret *caret, VdiHdl vh, GRECT *clip)
|
||||
{
|
||||
struct rect old_clip;
|
||||
GRECT old_dim;
|
||||
|
||||
plot_lock();
|
||||
plot_get_clip(&old_clip);
|
||||
plot_get_dimensions(&old_dim);
|
||||
plot_set_dimensions(clip->g_x, clip->g_y, clip->g_w, clip->g_h);
|
||||
caret_restore_background(caret, vh, clip);
|
||||
plot_set_dimensions(old_clip.x0, old_clip.y0, old_clip.x1, old_clip.y1);
|
||||
plot_clip(&old_clip);
|
||||
plot_unlock();
|
||||
caret->visible = false;
|
||||
}
|
||||
|
||||
static void caret_restore_background(struct s_caret *caret, VdiHdl vh, GRECT *clip)
|
||||
{
|
||||
MFDB screen;
|
||||
GRECT visible;
|
||||
short pxy[8];
|
||||
|
||||
visible = caret->dimensions;
|
||||
visible.g_x += clip->g_x;
|
||||
visible.g_y += clip->g_y;
|
||||
|
||||
dbg_grect("restore ", &visible);
|
||||
|
||||
if(!rc_intersect(clip, &visible)){
|
||||
goto exit;
|
||||
}
|
||||
|
||||
// TODO: check isect
|
||||
|
||||
// restore mfdb
|
||||
|
||||
init_mfdb(0, caret->dimensions.g_w, caret->dimensions.g_h, 0, &screen);
|
||||
pxy[0] = 0;
|
||||
pxy[1] = 0;
|
||||
pxy[2] = caret->dimensions.g_w;
|
||||
pxy[3] = caret->dimensions.g_h;
|
||||
pxy[4] = clip->g_x + caret->dimensions.g_x;
|
||||
pxy[5] = clip->g_y + caret->dimensions.g_y;
|
||||
pxy[6] = pxy[2];
|
||||
pxy[7] = pxy[3];
|
||||
vro_cpyfm(vh, S_ONLY, pxy, &caret->background, &screen);
|
||||
// exit:
|
||||
// TODO: do not alloc / free on every redraw...
|
||||
|
||||
exit:
|
||||
free(caret->background.fd_addr);
|
||||
caret->background.fd_addr = NULL;
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
#ifndef NS_ATARI_CARET_H
|
||||
#define NS_ATARI_CARET_H
|
||||
|
||||
#include <mt_gem.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
struct s_caret {
|
||||
GRECT dimensions;
|
||||
MFDB background;
|
||||
bool visible;
|
||||
};
|
||||
|
||||
void caret_show(struct s_caret *c, VdiHdl vh, GRECT * dimensions, GRECT *clip);
|
||||
void caret_hide(struct s_caret *c, VdiHdl vh, GRECT *clip);
|
||||
|
||||
#endif // NS_ATARI_CARET_H
|
||||
|
@ -33,6 +33,12 @@
|
||||
extern unsigned short _systype_v;
|
||||
unsigned short _systype (void);
|
||||
|
||||
/*
|
||||
* Chech for GRECT intersection without modifiend the src rectangles
|
||||
* return true when the GRECT's intersect, fals otherwise.
|
||||
*/
|
||||
bool rc_intersect_ro(GRECT *a, GRECT *b);
|
||||
|
||||
#ifndef POINT_WITHIN
|
||||
# define POINT_WITHIN(_x,_y, r) ((_x >= r.g_x) && (_x <= r.g_x + r.g_w ) \
|
||||
&& (_y >= r.g_y) && (_y <= r.g_y + r.g_h))
|
||||
|
@ -26,8 +26,8 @@
|
||||
#include <mt_gem.h>
|
||||
#include "gemtk.h"
|
||||
|
||||
#define DEBUG_PRINT(x) printf x
|
||||
//#define DEBUG_PRINT(x)
|
||||
//#define DEBUG_PRINT(x) printf x
|
||||
#define DEBUG_PRINT(x)
|
||||
|
||||
struct gui_window_s {
|
||||
short handle;
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <gem.h>
|
||||
#include "gemtk.h"
|
||||
|
||||
@ -38,3 +39,12 @@ unsigned short _systype (void)
|
||||
return _systype_v;
|
||||
}
|
||||
|
||||
bool rc_intersect_ro(GRECT *a, GRECT *b)
|
||||
{
|
||||
GRECT r1, r2;
|
||||
|
||||
r1 = *a;
|
||||
r2 = *b;
|
||||
|
||||
return((bool)rc_intersect(&r1, &r2));
|
||||
}
|
||||
|
50
atari/gui.c
50
atari/gui.c
@ -607,26 +607,30 @@ void gui_window_stop_throbber(struct gui_window *w)
|
||||
/* Place caret in window */
|
||||
void gui_window_place_caret(struct gui_window *w, int x, int y, int height)
|
||||
{
|
||||
//printf("gw place caret\n");
|
||||
|
||||
GRECT clip, dim;
|
||||
struct guiwin_scroll_info_s * slid;
|
||||
if (w == NULL)
|
||||
return;
|
||||
|
||||
slid = guiwin_get_scroll_info(w->root->win);
|
||||
window_get_grect(w->root, BROWSER_AREA_CONTENT, &clip);
|
||||
dim.g_x = x - (slid->x_pos * slid->x_unit_px);
|
||||
dim.g_y = y - (slid->y_pos * slid->y_unit_px);
|
||||
dim.g_h = height;
|
||||
dim.g_w = 2;
|
||||
caret_show(&w->caret, guiwin_get_vdi_handle(w->root->win), &dim, &clip);
|
||||
// if( w->browser->caret.current.g_w > 0 )
|
||||
// gui_window_remove_caret( w );
|
||||
// w->browser->caret.requested.g_x = x;
|
||||
// w->browser->caret.requested.g_y = y;
|
||||
// w->browser->caret.requested.g_w = 1;
|
||||
// w->browser->caret.requested.g_h = height;
|
||||
// w->browser->caret.redraw = true;
|
||||
window_place_caret(w->root, 1, x, y, height, NULL);
|
||||
w->root->caret.state |= CARET_STATE_ENABLED;
|
||||
//
|
||||
// GRECT clip, dim;
|
||||
// struct guiwin_scroll_info_s * slid;
|
||||
// if (w == NULL)
|
||||
// return;
|
||||
//
|
||||
// slid = guiwin_get_scroll_info(w->root->win);
|
||||
// window_get_grect(w->root, BROWSER_AREA_CONTENT, &clip);
|
||||
// dim.g_x = x - (slid->x_pos * slid->x_unit_px);
|
||||
// dim.g_y = y - (slid->y_pos * slid->y_unit_px);
|
||||
// dim.g_h = height;
|
||||
// dim.g_w = 2;
|
||||
// caret_show(&w->caret, guiwin_get_vdi_handle(w->root->win), &dim, &clip);
|
||||
//// if( w->browser->caret.current.g_w > 0 )
|
||||
//// gui_window_remove_caret( w );
|
||||
//// w->browser->caret.requested.g_x = x;
|
||||
//// w->browser->caret.requested.g_y = y;
|
||||
//// w->browser->caret.requested.g_w = 1;
|
||||
//// w->browser->caret.requested.g_h = height;
|
||||
//// w->browser->caret.redraw = true;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -640,6 +644,14 @@ gui_window_remove_caret(struct gui_window *w)
|
||||
if (w == NULL)
|
||||
return;
|
||||
|
||||
|
||||
|
||||
if(w->root->caret.dimensions.g_h > 0 ){
|
||||
//printf("gw hide caret\n");
|
||||
window_place_caret(w->root, 0, -1, -1, -1, NULL);
|
||||
w->root->caret.state &= ~CARET_STATE_ENABLED;
|
||||
}
|
||||
|
||||
// if( w->browser->caret.background.fd_addr != NULL ) {
|
||||
// browser_restore_caret_background( w, NULL );
|
||||
// w->browser->caret.requested.g_w = 0;
|
||||
|
15
atari/gui.h
15
atari/gui.h
@ -19,10 +19,22 @@
|
||||
#ifndef NS_ATARI_GUI_H_
|
||||
#define NS_ATARI_GUI_H_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <mt_gem.h>
|
||||
|
||||
#include "atari/redrawslots.h"
|
||||
#include "atari/caret.h"
|
||||
#include "atari/gemtk/gemtk.h"
|
||||
|
||||
#define CARET_STATE_VISIBLE 0x01
|
||||
#define CARET_STATE_ENABLED 0x02
|
||||
|
||||
struct s_caret {
|
||||
GRECT dimensions;
|
||||
MFDB symbol;
|
||||
int fd_size;
|
||||
unsigned short state;
|
||||
};
|
||||
|
||||
struct point_s {
|
||||
int x;
|
||||
int y;
|
||||
@ -108,6 +120,7 @@ struct s_gui_win_root
|
||||
struct bitmap * icon;
|
||||
struct gui_window *active_gui_window;
|
||||
struct s_redrw_slots redraw_slots;
|
||||
struct s_caret caret;
|
||||
/* current size of window on screen: */
|
||||
GRECT loc;
|
||||
};
|
||||
|
261
atari/rootwin.c
261
atari/rootwin.c
@ -14,6 +14,12 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Module Description:
|
||||
*
|
||||
* This File implements the NetSurf Browser window, or passed functionality to
|
||||
* the appropriate widget's.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -127,7 +133,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
|
||||
// TODO: this needs to iterate through all gui windows and
|
||||
// check if the rootwin is this window...
|
||||
if (data->rootwin->active_gui_window != NULL) {
|
||||
printf("destroy...\n");
|
||||
printf("destroy...\n");
|
||||
browser_window_destroy(
|
||||
data->rootwin->active_gui_window->browser->bw);
|
||||
}
|
||||
@ -178,17 +184,16 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
|
||||
window_get_grect(data->rootwin, BROWSER_AREA_URL_INPUT, &tb_area);
|
||||
if (POINT_WITHIN(ev_out->emo_mouse.p_x, ev_out->emo_mouse.p_y,
|
||||
tb_area)) {
|
||||
gem_set_cursor(&gem_cursors.ibeam);
|
||||
prev_url = true;
|
||||
gem_set_cursor(&gem_cursors.ibeam);
|
||||
prev_url = true;
|
||||
} else {
|
||||
if(prev_url) {
|
||||
struct gui_window *gw;
|
||||
gw = window_get_active_gui_window(data->rootwin);
|
||||
gem_set_cursor(gw->cursor);
|
||||
prev_url = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(prev_url) {
|
||||
struct gui_window *gw;
|
||||
gw = window_get_active_gui_window(data->rootwin);
|
||||
gem_set_cursor(gw->cursor);
|
||||
prev_url = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -486,7 +491,7 @@ void window_set_icon(ROOTWIN *rootwin, struct bitmap * bmp )
|
||||
if (rootwin->icon != NULL) {
|
||||
short info, dummy;
|
||||
if (guiwin_get_state(rootwin->win) & GW_STATUS_ICONIFIED) {
|
||||
printf("set & redraw\n");
|
||||
printf("set & redraw\n");
|
||||
window_redraw_favicon(rootwin, NULL);
|
||||
}
|
||||
}
|
||||
@ -561,7 +566,7 @@ void window_redraw_favicon(ROOTWIN *rootwin, GRECT *clip)
|
||||
}
|
||||
|
||||
if (rootwin->icon == NULL) {
|
||||
printf("window_redraw_favicon OBJCTREE\n");
|
||||
printf("window_redraw_favicon OBJCTREE\n");
|
||||
OBJECT * tree = get_tree(ICONIFY);
|
||||
tree->ob_x = work.g_x;
|
||||
tree->ob_y = work.g_y;
|
||||
@ -598,7 +603,7 @@ void window_schedule_redraw_grect(ROOTWIN *rootwin, GRECT *area)
|
||||
|
||||
guiwin_get_grect(rootwin->win, GUIWIN_AREA_WORK, &work);
|
||||
if(!rc_intersect(area, &work))
|
||||
return;
|
||||
return;
|
||||
|
||||
//dbg_grect("window_schedule_redraw_grect intersection ", &work);
|
||||
|
||||
@ -656,24 +661,175 @@ static void window_redraw_content(ROOTWIN *rootwin, GRECT *content_area,
|
||||
//dbg_rect("rdrw area", &redraw_area);
|
||||
|
||||
browser_window_redraw( bw, -(slid->x_pos*slid->x_unit_px),
|
||||
-(slid->y_pos*slid->y_unit_px), &redraw_area, &rootwin_rdrw_ctx );
|
||||
-(slid->y_pos*slid->y_unit_px), &redraw_area, &rootwin_rdrw_ctx);
|
||||
}
|
||||
|
||||
|
||||
void window_place_caret(ROOTWIN *rootwin, short mode, int content_x,
|
||||
int content_y, int h, GRECT *work)
|
||||
{
|
||||
struct s_caret *caret = &rootwin->caret;
|
||||
VdiHdl vh = guiwin_get_vdi_handle(rootwin->win);
|
||||
short pxy[8];
|
||||
GRECT mywork, caret_pos;
|
||||
MFDB screen;
|
||||
int i, scroll_x, scroll_y;
|
||||
uint16_t *fd_addr;
|
||||
struct guiwin_scroll_info_s *slid;
|
||||
short colors[2] = {BLACK, WHITE};
|
||||
bool render_required = false;
|
||||
|
||||
// avoid duplicate draw of the caret:
|
||||
if (mode == 1 &&(caret->state&CARET_STATE_VISIBLE)!=0) {
|
||||
if (caret->dimensions.g_x == content_x
|
||||
&& caret->dimensions.g_y == content_y
|
||||
&& caret->dimensions.g_h == h) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(work == NULL) {
|
||||
window_get_grect(rootwin, BROWSER_AREA_CONTENT, &mywork);
|
||||
work = &mywork;
|
||||
}
|
||||
slid = guiwin_get_scroll_info(rootwin->win);
|
||||
|
||||
scroll_x = slid->x_pos * slid->x_unit_px;
|
||||
scroll_y = slid->y_pos * slid->y_unit_px;
|
||||
|
||||
init_mfdb(0, 1, h, 0, &screen);
|
||||
|
||||
// enable clipping:
|
||||
pxy[0] = work->g_x;
|
||||
pxy[1] = work->g_y;
|
||||
pxy[2] = pxy[0] + work->g_w - 1;
|
||||
pxy[3] = pxy[1] + work->g_h - 1;
|
||||
vs_clip(vh, 1, pxy);
|
||||
|
||||
// when the caret is visible, undraw it:
|
||||
if (caret->symbol.fd_addr != NULL
|
||||
&& (caret->state&CARET_STATE_VISIBLE)!=0) {
|
||||
|
||||
caret_pos.g_x = work->g_x + (caret->dimensions.g_x - scroll_x);
|
||||
caret_pos.g_y = work->g_y + (caret->dimensions.g_y - scroll_y);
|
||||
caret_pos.g_w = caret->dimensions.g_w;
|
||||
caret_pos.g_h = caret->dimensions.g_h;
|
||||
|
||||
if (rc_intersect(work, &caret_pos)) {
|
||||
|
||||
pxy[0] = 0;
|
||||
pxy[1] = 0;
|
||||
pxy[2] = caret->dimensions.g_w-1;
|
||||
pxy[3] = caret->dimensions.g_h-1;
|
||||
|
||||
pxy[4] = caret_pos.g_x;
|
||||
pxy[5] = caret_pos.g_y;
|
||||
pxy[6] = pxy[4] + caret_pos.g_w-1;
|
||||
pxy[7] = pxy[5] + caret_pos.g_h-1;
|
||||
|
||||
vrt_cpyfm(vh, MD_XOR, pxy, &caret->symbol, &screen, colors);
|
||||
}
|
||||
}
|
||||
if (mode == 0) {
|
||||
// update state:
|
||||
caret->state &= ~CARET_STATE_VISIBLE;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
// when the caret isn't allocated, create it:
|
||||
if (caret->symbol.fd_addr == NULL) {
|
||||
caret->fd_size = init_mfdb(1, 16, h, MFDB_FLAG_ZEROMEM,
|
||||
&caret->symbol);
|
||||
render_required = true;
|
||||
} else {
|
||||
// the caret may need more memory:
|
||||
if (caret->dimensions.g_h < h) {
|
||||
caret->fd_size = init_mfdb(1, 16, h, MFDB_FLAG_NOALLOC,
|
||||
&caret->symbol);
|
||||
realloc(caret->symbol.fd_addr, caret->fd_size);
|
||||
render_required = true;
|
||||
}
|
||||
}
|
||||
|
||||
// set new caret position:
|
||||
caret->dimensions.g_x = content_x;
|
||||
caret->dimensions.g_y = content_y;
|
||||
caret->dimensions.g_w = 1;
|
||||
caret->dimensions.g_h = h;
|
||||
|
||||
// draw the caret into the mfdb buffer:
|
||||
if (render_required) {
|
||||
|
||||
assert(caret->symbol.fd_nplanes == 1);
|
||||
assert(caret->symbol.fd_w == 16);
|
||||
|
||||
// draw an vertical line into the mfdb buffer
|
||||
fd_addr = (uint16_t*)caret->symbol.fd_addr;
|
||||
for(i = 0; i<caret->symbol.fd_h; i++) {
|
||||
fd_addr[i] = 0xFFFF;
|
||||
}
|
||||
}
|
||||
|
||||
// convert content coords to screen coords:
|
||||
|
||||
caret_pos.g_x = work->g_x + (content_x - scroll_x);
|
||||
caret_pos.g_y = work->g_y + (content_y - scroll_y);
|
||||
caret_pos.g_w = caret->dimensions.g_w;
|
||||
caret_pos.g_h = caret->dimensions.g_h;
|
||||
|
||||
if (rc_intersect(work, &caret_pos) /*&& redraw_active == false*/) {
|
||||
|
||||
pxy[0] = 0;
|
||||
pxy[1] = 0;
|
||||
pxy[2] = caret->dimensions.g_w-1;
|
||||
pxy[3] = caret->dimensions.g_h-1;
|
||||
|
||||
pxy[4] = caret_pos.g_x;
|
||||
pxy[5] = caret_pos.g_y;
|
||||
pxy[6] = pxy[4] + caret_pos.g_w-1;
|
||||
pxy[7] = pxy[5] + caret_pos.g_h-1;
|
||||
|
||||
//dbg_pxy("caret screen coords (md_repl)", &pxy[4]);
|
||||
|
||||
// draw caret to screen coords:
|
||||
vrt_cpyfm(vh, /*MD_REPLACE*/ MD_XOR, pxy, &caret->symbol, &screen, colors);
|
||||
|
||||
}
|
||||
|
||||
// update state:
|
||||
caret->state |= CARET_STATE_VISIBLE;
|
||||
|
||||
exit:
|
||||
// disable clipping:
|
||||
vs_clip(guiwin_get_vdi_handle(rootwin->win), 0, pxy);
|
||||
}
|
||||
|
||||
void window_process_redraws(ROOTWIN * rootwin)
|
||||
{
|
||||
GRECT work, visible_ro, tb_area, content_area;
|
||||
short i;
|
||||
short scroll_x=0, scroll_y=0;
|
||||
bool toolbar_rdrw_required;
|
||||
bool caret_rdrw_required = false;
|
||||
struct guiwin_scroll_info_s *slid =NULL;
|
||||
int caret_h = 0;
|
||||
struct s_caret *caret = &rootwin->caret;
|
||||
|
||||
redraw_active = true;
|
||||
|
||||
|
||||
guiwin_get_grect(rootwin->win, GUIWIN_AREA_TOOLBAR, &tb_area);
|
||||
guiwin_get_grect(rootwin->win, GUIWIN_AREA_CONTENT, &content_area);
|
||||
|
||||
//dbg_grect("content area", &content_area);
|
||||
|
||||
while(plot_lock() == false);
|
||||
|
||||
if (((rootwin->caret.state & CARET_STATE_ENABLED)!=0)
|
||||
&& rootwin->caret.dimensions.g_h > 0) {
|
||||
// hide caret:
|
||||
window_place_caret(rootwin, 0, -1, -1, -1, &content_area);
|
||||
}
|
||||
|
||||
short pxy_clip[4];
|
||||
|
||||
pxy_clip[0] = tb_area.g_x;
|
||||
@ -682,8 +838,6 @@ void window_process_redraws(ROOTWIN * rootwin)
|
||||
pxy_clip[0] = pxy_clip[1] + tb_area.g_h + content_area.g_h - 1;
|
||||
vs_clip(guiwin_get_vdi_handle(rootwin->win), 1, pxy_clip);
|
||||
|
||||
while(plot_lock() == false);
|
||||
|
||||
wind_get_grect(rootwin->aes_handle, WF_FIRSTXYWH, &visible_ro);
|
||||
while (visible_ro.g_w > 0 && visible_ro.g_h > 0) {
|
||||
|
||||
@ -709,16 +863,51 @@ void window_process_redraws(ROOTWIN * rootwin)
|
||||
|
||||
rdrw_area = rdrw_area_ro;
|
||||
if (rc_intersect(&content_area, &rdrw_area)) {
|
||||
if(slid == NULL)
|
||||
slid = guiwin_get_scroll_info(rootwin->win);
|
||||
window_redraw_content(rootwin, &content_area, &rdrw_area, slid,
|
||||
rootwin->active_gui_window->browser->bw);
|
||||
}
|
||||
|
||||
if(slid == NULL) {
|
||||
slid = guiwin_get_scroll_info(rootwin->win);
|
||||
|
||||
scroll_x = slid->x_pos * slid->x_unit_px;
|
||||
scroll_y = slid->y_pos * slid->y_unit_px;
|
||||
}
|
||||
|
||||
window_redraw_content(rootwin, &content_area, &rdrw_area,
|
||||
slid,
|
||||
rootwin->active_gui_window->browser->bw);
|
||||
if (((rootwin->caret.state & CARET_STATE_ENABLED)!=0)) {
|
||||
|
||||
GRECT caret_pos;
|
||||
|
||||
caret_pos.g_x = content_area.g_x +
|
||||
(caret->dimensions.g_x - scroll_x);
|
||||
caret_pos.g_y = content_area.g_y +
|
||||
(caret->dimensions.g_y - scroll_y);
|
||||
caret_pos.g_w = caret->dimensions.g_w;
|
||||
caret_pos.g_h = caret->dimensions.g_h;
|
||||
|
||||
if(rc_intersect_ro(&caret_pos, &content_area)) {
|
||||
caret_rdrw_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
wind_get_grect(rootwin->aes_handle, WF_NEXTXYWH, &visible_ro);
|
||||
}
|
||||
|
||||
|
||||
// disable clipping:
|
||||
vs_clip(guiwin_get_vdi_handle(rootwin->win), 0, pxy_clip);
|
||||
|
||||
if (caret_rdrw_required && ((rootwin->caret.state & CARET_STATE_ENABLED)!=0)) {
|
||||
|
||||
// force redraw of caret:
|
||||
caret_h = rootwin->caret.dimensions.g_h;
|
||||
rootwin->caret.dimensions.g_h = 0;
|
||||
window_place_caret(rootwin, 1, rootwin->caret.dimensions.g_x,
|
||||
rootwin->caret.dimensions.g_y,
|
||||
caret_h, &content_area);
|
||||
}
|
||||
|
||||
rootwin->redraw_slots.areas_used = 0;
|
||||
redraw_active = false;
|
||||
|
||||
@ -731,22 +920,22 @@ void window_process_redraws(ROOTWIN * rootwin)
|
||||
/* -------------------------------------------------------------------------- */
|
||||
static bool on_content_mouse_move(ROOTWIN *rootwin, GRECT *content_area)
|
||||
{
|
||||
int mx, my, sx, sy;
|
||||
struct guiwin_scroll_info_s *slid;
|
||||
struct gui_window *gw;
|
||||
struct browser_window *bw;
|
||||
int mx, my, sx, sy;
|
||||
struct guiwin_scroll_info_s *slid;
|
||||
struct gui_window *gw;
|
||||
struct browser_window *bw;
|
||||
|
||||
// make relative mouse coords:
|
||||
mx = aes_event_out.emo_mouse.p_x - content_area->g_x;
|
||||
my = aes_event_out.emo_mouse.p_y - content_area->g_y;
|
||||
// make relative mouse coords:
|
||||
mx = aes_event_out.emo_mouse.p_x - content_area->g_x;
|
||||
my = aes_event_out.emo_mouse.p_y - content_area->g_y;
|
||||
|
||||
slid = guiwin_get_scroll_info(rootwin->win);
|
||||
gw = window_get_active_gui_window(rootwin);
|
||||
bw = gw->browser->bw;
|
||||
slid = guiwin_get_scroll_info(rootwin->win);
|
||||
gw = window_get_active_gui_window(rootwin);
|
||||
bw = gw->browser->bw;
|
||||
|
||||
// calculate scroll pos. in pixel:
|
||||
sx = slid->x_pos * slid->x_unit_px;
|
||||
sy = slid->y_pos * slid->y_unit_px;
|
||||
// calculate scroll pos. in pixel:
|
||||
sx = slid->x_pos * slid->x_unit_px;
|
||||
sy = slid->y_pos * slid->y_unit_px;
|
||||
|
||||
browser_window_mouse_track(bw, 0, mx + sx, my + sy);
|
||||
}
|
||||
|
@ -73,6 +73,8 @@ void window_set_active_gui_window(ROOTWIN *rootwin, struct gui_window *gw);
|
||||
void window_scroll_by(ROOTWIN *rootwin, int x, int y);
|
||||
void window_schedule_redraw_grect(ROOTWIN *rootwin, GRECT *area);
|
||||
void window_process_redraws(ROOTWIN * rootwin);
|
||||
void window_place_caret(ROOTWIN *rootwin, short mode, int content_x,
|
||||
int content_y, int h, GRECT *work);
|
||||
struct gui_window * window_get_active_gui_window(ROOTWIN * rootwin);
|
||||
void window_get_scroll(ROOTWIN *rootwin, int *x, int *y);
|
||||
void window_get_grect(ROOTWIN *rootwin, enum browser_area_e which, GRECT *d);
|
||||
|
Loading…
Reference in New Issue
Block a user