Commit fb5739dc authored by Raphael Defosseux's avatar Raphael Defosseux

Merge branch 'develop_integration_w48' into 'develop'

Develop integration 2018 week 48

See merge request oai/openairinterface5g!462

Integration of the following MRs:

 - MR 448: Missing RRC inactivity timer
 - MR 458: Adding MAC main config to RRC connection setup
 - MR 457: Resolving "parallelization not working correctly in phy simulators"
 - MR 460: Fixing RU DFT initialization
parents 814b967c 84d66914
...@@ -436,7 +436,7 @@ class SSHConnection(): ...@@ -436,7 +436,7 @@ class SSHConnection():
self.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, pcap_log_file, self.eNBSourceCodePath + '/cmake_targets/.') self.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, pcap_log_file, self.eNBSourceCodePath + '/cmake_targets/.')
sys.exit(1) sys.exit(1)
else: else:
self.command('stdbuf -o0 cat enb_' + SSH.testCase_id + '.log | egrep --color=never -i "wait|sync"', '\$', 4) self.command('stdbuf -o0 cat enb_' + SSH.testCase_id + '.log | egrep --text --color=never -i "wait|sync"', '\$', 4)
if rruCheck: if rruCheck:
result = re.search('wait RUs', str(self.ssh.before)) result = re.search('wait RUs', str(self.ssh.before))
else: else:
...@@ -1573,6 +1573,8 @@ class SSHConnection(): ...@@ -1573,6 +1573,8 @@ class SSHConnection():
rrcReestablishRequest = 0 rrcReestablishRequest = 0
rrcReestablishComplete = 0 rrcReestablishComplete = 0
rrcReestablishReject = 0 rrcReestablishReject = 0
rlcDiscardBuffer = 0
rachCanceledProcedure = 0
uciStatMsgCount = 0 uciStatMsgCount = 0
pdcpFailure = 0 pdcpFailure = 0
ulschFailure = 0 ulschFailure = 0
...@@ -1625,6 +1627,12 @@ class SSHConnection(): ...@@ -1625,6 +1627,12 @@ class SSHConnection():
result = re.search('ULSCH in error in round', str(line)) result = re.search('ULSCH in error in round', str(line))
if result is not None: if result is not None:
ulschFailure += 1 ulschFailure += 1
result = re.search('BAD all_segments_received', str(line))
if result is not None:
rlcDiscardBuffer += 1
result = re.search('Canceled RA procedure for UE rnti', str(line))
if result is not None:
rachCanceledProcedure += 1
enb_log_file.close() enb_log_file.close()
self.htmleNBFailureMsg = '' self.htmleNBFailureMsg = ''
if uciStatMsgCount > 0: if uciStatMsgCount > 0:
...@@ -1667,6 +1675,10 @@ class SSHConnection(): ...@@ -1667,6 +1675,10 @@ class SSHConnection():
rrcMsg = ' -- ' + str(rrcReestablishReject) + ' were rejected' rrcMsg = ' -- ' + str(rrcReestablishReject) + ' were rejected'
logging.debug('\u001B[1;30;43m ' + rrcMsg + ' \u001B[0m') logging.debug('\u001B[1;30;43m ' + rrcMsg + ' \u001B[0m')
self.htmleNBFailureMsg += rrcMsg + '\n' self.htmleNBFailureMsg += rrcMsg + '\n'
if rachCanceledProcedure > 0:
rachMsg = 'eNB cancelled ' + str(rachCanceledProcedure) + ' RA procedure(s)'
logging.debug('\u001B[1;30;43m ' + rachMsg + ' \u001B[0m')
self.htmleNBFailureMsg += rachMsg + '\n'
if foundSegFault: if foundSegFault:
logging.debug('\u001B[1;37;41m eNB ended with a Segmentation Fault! \u001B[0m') logging.debug('\u001B[1;37;41m eNB ended with a Segmentation Fault! \u001B[0m')
return ENB_PROCESS_SEG_FAULT return ENB_PROCESS_SEG_FAULT
...@@ -1677,6 +1689,11 @@ class SSHConnection(): ...@@ -1677,6 +1689,11 @@ class SSHConnection():
if foundRealTimeIssue: if foundRealTimeIssue:
logging.debug('\u001B[1;37;41m eNB faced real time issues! \u001B[0m') logging.debug('\u001B[1;37;41m eNB faced real time issues! \u001B[0m')
return ENB_PROCESS_REALTIME_ISSUE return ENB_PROCESS_REALTIME_ISSUE
if rlcDiscardBuffer > 0:
rlcMsg = 'eNB RLC discarded ' + str(rlcDiscardBuffer) + ' buffer(s)'
logging.debug('\u001B[1;37;41m ' + rlcMsg + ' \u001B[0m')
self.htmleNBFailureMsg += rlcMsg + '\n'
return ENB_PROCESS_REALTIME_ISSUE
return 0 return 0
def TerminateeNB(self): def TerminateeNB(self):
......
...@@ -21,17 +21,15 @@ ...@@ -21,17 +21,15 @@
--> -->
<testCaseList> <testCaseList>
<!-- Only 5MHz is tested since neither 10MHz nor 20MHz work in this configuration --> <!-- Only 5MHz/10MHz is tested since 20MHz does not work as in monolithic -->
<!-- Also no UL iperf in 5MHz (040642) -->
<TestCaseRequestedList> <TestCaseRequestedList>
010101 010101
050101 060101 070101 040101 050101 060101 070101 040101
030104 030105 040301 040501 040602 040401 040201 030201 030202 030104 030105 040301 040501 040602 040642 040401 040201 030201 030202
030114 030115 040301 040511 040612 040652 040401 040201 030201 030202
050201 060201 070201 050201 060201 070201
</TestCaseRequestedList> </TestCaseRequestedList>
<!-- <!--
030104 030105 040301 040501 040602 040642 040401 040201 030201 030202
030114 030115 040301 040511 040612 040652 040401 040201 030201 030202
030124 030125 040301 040521 040622 040662 040401 040201 030201 030202 030124 030125 040301 040521 040622 040662 040401 040201 030201 030202
--> -->
<TestCaseExclusionList> <TestCaseExclusionList>
......
...@@ -21,17 +21,14 @@ ...@@ -21,17 +21,14 @@
--> -->
<testCaseList> <testCaseList>
<!-- Only 5MHz is tested since neither 10MHz nor 20MHz work in this configuration -->
<TestCaseRequestedList> <TestCaseRequestedList>
010101 010101
050101 060101 070101 040101 050101 060101 070101 040101
030101 030102 040301 040501 040604 040642 040401 040201 030201 030202 030101 030102 040301 040501 040604 040642 040401 040201 030201 030202
050201 060201 070201
</TestCaseRequestedList>
<!--
030111 030112 040301 040511 040614 040652 040401 040201 030201 030202 030111 030112 040301 040511 040614 040652 040401 040201 030201 030202
030121 030122 040301 040521 040624 040662 040401 040201 030201 030202 030121 030122 040301 040521 040624 040662 040401 040201 030201 030202
--> 050201 060201 070201
</TestCaseRequestedList>
<TestCaseExclusionList> <TestCaseExclusionList>
</TestCaseExclusionList> </TestCaseExclusionList>
......
...@@ -232,7 +232,7 @@ add_definitions("-DPACKAGE_BUGREPORT=\"openair4g-devel@lists.eurecom.fr\"") ...@@ -232,7 +232,7 @@ add_definitions("-DPACKAGE_BUGREPORT=\"openair4g-devel@lists.eurecom.fr\"")
# Debug related options # Debug related options
######################################### #########################################
add_boolean_option(ASN_DEBUG False "ASN1 coder/decoder Debug") add_boolean_option(ASN_DEBUG False "ASN1 coder/decoder Debug")
add_boolean_option(EMIT_ASN_DEBUG False "ASN1 coder/decoder Debug") add_boolean_option(ASN_EMIT_DEBUG False "ASN1 coder/decoder Debug")
add_boolean_option(MSG_PRINT False "print debug messages") add_boolean_option(MSG_PRINT False "print debug messages")
add_boolean_option(DISABLE_XER_PRINT False "print XER Format") add_boolean_option(DISABLE_XER_PRINT False "print XER Format")
add_boolean_option(XER_PRINT False "print XER Format") add_boolean_option(XER_PRINT False "print XER Format")
......
...@@ -39,10 +39,9 @@ ...@@ -39,10 +39,9 @@
#include "vcd_signal_dumper.h" #include "vcd_signal_dumper.h"
#include "assertions.h" #include "assertions.h"
#include <pthread.h>
# include <pthread.h> #include <string.h>
# include <string.h> #include <linux/prctl.h>
#include <linux/prctl.h>
#include "common/config/config_userapi.h" #include "common/config/config_userapi.h"
// main log variables // main log variables
......
...@@ -7,21 +7,19 @@ ...@@ -7,21 +7,19 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
int x_connection_fd(x_connection *_x) int x_connection_fd(x_connection *_x) {
{
struct x_connection *x = _x; struct x_connection *x = _x;
return ConnectionNumber(x->d); return ConnectionNumber(x->d);
} }
static GC create_gc(Display *d, char *color) static GC create_gc(Display *d, char *color) {
{
GC ret = XCreateGC(d, DefaultRootWindow(d), 0, NULL); GC ret = XCreateGC(d, DefaultRootWindow(d), 0, NULL);
XGCValues gcv; XGCValues gcv;
XColor rcol, scol; XColor rcol, scol;
XCopyGC(d, DefaultGC(d, DefaultScreen(d)), -1L, ret); XCopyGC(d, DefaultGC(d, DefaultScreen(d)), -1L, ret);
if (XAllocNamedColor(d, DefaultColormap(d, DefaultScreen(d)), if (XAllocNamedColor(d, DefaultColormap(d, DefaultScreen(d)),
color, &scol, &rcol)) { color, &scol, &rcol)) {
gcv.foreground = scol.pixel; gcv.foreground = scol.pixel;
XChangeGC(d, ret, GCForeground, &gcv); XChangeGC(d, ret, GCForeground, &gcv);
} else ERR("X: could not allocate color '%s'\n", color); } else ERR("X: could not allocate color '%s'\n", color);
...@@ -29,82 +27,81 @@ static GC create_gc(Display *d, char *color) ...@@ -29,82 +27,81 @@ static GC create_gc(Display *d, char *color)
return ret; return ret;
} }
int x_new_color(x_connection *_x, char *color) int x_new_color(x_connection *_x, char *color) {
{
struct x_connection *x = _x; struct x_connection *x = _x;
x->ncolors++; x->ncolors++;
x->colors = realloc(x->colors, x->ncolors * sizeof(GC)); x->colors = realloc(x->colors, x->ncolors * sizeof(GC));
if (x->colors == NULL) OOM; if (x->colors == NULL) OOM;
x->colors[x->ncolors-1] = create_gc(x->d, color);
x->colors[x->ncolors-1] = create_gc(x->d, color);
x->xft_colors = realloc(x->xft_colors, x->ncolors * sizeof(XftColor)); x->xft_colors = realloc(x->xft_colors, x->ncolors * sizeof(XftColor));
if (x->xft_colors == NULL) OOM; if (x->xft_colors == NULL) OOM;
if (XftColorAllocName(x->d, DefaultVisual(x->d, DefaultScreen(x->d)), if (XftColorAllocName(x->d, DefaultVisual(x->d, DefaultScreen(x->d)),
DefaultColormap(x->d, DefaultScreen(x->d)), DefaultColormap(x->d, DefaultScreen(x->d)),
color, &x->xft_colors[x->ncolors-1]) == False) color, &x->xft_colors[x->ncolors-1]) == False)
ERR("could not allocate color '%s'\n", color); ERR("could not allocate color '%s'\n", color);
return x->ncolors - 1; return x->ncolors - 1;
} }
int x_new_font(x_connection *_x, char *font) int x_new_font(x_connection *_x, char *font) {
{
struct x_connection *x = _x; struct x_connection *x = _x;
/* TODO: allocate fonts only once */ /* TODO: allocate fonts only once */
x->nfonts++; x->nfonts++;
x->fonts = realloc(x->fonts, x->nfonts * sizeof(XftFont *)); x->fonts = realloc(x->fonts, x->nfonts * sizeof(XftFont *));
if (x->fonts == NULL) OOM; if (x->fonts == NULL) OOM;
x->fonts[x->nfonts-1] = XftFontOpenName(x->d, DefaultScreen(x->d), font); x->fonts[x->nfonts-1] = XftFontOpenName(x->d, DefaultScreen(x->d), font);
if (x->fonts[x->nfonts-1] == NULL) if (x->fonts[x->nfonts-1] == NULL)
ERR("failed allocating font '%s'\n", font); ERR("failed allocating font '%s'\n", font);
return x->nfonts - 1; return x->nfonts - 1;
} }
x_connection *x_open(void) x_connection *x_open(void) {
{
struct x_connection *ret; struct x_connection *ret;
ret = calloc(1, sizeof(struct x_connection)); ret = calloc(1, sizeof(struct x_connection));
if (ret == NULL) OOM; if (ret == NULL) OOM;
ret->d = XOpenDisplay(0); ret->d = XOpenDisplay(0);
LOGD("XOpenDisplay display %p return x_connection %p\n", ret->d, ret); LOGD("XOpenDisplay display %p return x_connection %p\n", ret->d, ret);
if (ret->d == NULL) ERR("error calling XOpenDisplay: no X? you root?\n"); if (ret->d == NULL) ERR("error calling XOpenDisplay: no X? you root?\n");
x_new_color(ret, "white"); /* background color */ x_new_color(ret, "white"); /* background color */
x_new_color(ret, "black"); /* foreground color */ x_new_color(ret, "black"); /* foreground color */
x_new_font(ret, "sans-8"); x_new_font(ret, "sans-8");
return ret; return ret;
} }
x_window *x_create_window(x_connection *_x, int width, int height, x_window *x_create_window(x_connection *_x, int width, int height,
char *title) char *title) {
{
struct x_connection *x = _x; struct x_connection *x = _x;
struct x_window *ret; struct x_window *ret;
ret = calloc(1, sizeof(struct x_window)); ret = calloc(1, sizeof(struct x_window));
if (ret == NULL) OOM; if (ret == NULL) OOM;
ret->w = XCreateSimpleWindow(x->d, DefaultRootWindow(x->d), 0, 0, ret->w = XCreateSimpleWindow(x->d, DefaultRootWindow(x->d), 0, 0,
width, height, 0, WhitePixel(x->d, DefaultScreen(x->d)), width, height, 0, WhitePixel(x->d, DefaultScreen(x->d)),
WhitePixel(x->d, DefaultScreen(x->d))); WhitePixel(x->d, DefaultScreen(x->d)));
ret->width = width; ret->width = width;
ret->height = height; ret->height = height;
XStoreName(x->d, ret->w, title); XStoreName(x->d, ret->w, title);
ret->p = XCreatePixmap(x->d, ret->w, width, height, ret->p = XCreatePixmap(x->d, ret->w, width, height,
DefaultDepth(x->d, DefaultScreen(x->d))); DefaultDepth(x->d, DefaultScreen(x->d)));
XFillRectangle(x->d, ret->p, x->colors[BACKGROUND_COLOR], XFillRectangle(x->d, ret->p, x->colors[BACKGROUND_COLOR],
0, 0, width, height); 0, 0, width, height);
ret->xft = XftDrawCreate(x->d, ret->p, ret->xft = XftDrawCreate(x->d, ret->p,
DefaultVisual(x->d, DefaultScreen(x->d)), DefaultVisual(x->d, DefaultScreen(x->d)),
DefaultColormap(x->d, DefaultScreen(x->d))); DefaultColormap(x->d, DefaultScreen(x->d)));
if (ret->xft == NULL) ERR("XftDrawCreate failed\n"); if (ret->xft == NULL) ERR("XftDrawCreate failed\n");
/* enable backing store */ /* enable backing store */
...@@ -113,23 +110,19 @@ x_window *x_create_window(x_connection *_x, int width, int height, ...@@ -113,23 +110,19 @@ x_window *x_create_window(x_connection *_x, int width, int height,
att.backing_store = Always; att.backing_store = Always;
XChangeWindowAttributes(x->d, ret->w, CWBackingStore, &att); XChangeWindowAttributes(x->d, ret->w, CWBackingStore, &att);
} }
XSelectInput(x->d, ret->w, XSelectInput(x->d, ret->w,
KeyPressMask | KeyPressMask |
ButtonPressMask | ButtonPressMask |
ButtonReleaseMask | ButtonReleaseMask |
PointerMotionMask | PointerMotionMask |
ExposureMask | ExposureMask |
StructureNotifyMask); StructureNotifyMask);
XMapWindow(x->d, ret->w); XMapWindow(x->d, ret->w);
return ret; return ret;
} }
x_image *x_create_image(x_connection *_x, unsigned char *data, x_image *x_create_image(x_connection *_x, unsigned char *data,
int width, int height) int width, int height) {
{
struct x_connection *x = _x; struct x_connection *x = _x;
struct x_image *ret; struct x_image *ret;
XImage *ximage; XImage *ximage;
...@@ -137,8 +130,9 @@ x_image *x_create_image(x_connection *_x, unsigned char *data, ...@@ -137,8 +130,9 @@ x_image *x_create_image(x_connection *_x, unsigned char *data,
XVisualInfo template; XVisualInfo template;
int nvs; int nvs;
Visual *v; Visual *v;
ret = calloc(1, sizeof(struct x_image));
ret = calloc(1, sizeof(struct x_image)); if (ret == NULL) OOM; if (ret == NULL) OOM;
template.class = TrueColor; template.class = TrueColor;
template.depth = 24; template.depth = 24;
...@@ -146,68 +140,65 @@ x_image *x_create_image(x_connection *_x, unsigned char *data, ...@@ -146,68 +140,65 @@ x_image *x_create_image(x_connection *_x, unsigned char *data,
template.green_mask = 0x00ff00; template.green_mask = 0x00ff00;
template.blue_mask = 0x0000ff; template.blue_mask = 0x0000ff;
template.bits_per_rgb = 8; template.bits_per_rgb = 8;
vs = XGetVisualInfo(x->d, VisualDepthMask | VisualClassMask | vs = XGetVisualInfo(x->d, VisualDepthMask | VisualClassMask |
VisualRedMaskMask | VisualGreenMaskMask | VisualBlueMaskMask | VisualRedMaskMask | VisualGreenMaskMask | VisualBlueMaskMask |
VisualBitsPerRGBMask, &template, &nvs); VisualBitsPerRGBMask, &template, &nvs);
if (vs == NULL) { if (vs == NULL) {
/* try again with 32 bpp */ /* try again with 32 bpp */
template.depth = 32; template.depth = 32;
vs = XGetVisualInfo(x->d, VisualDepthMask | VisualClassMask | vs = XGetVisualInfo(x->d, VisualDepthMask | VisualClassMask |
VisualRedMaskMask | VisualGreenMaskMask | VisualBlueMaskMask | VisualRedMaskMask | VisualGreenMaskMask | VisualBlueMaskMask |
VisualBitsPerRGBMask, &template, &nvs); VisualBitsPerRGBMask, &template, &nvs);
} }
if (vs == NULL) ERR("no good visual found\n"); if (vs == NULL) ERR("no good visual found\n");
v = vs[0].visual; v = vs[0].visual;
XFree(vs); XFree(vs);
ximage = XCreateImage(x->d, v, 24, ZPixmap, 0, ximage = XCreateImage(x->d, v, 24, ZPixmap, 0,
(char*)data, width, height, 32, 0); (char *)data, width, height, 32, 0);
if (ximage == NULL) ERR("image creation failed\n"); if (ximage == NULL) ERR("image creation failed\n");
ret->p = XCreatePixmap(x->d, DefaultRootWindow(x->d), width, height, 24); ret->p = XCreatePixmap(x->d, DefaultRootWindow(x->d), width, height, 24);
XPutImage(x->d, ret->p, DefaultGC(x->d, DefaultScreen(x->d)), XPutImage(x->d, ret->p, DefaultGC(x->d, DefaultScreen(x->d)),
ximage, 0, 0, 0, 0, width, height); ximage, 0, 0, 0, 0, width, height);
/* TODO: be sure it's fine to set data to NULL */ /* TODO: be sure it's fine to set data to NULL */
ximage->data = NULL; ximage->data = NULL;
XDestroyImage(ximage); XDestroyImage(ximage);
ret->width = width; ret->width = width;
ret->height = height; ret->height = height;
return ret; return ret;
} }
static struct toplevel_window_widget *find_x_window(struct gui *g, Window id) static struct toplevel_window_widget *find_x_window(struct gui *g, Window id) {
{
struct widget_list *cur; struct widget_list *cur;
struct toplevel_window_widget *w; struct toplevel_window_widget *w;
struct x_window *xw; struct x_window *xw;
cur = g->toplevel; cur = g->toplevel;
while (cur) { while (cur) {
w = (struct toplevel_window_widget *)cur->item; w = (struct toplevel_window_widget *)cur->item;
xw = w->x; xw = w->x;
if (xw->w == id) return w; if (xw->w == id) return w;
cur = cur->next; cur = cur->next;
} }
return NULL; return NULL;
} }
void x_events(gui *_gui) void x_events(gui *_gui) {
{
struct gui *g = _gui; struct gui *g = _gui;
struct widget_list *cur; struct widget_list *cur;
struct x_connection *x = g->x; struct x_connection *x = g->x;
struct toplevel_window_widget *w; struct toplevel_window_widget *w;
LOGD("x_events START\n"); LOGD("x_events START\n");
/* preprocessing (to "compress" events) */ /* preprocessing (to "compress" events) */
cur = g->toplevel; cur = g->toplevel;
while (cur) { while (cur) {
struct x_window *xw; struct x_window *xw;
w = (struct toplevel_window_widget *)cur->item; w = (struct toplevel_window_widget *)cur->item;
...@@ -222,58 +213,84 @@ void x_events(gui *_gui) ...@@ -222,58 +213,84 @@ void x_events(gui *_gui)
XEvent ev; XEvent ev;
XNextEvent(x->d, &ev); XNextEvent(x->d, &ev);
LOGD("XEV %d\n", ev.type); LOGD("XEV %d\n", ev.type);
switch (ev.type) { switch (ev.type) {
case MapNotify: case MapNotify:
case Expose: case Expose:
if ((w = find_x_window(g, ev.xexpose.window)) != NULL) { if ((w = find_x_window(g, ev.xexpose.window)) != NULL) {
struct x_window *xw = w->x; struct x_window *xw = w->x;
xw->redraw = 1; xw->redraw = 1;
} }
break;
case ConfigureNotify: break;
if ((w = find_x_window(g, ev.xconfigure.window)) != NULL) {
struct x_window *xw = w->x; case ConfigureNotify:
xw->resize = 1; if ((w = find_x_window(g, ev.xconfigure.window)) != NULL) {
xw->new_width = ev.xconfigure.width; struct x_window *xw = w->x;
xw->new_height = ev.xconfigure.height; xw->resize = 1;
if (xw->new_width < 10) xw->new_width = 10; xw->new_width = ev.xconfigure.width;
if (xw->new_height < 10) xw->new_height = 10; xw->new_height = ev.xconfigure.height;
LOGD("ConfigureNotify %d %d\n", ev.xconfigure.width, ev.xconfigure.height);
} if (xw->new_width < 10) xw->new_width = 10;
break;
case ButtonPress: if (xw->new_height < 10) xw->new_height = 10;
if ((w = find_x_window(g, ev.xbutton.window)) != NULL) {
int key_modifiers = 0; LOGD("ConfigureNotify %d %d\n", ev.xconfigure.width, ev.xconfigure.height);
if (ev.xbutton.state & ShiftMask) key_modifiers |= KEY_SHIFT; }
if (ev.xbutton.state & Mod1Mask) key_modifiers |= KEY_ALT;
if (ev.xbutton.state & ControlMask) key_modifiers |= KEY_CONTROL; break;
w->common.button(g, w, ev.xbutton.x, ev.xbutton.y, key_modifiers,
ev.xbutton.button, 0); case ButtonPress:
} if ((w = find_x_window(g, ev.xbutton.window)) != NULL) {
break; int key_modifiers = 0;
case ButtonRelease:
if ((w = find_x_window(g, ev.xbutton.window)) != NULL) { if (ev.xbutton.state & ShiftMask) key_modifiers |= KEY_SHIFT;
int key_modifiers = 0;
if (ev.xbutton.state & ShiftMask) key_modifiers |= KEY_SHIFT; if (ev.xbutton.state & Mod1Mask) key_modifiers |= KEY_ALT;
if (ev.xbutton.state & Mod1Mask) key_modifiers |= KEY_ALT;
if (ev.xbutton.state & ControlMask) key_modifiers |= KEY_CONTROL; if (ev.xbutton.state & ControlMask) key_modifiers |= KEY_CONTROL;
w->common.button(g, w, ev.xbutton.x, ev.xbutton.y, key_modifiers,
ev.xbutton.button, 1); w->common.button(g, w, ev.xbutton.x, ev.xbutton.y, key_modifiers,
} ev.xbutton.button, 0);
break; }
default: if (gui_logd) WARN("TODO: X event type %d\n", ev.type); break;
break;
case ButtonRelease:
if ((w = find_x_window(g, ev.xbutton.window)) != NULL) {
int key_modifiers = 0;
if (ev.xbutton.state & ShiftMask) key_modifiers |= KEY_SHIFT;
if (ev.xbutton.state & Mod1Mask) key_modifiers |= KEY_ALT;
if (ev.xbutton.state & ControlMask) key_modifiers |= KEY_CONTROL;
w->common.button(g, w, ev.xbutton.x, ev.xbutton.y, key_modifiers,
ev.xbutton.button, 1);
}
break;
default:
if (gui_logd) WARN("TODO: X event type %d\n", ev.type);
break;
} }
} }
/* postprocessing */ /* postprocessing */
LOGD("post processing\n"); LOGD("post processing\n");
cur = g->toplevel; cur = g->toplevel;
while (cur) { while (cur) {
struct toplevel_window_widget *w = struct toplevel_window_widget *w =
(struct toplevel_window_widget *)cur->item; (struct toplevel_window_widget *)cur->item;
struct x_window *xw = w->x; struct x_window *xw = w->x;
if (xw->resize) { if (xw->resize) {
LOGD("resize old %d %d new %d %d\n", xw->width, xw->height, xw->new_width, xw->new_height); LOGD("resize old %d %d new %d %d\n", xw->width, xw->height, xw->new_width, xw->new_height);
if (xw->width != xw->new_width || xw->height != xw->new_height) { if (xw->width != xw->new_width || xw->height != xw->new_height) {
w->common.allocate(g, w, 0, 0, xw->new_width, xw->new_height); w->common.allocate(g, w, 0, 0, xw->new_width, xw->new_height);
xw->width = xw->new_width; xw->width = xw->new_width;
...@@ -281,46 +298,47 @@ void x_events(gui *_gui) ...@@ -281,46 +298,47 @@ void x_events(gui *_gui)
XftDrawDestroy(xw->xft); XftDrawDestroy(xw->xft);
XFreePixmap(x->d, xw->p); XFreePixmap(x->d, xw->p);
xw->p = XCreatePixmap(x->d, xw->w, xw->width, xw->height, xw->p = XCreatePixmap(x->d, xw->w, xw->width, xw->height,
DefaultDepth(x->d, DefaultScreen(x->d))); DefaultDepth(x->d, DefaultScreen(x->d)));
XFillRectangle(x->d, xw->p, x->colors[BACKGROUND_COLOR], XFillRectangle(x->d, xw->p, x->colors[BACKGROUND_COLOR],
0, 0, xw->width, xw->height); 0, 0, xw->width, xw->height);
xw->xft = XftDrawCreate(x->d, xw->p, xw->xft = XftDrawCreate(x->d, xw->p,
DefaultVisual(x->d, DefaultScreen(x->d)), DefaultVisual(x->d, DefaultScreen(x->d)),
DefaultColormap(x->d, DefaultScreen(x->d))); DefaultColormap(x->d, DefaultScreen(x->d)));
if (xw->xft == NULL) ERR("XftDrawCreate failed\n");