forked from pyrite-dev/milsko
less flickering for x11
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@322 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
parent
1adce781eb
commit
27bf409a88
5 changed files with 27 additions and 11 deletions
|
|
@ -73,14 +73,14 @@ void tick(MwWidget handle, void* user, void* call) {
|
||||||
glVertex2f(cos(rad) * 0.5, sin(rad) * 0.5);
|
glVertex2f(cos(rad) * 0.5, sin(rad) * 0.5);
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
if(render && w > 0 && h > 0){
|
if(render && w > 0 && h > 0) {
|
||||||
unsigned char* buffer = malloc(w * h * 4);
|
unsigned char* buffer = malloc(w * h * 4);
|
||||||
MwLLPixmap px;
|
MwLLPixmap px;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
|
glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
|
||||||
for(i = 0; i < h / 2; i++){
|
for(i = 0; i < h / 2; i++) {
|
||||||
for(j = 0; j < w * 4; j++){
|
for(j = 0; j < w * 4; j++) {
|
||||||
unsigned char b = buffer[i * w * 4 + j];
|
unsigned char b = buffer[i * w * 4 + j];
|
||||||
|
|
||||||
buffer[i * w * 4 + j] = buffer[(h - i - 1) * w * 4 + j];
|
buffer[i * w * 4 + j] = buffer[(h - i - 1) * w * 4 + j];
|
||||||
|
|
|
||||||
|
|
@ -115,6 +115,8 @@ MWDECL void MwLLMakeBorderless(MwLL handle, int toggle);
|
||||||
|
|
||||||
MWDECL long MwLLGetTick(void);
|
MWDECL long MwLLGetTick(void);
|
||||||
|
|
||||||
|
MWDECL void MwLLSetBackground(MwLL handle, MwLLColor color);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -276,6 +276,11 @@ void MwLLFreeColor(MwLLColor color) {
|
||||||
free(color);
|
free(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MwLLSetBackground(MwLL handle, MwLLColor color) {
|
||||||
|
(void)handle;
|
||||||
|
(void)color;
|
||||||
|
}
|
||||||
|
|
||||||
void MwLLGetXYWH(MwLL handle, int* x, int* y, unsigned int* w, unsigned int* h) {
|
void MwLLGetXYWH(MwLL handle, int* x, int* y, unsigned int* w, unsigned int* h) {
|
||||||
RECT rc;
|
RECT rc;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -174,6 +174,10 @@ void MwLLFreeColor(MwLLColor color) {
|
||||||
free(color);
|
free(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MwLLSetBackground(MwLL handle, MwLLColor color) {
|
||||||
|
XSetWindowBackground(handle->display, handle->window, color->pixel);
|
||||||
|
}
|
||||||
|
|
||||||
int MwLLPending(MwLL handle) {
|
int MwLLPending(MwLL handle) {
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
if(XCheckTypedWindowEvent(handle->display, handle->window, ClientMessage, &ev) || XCheckWindowEvent(handle->display, handle->window, mask, &ev)) {
|
if(XCheckTypedWindowEvent(handle->display, handle->window, ClientMessage, &ev) || XCheckWindowEvent(handle->display, handle->window, mask, &ev)) {
|
||||||
|
|
|
||||||
|
|
@ -275,6 +275,11 @@ void MwSetText(MwWidget handle, const char* key, const char* value) {
|
||||||
shput(handle->text, key, v);
|
shput(handle->text, key, v);
|
||||||
}
|
}
|
||||||
if(handle->prop_event) MwDispatch3(handle, prop_change, key);
|
if(handle->prop_event) MwDispatch3(handle, prop_change, key);
|
||||||
|
if(strcmp(key, MwNbackground) == 0) {
|
||||||
|
MwLLColor c = MwParseColor(handle, value);
|
||||||
|
MwLLSetBackground(handle->lowlevel, c);
|
||||||
|
MwLLFreeColor(c);
|
||||||
|
}
|
||||||
if(strcmp(key, MwNbackground) == 0 || strcmp(key, MwNforeground) == 0) {
|
if(strcmp(key, MwNbackground) == 0 || strcmp(key, MwNforeground) == 0) {
|
||||||
MwForceRender(handle);
|
MwForceRender(handle);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue