fix xcb build; update button resources

This commit is contained in:
Vadim Lopatin 2014-03-18 09:16:00 +04:00
parent 27d2f64735
commit 67b4534b70
8 changed files with 940 additions and 916 deletions

View File

@ -161,11 +161,22 @@
<Compile Include="3rdparty\X11\xcb\xvmc.d" /> <Compile Include="3rdparty\X11\xcb\xvmc.d" />
<Compile Include="3rdparty\X11\keysymdef.d" /> <Compile Include="3rdparty\X11\keysymdef.d" />
<Compile Include="3rdparty\X11\xcb\image.d" /> <Compile Include="3rdparty\X11\xcb\image.d" />
<Compile Include="src\dlangui\core\events.d" />
<Compile Include="..\DerelictFI\source\derelict\freeimage\freeimage.d">
<Link>3rdparty\DerelictFI\freeimage.d</Link>
</Compile>
<Compile Include="..\DerelictFI\source\derelict\freeimage\functions.d">
<Link>3rdparty\DerelictFI\functions.d</Link>
</Compile>
<Compile Include="..\DerelictFI\source\derelict\freeimage\types.d">
<Link>3rdparty\DerelictFI\types.d</Link>
</Compile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="src\dlangui\platforms\x11\" /> <Folder Include="src\dlangui\platforms\x11\" />
<Folder Include="3rdparty\DerelictUtil\" /> <Folder Include="3rdparty\DerelictUtil\" />
<Folder Include="3rdparty\DerelictGL3\" /> <Folder Include="3rdparty\DerelictGL3\" />
<Folder Include="3rdparty\DerelictFT\" /> <Folder Include="3rdparty\DerelictFT\" />
<Folder Include="3rdparty\DerelictFI\" />
</ItemGroup> </ItemGroup>
</Project> </Project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -2,23 +2,23 @@ module src.dlangui.platforms.x11.x11app;
version(linux) { version(linux) {
import std.string; import std.string;
import std.c.linux.X11.xcb.xcb; import std.c.linux.X11.xcb.xcb;
import std.c.linux.X11.xcb.shm; import std.c.linux.X11.xcb.shm;
import std.c.linux.X11.xcb.xproto; import std.c.linux.X11.xcb.xproto;
import std.c.linux.X11.xcb.image; import std.c.linux.X11.xcb.image;
import std.c.linux.X11.keysymdef; import std.c.linux.X11.keysymdef;
import std.c.linux.linux; import std.c.linux.linux;
import std.c.stdlib; import std.c.stdlib;
import std.conv; import std.conv;
import dlangui.core.logger; import dlangui.core.logger;
import dlangui.graphics.drawbuf; import dlangui.graphics.drawbuf;
import dlangui.graphics.fonts; import dlangui.graphics.fonts;
import dlangui.graphics.ftfonts; import dlangui.graphics.ftfonts;
import dlangui.platforms.common.platform; import dlangui.platforms.common.platform;
class XCBWindow : Window { class XCBWindow : Window {
xcb_window_t _w; xcb_window_t _w;
xcb_gcontext_t _g; xcb_gcontext_t _g;
xcb_image_t * _image; xcb_image_t * _image;
@ -32,6 +32,12 @@ class XCBWindow : Window {
~this() { ~this() {
Log.d("Destroying window"); Log.d("Destroying window");
} }
/// request window redraw
override void invalidate() {
redraw();
}
bool create() { bool create() {
uint mask; uint mask;
uint values[2]; uint values[2];
@ -169,11 +175,11 @@ class XCBWindow : Window {
cast(void*)title); cast(void*)title);
} }
ColorDrawBuf _drawbuf; void redraw() {
void processExpose(xcb_expose_event_t * event) {
if (!_drawbuf) if (!_drawbuf)
_drawbuf = new ColorDrawBuf(_dx, _dy); _drawbuf = new ColorDrawBuf(_dx, _dy);
_drawbuf.resize(_dx, _dy); _drawbuf.resize(_dx, _dy);
_drawbuf.fill(_backgroundColor);
Log.d("calling createImage"); Log.d("calling createImage");
createImage(); createImage();
Log.d("done createImage"); Log.d("done createImage");
@ -188,13 +194,18 @@ class XCBWindow : Window {
xcb_flush(_xcbconnection); xcb_flush(_xcbconnection);
} }
} ColorDrawBuf _drawbuf;
void processExpose(xcb_expose_event_t * event) {
redraw();
}
private __gshared xcb_connection_t * _xcbconnection; }
private __gshared xcb_screen_t * _xcbscreen;
private __gshared ubyte _xcbscreendepth;
class XCBPlatform : Platform { private __gshared xcb_connection_t * _xcbconnection;
private __gshared xcb_screen_t * _xcbscreen;
private __gshared ubyte _xcbscreendepth;
class XCBPlatform : Platform {
this() { this() {
} }
~this() { ~this() {
@ -378,13 +389,13 @@ class XCBPlatform : Platform {
return 0; return 0;
} }
XCBWindow[xcb_window_t] _windowMap; XCBWindow[xcb_window_t] _windowMap;
} }
// entry point // entry point
extern(C) int UIAppMain(string[] args); extern(C) int UIAppMain(string[] args);
int main(string[] args) int main(string[] args)
{ {
setStderrLogger(); setStderrLogger();
setLogLevel(LogLevel.Trace); setLogLevel(LogLevel.Trace);
@ -415,6 +426,6 @@ int main(string[] args)
return res; return res;
} }
} }

View File

@ -502,8 +502,10 @@ private __gshared Theme _currentTheme;
static this() { static this() {
_currentTheme = new Theme("default"); _currentTheme = new Theme("default");
Style button = _currentTheme.createSubstyle("BUTTON").backgroundImageId("btn_default_normal").alignment(Align.Center); Style button = _currentTheme.createSubstyle("BUTTON").backgroundImageId("btn_default_small_normal").alignment(Align.Center);
Style text = _currentTheme.createSubstyle("TEXT").margins(Rect(3,3,3,3)).padding(Rect(3,3,3,3)); Style text = _currentTheme.createSubstyle("TEXT").margins(Rect(3,3,3,3)).padding(Rect(3,3,3,3));
button.createState(State.Pressed, State.Pressed).backgroundImageId("btn_default_pressed"); button.createState(State.Disabled | State.Focused, State.Disabled | State.Focused).backgroundImageId("btn_default_small_normal_disable_focused");
button.createState(State.Focused, State.Focused).backgroundImageId("btn_default_selected"); button.createState(State.Disabled, State.Disabled).backgroundImageId("btn_default_small_normal_disable");
button.createState(State.Pressed, State.Pressed).backgroundImageId("btn_default_small_pressed");
button.createState(State.Focused, State.Focused).backgroundImageId("btn_default_small_selected");
} }