mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 08:15:18 -04:00
pgui: Workaround for DirectEntry flickering issues w/ pipelining
See #1070. This is a temporary solution (one which isn't complete- it doesn't properly handle state changes).
This commit is contained in:
parent
4f63ef635d
commit
761c54f63d
@ -113,6 +113,12 @@ set_cursor_position(int position) {
|
|||||||
_cursor_position = position;
|
_cursor_position = position;
|
||||||
_cursor_stale = true;
|
_cursor_stale = true;
|
||||||
_blink_start = ClockObject::get_global_clock()->get_frame_time();
|
_blink_start = ClockObject::get_global_clock()->get_frame_time();
|
||||||
|
|
||||||
|
#ifdef THREADED_PIPELINE
|
||||||
|
if (Pipeline::get_render_pipeline()->get_num_stages() > 1) {
|
||||||
|
update_cursor();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,6 +191,13 @@ set_max_width(PN_stdfloat max_width) {
|
|||||||
LightReMutexHolder holder(_lock);
|
LightReMutexHolder holder(_lock);
|
||||||
_max_width = max_width;
|
_max_width = max_width;
|
||||||
_text_geom_stale = true;
|
_text_geom_stale = true;
|
||||||
|
|
||||||
|
#ifdef THREADED_PIPELINE
|
||||||
|
if (Pipeline::get_render_pipeline()->get_num_stages() > 1) {
|
||||||
|
update_text();
|
||||||
|
update_cursor();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -206,9 +219,17 @@ INLINE void PGEntry::
|
|||||||
set_num_lines(int num_lines) {
|
set_num_lines(int num_lines) {
|
||||||
LightReMutexHolder holder(_lock);
|
LightReMutexHolder holder(_lock);
|
||||||
nassertv(num_lines >= 1);
|
nassertv(num_lines >= 1);
|
||||||
_num_lines = num_lines;
|
if (_num_lines != num_lines) {
|
||||||
_text_geom_stale = true;
|
_num_lines = num_lines;
|
||||||
update_text();
|
_text_geom_stale = true;
|
||||||
|
update_text();
|
||||||
|
|
||||||
|
#ifdef THREADED_PIPELINE
|
||||||
|
if (Pipeline::get_render_pipeline()->get_num_stages() > 1) {
|
||||||
|
update_cursor();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -300,6 +321,13 @@ set_obscure_mode(bool flag) {
|
|||||||
if (_obscure_mode != flag) {
|
if (_obscure_mode != flag) {
|
||||||
_obscure_mode = flag;
|
_obscure_mode = flag;
|
||||||
_text_geom_stale = true;
|
_text_geom_stale = true;
|
||||||
|
|
||||||
|
#ifdef THREADED_PIPELINE
|
||||||
|
if (Pipeline::get_render_pipeline()->get_num_stages() > 1) {
|
||||||
|
update_text();
|
||||||
|
update_cursor();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,6 +353,13 @@ set_overflow_mode(bool flag) {
|
|||||||
_overflow_mode = flag;
|
_overflow_mode = flag;
|
||||||
_text_geom_stale = true;
|
_text_geom_stale = true;
|
||||||
_cursor_stale = true;
|
_cursor_stale = true;
|
||||||
|
|
||||||
|
#ifdef THREADED_PIPELINE
|
||||||
|
if (Pipeline::get_render_pipeline()->get_num_stages() > 1) {
|
||||||
|
update_text();
|
||||||
|
update_cursor();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -518,6 +553,11 @@ set_wtext(const std::wstring &wtext) {
|
|||||||
ret = _obscure_text.set_wtext(std::wstring(_text.get_num_characters(), '*'));
|
ret = _obscure_text.set_wtext(std::wstring(_text.get_num_characters(), '*'));
|
||||||
}
|
}
|
||||||
_text_geom_stale = true;
|
_text_geom_stale = true;
|
||||||
|
#ifdef THREADED_PIPELINE
|
||||||
|
if (Pipeline::get_render_pipeline()->get_num_stages() > 1) {
|
||||||
|
update_text();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
set_cursor_position(std::min(_cursor_position, _text.get_num_characters()));
|
set_cursor_position(std::min(_cursor_position, _text.get_num_characters()));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -176,8 +176,10 @@ bool PGEntry::
|
|||||||
cull_callback(CullTraverser *trav, CullTraverserData &data) {
|
cull_callback(CullTraverser *trav, CullTraverserData &data) {
|
||||||
LightReMutexHolder holder(_lock);
|
LightReMutexHolder holder(_lock);
|
||||||
PGItem::cull_callback(trav, data);
|
PGItem::cull_callback(trav, data);
|
||||||
update_text();
|
if (Thread::get_current_pipeline_stage() == 0) {
|
||||||
update_cursor();
|
update_text();
|
||||||
|
update_cursor();
|
||||||
|
}
|
||||||
|
|
||||||
// Now render the text.
|
// Now render the text.
|
||||||
CullTraverserData next_data(data, _text_render_root.node());
|
CullTraverserData next_data(data, _text_render_root.node());
|
||||||
@ -260,7 +262,7 @@ press(const MouseWatcherParameter ¶m, bool background) {
|
|||||||
}
|
}
|
||||||
_cursor_stale = true;
|
_cursor_stale = true;
|
||||||
if (overflow_mode){
|
if (overflow_mode){
|
||||||
_text_geom_stale = true;
|
_text_geom_stale = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -276,7 +278,7 @@ press(const MouseWatcherParameter ¶m, bool background) {
|
|||||||
}
|
}
|
||||||
_cursor_stale = true;
|
_cursor_stale = true;
|
||||||
if (overflow_mode){
|
if (overflow_mode){
|
||||||
_text_geom_stale = true;
|
_text_geom_stale = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,7 +288,7 @@ press(const MouseWatcherParameter ¶m, bool background) {
|
|||||||
_cursor_position = 0;
|
_cursor_position = 0;
|
||||||
_cursor_stale = true;
|
_cursor_stale = true;
|
||||||
if (overflow_mode){
|
if (overflow_mode){
|
||||||
_text_geom_stale = true;
|
_text_geom_stale = true;
|
||||||
}
|
}
|
||||||
type(param);
|
type(param);
|
||||||
}
|
}
|
||||||
@ -297,7 +299,7 @@ press(const MouseWatcherParameter ¶m, bool background) {
|
|||||||
_cursor_position = _text.get_num_characters();
|
_cursor_position = _text.get_num_characters();
|
||||||
_cursor_stale = true;
|
_cursor_stale = true;
|
||||||
if (overflow_mode){
|
if (overflow_mode){
|
||||||
_text_geom_stale = true;
|
_text_geom_stale = true;
|
||||||
}
|
}
|
||||||
type(param);
|
type(param);
|
||||||
}
|
}
|
||||||
@ -306,6 +308,17 @@ press(const MouseWatcherParameter ¶m, bool background) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
PGItem::press(param, background);
|
PGItem::press(param, background);
|
||||||
|
|
||||||
|
#ifdef THREADED_PIPELINE
|
||||||
|
if (Pipeline::get_render_pipeline()->get_num_stages() > 1) {
|
||||||
|
if (_text_geom_stale) {
|
||||||
|
update_text();
|
||||||
|
}
|
||||||
|
if (_cursor_stale) {
|
||||||
|
update_cursor();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -411,6 +424,17 @@ keystroke(const MouseWatcherParameter ¶m, bool background) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
PGItem::keystroke(param, background);
|
PGItem::keystroke(param, background);
|
||||||
|
|
||||||
|
#ifdef THREADED_PIPELINE
|
||||||
|
if (Pipeline::get_render_pipeline()->get_num_stages() > 1) {
|
||||||
|
if (_text_geom_stale) {
|
||||||
|
update_text();
|
||||||
|
}
|
||||||
|
if (_cursor_stale) {
|
||||||
|
update_cursor();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -434,6 +458,17 @@ candidate(const MouseWatcherParameter ¶m, bool background) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
PGItem::candidate(param, background);
|
PGItem::candidate(param, background);
|
||||||
|
|
||||||
|
#ifdef THREADED_PIPELINE
|
||||||
|
if (Pipeline::get_render_pipeline()->get_num_stages() > 1) {
|
||||||
|
if (_text_geom_stale) {
|
||||||
|
update_text();
|
||||||
|
}
|
||||||
|
if (_cursor_stale) {
|
||||||
|
update_cursor();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -924,4 +959,10 @@ update_state() {
|
|||||||
} else {
|
} else {
|
||||||
set_state(S_inactive);
|
set_state(S_inactive);
|
||||||
}
|
}
|
||||||
|
#ifdef THREADED_PIPELINE
|
||||||
|
if (Pipeline::get_render_pipeline()->get_num_stages() > 1) {
|
||||||
|
update_text();
|
||||||
|
update_cursor();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include "pvector.h"
|
#include "pvector.h"
|
||||||
#include "clockObject.h"
|
#include "clockObject.h"
|
||||||
#include "textAssembler.h"
|
#include "textAssembler.h"
|
||||||
|
#include "pipeline.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a particular kind of PGItem that handles simple one-line or short
|
* This is a particular kind of PGItem that handles simple one-line or short
|
||||||
|
Loading…
x
Reference in New Issue
Block a user