Skip to content

Commit

Permalink
Fix desktop background copy for newer wxWidgets version
Browse files Browse the repository at this point in the history
  • Loading branch information
onli committed Mar 15, 2016
1 parent 4efb6ef commit 0686021
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 18 deletions.
2 changes: 2 additions & 0 deletions src/background.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ wxBitmap* getRootWallpaper()
pm
)
);
return backImage;
} else {
wxSize sz = wxGetDisplaySize();
wxBitmap* backImage = new wxBitmap(sz.GetWidth(), sz.GetHeight());
Expand All @@ -51,6 +52,7 @@ wxBitmap* getRootWallpaper()
dc.SetBackground(*wxTRANSPARENT_BRUSH);
dc.Clear();
dc.SelectObject(*backImage);
return backImage;
}
return backImage;
}
Expand Down
26 changes: 9 additions & 17 deletions src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,13 @@ MyApp::OnInit () {

long options = wxNO_BORDER;
options = options | wxFRAME_TOOL_WINDOW;
if (!showInTray)
{
if (!showInTray) {
options = options | wxFRAME_NO_TASKBAR;
}

if (onTop)
if (onTop) {
options = options | wxSTAY_ON_TOP;
}
frame = new MyFrame (NULL, settings,ImagesList,-1, _T ("SimDock"), wxPoint (10, 10),
wxSize (450, 150), options);
wxImage* appBackground = new wxImage (settings.BG_PATH);
Expand All @@ -300,34 +300,26 @@ MyApp::OnInit () {
GtkWidget* widget = frame->GetHandle();
XID xid = GDK_WINDOW_XWINDOW(widget->window);
xstuff_resizeScreen(xid, *frame);
if (settings.ENABLE_TASKS)
{
if (settings.ENABLE_TASKS) {
tasks_fillList(ImagesList, settings);
tasks_register_signals(ImagesList, settings);
}
frame->appSize = FirstPosition (settings, ImagesList);
frame->updateSize();
if (!settings.AUTO_POSITION)
{
if (!settings.AUTO_POSITION) {
frame->Move (startPositionX, startPositionY);
}
else
{
} else {
wxSize sz = wxGetDisplaySize();
frame->Move ((sz.GetWidth() - frame->GetClientSize().GetWidth()) / 2,
sz.GetHeight() - frame->GetClientSize().GetHeight());
}
//getting the background from root will only work at a late point
//like this
wxBitmap * backImage;
if (!customBackground.IsEmpty ())
{
backImage =
fixImage (customBackground, customBackgroundType,
if (!customBackground.IsEmpty ()) {
backImage = fixImage (customBackground, customBackgroundType,
customBackgroundColour);
}
else
{
} else {
backImage = getRootWallpaper();
}
frame->SetWallpaper(backImage);
Expand Down
3 changes: 2 additions & 1 deletion src/myFrame.cc
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ wxFrame (parent, id, title, pos, size, style)
draggedStart = 0;

showTooltip = false;

SetBackgroundStyle(wxBG_STYLE_PAINT); // needed since wx2.9.1 for the autodc in onPaint
}


Expand Down Expand Up @@ -838,7 +840,6 @@ MyFrame::approachFutures() {

void
MyFrame::OnPaint (wxPaintEvent & event) {

wxAutoBufferedPaintDC dc (this);
wxPoint framePos = this->GetScreenPosition ();
wxSize sz = GetClientSize ();
Expand Down

0 comments on commit 0686021

Please sign in to comment.