From axeld at pinc-software.de Fri May 1 00:17:19 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Fri, 01 May 2009 00:17:19 +0200 CEST Subject: [Haiku-commits] r30511 - in haiku/trunk: build/jam src/bin In-Reply-To: <1e42d8c50904301332v4fcd0c8do6854a7975c5e0315@mail.gmail.com> Message-ID: <50955757206-BeMail@zon> Pier Luigi Fiorini wrote: > > * Added a version of reindex that works under Haiku. Changes made > > to the > > original version: > I love you! Oh, I would have done it earlier in case someone had mentioned it before ;-) Luckily, it's a tool that one doesn't need that often. Matt Madia wrote: > One problem, it's not reindexing directories. You mean it's not reindexing the attributes of directories, or does not traverse directories? I actually only tested it on a single file when I made the changes. Bye, Axel. From mattmadia at gmail.com Fri May 1 00:20:01 2009 From: mattmadia at gmail.com (Matt Madia) Date: Thu, 30 Apr 2009 22:20:01 +0000 Subject: [Haiku-commits] r30511 - in haiku/trunk: build/jam src/bin In-Reply-To: <50955757206-BeMail@zon> References: <1e42d8c50904301332v4fcd0c8do6854a7975c5e0315@mail.gmail.com> <50955757206-BeMail@zon> Message-ID: <1e42d8c50904301520t78a67d65v1e16968fdbfd4228@mail.gmail.com> On Thu, Apr 30, 2009 at 10:17 PM, Axel D?rfler wrote: > Matt Madia wrote: >> One problem, it's not reindexing directories. > > You mean it's not reindexing the attributes of directories, or does not > traverse directories? I actually only tested it on a single file when I > made the changes. > it isn't reindexing the attributes of directories. traversing them is working properly. --mmadia From dlmcpaul at mail.berlios.de Fri May 1 00:36:24 2009 From: dlmcpaul at mail.berlios.de (dlmcpaul at BerliOS) Date: Fri, 1 May 2009 00:36:24 +0200 Subject: [Haiku-commits] r30520 - haiku/trunk/src/add-ons/media/plugins/wav_reader Message-ID: <200904302236.n3UMaO2N029143@sheep.berlios.de> Author: dlmcpaul Date: 2009-05-01 00:36:22 +0200 (Fri, 01 May 2009) New Revision: 30520 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30520&view=rev Modified: haiku/trunk/src/add-ons/media/plugins/wav_reader/WavReaderPlugin.cpp haiku/trunk/src/add-ons/media/plugins/wav_reader/WavReaderPlugin.h haiku/trunk/src/add-ons/media/plugins/wav_reader/wav.h Log: Add support for mpeg audio in wav format files Modified: haiku/trunk/src/add-ons/media/plugins/wav_reader/WavReaderPlugin.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/wav_reader/WavReaderPlugin.cpp 2009-04-30 20:19:43 UTC (rev 30519) +++ haiku/trunk/src/add-ons/media/plugins/wav_reader/WavReaderPlugin.cpp 2009-04-30 22:36:22 UTC (rev 30520) @@ -137,7 +137,11 @@ } format_struct format; + wave_format_ex wav_format; format_struct_extensible format_ext; + mpeg1_wav_format mpeg1_format; + mpeg3_wav_format mpeg3_format; + fact_struct fact; // read all chunks and search for "fact", "fmt" (normal or extensible) and "data" @@ -146,6 +150,9 @@ bool foundFmt = false; bool foundFmtExt = false; bool foundData = false; + bool foundMPEG1 = false; + bool foundMPEG3 = false; + while (pos + sizeof(chunk_struct) <= fFileSize) { chunk_struct chunk; if (sizeof(chunk) != Source()->ReadAt(pos, &chunk, sizeof(chunk))) { @@ -159,12 +166,43 @@ } switch (UINT32(chunk.fourcc)) { case FOURCC('f','m','t',' '): - if (UINT32(chunk.len) >= sizeof(format)) { + // So what do we have a std format structure, a wav_format structure or a extended structure + if (UINT32(chunk.len) >= sizeof(wav_format)) { + // Read both format and wav format if (sizeof(format) != Source()->ReadAt(pos, &format, sizeof(format))) { ERROR("WavReader::Sniff: format chunk reading failed\n"); break; } + if (sizeof(wav_format) != Source()->ReadAt(pos, &wav_format, sizeof(wav_format))) { + ERROR("WavReader::Sniff: format chunk reading failed\n"); + break; + } foundFmt = true; + + if (UINT16(wav_format.extra_size) == 12) { + // MPEG3 WAV FORMAT Structure + if (sizeof(mpeg3_format) != Source()->ReadAt(pos, &mpeg3_format, sizeof(mpeg3_format))) { + ERROR("WavReader::Sniff: format chunk reading failed\n"); + break; + } + foundMPEG3 = true; + } + if (UINT16(wav_format.extra_size) == 22) { + // MPEG1 WAV FORMAT Structure + if (sizeof(mpeg1_format) != Source()->ReadAt(pos, &mpeg1_format, sizeof(mpeg1_format))) { + ERROR("WavReader::Sniff: format chunk reading failed\n"); + break; + } + foundMPEG1 = true; + } + + } else if (UINT32(chunk.len) >= sizeof(format)) { + if (sizeof(format) != Source()->ReadAt(pos, &format, sizeof(format))) { + ERROR("WavReader::Sniff: format chunk reading failed\n"); + break; + } + foundFmt = true; + if (UINT32(chunk.len) >= sizeof(format_ext) && UINT16(format.format_tag) == 0xfffe) { if (sizeof(format_ext) != Source()->ReadAt(pos, &format_ext, sizeof(format_ext))) { ERROR("WavReader::Sniff: format extensible chunk reading failed\n"); @@ -231,7 +269,29 @@ if (foundFact) { TRACE(" sample_length %ld\n", UINT32(fact.sample_length)); } + + if (foundMPEG1) { + TRACE(" layer %d\n", UINT16(mpeg1_format.head_layer)); + TRACE(" bitrate %ld\n", UINT32(mpeg1_format.head_bitrate)); + TRACE(" mode %d\n", UINT16(mpeg1_format.head_mode)); + TRACE(" mode ext %d\n", UINT16(mpeg1_format.head_mode_ext)); + TRACE(" emphisis %d\n", UINT16(mpeg1_format.head_emphasis)); + TRACE(" flags %d\n", UINT16(mpeg1_format.head_flags)); + TRACE(" pts low %ld\n", UINT32(mpeg1_format.pts_low)); + TRACE(" pts high %ld\n", UINT32(mpeg1_format.pts_high)); + } + if (foundMPEG3) { + TRACE(" id %d\n", UINT16(mpeg3_format.id)); + TRACE(" flags %ld\n", UINT32(mpeg3_format.flags)); + TRACE(" block size %d\n", UINT16(mpeg3_format.block_size)); + TRACE(" frames per block %d\n", UINT16(mpeg3_format.frames_per_block)); + TRACE(" codec delay %d\n", UINT16(mpeg3_format.codec_delay)); + fBufferSize = mpeg3_format.block_size; + } else { + fBufferSize = BUFFER_SIZE; + } + fMetaData.extra_size = 0; fMetaData.channels = UINT16(format.channels); fMetaData.samples_per_sec = UINT32(format.samples_per_sec); @@ -298,7 +358,7 @@ data->position = 0; data->datasize = fDataSize; data->fps = fMetaData.samples_per_sec; - data->buffersize = (BUFFER_SIZE / fMetaData.block_align) * fMetaData.block_align; + data->buffersize = (fBufferSize / fMetaData.block_align) * fMetaData.block_align; data->buffer = malloc(data->buffersize); data->framecount = fFrameCount ? fFrameCount : (8 * fDataSize) / (fMetaData.channels * fMetaData.bits_per_sample); data->raw = fMetaData.format_tag == 0x0001; Modified: haiku/trunk/src/add-ons/media/plugins/wav_reader/WavReaderPlugin.h =================================================================== --- haiku/trunk/src/add-ons/media/plugins/wav_reader/WavReaderPlugin.h 2009-04-30 20:19:43 UTC (rev 30519) +++ haiku/trunk/src/add-ons/media/plugins/wav_reader/WavReaderPlugin.h 2009-04-30 22:36:22 UTC (rev 30520) @@ -71,6 +71,7 @@ int64 fFrameCount; int32 fFrameRate; + uint16 fBufferSize; }; Modified: haiku/trunk/src/add-ons/media/plugins/wav_reader/wav.h =================================================================== --- haiku/trunk/src/add-ons/media/plugins/wav_reader/wav.h 2009-04-30 20:19:43 UTC (rev 30519) +++ haiku/trunk/src/add-ons/media/plugins/wav_reader/wav.h 2009-04-30 22:36:22 UTC (rev 30520) @@ -56,8 +56,41 @@ uint16 block_align; uint16 bits_per_sample; uint16 extra_size; -} _PACKED; +}; +struct mpeg3_wav_format { + uint16 format_tag; + uint16 channels; + uint32 samples_per_sec; + uint32 avg_bytes_per_sec; + uint16 block_align; + uint16 bits_per_sample; + uint16 extra_size; + uint16 id; + uint32 flags; + uint16 block_size; + uint16 frames_per_block; + uint16 codec_delay; +}; + +struct mpeg1_wav_format { + uint16 format_tag; + uint16 channels; + uint32 samples_per_sec; + uint32 avg_bytes_per_sec; + uint16 block_align; + uint16 bits_per_sample; + uint16 extra_size; + uint16 head_layer; + uint32 head_bitrate; + uint16 head_mode; + uint16 head_mode_ext; + uint16 head_emphasis; + uint16 head_flags; + uint32 pts_low; + uint32 pts_high; +}; + struct format_struct_extensible { uint16 format_tag; // 0xfffe for extensible format From dlmcpaul at mail.berlios.de Fri May 1 00:37:58 2009 From: dlmcpaul at mail.berlios.de (dlmcpaul at BerliOS) Date: Fri, 1 May 2009 00:37:58 +0200 Subject: [Haiku-commits] r30521 - haiku/trunk/src/add-ons/media/plugins/mp4_reader/libMP4 Message-ID: <200904302237.n3UMbwnK030460@sheep.berlios.de> Author: dlmcpaul Date: 2009-05-01 00:37:57 +0200 (Fri, 01 May 2009) New Revision: 30521 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30521&view=rev Modified: haiku/trunk/src/add-ons/media/plugins/mp4_reader/libMP4/MP4FileReader.cpp Log: modfy debug a bit, no functional change Modified: haiku/trunk/src/add-ons/media/plugins/mp4_reader/libMP4/MP4FileReader.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/mp4_reader/libMP4/MP4FileReader.cpp 2009-04-30 22:36:22 UTC (rev 30520) +++ haiku/trunk/src/add-ons/media/plugins/mp4_reader/libMP4/MP4FileReader.cpp 2009-04-30 22:37:57 UTC (rev 30521) @@ -69,6 +69,7 @@ if ((aAtomBase) && (aAtomBase->getAtomSize() > 8)) { MDATAtom *aMDATAtom = dynamic_cast(aAtomBase); if (pPosition >= aMDATAtom->getAtomOffset() && pPosition <= aMDATAtom->getEOF()) { +// printf("IsEndOfData %Ld,%Ld,%Ld\n",pPosition,aMDATAtom->getAtomOffset(),aMDATAtom->getEOF()); return false; } } @@ -634,7 +635,7 @@ *keyframe = IsKeyFrame(streamIndex, pFrameNo); } -// printf("start %Ld, size %ld, eof %s, eod %s\n",*start,*size, IsEndOfFile(*start + *size) ? "true" : "false", IsEndOfData(*start + *size) ? "true" : "false"); +// printf("frame %ld start %Ld, size %ld, eof %s, eod %s\n",pFrameNo,*start,*size, IsEndOfFile(*start + *size) ? "true" : "false", IsEndOfData(*start + *size) ? "true" : "false"); // TODO need a better method for detecting End of Data Note ChunkSize of 0 seems to be it. if (IsEndOfFile(*start + *size) || IsEndOfData(*start + *size)) { From dlmcpaul at mail.berlios.de Fri May 1 00:41:57 2009 From: dlmcpaul at mail.berlios.de (dlmcpaul at BerliOS) Date: Fri, 1 May 2009 00:41:57 +0200 Subject: [Haiku-commits] r30522 - haiku/trunk/src/add-ons/media/plugins/avcodec/libavcodec Message-ID: <200904302241.n3UMfvwW000706@sheep.berlios.de> Author: dlmcpaul Date: 2009-05-01 00:41:56 +0200 (Fri, 01 May 2009) New Revision: 30522 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30522&view=rev Modified: haiku/trunk/src/add-ons/media/plugins/avcodec/libavcodec/config.h Log: Slight performance optimisations Modified: haiku/trunk/src/add-ons/media/plugins/avcodec/libavcodec/config.h =================================================================== --- haiku/trunk/src/add-ons/media/plugins/avcodec/libavcodec/config.h 2009-04-30 22:37:57 UTC (rev 30521) +++ haiku/trunk/src/add-ons/media/plugins/avcodec/libavcodec/config.h 2009-04-30 22:41:56 UTC (rev 30522) @@ -54,7 +54,9 @@ #define HAVE_DLFCN_H 0 #define HAVE_DLOPEN 0 #define HAVE_DOS_PATHS 0 -#define HAVE_EBP_AVAILABLE 0 +// Jamfile must have -fomit_frame_pointer +#define HAVE_EBP_AVAILABLE 1 +// We use position independant code so no EBX #define HAVE_EBX_AVAILABLE 0 #define HAVE_FAST_64BIT 0 #define HAVE_FAST_CMOV 0 @@ -75,10 +77,10 @@ #define HAVE_MACHINE_IOCTL_BT848_H 0 #define HAVE_MACHINE_IOCTL_METEOR_H 0 #define HAVE_MALLOC_H 1 -#define HAVE_MEMALIGN 1 +#define HAVE_MEMALIGN 0 #define HAVE_MKSTEMP 1 #define HAVE_PLD 0 -#define HAVE_POSIX_MEMALIGN 0 +#define HAVE_POSIX_MEMALIGN 1 #define HAVE_PPC64 0 #define HAVE_ROUND 1 #define HAVE_ROUNDF 1 From bonefish at mail.berlios.de Fri May 1 00:50:10 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Fri, 1 May 2009 00:50:10 +0200 Subject: [Haiku-commits] r30523 - haiku/trunk/src/apps/debuganalyzer/gui/chart Message-ID: <200904302250.n3UMoADI006685@sheep.berlios.de> Author: bonefish Date: 2009-05-01 00:50:01 +0200 (Fri, 01 May 2009) New Revision: 30523 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30523&view=rev Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.cpp Log: Take the one pixel wide border around the chart area into account when computing the axes' frames. Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.cpp =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.cpp 2009-04-30 22:41:56 UTC (rev 30522) +++ haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.cpp 2009-04-30 22:50:01 UTC (rev 30523) @@ -300,14 +300,14 @@ fRenderer->SetFrame(fChartFrame.InsetByCopy(1, 1)); printf(" fChartFrame: (%f, %f) - (%f, %f)\n", fChartFrame.left, fChartFrame.top, fChartFrame.right, fChartFrame.bottom); - fLeftAxis.SetFrame(0, fChartFrame.top, fChartFrame.left - 1, - fChartFrame.bottom); - fRightAxis.SetFrame(fChartFrame.right + 1, fChartFrame.top, width - 1, - fChartFrame.bottom); - fTopAxis.SetFrame(fChartFrame.left, 0, fChartFrame.right, + fLeftAxis.SetFrame(0, fChartFrame.top + 1, fChartFrame.left - 1, + fChartFrame.bottom - 1); + fRightAxis.SetFrame(fChartFrame.right + 1, fChartFrame.top + 1, width - 1, + fChartFrame.bottom - 1); + fTopAxis.SetFrame(fChartFrame.left + 1, 0, fChartFrame.right - 1, fChartFrame.top - 1); - fBottomAxis.SetFrame(fChartFrame.left, fChartFrame.bottom + 1, - fChartFrame.right, height - 1); + fBottomAxis.SetFrame(fChartFrame.left + 1, fChartFrame.bottom + 1, + fChartFrame.right - 1, height - 1); } From bonefish at mail.berlios.de Fri May 1 00:53:06 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Fri, 1 May 2009 00:53:06 +0200 Subject: [Haiku-commits] r30524 - haiku/trunk/src/apps/debuganalyzer/gui/chart Message-ID: <200904302253.n3UMr64T009861@sheep.berlios.de> Author: bonefish Date: 2009-05-01 00:52:59 +0200 (Fri, 01 May 2009) New Revision: 30524 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30524&view=rev Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/LegendChartAxis.cpp Log: Generalized the axis drawing code. All four sides of the chart area are supported, now. Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/LegendChartAxis.cpp =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/chart/LegendChartAxis.cpp 2009-04-30 22:50:01 UTC (rev 30523) +++ haiku/trunk/src/apps/debuganalyzer/gui/chart/LegendChartAxis.cpp 2009-04-30 22:52:59 UTC (rev 30524) @@ -215,52 +215,98 @@ if (!_ValidateLayout(view)) return; - if (fLocation == CHART_AXIS_BOTTOM) { + float valueDirection; + float rulerDirection; + float BSize::* sizeField; + float BSize::* otherSizeField; + float BPoint::* pointField; + float BPoint::* otherPointField; + + switch (fLocation) { + case CHART_AXIS_LEFT: + case CHART_AXIS_RIGHT: + valueDirection = -1; + rulerDirection = fLocation == CHART_AXIS_LEFT ? -1 : 1; + sizeField = &BSize::height; + otherSizeField = &BSize::width; + pointField = &BPoint::y; + otherPointField = &BPoint::x; + break; + case CHART_AXIS_TOP: + case CHART_AXIS_BOTTOM: + valueDirection = 1; + rulerDirection = fLocation == CHART_AXIS_TOP ? -1 : 1; + sizeField = &BSize::width; + otherSizeField = &BSize::height; + pointField = &BPoint::x; + otherPointField = &BPoint::y; + break; + default: + return; + } + printf(" rendering...\n"); - float totalSize = floorf(fFrame.Width()) + 1; - double rangeSize = fRange.max - fRange.min; - if (rangeSize == 0) - rangeSize = 1.0; - double scale = (double)totalSize / rangeSize; - float BSize::* sizeField = &BSize::width; + float totalSize = floorf(fFrame.Size().*sizeField) + 1; + double rangeSize = fRange.max - fRange.min; + if (rangeSize == 0) + rangeSize = 1.0; + double scale = (double)totalSize / rangeSize; - // draw the ruler - float rulerLeft = fFrame.left; - float rulerTop = fFrame.top + kChartRulerDistance; - float rulerRight = fFrame.right; - float rulerBottom = rulerTop + kRulerSize; -printf(" ruler: (%f, %f) - (%f, %f)\n", rulerLeft, rulerTop, rulerRight, rulerBottom); + // draw the ruler + float rulerStart = fFrame.LeftBottom().*pointField; + float rulerChartClosest = rulerDirection == 1 + ? fFrame.LeftTop().*otherPointField + kChartRulerDistance + : fFrame.RightBottom().*otherPointField - kChartRulerDistance; + float rulerEnd = fFrame.RightTop().*pointField; + float rulerChartDistant = rulerChartClosest + rulerDirection * kRulerSize; +printf(" ruler: (%f, %f) - (%f, %f)\n", rulerStart, rulerChartClosest, rulerEnd, rulerChartDistant); - rgb_color black = { 0, 0, 0, 255 }; - view->BeginLineArray(3 + fLegends.CountItems()); - view->AddLine(BPoint(rulerLeft, rulerTop), - BPoint(rulerLeft, rulerBottom), black); - view->AddLine(BPoint(rulerLeft, rulerBottom), - BPoint(rulerRight, rulerBottom), black); - view->AddLine(BPoint(rulerRight, rulerBottom), - BPoint(rulerRight, rulerTop), black); + rgb_color black = { 0, 0, 0, 255 }; + view->BeginLineArray(3 + fLegends.CountItems()); + BPoint first; + first.*pointField = rulerStart; + first.*otherPointField = rulerChartClosest; + BPoint second = first; + second.*otherPointField = rulerChartDistant; + BPoint third = second; + third.*pointField = rulerEnd; + BPoint fourth = third; + fourth.*otherPointField = rulerChartClosest; + view->AddLine(first, second, black); + view->AddLine(second, third, black); + view->AddLine(third, fourth, black); - // marks - for (int32 i = 0; LegendInfo* info = fLegends.ItemAt(i); i++) { - float position = (info->value - fRange.min) * scale; - position += rulerLeft; -printf(" drawing mark at (%f, %f)\n", position, rulerBottom); - view->AddLine(BPoint(position, rulerBottom), - BPoint(position, rulerBottom + kRulerMarkSize), black); - } - view->EndLineArray(); + // marks + for (int32 i = 0; LegendInfo* info = fLegends.ItemAt(i); i++) { + float position = (info->value - fRange.min) * scale; + position = rulerStart + valueDirection * position; + first.*pointField = position; + first.*otherPointField = rulerChartDistant; + second.*pointField = position; + second.*otherPointField = rulerChartDistant + + rulerDirection * kRulerMarkSize; +printf(" drawing mark at (%f, %f)\n", first.x, first.y); + view->AddLine(first, second, black); + } + view->EndLineArray(); - // draw the legends - float legendTop = rulerBottom + kRulerMarkSize + kRulerLegendDistance; + // draw the legends + float legendRulerClosest = rulerChartDistant + + rulerDirection * (kRulerMarkSize + kRulerLegendDistance); - for (int32 i = 0; LegendInfo* info = fLegends.ItemAt(i); i++) { - float position = _LegendPosition(info->value, info->size.*sizeField, - (float)totalSize, scale);; -printf(" legend %ld: position: (%f, %f), size: (%f, %f)\n", i, position, legendTop, info->size.width, info->size.height); + for (int32 i = 0; LegendInfo* info = fLegends.ItemAt(i); i++) { + float position = _LegendPosition(info->value, info->size.*sizeField, + (float)totalSize, scale);; - fLegendRenderer->RenderLegend(info->legend, view, - BPoint(rulerLeft + position, legendTop)); - } + first.*pointField = rulerStart + + (valueDirection == 1 + ? position : -position - info->size.*sizeField); + first.*otherPointField = rulerDirection == 1 + ? legendRulerClosest + : legendRulerClosest - info->size.*otherSizeField; +printf(" legend %ld: position: (%f, %f), size: (%f, %f)\n", i, first.x, first.y, info->size.width, info->size.height); + + fLegendRenderer->RenderLegend(info->legend, view, first); } } From bonefish at mail.berlios.de Fri May 1 00:53:48 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Fri, 1 May 2009 00:53:48 +0200 Subject: [Haiku-commits] r30525 - haiku/trunk/src/apps/debuganalyzer/gui/chart Message-ID: <200904302253.n3UMrmSt010656@sheep.berlios.de> Author: bonefish Date: 2009-05-01 00:53:47 +0200 (Fri, 01 May 2009) New Revision: 30525 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30525&view=rev Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/BigtimeChartAxisLegendSource.cpp Log: Cosmetical. Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/BigtimeChartAxisLegendSource.cpp =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/chart/BigtimeChartAxisLegendSource.cpp 2009-04-30 22:52:59 UTC (rev 30524) +++ haiku/trunk/src/apps/debuganalyzer/gui/chart/BigtimeChartAxisLegendSource.cpp 2009-04-30 22:53:47 UTC (rev 30525) @@ -90,9 +90,9 @@ // TODO: Drop superfluous micro seconds digits, or even microseconds and seconds // completely. - StringChartLegend* legend = new(std::nothrow) StringChartLegend(buffer, - 1); - if (legend == 0) + StringChartLegend* legend + = new(std::nothrow) StringChartLegend(buffer, 1); + if (legend == NULL) return count; legends[count] = legend; From bonefish at mail.berlios.de Fri May 1 00:58:58 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Fri, 1 May 2009 00:58:58 +0200 Subject: [Haiku-commits] r30526 - haiku/trunk/src/apps/debuganalyzer/gui/chart Message-ID: <200904302258.n3UMwwL6016138@sheep.berlios.de> Author: bonefish Date: 2009-05-01 00:58:55 +0200 (Fri, 01 May 2009) New Revision: 30526 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30526&view=rev Added: haiku/trunk/src/apps/debuganalyzer/gui/chart/DefaultChartAxisLegendSource.cpp haiku/trunk/src/apps/debuganalyzer/gui/chart/DefaultChartAxisLegendSource.h Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/Jamfile Log: An axis legend source regarding the range as ordinary numbers and producing string legends for them. Added: haiku/trunk/src/apps/debuganalyzer/gui/chart/DefaultChartAxisLegendSource.cpp =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/chart/DefaultChartAxisLegendSource.cpp 2009-04-30 22:53:47 UTC (rev 30525) +++ haiku/trunk/src/apps/debuganalyzer/gui/chart/DefaultChartAxisLegendSource.cpp 2009-04-30 22:58:55 UTC (rev 30526) @@ -0,0 +1,96 @@ +/* + * Copyright 2009, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ + +#include "chart/DefaultChartAxisLegendSource.h" + +#include +#include + +#include "chart/ChartDataRange.h" +#include "chart/StringChartLegend.h" + + +int32 +DefaultChartAxisLegendSource::GetAxisLegends(const ChartDataRange& range, + ChartLegend** legends, double* values, int32 maxLegends) +{ +// TODO: Also support scientific notation! Otherwise the numbers can get really +// long. + double start = range.min; + double end = range.max; + double rangeSpan = end - start; + + if (rangeSpan >= maxLegends / 2) { + // We only need to consider the integer part. + + // find an interval so that we get maxLegends / 2 to maxLegends legends + double baseInterval = 1; + double relativeFactor = 1; + while (rangeSpan / baseInterval / relativeFactor >= maxLegends) { + if (relativeFactor == 1) { + relativeFactor = 2; + } else if (relativeFactor == 2) { + relativeFactor = 5; + } else if (relativeFactor == 5) { + baseInterval *= 10; + relativeFactor = 1; + } + } + + // generate the legends + int32 count = 0; + double interval = baseInterval * relativeFactor; + double value = ceil(start / interval) * interval; + for (; value <= end; value += interval) { + char buffer[128]; + snprintf(buffer, sizeof(buffer), "%.0f", value); + StringChartLegend* legend + = new(std::nothrow) StringChartLegend(buffer, 1); + if (legend == NULL) + return count; + + legends[count] = legend; + values[count++] = value; + } + + return count; + } + + // The range is so small that we need a fraction interval. + + // First find out how many places after the decimal point we need. + int positions = 0; + double factor = 1; + while (rangeSpan * factor < maxLegends / 2) { + factor *= 10; + positions++; + } + + double relativeFactor = 1; + if (rangeSpan * factor / relativeFactor >= maxLegends) { + relativeFactor = 2; + if (rangeSpan * factor / relativeFactor >= maxLegends) + relativeFactor = 5; + } + + // generate the legends + int32 count = 0; + double interval = relativeFactor / factor; + double shiftedValue = ceil(start / interval); + for (; shiftedValue * interval <= end; shiftedValue++) { + double value = shiftedValue * interval; + char buffer[128]; + snprintf(buffer, sizeof(buffer), "%.*f", positions, value); + StringChartLegend* legend + = new(std::nothrow) StringChartLegend(buffer, 1); + if (legend == NULL) + return count; + + legends[count] = legend; + values[count++] = value; + } + + return count; +} Added: haiku/trunk/src/apps/debuganalyzer/gui/chart/DefaultChartAxisLegendSource.h =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/chart/DefaultChartAxisLegendSource.h 2009-04-30 22:53:47 UTC (rev 30525) +++ haiku/trunk/src/apps/debuganalyzer/gui/chart/DefaultChartAxisLegendSource.h 2009-04-30 22:58:55 UTC (rev 30526) @@ -0,0 +1,19 @@ +/* + * Copyright 2009, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ +#ifndef DEFAULT_CHART_AXIS_LEGEND_SOURCE_H +#define DEFAULT_CHART_AXIS_LEGEND_SOURCE_H + +#include "chart/ChartAxisLegendSource.h" + + +class DefaultChartAxisLegendSource : public ChartAxisLegendSource { +public: + virtual int32 GetAxisLegends(const ChartDataRange& range, + ChartLegend** legends, double* values, + int32 maxLegends); +}; + + +#endif // DEFAULT_CHART_AXIS_LEGEND_SOURCE_H Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/Jamfile =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/chart/Jamfile 2009-04-30 22:53:47 UTC (rev 30525) +++ haiku/trunk/src/apps/debuganalyzer/gui/chart/Jamfile 2009-04-30 22:58:55 UTC (rev 30526) @@ -14,6 +14,7 @@ ChartDataSource.cpp ChartLegend.cpp ChartRenderer.cpp + DefaultChartAxisLegendSource.cpp LegendChartAxis.cpp LineChartRenderer.cpp StringChartLegend.cpp From dlmcpaul at gmail.com Fri May 1 01:15:29 2009 From: dlmcpaul at gmail.com (David McPaul) Date: Fri, 1 May 2009 09:15:29 +1000 Subject: [Haiku-commits] r30498 - in haiku/trunk/src/add-ons/media/plugins: . avcodec avcodec/libavcodec avcodec/libavcodec/x86 avcodec/libavutil avcodec/libswscale mov_reader mov_reader/libMOV mp4_reader/libMP4 wav_reader In-Reply-To: References: <200904301023.n3UANGVG021249@sheep.berlios.de> <49F97DF4.2030805@gmx.de> Message-ID: On 2009-04-30, David McPaul wrote: > > This commit seems to include a lot of debugging output which is still > > enabled. Was this intentional? > > No this was a big oops > > Only wanted to commit the jamfile. Rolling it back now Ok should be all sorted, I am going to commit some of the bits and pieces I had as well just to make such an oops less likely. -- Cheers David From bonefish at mail.berlios.de Fri May 1 01:51:44 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Fri, 1 May 2009 01:51:44 +0200 Subject: [Haiku-commits] r30527 - haiku/trunk/src/apps/debuganalyzer/gui/chart Message-ID: <200904302351.n3UNpivt006277@sheep.berlios.de> Author: bonefish Date: 2009-05-01 01:51:43 +0200 (Fri, 01 May 2009) New Revision: 30527 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30527&view=rev Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.cpp haiku/trunk/src/apps/debuganalyzer/gui/chart/ChartAxis.h haiku/trunk/src/apps/debuganalyzer/gui/chart/LegendChartAxis.cpp haiku/trunk/src/apps/debuganalyzer/gui/chart/LegendChartAxis.h Log: * Added a maximum size parameter to ChartAxis::PreferredSize(), specifying how big the axis can maximally become. This helps to solve the chicken and egg problem that the axis can't compute a size without knowing what legends to use, which in turn requires knowing the size. * Reimplemented LegendChartAxis accordingly. Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.cpp =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.cpp 2009-04-30 22:58:55 UTC (rev 30526) +++ haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.cpp 2009-04-30 23:51:43 UTC (rev 30527) @@ -288,13 +288,15 @@ int32 bottom = 0; if (fLeftAxis.axis != NULL) - left = fLeftAxis.axis->PreferredSize(this).IntegerWidth() + 1; + left = fLeftAxis.axis->PreferredSize(this, size).IntegerWidth() + 1; if (fRightAxis.axis != NULL) - right = fRightAxis.axis->PreferredSize(this).IntegerWidth() + 1; + right = fRightAxis.axis->PreferredSize(this, size).IntegerWidth() + 1; if (fTopAxis.axis != NULL) - top = fTopAxis.axis->PreferredSize(this).IntegerHeight() + 1; - if (fBottomAxis.axis != NULL) - bottom = fBottomAxis.axis->PreferredSize(this).IntegerHeight() + 1; + top = fTopAxis.axis->PreferredSize(this, size).IntegerHeight() + 1; + if (fBottomAxis.axis != NULL) { + bottom = fBottomAxis.axis->PreferredSize(this, size).IntegerHeight() + + 1; + } fChartFrame = BRect(left, top, width - right - 1, height - bottom - 1); fRenderer->SetFrame(fChartFrame.InsetByCopy(1, 1)); Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/ChartAxis.h =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/chart/ChartAxis.h 2009-04-30 22:58:55 UTC (rev 30526) +++ haiku/trunk/src/apps/debuganalyzer/gui/chart/ChartAxis.h 2009-04-30 23:51:43 UTC (rev 30527) @@ -21,7 +21,7 @@ virtual void SetLocation(ChartAxisLocation location) = 0; virtual void SetRange(const ChartDataRange& range) = 0; virtual void SetFrame(BRect frame) = 0; - virtual BSize PreferredSize(BView* view) = 0; + virtual BSize PreferredSize(BView* view, BSize maxSize) = 0; virtual void Render(BView* view, BRect updateRect) = 0; }; Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/LegendChartAxis.cpp =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/chart/LegendChartAxis.cpp 2009-04-30 22:58:55 UTC (rev 30526) +++ haiku/trunk/src/apps/debuganalyzer/gui/chart/LegendChartAxis.cpp 2009-04-30 23:51:43 UTC (rev 30527) @@ -192,19 +192,53 @@ BSize -LegendChartAxis::PreferredSize(BView* view) +LegendChartAxis::PreferredSize(BView* view, BSize maxSize) { -// TODO: Implement for real! - BSize size = fLegendRenderer->MaximumLegendSize(view); + // estimate the maximum legend count we might need + float hSpacing, vSpacing; + int32 maxLegends = _EstimateMaxLegendCount(view, maxSize, &hSpacing, + &vSpacing); + BSize spacing(hSpacing, vSpacing); + if (maxLegends < 4) + maxLegends = 4; + + // get the legends + ChartLegend* legends[maxLegends]; + double values[maxLegends]; + + int32 legendCount = fLegendSource->GetAxisLegends(fRange, legends, values, + maxLegends); + + // get the sizes, delete the legends, and compute the preferred size + float BSize::* sizeField; + float BSize::* otherSizeField; if (fLocation == CHART_AXIS_LEFT || fLocation == CHART_AXIS_RIGHT) { - size.width += kChartLegendDistance; - size.height = std::max(size.height * 4, 100.0f); + sizeField = &BSize::height; + otherSizeField = &BSize::width; } else { - size.width = std::max(size.width * 4, 100.0f); - size.height += kChartLegendDistance; + sizeField = &BSize::width; + otherSizeField = &BSize::height; } - return size; + BSize preferredSize; + + for (int32 i = 0; i < legendCount; i++) { + ChartLegend* legend = legends[i]; + BSize size = fLegendRenderer->LegendSize(legend, view); + delete legend; + + if (size.*sizeField > preferredSize.*sizeField) + preferredSize.*sizeField = size.*sizeField; + if (size.*otherSizeField > preferredSize.*otherSizeField) + preferredSize.*otherSizeField = size.*otherSizeField; + } + + // Suppose we want to have at least 2 legends. + preferredSize.*sizeField + = ceilf(preferredSize.*sizeField * 2 + spacing.*sizeField); + preferredSize.*otherSizeField += kChartLegendDistance; + + return preferredSize; } @@ -331,15 +365,9 @@ int32 height = fFrame.IntegerHeight() + 1; printf(" width: %ld, height: %ld\n", width, height); - fLegendRenderer->GetMinimumLegendSpacing(view, &fHorizontalSpacing, - &fVerticalSpacing); - // estimate the maximum legend count we might need - int32 maxLegends; - if (fLocation == CHART_AXIS_LEFT || fLocation == CHART_AXIS_RIGHT) - maxLegends = height / (10 + fVerticalSpacing); - else - maxLegends = width / (20 + fHorizontalSpacing); + int32 maxLegends = _EstimateMaxLegendCount(view, fFrame.Size(), + &fHorizontalSpacing, &fVerticalSpacing); printf(" max %ld legends\n", maxLegends); if (maxLegends == 0) @@ -387,3 +415,17 @@ fLayoutValid = true; return true; } + + +int32 +LegendChartAxis::_EstimateMaxLegendCount(BView* view, BSize size, + float* _hSpacing, float* _vSpacing) +{ + // get the legend spacing + fLegendRenderer->GetMinimumLegendSpacing(view, _hSpacing, _vSpacing); + + // estimate the maximum legend count we might need + if (fLocation == CHART_AXIS_LEFT || fLocation == CHART_AXIS_RIGHT) + return (size.IntegerHeight() + 1) / (10 + *_vSpacing); + return (size.IntegerWidth() + 1) / (20 + *_hSpacing); +} Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/LegendChartAxis.h =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/chart/LegendChartAxis.h 2009-04-30 22:58:55 UTC (rev 30526) +++ haiku/trunk/src/apps/debuganalyzer/gui/chart/LegendChartAxis.h 2009-04-30 23:51:43 UTC (rev 30527) @@ -25,7 +25,7 @@ virtual void SetLocation(ChartAxisLocation location); virtual void SetRange(const ChartDataRange& range); virtual void SetFrame(BRect frame); - virtual BSize PreferredSize(BView* view); + virtual BSize PreferredSize(BView* view, BSize maxSize); virtual void Render(BView* view, BRect updateRect); private: @@ -34,6 +34,8 @@ private: void _InvalidateLayout(); bool _ValidateLayout(BView* view); + int32 _EstimateMaxLegendCount(BView* view, BSize size, + float* _hSpacing, float* _vSpacing); inline float _LegendPosition(double value, float legendSize, float totalSize, double scale); inline void _FilterLegends(int32 totalSize, int32 spacing, From bonefish at mail.berlios.de Fri May 1 01:52:36 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Fri, 1 May 2009 01:52:36 +0200 Subject: [Haiku-commits] r30528 - haiku/trunk/src/apps/debuganalyzer/gui/thread_window Message-ID: <200904302352.n3UNqaX1006316@sheep.berlios.de> Author: bonefish Date: 2009-05-01 01:52:35 +0200 (Fri, 01 May 2009) New Revision: 30528 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30528&view=rev Modified: haiku/trunk/src/apps/debuganalyzer/gui/thread_window/ActivityPage.cpp Log: Added the other three axes to the activity chart. Modified: haiku/trunk/src/apps/debuganalyzer/gui/thread_window/ActivityPage.cpp =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/thread_window/ActivityPage.cpp 2009-04-30 23:51:43 UTC (rev 30527) +++ haiku/trunk/src/apps/debuganalyzer/gui/thread_window/ActivityPage.cpp 2009-04-30 23:52:35 UTC (rev 30528) @@ -16,6 +16,7 @@ #include "chart/BigtimeChartAxisLegendSource.h" #include "chart/Chart.h" #include "chart/ChartDataSource.h" +#include "chart/DefaultChartAxisLegendSource.h" #include "chart/LegendChartAxis.h" #include "chart/LineChartRenderer.h" #include "chart/StringChartLegend.h" @@ -324,6 +325,18 @@ LegendChartAxis* axis = new LegendChartAxis( new BigtimeChartAxisLegendSource, new StringChartLegendRenderer); fActivityChart->SetAxis(CHART_AXIS_BOTTOM, axis); + + axis = new LegendChartAxis( + new BigtimeChartAxisLegendSource, new StringChartLegendRenderer); + fActivityChart->SetAxis(CHART_AXIS_TOP, axis); + + axis = new LegendChartAxis( + new DefaultChartAxisLegendSource, new StringChartLegendRenderer); + fActivityChart->SetAxis(CHART_AXIS_LEFT, axis); + + axis = new LegendChartAxis( + new DefaultChartAxisLegendSource, new StringChartLegendRenderer); + fActivityChart->SetAxis(CHART_AXIS_RIGHT, axis); } From stpere at mail.berlios.de Fri May 1 01:53:33 2009 From: stpere at mail.berlios.de (stpere at mail.berlios.de) Date: Fri, 1 May 2009 01:53:33 +0200 Subject: [Haiku-commits] r30529 - haiku/trunk/src/apps/charactermap Message-ID: <200904302353.n3UNrXYg006345@sheep.berlios.de> Author: stpere Date: 2009-05-01 01:52:59 +0200 (Fri, 01 May 2009) New Revision: 30529 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30529&view=rev Modified: haiku/trunk/src/apps/charactermap/CharacterWindow.cpp Log: Make the CharacterMap start with a reasonnable window size on first launch (without saved settings). As it was before, the window took all the space it needed i.e. each section was on a single line. Maybe a better way would be to just start it zoomed. Maybe it fixes ticket #3752. Modified: haiku/trunk/src/apps/charactermap/CharacterWindow.cpp =================================================================== --- haiku/trunk/src/apps/charactermap/CharacterWindow.cpp 2009-04-30 23:52:35 UTC (rev 30528) +++ haiku/trunk/src/apps/charactermap/CharacterWindow.cpp 2009-04-30 23:52:59 UTC (rev 30529) @@ -126,6 +126,9 @@ if (settings.FindRect("window frame", &frame) == B_OK) { MoveTo(frame.LeftTop()); ResizeTo(frame.Width(), frame.Height()); + } else { + MoveTo(BPoint(100, 100)); + ResizeTo(600, 450); } // create GUI From korli at mail.berlios.de Fri May 1 10:39:02 2009 From: korli at mail.berlios.de (korli at BerliOS) Date: Fri, 1 May 2009 10:39:02 +0200 Subject: [Haiku-commits] r30530 - haiku/trunk/src/kits/tracker Message-ID: <200905010839.n418d2ZR012648@sheep.berlios.de> Author: korli Date: 2009-05-01 10:39:02 +0200 (Fri, 01 May 2009) New Revision: 30530 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30530&view=rev Modified: haiku/trunk/src/kits/tracker/FindPanel.cpp Log: * combine MovePenTo() with DrawString() Modified: haiku/trunk/src/kits/tracker/FindPanel.cpp =================================================================== --- haiku/trunk/src/kits/tracker/FindPanel.cpp 2009-04-30 23:52:59 UTC (rev 30529) +++ haiku/trunk/src/kits/tracker/FindPanel.cpp 2009-05-01 08:39:02 UTC (rev 30530) @@ -2564,8 +2564,7 @@ // draws the is/contains, etc. string bounds.left -= (width + 10); bounds.bottom -= 6; - MovePenTo(bounds.LeftBottom()); - DrawString(item->Submenu()->FindMarked()->Label()); + DrawString(item->Submenu()->FindMarked()->Label(), bounds.LeftBottom()); } } From axeld at pinc-software.de Fri May 1 12:07:33 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Fri, 01 May 2009 12:07:33 +0200 CEST Subject: [Haiku-commits] r30529 - haiku/trunk/src/apps/charactermap In-Reply-To: <200904302353.n3UNrXYg006345@sheep.berlios.de> Message-ID: <1649724294-BeMail@zon> stpere at mail.berlios.de wrote: > Log: > Make the CharacterMap start with a reasonnable window size on first > launch (without saved settings). As it was before, the window took > all > the space it needed i.e. each section was on a single line. > > Maybe a better way would be to just start it zoomed. > > Maybe it fixes ticket #3752. While that might serve as a temporary solution, this does not fix the actual bug. There is some strange stuff going on that should be investigated. Bye, Axel. From rudolfc at mail.berlios.de Fri May 1 12:09:24 2009 From: rudolfc at mail.berlios.de (rudolfc at BerliOS) Date: Fri, 1 May 2009 12:09:24 +0200 Subject: [Haiku-commits] r30531 - in haiku/trunk/src/add-ons: accelerants/nvidia/engine kernel/drivers/graphics/nvidia Message-ID: <200905011009.n41A9Oww024691@sheep.berlios.de> Author: rudolfc Date: 2009-05-01 12:09:22 +0200 (Fri, 01 May 2009) New Revision: 30531 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30531&view=rev Modified: haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_info.c haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/README.html haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html Log: fixed (at least NV34) card hanging after failed boot-time kernel VESA modeswitch. Updated docs. Bumped version to 0.87. Modified: haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c 2009-05-01 08:39:02 UTC (rev 30530) +++ haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c 2009-05-01 10:09:22 UTC (rev 30531) @@ -92,7 +92,7 @@ { status_t status; - LOG(1,("POWERUP: Haiku nVidia Accelerant 0.86 running.\n")); + LOG(1,("POWERUP: Haiku nVidia Accelerant 0.87 running.\n")); /* log VBLANK INT usability status */ if (si->ps.int_assigned) Modified: haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_info.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_info.c 2009-05-01 08:39:02 UTC (rev 30530) +++ haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_info.c 2009-05-01 10:09:22 UTC (rev 30531) @@ -1,7 +1,7 @@ /* Read initialisation information from card */ /* some bits are hacks, where PINS is not known */ /* Author: - Rudolf Cornelissen 7/2003-3/2006 + Rudolf Cornelissen 7/2003-5/2009 */ #define MODULE_BIT 0x00002000 @@ -2517,11 +2517,13 @@ /* determine flatpanel type(s) */ /* note: - * on NV11 accessing registerset(s) hangs card. */ - //fixme: how about NV11's with panels? - //fixme?: linux checks on (only and) all dualhead cards, and only on DAC1... -//fixme: testing... - if (/*si->ps.tmds1_active && */(si->ps.card_type != NV11)) + * - on NV11 accessing registerset(s) hangs card. + * - the same applies for NV34. + * Confirmed for DAC2 access on ID 0x0322, + * but only after a failed VESA modeswitch by the HAIKU kernel + * at boot time caused by a BIOS fault inside the gfx card: it says + * it can do VESA 1280x1024x32 on CRTC1/DAC1 but it fails: no signal. */ + if (si->ps.tmds1_active && (si->ps.card_type != NV11)) { /* Read a indexed register to see if it indicates LVDS or TMDS panel presence. * b0-7 = adress, b16 = 1 = write_enable */ @@ -2532,9 +2534,7 @@ else LOG(2,("INFO: Flatpanel on head 1 is TMDS type\n")); } -//fixme: testing... -// if (si->ps.tmds2_active && (si->ps.card_type != NV11)) - if (si->ps.secondary_head && (si->ps.card_type != NV11)) + if (si->ps.tmds2_active && (si->ps.card_type != NV11)) { /* Read a indexed register to see if it indicates LVDS or TMDS panel presence. * b0-7 = adress, b16 = 1 = write_enable */ Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/README.html =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/README.html 2009-05-01 08:39:02 UTC (rev 30530) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/README.html 2009-05-01 10:09:22 UTC (rev 30531) @@ -243,10 +243,18 @@
  • Coldstarting doesn't work on TNT1 and GeForce 6xxx/7xxx cards yet.
  • Primary forces the primary card by preceding the exported name by a minus-sign (-) for the selected device. This ensures that this device will be listed at the top in the /dev/graphics/ folder, which is alphabetically ordered. Please make sure you enable the 'primary' feature on just one graphics driver, otherwise it's effect isn't 'guaranteed'. +
  • block_acc:
    +This option lets you disable the acceleration engine all together if enabled. Use this as a workaround if you encounter acceleration engine trouble. +
      +
    • false: (default setting)
      +The acceleration engine is enabled. +
    • true:
      +The acceleration engine is disabled.
    +

    Rudolf Cornelissen. -

    (Page last updated on June 10, 2008)

    +

    (Page last updated on May 1, 2009)

    Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html 2009-05-01 08:39:02 UTC (rev 30530) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html 2009-05-01 10:09:22 UTC (rev 30531) @@ -4,7 +4,7 @@

    Changes done for each driverversion:

    -

    head (SVN 0.85, Rudolf)

    +

    head (SVN 0.87, Rudolf)

    • Fixed driver assuming enabling AGP mode succeeded on some occasions if it did not block it itself. Blocking AGP mode completely via the AGP busmanager (option 'block_agp') resulted in a crashing acceleration engine because it was setup for AGP transfers instead of using PCI transfers. Error was solved with help from user kraton.
    • Fixed shared_info struct problem occuring when 3D 'accelerant' is used (tested Alpha 4.1): the TVencoder type definition list apparantly gets some memory assigned these days when done inside the definition of shared_info. Moved encoder list outside the shared_info definition. @@ -14,6 +14,8 @@
    • 'pgm_panel' is now preset to 'false' since this will probably increase chances of a good picture on panels outthere.
    • 'force_ws' is now (re-enabled but) preset to 'true' since the number of widescreen monitors outthere is rapidly becoming mainstream.
      Note please:
      'force_ws' was hardcoded to setting 'true' some time ago by the Haiku team because of these monitors. +
    • Added 'block_acc' option in nvidia.settings to completely disable the acceleration engine. Use this as a work-around if the acceleration engine misbehaves. +
    • Fixed card/system hanging after trying to log LVDS/TMDS distinction info. This (at least) fixes one NV34 trying to startup after a failed kernel VESA modeswitch without using the driver's coldstart option. Might very well help on other type cards too.
    From bga at bug-br.org.br Fri May 1 09:58:40 2009 From: bga at bug-br.org.br (Bruno Albuquerque) Date: Fri, 01 May 2009 09:58:40 Subject: [Haiku-commits] r30529 - haiku/trunk/src/apps/charactermap In-Reply-To: <1649724294-BeMail@zon> Message-ID: <1049678387-BeMail@Gaspode> On Fri, 01 May 2009 12:07:33 +0200 CEST, Axel D?rfler said: > > Make the CharacterMap start with a reasonnable window size on first > > launch (without saved settings). As it was before, the window took > > all > > the space it needed i.e. each section was on a single line. > > > > Maybe a better way would be to just start it zoomed. > > > > Maybe it fixes ticket #3752. > > While that might serve as a temporary solution, this does not fix the > actual bug. There is some strange stuff going on that should be > investigated. Well, it does not. The bug is still there even afyter this change. -Bruno From zooey at mail.berlios.de Fri May 1 15:59:13 2009 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Fri, 1 May 2009 15:59:13 +0200 Subject: [Haiku-commits] r30532 - in haiku/trunk: headers/os/interface src/kits/interface Message-ID: <200905011359.n41DxDlR002879@sheep.berlios.de> Author: zooey Date: 2009-05-01 15:59:13 +0200 (Fri, 01 May 2009) New Revision: 30532 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30532&view=rev Modified: haiku/trunk/headers/os/interface/TextView.h haiku/trunk/src/kits/interface/TextView.cpp Log: * unified application of style into a separate method _ApplyStyleRange() in order to maintain the null-style appropriately, if required * finally fix #3040 for real (a single style is now maintained at all times for non-stylable textviews) * the caret is now being drawn with the correct size, even if it is on the empty line at the end of the buffer and a specific font size has been requested Modified: haiku/trunk/headers/os/interface/TextView.h =================================================================== --- haiku/trunk/headers/os/interface/TextView.h 2009-05-01 10:09:22 UTC (rev 30531) +++ haiku/trunk/headers/os/interface/TextView.h 2009-05-01 13:59:13 UTC (rev 30532) @@ -362,6 +362,13 @@ void _SetRunArray(int32 startOffset, int32 endOffset, const text_run_array* inRuns); + void _ApplyStyleRange(int32 fromOffset, + int32 toOffset, + uint32 inMode = B_FONT_ALL, + const BFont *inFont = NULL, + const rgb_color *inColor = NULL, + bool syncNullStyle = true); + uint32 _CharClassification(int32 offset) const; int32 _NextInitialByte(int32 offset) const; int32 _PreviousInitialByte(int32 offset) const; @@ -385,6 +392,8 @@ int32 _LineAt(const BPoint& point) const; bool _IsOnEmptyLastLine(int32 offset) const; + float _NullStyleHeight() const; + BPrivate::TextGapBuffer* fText; LineBuffer* fLines; StyleBuffer* fStyles; Modified: haiku/trunk/src/kits/interface/TextView.cpp =================================================================== --- haiku/trunk/src/kits/interface/TextView.cpp 2009-05-01 10:09:22 UTC (rev 30531) +++ haiku/trunk/src/kits/interface/TextView.cpp 2009-05-01 13:59:13 UTC (rev 30532) @@ -1162,13 +1162,11 @@ // update the style runs fStyles->BumpOffset(inLength, fStyles->OffsetToRun(inOffset - 1) + 1); - if (inRuns != NULL) + if (fStylable && inRuns != NULL) SetRunArray(inOffset, inOffset + inLength, inRuns); else { - // apply nullStyle to inserted text - fStyles->SyncNullStyle(inOffset); - fStyles->SetStyleRange(inOffset, inOffset + inLength, - fText->Length(), B_FONT_ALL, NULL, NULL); + // apply null-style to inserted text + _ApplyStyleRange(inOffset, inOffset + inLength); } // recalc line breaks and draw the text @@ -1591,15 +1589,8 @@ { CALLED(); - if (startOffset > endOffset) - return; + _HideCaret(); - BFont newFont; - if (font != NULL) { - newFont = font; - _NormalizeFont(&newFont); - } - const int32 textLength = fText->Length(); if (!fStylable) { @@ -1607,24 +1598,23 @@ // style and ignore the offsets startOffset = 0; endOffset = textLength; + } else { + // pin offsets at reasonable values + if (startOffset < 0) + startOffset = 0; + else if (startOffset > textLength) + startOffset = textLength; + + if (endOffset < 0) + endOffset = 0; + else if (endOffset > textLength) + endOffset = textLength; } - // pin offsets at reasonable values - if (startOffset < 0) - startOffset = 0; - else if (startOffset > textLength) - startOffset = textLength; + // apply the style to the style buffer + fStyles->InvalidateNullStyle(); + _ApplyStyleRange(startOffset, endOffset, fontMode, font, color); - if (endOffset < 0) - endOffset = 0; - else if (endOffset > textLength) - endOffset = textLength; - - // add the style to the style buffer - fStyles->SyncNullStyle(startOffset); - fStyles->SetStyleRange(startOffset, endOffset, fText->Length(), - fontMode, &newFont, color); - if ((fontMode & (B_FONT_FAMILY_AND_STYLE | B_FONT_SIZE)) != 0) { // TODO: maybe only invalidate the layout (depending on // B_SUPPORTS_LAYOUT) and have it _Refresh() automatically? @@ -1636,6 +1626,8 @@ _RequestDrawLines(_LineAt(startOffset), _LineAt(endOffset), startOffset, false); } + + _ShowCaret(); } @@ -1769,20 +1761,18 @@ // Handle the case where there is only one line (no text inserted) // TODO: See if we can do this better if (fStyles->NumRuns() == 0) { - const rgb_color *color = NULL; - const BFont *font = NULL; - fStyles->GetNullStyle(&font, &color); - - font_height fontHeight; - font->GetHeight(&fontHeight); - height = fontHeight.ascent + fontHeight.descent; + fStyles->SyncNullStyle(0); + height = _NullStyleHeight(); } else { height = (line + 1)->origin - line->origin; if (_IsOnEmptyLastLine(inOffset)) { - // special case: go down one line if inOffset is the newline - // at the end of the buffer + // special case: go down one line if inOffset is at the newline + // at the end of the buffer ... result.y += height; + // ... and return the height of that (empty) line + fStyles->SyncNullStyle(inOffset); + height = _NullStyleHeight(); } else { int32 offset = line->offset; int32 length = inOffset - line->offset; @@ -2983,27 +2973,31 @@ const text_run_array *inRuns) { CALLED(); - // why add nothing? - if (inLength < 1) - return; - // TODO: Pin offset/lenght - // add the text to the buffer - fText->InsertText(inText, inLength, inOffset); + if (inLength < 0) + inLength = 0; - // update the start offsets of each line below offset - fLines->BumpOffset(inLength, _LineAt(inOffset) + 1); + if (inOffset < 0) + inOffset = 0; + else if (inOffset > fText->Length()) + inOffset = fText->Length(); - // update the style runs - fStyles->BumpOffset(inLength, fStyles->OffsetToRun(inOffset - 1) + 1); + if (inLength > 0) { + // add the text to the buffer + fText->InsertText(inText, inLength, inOffset); - if (fStylable && (inRuns != NULL)) { + // update the start offsets of each line below offset + fLines->BumpOffset(inLength, _LineAt(inOffset) + 1); + + // update the style runs + fStyles->BumpOffset(inLength, fStyles->OffsetToRun(inOffset - 1) + 1); + } + + if (fStylable && inRuns != NULL) { _SetRunArray(inOffset, inOffset + inLength, inRuns); } else { - // apply nullStyle to inserted text - fStyles->SyncNullStyle(inOffset); - fStyles->SetStyleRange(inOffset, inOffset + inLength, - fText->Length(), B_FONT_ALL, NULL, NULL); + // apply null-style to inserted text + _ApplyStyleRange(inOffset, inOffset + inLength); } } @@ -4927,10 +4921,8 @@ toOffset = (toOffset > endOffset) ? endOffset : toOffset; } - BFont font = theRun->font; - _NormalizeFont(&font); - fStyles->SetStyleRange(fromOffset, toOffset, textLength, - B_FONT_ALL, &theRun->font, &theRun->color); + _ApplyStyleRange(fromOffset, toOffset, B_FONT_ALL, &theRun->font, + &theRun->color, false); theRun++; } @@ -5289,6 +5281,43 @@ } +void +BTextView::_ApplyStyleRange(int32 fromOffset, int32 toOffset, uint32 inMode, + const BFont *inFont, const rgb_color *inColor, bool syncNullStyle) +{ + if (inFont != NULL) { + // if a font has been given, normalize it + BFont font = *inFont; + _NormalizeFont(&font); + inFont = &font; + } + + if (!fStylable) { + // always apply font and color to full range for non-stylable textviews + fromOffset = 0; + toOffset = fText->Length(); + } + + if (syncNullStyle) + fStyles->SyncNullStyle(fromOffset); + + fStyles->SetStyleRange(fromOffset, toOffset, fText->Length(), inMode, + inFont, inColor); +} + + +float +BTextView::_NullStyleHeight() const +{ + const BFont *font = NULL; + fStyles->GetNullStyle(&font, NULL); + + font_height fontHeight; + font->GetHeight(&fontHeight); + return fontHeight.ascent + fontHeight.descent; +} + + // #pragma mark - BTextView::TextTrackState From zooey at mail.berlios.de Fri May 1 16:27:53 2009 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Fri, 1 May 2009 16:27:53 +0200 Subject: [Haiku-commits] r30533 - in haiku/trunk/src/kits/interface: . textview_support Message-ID: <200905011427.n41ERrJU018166@sheep.berlios.de> Author: zooey Date: 2009-05-01 16:27:52 +0200 (Fri, 01 May 2009) New Revision: 30533 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30533&view=rev Modified: haiku/trunk/src/kits/interface/TextView.cpp haiku/trunk/src/kits/interface/textview_support/StyleBuffer.cpp haiku/trunk/src/kits/interface/textview_support/StyleBuffer.h Log: * maintain width of 80 chars per line * automatic whitespace cleanup Modified: haiku/trunk/src/kits/interface/TextView.cpp =================================================================== --- haiku/trunk/src/kits/interface/TextView.cpp 2009-05-01 13:59:13 UTC (rev 30532) +++ haiku/trunk/src/kits/interface/TextView.cpp 2009-05-01 14:27:52 UTC (rev 30533) @@ -2031,7 +2031,8 @@ void -BTextView::GetTextRegion(int32 startOffset, int32 endOffset, BRegion *outRegion) const +BTextView::GetTextRegion(int32 startOffset, int32 endOffset, + BRegion *outRegion) const { if (!outRegion) return; @@ -4472,10 +4473,9 @@ if (currentOffset <= fTrackingMouse->anchor) { fTrackingMouse->selStart = (*fLines)[_LineAt(currentOffset)]->offset; - fTrackingMouse->selEnd - = fTrackingMouse->shiftDown - ? fSelEnd - : (*fLines)[_LineAt(fTrackingMouse->anchor) + 1]->offset; + fTrackingMouse->selEnd = fTrackingMouse->shiftDown + ? fSelEnd + : (*fLines)[_LineAt(fTrackingMouse->anchor) + 1]->offset; } else { fTrackingMouse->selStart = fTrackingMouse->shiftDown Modified: haiku/trunk/src/kits/interface/textview_support/StyleBuffer.cpp =================================================================== --- haiku/trunk/src/kits/interface/textview_support/StyleBuffer.cpp 2009-05-01 13:59:13 UTC (rev 30532) +++ haiku/trunk/src/kits/interface/textview_support/StyleBuffer.cpp 2009-05-01 14:27:52 UTC (rev 30533) @@ -85,7 +85,8 @@ int32 -_BStyleRecordBuffer_::InsertRecord(const BFont *inFont, const rgb_color *inColor) +_BStyleRecordBuffer_::InsertRecord(const BFont *inFont, + const rgb_color *inColor) { int32 index = 0; @@ -138,7 +139,8 @@ bool -_BStyleRecordBuffer_::MatchRecord(const BFont *inFont, const rgb_color *inColor, int32 *outIndex) +_BStyleRecordBuffer_::MatchRecord(const BFont *inFont, const rgb_color *inColor, + int32 *outIndex) { for (int32 i = 0; i < fItemCount; i++) { if (*inFont == fBuffer[i].style.font @@ -176,7 +178,8 @@ } -BTextView::StyleBuffer::StyleBuffer(const BFont *inFont, const rgb_color *inColor) +BTextView::StyleBuffer::StyleBuffer(const BFont *inFont, + const rgb_color *inColor) : fValidNullStyle(true) { @@ -216,12 +219,14 @@ BTextView::StyleBuffer::SetNullStyle(uint32 inMode, const BFont *inFont, const rgb_color *inColor, int32 offset) { - if (fValidNullStyle || fStyleRunDesc.ItemCount() < 1) - SetStyleFromMode(inMode, inFont, &fNullStyle.font, inColor, &fNullStyle.color); - else { + if (fValidNullStyle || fStyleRunDesc.ItemCount() < 1) { + SetStyleFromMode(inMode, inFont, &fNullStyle.font, inColor, + &fNullStyle.color); + } else { int32 index = OffsetToRun(offset - 1); fNullStyle = fStyleRecord[fStyleRunDesc[index]->index]->style; - SetStyleFromMode(inMode, inFont, &fNullStyle.font, inColor, &fNullStyle.color); + SetStyleFromMode(inMode, inFont, &fNullStyle.font, inColor, + &fNullStyle.color); } fValidNullStyle = true; @@ -229,11 +234,12 @@ void -BTextView::StyleBuffer::GetNullStyle(const BFont **font, const rgb_color **color) const +BTextView::StyleBuffer::GetNullStyle(const BFont **font, + const rgb_color **color) const { - if (font) + if (font != NULL) *font = &fNullStyle.font; - if (color) + if (color != NULL) *color = &fNullStyle.color; } @@ -241,8 +247,9 @@ STEStyleRange * BTextView::StyleBuffer::AllocateStyleRange(const int32 numStyles) const { - STEStyleRange* range = (STEStyleRange *)malloc(sizeof(int32) + sizeof(STEStyleRun) * numStyles); - if (range) + STEStyleRange* range = (STEStyleRange *)malloc(sizeof(int32) + + sizeof(STEStyleRun) * numStyles); + if (range != NULL) range->count = numStyles; return range; } @@ -326,7 +333,8 @@ void -BTextView::StyleBuffer::GetStyle(int32 inOffset, BFont *outFont, rgb_color *outColor) const +BTextView::StyleBuffer::GetStyle(int32 inOffset, BFont *outFont, + rgb_color *outColor) const { if (fStyleRunDesc.ItemCount() < 1) { if (outFont) @@ -487,7 +495,8 @@ // ? CompareStyles ? // ? FilterStyles ? static void -FixupMode(const STEStyle &firstStyle, const STEStyle &otherStyle, uint32 &mode, bool &sameColor) +FixupMode(const STEStyle &firstStyle, const STEStyle &otherStyle, uint32 &mode, + bool &sameColor) { if (mode & B_FONT_FAMILY_AND_STYLE) { if (firstStyle.font != otherStyle.font) @@ -550,7 +559,8 @@ for (int32 i = fromIndex; i < toIndex; i++) { styleIndex = fStyleRunDesc[i]->index; - FixupMode(fStyleRecord[styleIndex]->style, theStyle, mode, oneColor); + FixupMode(fStyleRecord[styleIndex]->style, theStyle, mode, + oneColor); } if (ioMode) Modified: haiku/trunk/src/kits/interface/textview_support/StyleBuffer.h =================================================================== --- haiku/trunk/src/kits/interface/textview_support/StyleBuffer.h 2009-05-01 13:59:13 UTC (rev 30532) +++ haiku/trunk/src/kits/interface/textview_support/StyleBuffer.h 2009-05-01 14:27:52 UTC (rev 30533) @@ -69,7 +69,7 @@ return &fBuffer[index]; } - + // _BStyleRecordBuffer_ class -------------------------------------------------- class _BStyleRecordBuffer_ : public _BTextViewSupportBuffer_ { public: @@ -77,7 +77,7 @@ int32 InsertRecord(const BFont *inFont, const rgb_color *inColor); void CommitRecord(int32 index); - void RemoveRecord(int32 index); + void RemoveRecord(int32 index); bool MatchRecord(const BFont *inFont, const rgb_color *inColor, int32 *outIndex); @@ -104,34 +104,35 @@ void SyncNullStyle(int32 offset); void SetNullStyle(uint32 inMode, const BFont *inFont, - const rgb_color *inColor, int32 offset = 0); + const rgb_color *inColor, int32 offset = 0); void GetNullStyle(const BFont **font, - const rgb_color **color) const; + const rgb_color **color) const; void GetStyle(int32 inOffset, BFont *outFont, rgb_color *outColor) const; void ContinuousGetStyle(BFont *, uint32 *, rgb_color *, bool *, int32, int32) const; - - STEStyleRange* AllocateStyleRange(const int32 numStyles) const; + + STEStyleRange* AllocateStyleRange(const int32 numStyles) const; void SetStyleRange(int32 fromOffset, int32 toOffset, - int32 textLen, uint32 inMode, + int32 textLen, uint32 inMode, const BFont *inFont, const rgb_color *inColor); - STEStyleRange* GetStyleRange(int32 startOffset, int32 endOffset) const; - + STEStyleRange* GetStyleRange(int32 startOffset, + int32 endOffset) const; + void RemoveStyleRange(int32 fromOffset, int32 toOffset); void RemoveStyles(int32 index, int32 count = 1); - + int32 Iterate(int32 fromOffset, int32 length, InlineInput* input, const BFont **outFont = NULL, const rgb_color **outColor = NULL, float *outAscent = NULL, - float *outDescen = NULL, uint32 * = NULL) const; - + float *outDescen = NULL, uint32 * = NULL) const; + int32 OffsetToRun(int32 offset) const; void BumpOffset(int32 delta, int32 index); - + STEStyleRun operator[](int32 index) const; int32 NumRuns() const; From kirilla at mail.berlios.de Fri May 1 16:42:53 2009 From: kirilla at mail.berlios.de (kirilla at BerliOS) Date: Fri, 1 May 2009 16:42:53 +0200 Subject: [Haiku-commits] r30534 - in buildtools/trunk: binutils/bfd binutils/gas binutils/ld binutils/ld/emulparams gcc/gcc gcc/gcc/config/mips gcc/libgcc Message-ID: <200905011442.n41EgrZ1021795@sheep.berlios.de> Author: kirilla Date: 2009-05-01 16:42:51 +0200 (Fri, 01 May 2009) New Revision: 30534 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30534&view=rev Added: buildtools/trunk/binutils/ld/emulparams/elf_mipsel_haiku.sh buildtools/trunk/gcc/gcc/config/mips/haiku.h Modified: buildtools/trunk/binutils/bfd/config.bfd buildtools/trunk/binutils/gas/configure.tgt buildtools/trunk/binutils/ld/Makefile.am buildtools/trunk/binutils/ld/Makefile.in buildtools/trunk/binutils/ld/configure.tgt buildtools/trunk/gcc/gcc/config.gcc buildtools/trunk/gcc/libgcc/config.host Log: Adding mipsel-unknown-haiku. Work in progress. Correctness uncertain. Especially gcc/gcc/config/mips/haiku.h. Inspired by the other Haiku targets x86/ppc/arm. Modified: buildtools/trunk/binutils/bfd/config.bfd =================================================================== --- buildtools/trunk/binutils/bfd/config.bfd 2009-05-01 14:27:52 UTC (rev 30533) +++ buildtools/trunk/binutils/bfd/config.bfd 2009-05-01 14:42:51 UTC (rev 30534) @@ -883,6 +883,10 @@ targ_defvec=bfd_elf32_tradlittlemips_vec targ_selvecs="bfd_elf32_tradbigmips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec ecoff_little_vec ecoff_big_vec" ;; + mips*el-*-haiku*) + targ_defvec=bfd_elf32_littlemips_vec + targ_selvecs="bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec ecoff_little_vec ecoff_big_vec" + ;; mips*-*-netbsd*) targ_defvec=bfd_elf32_tradbigmips_vec targ_selvecs="bfd_elf32_tradlittlemips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec ecoff_big_vec ecoff_little_vec" Modified: buildtools/trunk/binutils/gas/configure.tgt =================================================================== --- buildtools/trunk/binutils/gas/configure.tgt 2009-05-01 14:27:52 UTC (rev 30533) +++ buildtools/trunk/binutils/gas/configure.tgt 2009-05-01 14:42:51 UTC (rev 30534) @@ -291,6 +291,7 @@ mips-*-elf* | mips-*-rtems*) fmt=elf ;; mips-*-netbsd*) fmt=elf em=tmips ;; mips-*-openbsd*) fmt=elf em=tmips ;; + mips*-*-haiku*) fmt=elf endian=little em=haiku ;; mmix-*-*) fmt=elf ;; Modified: buildtools/trunk/binutils/ld/Makefile.am =================================================================== --- buildtools/trunk/binutils/ld/Makefile.am 2009-05-01 14:27:52 UTC (rev 30533) +++ buildtools/trunk/binutils/ld/Makefile.am 2009-05-01 14:42:51 UTC (rev 30534) @@ -212,6 +212,7 @@ eelf_i386_haiku.o \ eelf_i386_ldso.o \ eelf_ppc_haiku.o \ + eelf_mipsel_haiku.o \ eelf_i386_vxworks.o \ eelf_s390.o \ egld960.o \ @@ -1039,6 +1040,9 @@ eelf_ppc_haiku.c: $(srcdir)/emulparams/elf_ppc_haiku.sh \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf_ppc_haiku "$(tdir_elf_ppc_haiku)" +eelf_mipsel_haiku.c: $(srcdir)/emulparams/elf_mipsel_haiku.sh \ + $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} + ${GENSCRIPTS} elf_mipsel_haiku "$(tdir_elf_mipsel_haiku)" eelf_i386_vxworks.c: $(srcdir)/emulparams/elf_i386_vxworks.sh \ $(srcdir)/emulparams/vxworks.sh $(srcdir)/emultempl/vxworks.em \ $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} Modified: buildtools/trunk/binutils/ld/Makefile.in =================================================================== --- buildtools/trunk/binutils/ld/Makefile.in 2009-05-01 14:27:52 UTC (rev 30533) +++ buildtools/trunk/binutils/ld/Makefile.in 2009-05-01 14:42:51 UTC (rev 30534) @@ -463,6 +463,7 @@ eelf_i386_haiku.o \ eelf_i386_ldso.o \ eelf_ppc_haiku.o \ + eelf_mipsel_haiku.o \ eelf_i386_vxworks.o \ eelf_s390.o \ egld960.o \ @@ -1866,6 +1867,9 @@ eelf_i386_ldso.c: $(srcdir)/emulparams/elf_i386_ldso.sh \ $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf_i386_ldso "$(tdir_elf_i386_ldso)" +eelf_mipsel_haiku.c: $(srcdir)/emulparams/elf_mipsel_haiku.sh \ + $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} + ${GENSCRIPTS} elf_mipsel_haiku "$(tdir_elf_mipsel_haiku)" eelf_ppc_haiku.c: $(srcdir)/emulparams/elf_ppc_haiku.sh \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf_ppc_haiku "$(tdir_elf_ppc_haiku)" Modified: buildtools/trunk/binutils/ld/configure.tgt =================================================================== --- buildtools/trunk/binutils/ld/configure.tgt 2009-05-01 14:27:52 UTC (rev 30533) +++ buildtools/trunk/binutils/ld/configure.tgt 2009-05-01 14:42:51 UTC (rev 30534) @@ -369,6 +369,9 @@ mips*el-*-netbsd*) targ_emul=elf32ltsmip targ_extra_emuls="elf32btsmip elf64ltsmip elf64btsmip" ;; +mips*el-*-haiku*) targ_emul=elf_mipsel_haiku + targ_extra_emuls="elf32ltsmip elf32btsmip elf32ltsmipn32 elf64ltsmip elf32btsmipn32 elf64btsmip" + ;; mips*-*-netbsd*) targ_emul=elf32btsmip targ_extra_emuls="elf32ltsmip elf64btsmip elf64ltsmip" ;; Added: buildtools/trunk/binutils/ld/emulparams/elf_mipsel_haiku.sh =================================================================== --- buildtools/trunk/binutils/ld/emulparams/elf_mipsel_haiku.sh 2009-05-01 14:27:52 UTC (rev 30533) +++ buildtools/trunk/binutils/ld/emulparams/elf_mipsel_haiku.sh 2009-05-01 14:42:51 UTC (rev 30534) @@ -0,0 +1,2 @@ +. ${srcdir}/emulparams/elf32lmip.sh + Added: buildtools/trunk/gcc/gcc/config/mips/haiku.h =================================================================== --- buildtools/trunk/gcc/gcc/config/mips/haiku.h 2009-05-01 14:27:52 UTC (rev 30533) +++ buildtools/trunk/gcc/gcc/config/mips/haiku.h 2009-05-01 14:42:51 UTC (rev 30534) @@ -0,0 +1,137 @@ +/* Definitions for MIPS running Haiku + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004 + Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + + +#define TARGET_VERSION fprintf (stderr, " (mips Haiku/ELF)"); + +#undef SIZE_TYPE +#define SIZE_TYPE "long unsigned int" + +#undef PTRDIFF_TYPE +#define PTRDIFF_TYPE "long int" + +#undef WCHAR_TYPE +#define WCHAR_TYPE "short unsigned int" + +#undef WCHAR_TYPE_SIZE +#define WCHAR_TYPE_SIZE 16 + +/* If we don't set MASK_ABICALLS, we can't default to PIC. */ +#undef TARGET_DEFAULT +#define TARGET_DEFAULT MASK_ABICALLS + +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + builtin_define ("__BEOS__"); \ + builtin_define ("__HAIKU__"); \ + builtin_define ("__MIPS__"); \ + builtin_define ("_MIPSEL_"); \ + builtin_define ("__stdcall=__attribute__((__stdcall__))"); \ + builtin_define ("__cdecl=__attribute__((__cdecl__))"); \ + builtin_assert ("system=haiku"); \ + if (flag_pic) \ + { \ + builtin_define ("__PIC__"); \ + builtin_define ("__pic__"); \ + } \ + /* Haiku apparently doesn't support merging of symbols across shared \ + object boundaries. Hence we need to explicitly specify that \ + type_infos are not merged, so that they get compared by name \ + instead of by pointer. */ \ + builtin_define ("__GXX_MERGED_TYPEINFO_NAMES=0"); \ + builtin_define ("__GXX_TYPEINFO_EQUALITY_INLINE=0"); \ + } \ + while (0) + +/* Provide a LINK_SPEC appropriate for Haiku. Here we provide support + for the special GCC options -static and -shared, which allow us to + link things in one of these three modes by applying the appropriate + combinations of options at link-time. */ + +/* If ELF is the default format, we should not use /lib/elf. */ + +#undef LINK_SPEC +#define LINK_SPEC "%{!o*:-o %b} -m elf_mipsel_haiku -shared -Bsymbolic %{nostart:-e 0}" + +/* A C statement (sans semicolon) to output to the stdio stream + FILE the assembler definition of uninitialized global DECL named + NAME whose size is SIZE bytes and alignment is ALIGN bytes. + Try to use asm_output_aligned_bss to implement this macro. */ + +#define BSS_SECTION_ASM_OP "\t.section\t.bss" + +#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ + asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN) + +#undef ASM_DECLARE_OBJECT_NAME +#define ASM_DECLARE_OBJECT_NAME mips_declare_object_name + +#undef FUNCTION_NAME_ALREADY_DECLARED +#define FUNCTION_NAME_ALREADY_DECLARED 1 + +/* The glibc _mcount stub will save $v0 for us. Don't mess with saving + it, since ASM_OUTPUT_REG_PUSH/ASM_OUTPUT_REG_POP do not work in the + presence of $gp-relative calls. */ +#undef ASM_OUTPUT_REG_PUSH +#undef ASM_OUTPUT_REG_POP + +/* The MIPS assembler has different syntax for .set. We set it to + .dummy to trap any errors. */ +#undef SET_ASM_OP +#define SET_ASM_OP "\t.dummy\t" + +#undef ASM_OUTPUT_DEF +#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \ + do { \ + fputc ( '\t', FILE); \ + assemble_name (FILE, LABEL1); \ + fputs ( " = ", FILE); \ + assemble_name (FILE, LABEL2); \ + fputc ( '\n', FILE); \ + } while (0) + +#undef ASM_DECLARE_FUNCTION_NAME +#define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \ + do { \ + if (!flag_inhibit_size_directive) \ + { \ + fputs ("\t.ent\t", STREAM); \ + assemble_name (STREAM, NAME); \ + putc ('\n', STREAM); \ + } \ + ASM_OUTPUT_TYPE_DIRECTIVE (STREAM, NAME, "function"); \ + assemble_name (STREAM, NAME); \ + fputs (":\n", STREAM); \ + } while (0) + +#undef ASM_DECLARE_FUNCTION_SIZE +#define ASM_DECLARE_FUNCTION_SIZE(STREAM, NAME, DECL) \ + do { \ + if (!flag_inhibit_size_directive) \ + { \ + fputs ("\t.end\t", STREAM); \ + assemble_name (STREAM, NAME); \ + putc ('\n', STREAM); \ + } \ + } while (0) + + Modified: buildtools/trunk/gcc/gcc/config.gcc =================================================================== --- buildtools/trunk/gcc/gcc/config.gcc 2009-05-01 14:27:52 UTC (rev 30533) +++ buildtools/trunk/gcc/gcc/config.gcc 2009-05-01 14:42:51 UTC (rev 30534) @@ -1802,6 +1802,11 @@ tmake_file="mips/t-elf mips/t-libgcc-mips16" use_fixproto=yes ;; +mipsel-*-haiku*) + tmake_file='mips/t-elf t-haiku' + tm_file="elfos.h ${tm_file} haiku.h mips/haiku.h" + extra_parts='crtbegin.o crtend.o' + ;; mips64-*-elf* | mips64el-*-elf*) tm_file="elfos.h ${tm_file} mips/elf.h" tmake_file="mips/t-elf mips/t-libgcc-mips16" Modified: buildtools/trunk/gcc/libgcc/config.host =================================================================== --- buildtools/trunk/gcc/libgcc/config.host 2009-05-01 14:27:52 UTC (rev 30533) +++ buildtools/trunk/gcc/libgcc/config.host 2009-05-01 14:42:51 UTC (rev 30534) @@ -449,6 +449,8 @@ ;; mips*-*-openbsd*) ;; +mips*-*-haiku*) + ;; mipsisa32-*-elf* | mipsisa32el-*-elf*) ;; mipsisa32r2-*-elf* | mipsisa32r2el-*-elf*) From mmlr at mlotz.ch Fri May 1 17:04:50 2009 From: mmlr at mlotz.ch (Michael Lotz) Date: Fri, 1 May 2009 17:04:50 +0200 Subject: [Haiku-commits] r30534 - in buildtools/trunk: binutils/bfd binutils/gas binutils/ld binutils/ld/emulparams gcc/gcc gcc/gcc/config/mips gcc/libgcc In-Reply-To: <200905011442.n41EgrZ1021795@sheep.berlios.de> References: <200905011442.n41EgrZ1021795@sheep.berlios.de> Message-ID: <20090501145838.M89288@mlotz.ch> On Fri, 1 May 2009 16:42:53 +0200, kirilla at BerliOS wrote > Author: kirilla > Date: 2009-05-01 16:42:51 +0200 (Fri, 01 May 2009) > New Revision: 30534 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30534&view=rev > > buildtools/trunk/gcc/gcc/config/mips/haiku.h > > Log: > Adding mipsel-unknown-haiku. Work in progress. Correctness > uncertain. Especially gcc/gcc/config/mips/haiku.h. Inspired by the > other Haiku targets x86/ppc/arm. > + builtin_define ("__BEOS__"); > + builtin_define ("__HAIKU__"); We do not define __BEOS__ anymore, not even on x86. On a platform for which there is no BeOS software it certainly makes no real sense. Regards Michael From rudolfc at mail.berlios.de Fri May 1 17:05:43 2009 From: rudolfc at mail.berlios.de (rudolfc at BerliOS) Date: Fri, 1 May 2009 17:05:43 +0200 Subject: [Haiku-commits] r30535 - in haiku/trunk/src/add-ons: accelerants/nvidia accelerants/nvidia/engine kernel/drivers/graphics/nvidia Message-ID: <200905011505.n41F5h5s026208@sheep.berlios.de> Author: rudolfc Date: 2009-05-01 17:05:43 +0200 (Fri, 01 May 2009) New Revision: 30535 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30535&view=rev Modified: haiku/trunk/src/add-ons/accelerants/nvidia/Overlay.c haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_bes.c haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html Log: added support for all HDTV modes video overlay for all GeForce cards that have overlay support. TNT1/2/2-M64 users remain in bitmap mode: the overlay engine there can't handle above DVD quality. Bumped version to 0.88. Modified: haiku/trunk/src/add-ons/accelerants/nvidia/Overlay.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia/Overlay.c 2009-05-01 14:42:51 UTC (rev 30534) +++ haiku/trunk/src/add-ons/accelerants/nvidia/Overlay.c 2009-05-01 15:05:43 UTC (rev 30535) @@ -1,4 +1,4 @@ -/* Written by Rudolf Cornelissen 05/2002-4/2006 */ +/* Written by Rudolf Cornelissen 05/2002-5/2009 */ /* Note on 'missing features' in BeOS 5.0.3 and DANO: * BeOS needs to define more colorspaces! It would be nice if BeOS would support the FourCC 'definitions' @@ -133,25 +133,49 @@ break; } - /* check if the requested buffer width is supported */ - if (si->overlay.myBuffer[offset].width > 1024) - { - LOG(4,("Overlay: Sorry, requested buffer width not supported, aborted\n")); + /* checkout input picture size */ + switch (si->ps.card_arch) { + case NV04A: + /* all DVD's are OK, but HDTV 1280x720p is not: it displays ghost images + * (still find exact limit..) */ - /* release the shared benaphore */ - RELEASE_BEN(si->overlay.lock) + /* check if the requested buffer width is supported */ + if (si->overlay.myBuffer[offset].width > 1024) { + LOG(4,("Overlay: Sorry, requested buffer width not supported, aborted\n")); - return NULL; - } - /* check if the requested buffer height is supported */ - if (height > 1024) - { - LOG(4,("Overlay: Sorry, requested buffer height not supported, aborted\n")); + /* release the shared benaphore */ + RELEASE_BEN(si->overlay.lock) + return NULL; + } + /* check if the requested buffer height is supported */ + if (height > 1024) { + LOG(4,("Overlay: Sorry, requested buffer height not supported, aborted\n")); - /* release the shared benaphore */ - RELEASE_BEN(si->overlay.lock) + /* release the shared benaphore */ + RELEASE_BEN(si->overlay.lock) + return NULL; + } + break; + default: + /* HDTV 1920x1080p is confirmed OK on NV11 and higher cards */ - return NULL; + /* check if the requested buffer width is supported */ + if (si->overlay.myBuffer[offset].width > 1920) { + LOG(4,("Overlay: Sorry, requested buffer width not supported, aborted\n")); + + /* release the shared benaphore */ + RELEASE_BEN(si->overlay.lock) + return NULL; + } + /* check if the requested buffer height is supported */ + if (height > 1080) { + LOG(4,("Overlay: Sorry, requested buffer height not supported, aborted\n")); + + /* release the shared benaphore */ + RELEASE_BEN(si->overlay.lock) + return NULL; + } + break; } /* store slopspace (in pixels) for each bitmap for use by 'overlay unit' (BES) */ Modified: haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_bes.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_bes.c 2009-05-01 14:42:51 UTC (rev 30534) +++ haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_bes.c 2009-05-01 15:05:43 UTC (rev 30535) @@ -1,5 +1,5 @@ /* Nvidia TNT and GeForce Back End Scaler functions */ -/* Written by Rudolf Cornelissen 05/2002-12/2005 */ +/* Written by Rudolf Cornelissen 05/2002-5/2009 */ #define MODULE_BIT 0x00000200 @@ -225,8 +225,8 @@ } /* take zoom into account */ moi->hsrcstv += ((uint32)si->overlay.my_ov.h_start) << 16; - /* AND below required by hardware */ - moi->hsrcstv &= 0x03fffffc; + /* AND below required by hardware (> 1024 support confirmed on all cards) */ + moi->hsrcstv &= 0x07fffffc; LOG(4,("Overlay: first hor. (sub)pixel of input bitmap contributing %f\n", moi->hsrcstv / (float)65536)); Modified: haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c 2009-05-01 14:42:51 UTC (rev 30534) +++ haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c 2009-05-01 15:05:43 UTC (rev 30535) @@ -92,7 +92,7 @@ { status_t status; - LOG(1,("POWERUP: Haiku nVidia Accelerant 0.87 running.\n")); + LOG(1,("POWERUP: Haiku nVidia Accelerant 0.88 running.\n")); /* log VBLANK INT usability status */ if (si->ps.int_assigned) Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html 2009-05-01 14:42:51 UTC (rev 30534) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html 2009-05-01 15:05:43 UTC (rev 30535) @@ -4,7 +4,7 @@

    Changes done for each driverversion:

    -

    head (SVN 0.87, Rudolf)

    +

    head (SVN 0.88, Rudolf)

    • Fixed driver assuming enabling AGP mode succeeded on some occasions if it did not block it itself. Blocking AGP mode completely via the AGP busmanager (option 'block_agp') resulted in a crashing acceleration engine because it was setup for AGP transfers instead of using PCI transfers. Error was solved with help from user kraton.
    • Fixed shared_info struct problem occuring when 3D 'accelerant' is used (tested Alpha 4.1): the TVencoder type definition list apparantly gets some memory assigned these days when done inside the definition of shared_info. Moved encoder list outside the shared_info definition. @@ -14,11 +14,11 @@
    • 'pgm_panel' is now preset to 'false' since this will probably increase chances of a good picture on panels outthere.
    • 'force_ws' is now (re-enabled but) preset to 'true' since the number of widescreen monitors outthere is rapidly becoming mainstream.
      Note please:
      'force_ws' was hardcoded to setting 'true' some time ago by the Haiku team because of these monitors. +
  • Added 'block_acc' option in nvidia.settings to completely disable the acceleration engine. Use this as a work-around if the acceleration engine misbehaves.
  • Fixed card/system hanging after trying to log LVDS/TMDS distinction info. This (at least) fixes one NV34 trying to startup after a failed kernel VESA modeswitch without using the driver's coldstart option. Might very well help on other type cards too. +
  • HDTV video upto/including 1920x1080p can now be played back using overlay on Geforce cards where overlay is supported. On TNT1/TNT2/TNT2-M64 this can't be done and bitmap output is used. - -

    nv_driver 0.80 (Rudolf)

    • Improved 3D speed related initialisation programming for NV11 and NV15: NV11 just gained 44% rendering speed, NV15 gained 21% speed. The GeForce2Ti (NV15) is the new winner: Quake 2 timedemo 1 runs at 28.3fps in 1024x768x32 mode @ 75Hz refreshrate (P4 2.8Ghz, fsb 533Mhz, AGP4x), while on the GeForce4MX (NV18) it keeps running at 26.3fps. The GeForce2MX (NV11) now runs at 18.9fps. From kirilla at mail.berlios.de Fri May 1 17:23:49 2009 From: kirilla at mail.berlios.de (kirilla at BerliOS) Date: Fri, 1 May 2009 17:23:49 +0200 Subject: [Haiku-commits] r30536 - buildtools/trunk/gcc/gcc/config/mips Message-ID: <200905011523.n41FNnOd028433@sheep.berlios.de> Author: kirilla Date: 2009-05-01 17:23:48 +0200 (Fri, 01 May 2009) New Revision: 30536 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30536&view=rev Modified: buildtools/trunk/gcc/gcc/config/mips/haiku.h Log: The define __BEOS__ is not relevant to Haiku. Modified: buildtools/trunk/gcc/gcc/config/mips/haiku.h =================================================================== --- buildtools/trunk/gcc/gcc/config/mips/haiku.h 2009-05-01 15:05:43 UTC (rev 30535) +++ buildtools/trunk/gcc/gcc/config/mips/haiku.h 2009-05-01 15:23:48 UTC (rev 30536) @@ -41,7 +41,6 @@ #define TARGET_OS_CPP_BUILTINS() \ do \ { \ - builtin_define ("__BEOS__"); \ builtin_define ("__HAIKU__"); \ builtin_define ("__MIPS__"); \ builtin_define ("_MIPSEL_"); \ From marcusoverhagen at arcor.de Fri May 1 18:48:18 2009 From: marcusoverhagen at arcor.de (Marcus Overhagen) Date: Fri, 1 May 2009 18:48:18 +0200 (CEST) Subject: [Haiku-commits] r30535 - in haiku/trunk/src/add-ons: accelerants/nvidia accelerants/nvidia/engine kernel/drivers/graphics/nvidia In-Reply-To: <200905011505.n41F5h5s026208@sheep.berlios.de> References: <200905011505.n41F5h5s026208@sheep.berlios.de> Message-ID: <1544724.1241196498372.JavaMail.ngmail@webmail09.arcor-online.net> rudolfc at BerliOS wrote: > + /* AND below required by hardware (> 1024 support confirmed on all cards) > */ > + moi->hsrcstv &= 0x07fffffc; shouldn't this and similar restrictions better be implemented as: moi->hsrcstv = MIN(moi->hsrcstv & 0xc, 0x07fffffc); regards Marcus Arcor.de Gaming Area - kostenfrei daddeln bis der Arzt kommt! Jetzt checken und aus ?ber 80 Spielen w?hlen! http://www.arcor.de/footer-gaming/ From anevilyak at gmail.com Fri May 1 20:14:21 2009 From: anevilyak at gmail.com (Rene Gollent) Date: Fri, 1 May 2009 13:14:21 -0500 Subject: [Haiku-commits] r30535 - in haiku/trunk/src/add-ons: accelerants/nvidia accelerants/nvidia/engine kernel/drivers/graphics/nvidia In-Reply-To: <1544724.1241196498372.JavaMail.ngmail@webmail09.arcor-online.net> References: <200905011505.n41F5h5s026208@sheep.berlios.de> <1544724.1241196498372.JavaMail.ngmail@webmail09.arcor-online.net> Message-ID: On Fri, May 1, 2009 at 11:48 AM, Marcus Overhagen wrote: > rudolfc at BerliOS wrote: > >> + ? ? /* AND below required by hardware (> 1024 support confirmed on all cards) >> */ >> + ? ? moi->hsrcstv &= 0x07fffffc; > > shouldn't this and similar restrictions better be implemented as: > > moi->hsrcstv = MIN(moi->hsrcstv & 0xc, 0x07fffffc); Wouldn't that always result in a value somewhere between 0 and 0xc? Regards, Rene From zooey at mail.berlios.de Fri May 1 20:27:04 2009 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Fri, 1 May 2009 20:27:04 +0200 Subject: [Haiku-commits] r30537 - in haiku/vendor: . opentracker-locale opentracker-locale/current opentracker-locale/current/add-ons opentracker-locale/current/add-ons/catalogs opentracker-locale/current/add-ons/catalogs/zeta opentracker-locale/current/add-ons/collators opentracker-locale/current/apps opentracker-locale/current/build opentracker-locale/current/include opentracker-locale/current/include/posix opentracker-locale/current/languages opentracker-locale/current/lib opentracker-locale/current/preferences opentracker-locale/current/test opentracker-locale/current/test/number_format opentracker-locale/current/test/number_format/generic_number_format opentracker-locale/current/tools opentracker-locale/current/tools/genprops opentracker-locale/current/tools/genprops/data Message-ID: <200905011827.n41IR4Iq028364@sheep.berlios.de> Author: zooey Date: 2009-05-01 20:26:59 +0200 (Fri, 01 May 2009) New Revision: 30537 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30537&view=rev Added: haiku/vendor/opentracker-locale/ haiku/vendor/opentracker-locale/current/ haiku/vendor/opentracker-locale/current/Jamfile haiku/vendor/opentracker-locale/current/Jamrules haiku/vendor/opentracker-locale/current/add-ons/ haiku/vendor/opentracker-locale/current/add-ons/Jamfile haiku/vendor/opentracker-locale/current/add-ons/catalogs/ haiku/vendor/opentracker-locale/current/add-ons/catalogs/Jamfile haiku/vendor/opentracker-locale/current/add-ons/catalogs/makefile haiku/vendor/opentracker-locale/current/add-ons/catalogs/zeta/ haiku/vendor/opentracker-locale/current/add-ons/catalogs/zeta/Catalog.cpp haiku/vendor/opentracker-locale/current/add-ons/catalogs/zeta/Jamfile haiku/vendor/opentracker-locale/current/add-ons/catalogs/zeta/makefile haiku/vendor/opentracker-locale/current/add-ons/collators/ haiku/vendor/opentracker-locale/current/add-ons/collators/French.cpp haiku/vendor/opentracker-locale/current/add-ons/collators/French.rsrc haiku/vendor/opentracker-locale/current/add-ons/collators/GermanDIN-2.cpp haiku/vendor/opentracker-locale/current/add-ons/collators/GermanDIN-2.rsrc haiku/vendor/opentracker-locale/current/add-ons/collators/Jamfile haiku/vendor/opentracker-locale/current/add-ons/makefile haiku/vendor/opentracker-locale/current/apps/ haiku/vendor/opentracker-locale/current/apps/Jamfile haiku/vendor/opentracker-locale/current/apps/RegExp.cpp haiku/vendor/opentracker-locale/current/apps/RegExp.h haiku/vendor/opentracker-locale/current/apps/collectcatkeys.cpp haiku/vendor/opentracker-locale/current/apps/collectcatkeys.rsrc haiku/vendor/opentracker-locale/current/apps/dumpcatalog.cpp haiku/vendor/opentracker-locale/current/apps/dumpcatalog.rsrc haiku/vendor/opentracker-locale/current/apps/linkcatkeys.cpp haiku/vendor/opentracker-locale/current/apps/linkcatkeys.rsrc haiku/vendor/opentracker-locale/current/apps/makefile haiku/vendor/opentracker-locale/current/build/ haiku/vendor/opentracker-locale/current/build/BuildSettings haiku/vendor/opentracker-locale/current/build/ConfigRules haiku/vendor/opentracker-locale/current/build/DownloadRules haiku/vendor/opentracker-locale/current/build/FileRules haiku/vendor/opentracker-locale/current/build/FinalRules haiku/vendor/opentracker-locale/current/build/HelperRules haiku/vendor/opentracker-locale/current/build/MainBuildRules haiku/vendor/opentracker-locale/current/build/OverriddenJamRules haiku/vendor/opentracker-locale/current/build/UserBuildConfig.sample haiku/vendor/opentracker-locale/current/include/ haiku/vendor/opentracker-locale/current/include/Catalog.h haiku/vendor/opentracker-locale/current/include/CatalogInAddOn.h haiku/vendor/opentracker-locale/current/include/Collator.h haiku/vendor/opentracker-locale/current/include/Country.h haiku/vendor/opentracker-locale/current/include/Currency.h haiku/vendor/opentracker-locale/current/include/DefaultCatalog.h haiku/vendor/opentracker-locale/current/include/FloatFormat.h haiku/vendor/opentracker-locale/current/include/FloatFormatImpl.h haiku/vendor/opentracker-locale/current/include/FloatFormatParameters.h haiku/vendor/opentracker-locale/current/include/Format.h haiku/vendor/opentracker-locale/current/include/FormatImpl.h haiku/vendor/opentracker-locale/current/include/FormatParameters.h haiku/vendor/opentracker-locale/current/include/GenericNumberFormat.h haiku/vendor/opentracker-locale/current/include/IntegerFormat.h haiku/vendor/opentracker-locale/current/include/IntegerFormatImpl.h haiku/vendor/opentracker-locale/current/include/IntegerFormatParameters.h haiku/vendor/opentracker-locale/current/include/Language.h haiku/vendor/opentracker-locale/current/include/Locale.h haiku/vendor/opentracker-locale/current/include/LocaleBuild.h haiku/vendor/opentracker-locale/current/include/LocaleRoster.h haiku/vendor/opentracker-locale/current/include/LocaleStrings.h haiku/vendor/opentracker-locale/current/include/NumberFormat.h haiku/vendor/opentracker-locale/current/include/NumberFormatImpl.h haiku/vendor/opentracker-locale/current/include/NumberFormatParameters.h haiku/vendor/opentracker-locale/current/include/UnicodeChar.h haiku/vendor/opentracker-locale/current/include/posix/ haiku/vendor/opentracker-locale/current/include/posix/langinfo.h haiku/vendor/opentracker-locale/current/include/posix/monetary.h haiku/vendor/opentracker-locale/current/include/posix/nl_types.h haiku/vendor/opentracker-locale/current/languages/ haiku/vendor/opentracker-locale/current/languages/Jamfile haiku/vendor/opentracker-locale/current/languages/deutsch.language haiku/vendor/opentracker-locale/current/languages/fran?\195?\167ais.language haiku/vendor/opentracker-locale/current/languages/makefile haiku/vendor/opentracker-locale/current/lib/ haiku/vendor/opentracker-locale/current/lib/Catalog.cpp haiku/vendor/opentracker-locale/current/lib/Collator.cpp haiku/vendor/opentracker-locale/current/lib/Country.cpp haiku/vendor/opentracker-locale/current/lib/Currency.cpp haiku/vendor/opentracker-locale/current/lib/DefaultCatalog.cpp haiku/vendor/opentracker-locale/current/lib/FloatFormat.cpp haiku/vendor/opentracker-locale/current/lib/FloatFormatImpl.cpp haiku/vendor/opentracker-locale/current/lib/FloatFormatParameters.cpp haiku/vendor/opentracker-locale/current/lib/Format.cpp haiku/vendor/opentracker-locale/current/lib/FormatImpl.cpp haiku/vendor/opentracker-locale/current/lib/FormatParameters.cpp haiku/vendor/opentracker-locale/current/lib/GenericNumberFormat.cpp haiku/vendor/opentracker-locale/current/lib/IntegerFormat.cpp haiku/vendor/opentracker-locale/current/lib/IntegerFormatImpl.cpp haiku/vendor/opentracker-locale/current/lib/IntegerFormatParameters.cpp haiku/vendor/opentracker-locale/current/lib/Jamfile haiku/vendor/opentracker-locale/current/lib/Language.cpp haiku/vendor/opentracker-locale/current/lib/LibraryInit.cpp haiku/vendor/opentracker-locale/current/lib/Locale.cpp haiku/vendor/opentracker-locale/current/lib/LocaleRoster.cpp haiku/vendor/opentracker-locale/current/lib/NumberFormat.cpp haiku/vendor/opentracker-locale/current/lib/NumberFormatImpl.cpp haiku/vendor/opentracker-locale/current/lib/NumberFormatParameters.cpp haiku/vendor/opentracker-locale/current/lib/OpenHashTable.h haiku/vendor/opentracker-locale/current/lib/PropertyFile.cpp haiku/vendor/opentracker-locale/current/lib/PropertyFile.h haiku/vendor/opentracker-locale/current/lib/UnicodeChar.cpp haiku/vendor/opentracker-locale/current/lib/UnicodeProperties.h haiku/vendor/opentracker-locale/current/lib/adler32.c haiku/vendor/opentracker-locale/current/lib/cat.cpp haiku/vendor/opentracker-locale/current/lib/langinfo.cpp haiku/vendor/opentracker-locale/current/lib/makefile haiku/vendor/opentracker-locale/current/lib/strfmon.cpp haiku/vendor/opentracker-locale/current/makefile haiku/vendor/opentracker-locale/current/preferences/ haiku/vendor/opentracker-locale/current/preferences/Jamfile haiku/vendor/opentracker-locale/current/preferences/Locale.cpp haiku/vendor/opentracker-locale/current/preferences/Locale.h haiku/vendor/opentracker-locale/current/preferences/Locale.rsrc haiku/vendor/opentracker-locale/current/preferences/LocaleWindow.cpp haiku/vendor/opentracker-locale/current/preferences/LocaleWindow.h haiku/vendor/opentracker-locale/current/test/ haiku/vendor/opentracker-locale/current/test/Jamfile haiku/vendor/opentracker-locale/current/test/catalogSpeed.cpp haiku/vendor/opentracker-locale/current/test/catalogTest.cpp haiku/vendor/opentracker-locale/current/test/catalogTestAddOn.cpp haiku/vendor/opentracker-locale/current/test/collatorSpeed.cpp haiku/vendor/opentracker-locale/current/test/collatorTest.cpp haiku/vendor/opentracker-locale/current/test/genericNumberFormatTest.cpp haiku/vendor/opentracker-locale/current/test/localeTest.cpp haiku/vendor/opentracker-locale/current/test/makefile haiku/vendor/opentracker-locale/current/test/number_format/ haiku/vendor/opentracker-locale/current/test/number_format/Jamfile haiku/vendor/opentracker-locale/current/test/number_format/NumberFormatTestAddOn.cpp haiku/vendor/opentracker-locale/current/test/number_format/generic_number_format/ haiku/vendor/opentracker-locale/current/test/number_format/generic_number_format/GenericNumberFormatConstructorTest.cpp haiku/vendor/opentracker-locale/current/test/number_format/generic_number_format/GenericNumberFormatConstructorTest.h haiku/vendor/opentracker-locale/current/test/number_format/generic_number_format/GenericNumberFormatTests.cpp haiku/vendor/opentracker-locale/current/test/number_format/generic_number_format/GenericNumberFormatTests.h haiku/vendor/opentracker-locale/current/tools/ haiku/vendor/opentracker-locale/current/tools/Jamfile haiku/vendor/opentracker-locale/current/tools/genprops/ haiku/vendor/opentracker-locale/current/tools/genprops/Jamfile haiku/vendor/opentracker-locale/current/tools/genprops/PropertyFile.cpp haiku/vendor/opentracker-locale/current/tools/genprops/PropertyFile.h haiku/vendor/opentracker-locale/current/tools/genprops/data/ haiku/vendor/opentracker-locale/current/tools/genprops/data/CaseFolding.txt haiku/vendor/opentracker-locale/current/tools/genprops/data/Mirror.txt haiku/vendor/opentracker-locale/current/tools/genprops/data/SpecialCasing.txt haiku/vendor/opentracker-locale/current/tools/genprops/data/UnicodeData.txt haiku/vendor/opentracker-locale/current/tools/genprops/genprops.cpp haiku/vendor/opentracker-locale/current/tools/genprops/genprops.h haiku/vendor/opentracker-locale/current/tools/genprops/license.html haiku/vendor/opentracker-locale/current/tools/genprops/makefile haiku/vendor/opentracker-locale/current/tools/genprops/store.cpp haiku/vendor/opentracker-locale/current/tools/genprops/utf.h haiku/vendor/opentracker-locale/current/tools/genprops/utf8.cpp haiku/vendor/opentracker-locale/current/tools/genprops/utf8.h haiku/vendor/opentracker-locale/current/tools/makefile Log: * importing OpenTracker Locale Kit Added: haiku/vendor/opentracker-locale/current/Jamfile =================================================================== --- haiku/vendor/opentracker-locale/current/Jamfile 2009-05-01 15:23:48 UTC (rev 30536) +++ haiku/vendor/opentracker-locale/current/Jamfile 2009-05-01 18:26:59 UTC (rev 30537) @@ -0,0 +1,11 @@ +SubDir LOCALE_TOP ; + +SubInclude LOCALE_TOP add-ons ; +SubInclude LOCALE_TOP apps ; +SubInclude LOCALE_TOP languages ; +SubInclude LOCALE_TOP lib ; +SubInclude LOCALE_TOP preferences ; +SubInclude LOCALE_TOP test ; +SubInclude LOCALE_TOP tools ; + +InvokeFinalRules ; Added: haiku/vendor/opentracker-locale/current/Jamrules =================================================================== --- haiku/vendor/opentracker-locale/current/Jamrules 2009-05-01 15:23:48 UTC (rev 30536) +++ haiku/vendor/opentracker-locale/current/Jamrules 2009-05-01 18:26:59 UTC (rev 30537) @@ -0,0 +1,34 @@ + +# The directories used by the build. +LOCALE_BUILD_DIR = [ FDirName $(LOCALE_TOP) build ] ; +LOCALE_INCLUDE_DIR = [ FDirName $(LOCALE_TOP) include ] ; +LOCALE_POSIX_INCLUDE_DIR = [ FDirName $(LOCALE_TOP) include posix ] ; +LOCALE_GENERATED_DIR = [ FDirName $(LOCALE_TOP) generated ] ; +LOCALE_DISTRO_DIR = [ FDirName $(LOCALE_TOP) generated distro ] ; +LOCALE_DOWNLOADS_DIR = [ FDirName $(LOCALE_TOP) generated downloads ] ; +LOCALE_OBJECTS_DIR = [ FDirName $(LOCALE_TOP) generated objects ] ; +LOCALE_UNITTESTS_DIR = [ FDirName $(LOCALE_TOP) generated unittests ] ; + +# Cache files for header scanning and jamfile caching. +HCACHEFILE = header_cache ; +JCACHEFILE = jamfile_cache ; +LOCATE on $(HCACHEFILE) $(JCACHEFILE) = $(LOCALE_OBJECTS_DIR) ; + +include [ FDirName $(LOCALE_BUILD_DIR) HelperRules ] ; +include [ FDirName $(LOCALE_BUILD_DIR) ConfigRules ] ; +include [ FDirName $(LOCALE_BUILD_DIR) DownloadRules ] ; +include [ FDirName $(LOCALE_BUILD_DIR) FinalRules ] ; +include [ FDirName $(LOCALE_BUILD_DIR) FileRules ] ; +include [ FDirName $(LOCALE_BUILD_DIR) OverriddenJamRules ] ; +include [ FDirName $(LOCALE_BUILD_DIR) MainBuildRules ] ; +include [ FDirName $(LOCALE_BUILD_DIR) BuildSettings ] ; + +# Include UserBuildConfig. +{ + local userBuildConfig = [ GLOB $(LOCALE_BUILD_DIR) : UserBuildConfig ] ; + if $(userBuildConfig) + { + LOCATE on UserBuildConfig = $(LOCALE_BUILD_DIR) ; + include UserBuildConfig ; + } +} Added: haiku/vendor/opentracker-locale/current/add-ons/Jamfile =================================================================== --- haiku/vendor/opentracker-locale/current/add-ons/Jamfile 2009-05-01 15:23:48 UTC (rev 30536) +++ haiku/vendor/opentracker-locale/current/add-ons/Jamfile 2009-05-01 18:26:59 UTC (rev 30537) @@ -0,0 +1,4 @@ +SubDir LOCALE_TOP add-ons ; + +SubInclude LOCALE_TOP add-ons catalogs ; +SubInclude LOCALE_TOP add-ons collators ; Added: haiku/vendor/opentracker-locale/current/add-ons/catalogs/Jamfile =================================================================== --- haiku/vendor/opentracker-locale/current/add-ons/catalogs/Jamfile 2009-05-01 15:23:48 UTC (rev 30536) +++ haiku/vendor/opentracker-locale/current/add-ons/catalogs/Jamfile 2009-05-01 18:26:59 UTC (rev 30537) @@ -0,0 +1,3 @@ +SubDir LOCALE_TOP add-ons catalogs ; + +SubInclude LOCALE_TOP add-ons catalogs zeta ; Added: haiku/vendor/opentracker-locale/current/add-ons/catalogs/makefile =================================================================== --- haiku/vendor/opentracker-locale/current/add-ons/catalogs/makefile 2009-05-01 15:23:48 UTC (rev 30536) +++ haiku/vendor/opentracker-locale/current/add-ons/catalogs/makefile 2009-05-01 18:26:59 UTC (rev 30537) @@ -0,0 +1,9 @@ +# makefile for the Locale Kit Collator add-ons + +SUBDIRS = \ + zeta \ + +default .DEFAULT : + - at for f in $(SUBDIRS) ; do \ + $(MAKE) -C $$f -f makefile $@; \ + done Added: haiku/vendor/opentracker-locale/current/add-ons/catalogs/zeta/Catalog.cpp =================================================================== --- haiku/vendor/opentracker-locale/current/add-ons/catalogs/zeta/Catalog.cpp 2009-05-01 15:23:48 UTC (rev 30536) +++ haiku/vendor/opentracker-locale/current/add-ons/catalogs/zeta/Catalog.cpp 2009-05-01 18:26:59 UTC (rev 30537) @@ -0,0 +1,89 @@ +/* +** Copyright 2003, Oliver Tappe, zooey at hirschkaefer.de. All rights reserved. +** Distributed under the terms of the OpenBeOS License. +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +/** This implements a compatibility catalog-type which uses the catalogs + * supplied by the Zeta Locale Kit. + */ + +class ZetaCatalog : public BCatalogAddOn { + + public: + ZetaCatalog(const char *signature, const char *language, + int32 fingerprint); + ~ZetaCatalog(); + + const char *GetString(const char *string, const char *context=NULL, + const char *comment=NULL); + const char *GetString(uint32 id); + + private: + +}; + +ZetaCatalog::ZetaCatalog(const char *signature, const char *language, + int32 fingerprint) + : + BCatalogAddOn(signature, language, fingerprint) +{ + app_info appInfo; + be_app->GetAppInfo(&appInfo); + node_ref nref; + nref.device = appInfo.ref.device; + nref.node = appInfo.ref.directory; + BDirectory appDir( &nref); + + // ToDo: implement loading of zeta-catalog + fInitCheck = EOPNOTSUPP; + + log_team(LOG_DEBUG, + "trying to load zeta-catalog with sig %s for lang %s results in %s", + signature, language, strerror(fInitCheck)); +} + +ZetaCatalog::~ZetaCatalog() +{ +} + +const char * +ZetaCatalog::GetString(const char *string, const char *context, + const char *comment) +{ + return "zeta-string-by-string"; +} + +const char * +ZetaCatalog::GetString(uint32 id) +{ + return "zeta-string-by-id"; +} + + + +extern "C" BCatalogAddOn * +instantiate_catalog(const char *signature, const char *language, int32 fingerprint) +{ + ZetaCatalog *catalog = new ZetaCatalog(signature, language, fingerprint); + if (catalog && catalog->InitCheck() != B_OK) { + delete catalog; + return NULL; + } + return catalog; +} + +uint8 gCatalogAddOnPriority = 5; + // priority for Zeta catalog-add-on Added: haiku/vendor/opentracker-locale/current/add-ons/catalogs/zeta/Jamfile =================================================================== --- haiku/vendor/opentracker-locale/current/add-ons/catalogs/zeta/Jamfile 2009-05-01 15:23:48 UTC (rev 30536) +++ haiku/vendor/opentracker-locale/current/add-ons/catalogs/zeta/Jamfile 2009-05-01 18:26:59 UTC (rev 30537) @@ -0,0 +1,3 @@ +SubDir LOCALE_TOP add-ons catalogs zeta ; + +AddOn zeta : Catalog.cpp : be liblocale.so ; Added: haiku/vendor/opentracker-locale/current/add-ons/catalogs/zeta/makefile =================================================================== --- haiku/vendor/opentracker-locale/current/add-ons/catalogs/zeta/makefile 2009-05-01 15:23:48 UTC (rev 30536) +++ haiku/vendor/opentracker-locale/current/add-ons/catalogs/zeta/makefile 2009-05-01 18:26:59 UTC (rev 30537) @@ -0,0 +1,146 @@ +## BeOS Generic Makefile v2.2 ## + +## Fill in this file to specify the project being created, and the referenced +## makefile-engine will do all of the hard work for you. This handles both +## Intel and PowerPC builds of the BeOS. + +## Application Specific Settings --------------------------------------------- + +# specify the name of the binary +NAME= zeta + +# specify the type of binary +# APP: Application +# SHARED: Shared library or add-on +# STATIC: Static library archive +# DRIVER: Kernel Driver +TYPE= SHARED + +# add support for new Pe and Eddie features +# to fill in generic makefile + +#%{ +# @src->@ + +# specify the source files to use +# full paths or paths relative to the makefile can be included +# all files, regardless of directory, will have their object +# files created in the common object directory. +# Note that this means this makefile will not work correctly +# if two source files with the same name (source.c or source.cpp) +# are included from different directories. Also note that spaces +# in folder names do not work well with this makefile. +SRCS= Catalog.cpp + +# specify the resource files to use +# full path or a relative path to the resource file can be used. +RSRCS= + +# @<-src@ +#%} + +# end support for Pe and Eddie + +# specify additional libraries to link against +# there are two acceptable forms of library specifications +# - if your library follows the naming pattern of: +# libXXX.so or libXXX.a you can simply specify XXX +# library: libbe.so entry: be +# +# - if your library does not follow the standard library +# naming scheme you need to specify the path to the library +# and it's name +# library: my_lib.a entry: my_lib.a or path/my_lib.a +LIBS= be locale + +# specify additional paths to directories following the standard +# libXXX.so or libXXX.a naming scheme. You can specify full paths +# or paths relative to the makefile. The paths included may not +# be recursive, so include all of the paths where libraries can +# be found. Directories where source files are found are +# automatically included. +LIBPATHS=../../../lib + +# additional paths to look for system headers +# thes use the form: #include
      +# source file directories are NOT auto-included here +SYSTEM_INCLUDE_PATHS = ../../../include + +# additional paths to look for local headers +# thes use the form: #include "header" +# source file directories are automatically included +LOCAL_INCLUDE_PATHS = + +# specify the level of optimization that you desire +# NONE, SOME, FULL +OPTIMIZE= SOME + +# specify any preprocessor symbols to be defined. The symbols will not +# have their values set automatically; you must supply the value (if any) +# to use. For example, setting DEFINES to "DEBUG=1" will cause the +# compiler option "-DDEBUG=1" to be used. Setting DEFINES to "DEBUG" +# would pass "-DDEBUG" on the compiler's command line. +DEFINES= + +# specify special warning levels +# if unspecified default warnings will be used +# NONE = supress all warnings +# ALL = enable all warnings +WARNINGS = ALL + +# specify whether image symbols will be created +# so that stack crawls in the debugger are meaningful +# if TRUE symbols will be created +SYMBOLS = TRUE + +# specify debug settings +# if TRUE will allow application to be run from a source-level +# debugger. Note that this will disable all optimzation. +DEBUGGER = TRUE + +# specify additional compiler flags for all files +COMPILER_FLAGS = + +# specify additional linker flags +LINKER_FLAGS = + +# specify the version of this particular item +# (for example, -app 3 4 0 d 0 -short 340 -long "340 "`echo -n -e '\302\251'`"1999 GNU GPL") +# This may also be specified in a resource. +APP_VERSION = + +# (for TYPE == DRIVER only) Specify desired location of driver in the /dev +# hierarchy. Used by the driverinstall rule. E.g., DRIVER_PATH = video/usb will +# instruct the driverinstall rule to place a symlink to your driver's binary in +# ~/add-ons/kernel/drivers/dev/video/usb, so that your driver will appear at +# /dev/video/usb when loaded. Default is "misc". +DRIVER_PATH = + +#MACHINE=$(shell uname -m) +#ifneq ($(MACHINE),BePC) +# COMPILER_FLAGS += -w iserr +#else +# COMPILER_FLAGS += -Werror +#endif + +# Custom overrides that can be set from the command line. +ifeq ($(DEBUG_BUILD), true) + SYMBOLS := TRUE + DEBUGGER := TRUE + OPTIMIZE := NONE + COMPILER_FLAGS += -DDEBUG=1 +endif + +ifeq ($(CHECK_MEM), true) + SYMBOLS := TRUE + DEBUGGER := TRUE + OPTIMIZE := NONE + COMPILER_FLAGS += -fcheck-memory-usage -DDEBUG=1 -D_NO_INLINE_ASM=1 -D_KERNEL_MODE=1 +endif + +INSTALL_DIR=/boot/home/config/add-ons/locale/catalogs +TARGET_DIR=. + +## include the makefile-engine +include $(BUILDHOME)/etc/makefile-engine + Added: haiku/vendor/opentracker-locale/current/add-ons/collators/French.cpp =================================================================== --- haiku/vendor/opentracker-locale/current/add-ons/collators/French.cpp 2009-05-01 15:23:48 UTC (rev 30536) +++ haiku/vendor/opentracker-locale/current/add-ons/collators/French.cpp 2009-05-01 18:26:59 UTC (rev 30537) @@ -0,0 +1,272 @@ +/* +** Copyright 2003, Axel D?rfler, axeld at pinc-software.de. All rights reserved. +** Distributed under the terms of the OpenBeOS License. +*/ + + +#include +#include +#include +#include + +#include + + +struct compare_context { + compare_context(bool ignorePunctuation) + : + inputA(ignorePunctuation), + inputB(ignorePunctuation) + { + } + + typedef BCollatorAddOn::input_context input_context; + + const char *a; + const char *b; + input_context inputA; + input_context inputB; + size_t length; +}; + +class FrenchCollator : public BCollatorAddOn { + public: + FrenchCollator(); + FrenchCollator(BMessage *archive); + ~FrenchCollator(); + + virtual status_t GetSortKey(const char *string, BString *key, int8 strength, + bool ignorePunctuation); + virtual int Compare(const char *a, const char *b, int32 length, int8 strength, + bool ignorePunctuation); + + // (un-)archiving API + virtual status_t Archive(BMessage *archive, bool deep) const; + static BArchivable *Instantiate(BMessage *archive); + + private: + int CompareSecondary(compare_context &context); + + typedef BCollatorAddOn _inherited; +}; + + +static const char *kSignature = "application/x-vnd.locale-collator.french"; + + +inline char +uint32_to_char(uint32 c) +{ + if (c > 255) + return 255; + + return (char)c; +} + + +// #pragma mark - + + +FrenchCollator::FrenchCollator() +{ +} + + +FrenchCollator::FrenchCollator(BMessage *archive) + : BCollatorAddOn(archive) +{ +} + + +FrenchCollator::~FrenchCollator() +{ +} + + +int +FrenchCollator::CompareSecondary(compare_context &context) +{ + if (context.length-- <= 0) + return 0; + + uint32 charA = BUnicodeChar::ToLower(GetNextChar(&context.a, context.inputA)); + uint32 charB = BUnicodeChar::ToLower(GetNextChar(&context.b, context.inputB)); + + // the two strings does have the same size when we get here + // (unfortunately, "length" is specified in bytes, not characters [if it was -1]) + if (charA == 0) + return 0; + + int compare = CompareSecondary(context); + if (compare != 0) + return compare; + + return (int32)charA - (int32)charB; +} + + +status_t +FrenchCollator::GetSortKey(const char *string, BString *key, int8 strength, + bool ignorePunctuation) +{ + if (strength == B_COLLATE_PRIMARY) + return _inherited::GetSortKey(string, key, strength, ignorePunctuation); + + size_t length = strlen(string); + + if (strength > B_COLLATE_QUATERNARY) { + key->SetTo(string, length); + return B_OK; + // what can we do about that? + } + + if (strength >= B_COLLATE_QUATERNARY) { + // the difference between tertiary and quaternary collation strength + // are usually a different handling of punctuation characters + ignorePunctuation = false; + } + + size_t keyLength = PrimaryKeyLength(length) + length + 1; + // the primary key + the secondary key + separator char + if (strength != B_COLLATE_SECONDARY) { + keyLength += length + 1; + // the secondary key + the tertiary key + separator char + } + + char *begin = key->LockBuffer(keyLength); + if (begin == NULL) + return B_NO_MEMORY; + + char *buffer = PutPrimaryKey(string, begin, length, ignorePunctuation); + *buffer++ = '\01'; + // separator + + char *secondary = buffer; + + input_context context(ignorePunctuation); + const char *source = string; + uint32 c; + for (uint32 i = 0; (c = GetNextChar(&source, context)) && i < length; i++) { + *buffer++ = uint32_to_char(BUnicodeChar::ToLower(c)); + // we only support Latin-1 characters here + // ToDo: this creates a non UTF-8 sort key - is that what we want? + } + + // reverse key + + char *end = buffer - 1; + while (secondary < end) { + char c = secondary[0]; + + *secondary++ = end[0]; + *end-- = c; + } + + // apply tertiary collation if necessary + + if (strength != B_COLLATE_SECONDARY) { + *buffer++ = '\01'; + // separator + + input_context context(ignorePunctuation); + source = string; + uint32 c; + for (uint32 i = 0; (c = GetNextChar(&source, context)) && i < length; i++) { + // ToDo: same problem as above, no UTF-8 key + if (BUnicodeChar::IsLower(c)) + *buffer++ = uint32_to_char(BUnicodeChar::ToUpper(c)); + else + *buffer++ = uint32_to_char(BUnicodeChar::ToLower(c)); + } + } + + *buffer = '\0'; + key->UnlockBuffer(buffer - begin); + + return B_OK; +} + + +int +FrenchCollator::Compare(const char *a, const char *b, int32 length, int8 strength, + bool ignorePunctuation) +{ + int compare = _inherited::Compare(a, b, length, B_COLLATE_PRIMARY, ignorePunctuation); + if (strength == B_COLLATE_PRIMARY || compare != 0) + return compare; + else if (strength >= B_COLLATE_QUATERNARY) { + // the difference between tertiary and quaternary collation strength + // are usually a different handling of punctuation characters + ignorePunctuation = false; + } + + compare_context context(ignorePunctuation); + context.a = a; + context.b = b; + context.length = length; + + switch (strength) { + case B_COLLATE_SECONDARY: + return CompareSecondary(context); + + case B_COLLATE_TERTIARY: + case B_COLLATE_QUATERNARY: + { + // diacriticals can only change the order between equal strings + int32 compare = Compare(a, b, length, B_COLLATE_SECONDARY, ignorePunctuation); + if (compare != 0) + return compare; + + for (int32 i = 0; i < length; i++) { + uint32 charA = GetNextChar(&a, context.inputA); + uint32 charB = GetNextChar(&b, context.inputB); + + // the two strings does have the same size when we get here + if (charA == 0) + return 0; + + if (charA != charB) + return (int32)charB - (int32)charA; + } + return 0; + } + + case B_COLLATE_IDENTICAL: + default: + return strncmp(a, b, length); + } +} + + +status_t +FrenchCollator::Archive(BMessage *archive, bool deep) const +{ + status_t status = BArchivable::Archive(archive, deep); + + // add the add-on signature, so that the roster can load + // us on demand! + if (status == B_OK) + status = archive->AddString("add_on", kSignature); + + return status; +} + + +BArchivable * +FrenchCollator::Instantiate(BMessage *archive) +{ + if (validate_instantiation(archive, "FrenchCollator")) + return new FrenchCollator(archive); + + return NULL; +} + + +// #pragma mark - + + +extern "C" BCollatorAddOn * +instantiate_collator(void) +{ + return new FrenchCollator(); +} Added: haiku/vendor/opentracker-locale/current/add-ons/collators/French.rsrc =================================================================== (Binary files differ) Property changes on: haiku/vendor/opentracker-locale/current/add-ons/collators/French.rsrc ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: haiku/vendor/opentracker-locale/current/add-ons/collators/GermanDIN-2.cpp =================================================================== --- haiku/vendor/opentracker-locale/current/add-ons/collators/GermanDIN-2.cpp 2009-05-01 15:23:48 UTC (rev 30536) +++ haiku/vendor/opentracker-locale/current/add-ons/collators/GermanDIN-2.cpp 2009-05-01 18:26:59 UTC (rev 30537) @@ -0,0 +1,131 @@ +/* +** Copyright 2003, Axel D?rfler, axeld at pinc-software.de. All rights reserved. +** Distributed under the terms of the OpenBeOS License. +*/ + + +#include +#include +#include +#include + +#include + + +/** This implements a German DIN-2 collator. It replaces German umlauts + * like "?" with "ae", or "?" with "oe", etc. + * For all other characters, it does the same as its parent class, + * BCollatorAddOn. + * This method is intended for sorting names (while DIN-1 is intended + * for words, BCollatorAddOn is already compatible with that method). + * It is used in German telephone books, for example. + */ + +class CollatorDeutsch : public BCollatorAddOn { + public: + CollatorDeutsch(); + CollatorDeutsch(BMessage *archive); + ~CollatorDeutsch(); + + // (un-)archiving API + virtual status_t Archive(BMessage *archive, bool deep) const; + static BArchivable *Instantiate(BMessage *archive); + + protected: + virtual uint32 GetNextChar(const char **string, input_context &context); +}; + + +static const char *kSignature = "application/x-vnd.locale-collator.germanDIN-2"; + + +CollatorDeutsch::CollatorDeutsch() +{ +} + + +CollatorDeutsch::CollatorDeutsch(BMessage *archive) + : BCollatorAddOn(archive) +{ +} + + +CollatorDeutsch::~CollatorDeutsch() +{ +} + + +uint32 +CollatorDeutsch::GetNextChar(const char **string, input_context &context) +{ + uint32 c = context.next_char; + if (c != 0) { + context.next_char = 0; + return c; + } + + do { + c = BUnicodeChar::FromUTF8(string); + } while (context.ignore_punctuation + && (BUnicodeChar::IsPunctuation(c) || BUnicodeChar::IsSpace(c))); + + switch (c) { + case 223: // ? + context.next_char = 's'; + return 's'; + case 196: // Ae + context.next_char = 'e'; + return 'A'; + case 214: // Oe + context.next_char = 'e'; + return 'O'; + case 220: // Ue + context.next_char = 'e'; + return 'U'; + case 228: // ae + context.next_char = 'e'; + return 'a'; + case 246: // oe + context.next_char = 'e'; + return 'o'; + case 252: // ue + context.next_char = 'e'; + return 'u'; + } + + return c; +} + + +status_t +CollatorDeutsch::Archive(BMessage *archive, bool deep) const +{ + status_t status = BArchivable::Archive(archive, deep); + + // add the add-on signature, so that the roster can load + // us on demand! + if (status == B_OK) + status = archive->AddString("add_on", kSignature); + + return status; +} + + +BArchivable * +CollatorDeutsch::Instantiate(BMessage *archive) +{ + if (validate_instantiation(archive, "CollatorDeutsch")) + return new CollatorDeutsch(archive); + + return NULL; +} + + +// #pragma mark - + + +extern "C" BCollatorAddOn * +instantiate_collator(void) +{ + return new CollatorDeutsch(); +} Added: haiku/vendor/opentracker-locale/current/add-ons/collators/GermanDIN-2.rsrc =================================================================== (Binary files differ) Property changes on: haiku/vendor/opentracker-locale/current/add-ons/collators/GermanDIN-2.rsrc ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: haiku/vendor/opentracker-locale/current/add-ons/collators/Jamfile =================================================================== --- haiku/vendor/opentracker-locale/current/add-ons/collators/Jamfile 2009-05-01 15:23:48 UTC (rev 30536) +++ haiku/vendor/opentracker-locale/current/add-ons/collators/Jamfile 2009-05-01 18:26:59 UTC (rev 30537) @@ -0,0 +1,15 @@ +SubDir LOCALE_TOP add-ons collators ; + +rule Collator +{ + # Collator ; + local sources = $(1) ; + local name = $(sources[1]:B) ; + local rsrc = $(name:S=.rsrc) ; + AddResources $(name) : $(rsrc) ; + AddOn $(name) : $(sources) : be liblocale.so ; +} + +Collator GermanDIN-2.cpp ; +Collator French.cpp ; + Added: haiku/vendor/opentracker-locale/current/add-ons/makefile =================================================================== --- haiku/vendor/opentracker-locale/current/add-ons/makefile 2009-05-01 15:23:48 UTC (rev 30536) +++ haiku/vendor/opentracker-locale/current/add-ons/makefile 2009-05-01 18:26:59 UTC (rev 30537) @@ -0,0 +1,10 @@ +# makefile for the Locale Kit add-ons + +SUBDIRS = \ + catalogs \ + collators \ + +default .DEFAULT : + - at for f in $(SUBDIRS) ; do \ + $(MAKE) -C $$f -f makefile $@; \ + done Added: haiku/vendor/opentracker-locale/current/apps/Jamfile =================================================================== --- haiku/vendor/opentracker-locale/current/apps/Jamfile 2009-05-01 15:23:48 UTC (rev 30536) +++ haiku/vendor/opentracker-locale/current/apps/Jamfile 2009-05-01 18:26:59 UTC (rev 30537) @@ -0,0 +1,10 @@ +SubDir LOCALE_TOP apps ; + +AddResources collectcatkeys : collectcatkeys.rsrc ; +Application collectcatkeys : collectcatkeys.cpp RegExp.cpp : be liblocale.so ; + +AddResources linkcatkeys : linkcatkeys.rsrc ; +Application linkcatkeys : linkcatkeys.cpp : be liblocale.so ; + +AddResources dumpcatalog ; +Application dumpcatalog : dumpcatalog.cpp : be liblocale.so ; Added: haiku/vendor/opentracker-locale/current/apps/RegExp.cpp =================================================================== --- haiku/vendor/opentracker-locale/current/apps/RegExp.cpp 2009-05-01 15:23:48 UTC (rev 30536) +++ haiku/vendor/opentracker-locale/current/apps/RegExp.cpp 2009-05-01 18:26:59 UTC (rev 30537) @@ -0,0 +1,1340 @@ +/* +Open Tracker License + +Terms and Conditions + +Copyright (c) 1991-2000, Be Incorporated. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice applies to all licensees +and shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF TITLE, MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +BE INCORPORATED BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of Be Incorporated shall not be +used in advertising or otherwise to promote the sale, use or other dealings in +this Software without prior written authorization from Be Incorporated. + +Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks +of Be Incorporated in the United States and other countries. Other brand product +names are registered trademarks or trademarks of their respective holders. +All rights reserved. +*/ + +// This code is based on regexp.c, v.1.3 by Henry Spencer: + +// @(#)regexp.c 1.3 of 18 April 87 +// +// Copyright (c) 1986 by University of Toronto. +// Written by Henry Spencer. Not derived from licensed software. +// +// Permission is granted to anyone to use this software for any +// purpose on any computer system, and to redistribute it freely, +// subject to the following restrictions: +// +// 1. The author is not responsible for the consequences of use of +// this software, no matter how awful, even if they arise +// from defects in it. +// +// 2. The origin of this software must not be misrepresented, either +// by explicit claim or by omission. +// +// 3. Altered versions must be plainly marked as such, and must not +// be misrepresented as being the original software. +// +// Beware that some of this code is subtly aware of the way operator +// precedence is structured in regular expressions. Serious changes in +// regular-expression syntax might require a total rethink. +// + +// ALTERED VERSION: Adapted to ANSI C and C++ for the OpenTracker +// project (www.opentracker.org), Jul 11, 2000. + +#include +#include +#include + +#include + +#include "RegExp.h" + +// The first byte of the regexp internal "program" is actually this magic +// number; the start node begins in the second byte. + +const uint8 kRegExpMagic = 0234; + +// The "internal use only" fields in RegExp.h are present to pass info from +// compile to execute that permits the execute phase to run lots faster on +// simple cases. They are: +// +// regstart char that must begin a match; '\0' if none obvious +// reganch is the match anchored (at beginning-of-line only)? +// regmust string (pointer into program) that match must include, or NULL +// regmlen length of regmust string +// +// Regstart and reganch permit very fast decisions on suitable starting points +// for a match, cutting down the work a lot. Regmust permits fast rejection +// of lines that cannot possibly match. The regmust tests are costly enough +// that Compile() supplies a regmust only if the r.e. contains something +// potentially expensive (at present, the only such thing detected is * or + +// at the start of the r.e., which can involve a lot of backup). Regmlen is +// supplied because the test in RunMatcher() needs it and Compile() is computing +// it anyway. +// +// +// +// Structure for regexp "program". This is essentially a linear encoding +// of a nondeterministic finite-state machine (aka syntax charts or +// "railroad normal form" in parsing technology). Each node is an opcode +// plus a "next" pointer, possibly plus an operand. "Next" pointers of +// all nodes except kRegExpBranch implement concatenation; a "next" pointer with +// a kRegExpBranch on both ends of it is connecting two alternatives. (Here we +// have one of the subtle syntax dependencies: an individual kRegExpBranch (as +// opposed to a collection of them) is never concatenated with anything +// because of operator precedence.) The operand of some types of node is +// a literal string; for others, it is a node leading into a sub-FSM. In +// particular, the operand of a kRegExpBranch node is the first node of the branch. +// (NB this is *not* a tree structure: the tail of the branch connects +// to the thing following the set of kRegExpBranches.) The opcodes are: +// + +// definition number opnd? meaning +enum { + kRegExpEnd = 0, // no End of program. + kRegExpBol = 1, // no Match "" at beginning of line. + kRegExpEol = 2, // no Match "" at end of line. + kRegExpAny = 3, // no Match any one character. + kRegExpAnyOf = 4, // str Match any character in this string. + kRegExpAnyBut = 5, // str Match any character not in this string. + kRegExpBranch = 6, // node Match this alternative, or the next... + kRegExpBack = 7, // no Match "", "next" ptr points backward. + kRegExpExactly = 8, // str Match this string. + kRegExpNothing = 9, // no Match empty string. + kRegExpStar = 10, // node Match this (simple) thing 0 or more times. + kRegExpPlus = 11, // node Match this (simple) thing 1 or more times. + kRegExpOpen = 20, // no Mark this point in input as start of #n. + // kRegExpOpen + 1 is number 1, etc. + kRegExpClose = 30 // no Analogous to kRegExpOpen. +}; + +// +// Opcode notes: +// +// kRegExpBranch The set of branches constituting a single choice are hooked +// together with their "next" pointers, since precedence prevents +// anything being concatenated to any individual branch. The +// "next" pointer of the last kRegExpBranch in a choice points to the +// thing following the whole choice. This is also where the +// final "next" pointer of each individual branch points; each +// branch starts with the operand node of a kRegExpBranch node. +// +// kRegExpBack Normal "next" pointers all implicitly point forward; kRegExpBack +// exists to make loop structures possible. +// +// kRegExpStar,kRegExpPlus '?', and complex '*' and '+', are implemented as circular +// kRegExpBranch structures using kRegExpBack. Simple cases (one character +// per match) are implemented with kRegExpStar and kRegExpPlus for speed +// and to minimize recursive plunges. +// +// kRegExpOpen,kRegExpClose ...are numbered at compile time. +// +// +// +// A node is one char of opcode followed by two chars of "next" pointer. +// "Next" pointers are stored as two 8-bit pieces, high order first. The +// value is a positive offset from the opcode of the node containing it. +// An operand, if any, simply follows the node. (Note that much of the +// code generation knows about this implicit relationship.) +// +// Using two bytes for the "next" pointer is vast overkill for most things, From Info.Be-Hold at inter.nl.net Fri May 1 19:50:07 2009 From: Info.Be-Hold at inter.nl.net (Info.Be-Hold at inter.nl.net) Date: Fri, 1 May 2009 19:50:07 +0200 (CEST) Subject: [Haiku-commits] r30535 - in haiku/trunk/src/add-ons: accelerants/nvidia accelerants/nvidia/engine kernel/drivers/graphics/nvidia In-Reply-To: <1544724.1241196498372.JavaMail.ngmail@webmail09.arcor-online.net> References: <200905011505.n41F5h5s026208@sheep.berlios.de> <1544724.1241196498372.JavaMail.ngmail@webmail09.arcor-online.net> Message-ID: <40302.85.223.98.72.1241200207.squirrel@webmail.inter.nl.net> Hi Marcus, Thanks for the pointer! Strictly speaking, I'd say yes. However, if things go wrong now it will be more plain for me to see so I can fix the real problem. You could say it's more there for myself than to let the driver work 'as best as it can' since the restrictions shouldn't be hit at all. If it happens anyway, it means I made a mistake somewhere. What would be the speed penalty for this MIN thing BTW? (I removed all these restrictions earlier today on a local copy to see if I could see a speed penalty as it is now. I couldn't.) On a 'sidenote': It would be nice if we would have YV12 (and such) support in Haiku to increase speed more: On a FSB533Mhz/2,8Ghz/AGP+FW Pentium system I can't playback video 1080p without dropping most frames. 720p nolonger drops frames here now: at more or less 75% CPU load. Bye! Rudolf. Op Vr, 1 mei, 2009 6:48 pm schreef Marcus Overhagen: > rudolfc at BerliOS wrote: > >> + /* AND below required by hardware (> 1024 support confirmed on all >> cards) */ >> + moi->hsrcstv &= 0x07fffffc; >> > > shouldn't this and similar restrictions better be implemented as: > > moi->hsrcstv = MIN(moi->hsrcstv & 0xc, 0x07fffffc); > > regards Marcus > > > Arcor.de Gaming Area - kostenfrei daddeln bis der Arzt kommt! > Jetzt checken und aus ?ber 80 Spielen w?hlen! > http://www.arcor.de/footer-gaming/ > _______________________________________________ > Haiku-commits mailing list > Haiku-commits at lists.berlios.de > https://lists.berlios.de/mailman/listinfo/haiku-commits > > From mmlr at mail.berlios.de Fri May 1 20:44:06 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Fri, 1 May 2009 20:44:06 +0200 Subject: [Haiku-commits] r30538 - haiku/trunk/src/add-ons/input_server/devices/keyboard Message-ID: <200905011844.n41Ii6Jg030681@sheep.berlios.de> Author: mmlr Date: 2009-05-01 20:43:57 +0200 (Fri, 01 May 2009) New Revision: 30538 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30538&view=rev Modified: haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp Log: * Ensure that we don't clear a combined B_*_KEY as long as one of the B_{LEFT|RIGHT}_*_KEYs is pressed for shift, command, control and option. This fixes bug #3841. * Only send a B_MODIFIERS_CHANGED message when the modifiers actually changed. * Minor simplification to only check for the lock keys once. * Minor cleanup. Modified: haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp 2009-05-01 18:26:59 UTC (rev 30537) +++ haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp 2009-05-01 18:43:57 UTC (rev 30538) @@ -649,12 +649,14 @@ ctrlAltDelPressed = true; } + if (ctrlAltDelPressed) { if (fOwner->fTeamMonitorWindow != NULL) { BMessage message(kMsgCtrlAltDelPressed); message.AddBool("key down", isKeyDown); fOwner->fTeamMonitorWindow->PostMessage(&message); } + if (!isKeyDown) ctrlAltDelPressed = false; } @@ -662,31 +664,45 @@ BAutolock lock(fKeymapLock); uint32 modifiers = fKeymap.Modifier(keycode); - if (modifiers - && (!(modifiers & (B_CAPS_LOCK | B_NUM_LOCK | B_SCROLL_LOCK)) - || isKeyDown)) { - BMessage* msg = new BMessage; - if (msg == NULL) - continue; + bool isLock + = (modifiers & (B_CAPS_LOCK | B_NUM_LOCK | B_SCROLL_LOCK)) != 0; + if (modifiers != 0 && (!isLock || isKeyDown)) { + uint32 oldModifiers = fModifiers; - msg->AddInt64("when", timestamp); - msg->what = B_MODIFIERS_CHANGED; - msg->AddInt32("be:old_modifiers", fModifiers); - - if ((isKeyDown && !(modifiers & (B_CAPS_LOCK | B_NUM_LOCK | B_SCROLL_LOCK))) + if ((isKeyDown && !isLock) || (isKeyDown && !(fModifiers & modifiers))) fModifiers |= modifiers; - else + else { fModifiers &= ~modifiers; - msg->AddInt32("modifiers", fModifiers); - msg->AddData("states", B_UINT8_TYPE, states, 16); + // ensure that we don't clear a combined B_*_KEY when still + // one of the individual B_{LEFT|RIGHT}_*_KEY is pressed + if (fModifiers & (B_LEFT_SHIFT_KEY | B_RIGHT_SHIFT_KEY)) + fModifiers |= B_SHIFT_KEY; + if (fModifiers & (B_LEFT_COMMAND_KEY | B_RIGHT_COMMAND_KEY)) + fModifiers |= B_COMMAND_KEY; + if (fModifiers & (B_LEFT_CONTROL_KEY | B_RIGHT_CONTROL_KEY)) + fModifiers |= B_CONTROL_KEY; + if (fModifiers & (B_LEFT_OPTION_KEY | B_RIGHT_OPTION_KEY)) + fModifiers |= B_OPTION_KEY; + } - if (fOwner->EnqueueMessage(msg) != B_OK) - delete msg; + if (fModifiers != oldModifiers) { + BMessage* message = new BMessage(B_MODIFIERS_CHANGED); + if (message == NULL) + continue; - if (modifiers & (B_CAPS_LOCK | B_NUM_LOCK | B_SCROLL_LOCK)) - _UpdateLEDs(); + message->AddInt64("when", timestamp); + message->AddInt32("be:old_modifiers", oldModifiers); + message->AddInt32("modifiers", fModifiers); + message->AddData("states", B_UINT8_TYPE, states, 16); + + if (fOwner->EnqueueMessage(message) != B_OK) + delete message; + + if (isLock) + _UpdateLEDs(); + } } uint8 newDeadKey = 0; From aldeck at mail.berlios.de Fri May 1 20:52:47 2009 From: aldeck at mail.berlios.de (aldeck at mail.berlios.de) Date: Fri, 1 May 2009 20:52:47 +0200 Subject: [Haiku-commits] r30539 - haiku/trunk/src/apps/cortex/MediaRoutingView Message-ID: <200905011852.n41Iqlf8032557@sheep.berlios.de> Author: aldeck Date: 2009-05-01 20:52:27 +0200 (Fri, 01 May 2009) New Revision: 30539 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30539&view=rev Modified: haiku/trunk/src/apps/cortex/MediaRoutingView/MediaJack.cpp Log: * Fix broken copy of a BString into a fixed size char[]. Input/output endpoints names would be broken and "Save Nodes" would create a broken file. Open/Save nodes now works (again?) and endpoint names display correctly in info windows/views. That detail is fixed but it's the design of Cortex that's broken here really :) To be continued... some day Modified: haiku/trunk/src/apps/cortex/MediaRoutingView/MediaJack.cpp =================================================================== --- haiku/trunk/src/apps/cortex/MediaRoutingView/MediaJack.cpp 2009-05-01 18:43:57 UTC (rev 30538) +++ haiku/trunk/src/apps/cortex/MediaRoutingView/MediaJack.cpp 2009-05-01 18:52:27 UTC (rev 30539) @@ -101,7 +101,7 @@ input->source = m_source; input->destination = m_destination; input->format = m_format; - m_label.CopyInto(input->name, 0, 64); + strlcpy(input->name, m_label.String(), B_MEDIA_NAME_LENGTH); return B_OK; } return B_ERROR; @@ -117,7 +117,7 @@ output->source = m_source; output->destination = m_destination; output->format = m_format; - m_label.CopyInto(output->name, 0, 64); + strlcpy(output->name, m_label.String(), B_MEDIA_NAME_LENGTH); return B_OK; } return B_ERROR; From zooey at mail.berlios.de Fri May 1 21:24:00 2009 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Fri, 1 May 2009 21:24:00 +0200 Subject: [Haiku-commits] r30540 - in haiku/trunk: headers/os headers/os/locale headers/posix headers/private headers/private/locale src/add-ons src/add-ons/locale src/add-ons/locale/catalogs src/add-ons/locale/catalogs/zeta src/add-ons/locale/collators src/bin src/bin/locale src/data/etc src/data/etc/locale src/data/etc/locale/languages src/kits src/kits/locale src/preferences src/preferences/locale src/tests/kits src/tests/kits/locale src/tools src/tools/locale src/tools/locale/genprops Message-ID: <200905011924.n41JO0oF004415@sheep.berlios.de> Author: zooey Date: 2009-05-01 21:23:59 +0200 (Fri, 01 May 2009) New Revision: 30540 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30540&view=rev Added: haiku/trunk/headers/os/locale/ haiku/trunk/headers/os/locale/Catalog.h haiku/trunk/headers/os/locale/CatalogInAddOn.h haiku/trunk/headers/os/locale/Collator.h haiku/trunk/headers/os/locale/Country.h haiku/trunk/headers/os/locale/Currency.h haiku/trunk/headers/os/locale/DefaultCatalog.h haiku/trunk/headers/os/locale/FloatFormat.h haiku/trunk/headers/os/locale/FloatFormatImpl.h haiku/trunk/headers/os/locale/FloatFormatParameters.h haiku/trunk/headers/os/locale/Format.h haiku/trunk/headers/os/locale/FormatImpl.h haiku/trunk/headers/os/locale/FormatParameters.h haiku/trunk/headers/os/locale/GenericNumberFormat.h haiku/trunk/headers/os/locale/IntegerFormat.h haiku/trunk/headers/os/locale/IntegerFormatImpl.h haiku/trunk/headers/os/locale/IntegerFormatParameters.h haiku/trunk/headers/os/locale/Language.h haiku/trunk/headers/os/locale/Locale.h haiku/trunk/headers/os/locale/LocaleBuild.h haiku/trunk/headers/os/locale/LocaleRoster.h haiku/trunk/headers/os/locale/LocaleStrings.h haiku/trunk/headers/os/locale/NumberFormat.h haiku/trunk/headers/os/locale/NumberFormatImpl.h haiku/trunk/headers/os/locale/NumberFormatParameters.h haiku/trunk/headers/os/locale/UnicodeChar.h haiku/trunk/headers/posix/langinfo.h haiku/trunk/headers/posix/monetary.h haiku/trunk/headers/private/locale/ haiku/trunk/headers/private/locale/PropertyFile.h haiku/trunk/headers/private/locale/UnicodeProperties.h haiku/trunk/src/add-ons/locale/ haiku/trunk/src/add-ons/locale/Jamfile haiku/trunk/src/add-ons/locale/catalogs/ haiku/trunk/src/add-ons/locale/catalogs/Jamfile haiku/trunk/src/add-ons/locale/catalogs/zeta/ haiku/trunk/src/add-ons/locale/catalogs/zeta/Catalog.cpp haiku/trunk/src/add-ons/locale/catalogs/zeta/Jamfile haiku/trunk/src/add-ons/locale/collators/ haiku/trunk/src/add-ons/locale/collators/French.cpp haiku/trunk/src/add-ons/locale/collators/GermanDIN-2.cpp haiku/trunk/src/add-ons/locale/collators/Jamfile haiku/trunk/src/bin/locale/ haiku/trunk/src/bin/locale/Jamfile haiku/trunk/src/bin/locale/collectcatkeys.cpp haiku/trunk/src/bin/locale/dumpcatalog.cpp haiku/trunk/src/bin/locale/linkcatkeys.cpp haiku/trunk/src/data/etc/locale/ haiku/trunk/src/data/etc/locale/languages/ haiku/trunk/src/data/etc/locale/languages/Jamfile haiku/trunk/src/data/etc/locale/languages/deutsch.language haiku/trunk/src/data/etc/locale/languages/francais.language haiku/trunk/src/kits/locale/ haiku/trunk/src/kits/locale/Catalog.cpp haiku/trunk/src/kits/locale/Collator.cpp haiku/trunk/src/kits/locale/Country.cpp haiku/trunk/src/kits/locale/Currency.cpp haiku/trunk/src/kits/locale/DefaultCatalog.cpp haiku/trunk/src/kits/locale/FloatFormat.cpp haiku/trunk/src/kits/locale/FloatFormatImpl.cpp haiku/trunk/src/kits/locale/FloatFormatParameters.cpp haiku/trunk/src/kits/locale/Format.cpp haiku/trunk/src/kits/locale/FormatImpl.cpp haiku/trunk/src/kits/locale/FormatParameters.cpp haiku/trunk/src/kits/locale/GenericNumberFormat.cpp haiku/trunk/src/kits/locale/IntegerFormat.cpp haiku/trunk/src/kits/locale/IntegerFormatImpl.cpp haiku/trunk/src/kits/locale/IntegerFormatParameters.cpp haiku/trunk/src/kits/locale/Jamfile haiku/trunk/src/kits/locale/Language.cpp haiku/trunk/src/kits/locale/LibraryInit.cpp haiku/trunk/src/kits/locale/Locale.cpp haiku/trunk/src/kits/locale/LocaleRoster.cpp haiku/trunk/src/kits/locale/NumberFormat.cpp haiku/trunk/src/kits/locale/NumberFormatImpl.cpp haiku/trunk/src/kits/locale/NumberFormatParameters.cpp haiku/trunk/src/kits/locale/PropertyFile.cpp haiku/trunk/src/kits/locale/UnicodeChar.cpp haiku/trunk/src/kits/locale/adler32.c haiku/trunk/src/kits/locale/cat.cpp haiku/trunk/src/kits/locale/langinfo.cpp haiku/trunk/src/kits/locale/makefile haiku/trunk/src/kits/locale/strfmon.cpp haiku/trunk/src/preferences/locale/ haiku/trunk/src/preferences/locale/Jamfile haiku/trunk/src/preferences/locale/Locale.cpp haiku/trunk/src/preferences/locale/Locale.h haiku/trunk/src/preferences/locale/LocaleWindow.cpp haiku/trunk/src/preferences/locale/LocaleWindow.h haiku/trunk/src/tests/kits/locale/ haiku/trunk/src/tests/kits/locale/Jamfile haiku/trunk/src/tests/kits/locale/catalogSpeed.cpp haiku/trunk/src/tests/kits/locale/catalogTest.cpp haiku/trunk/src/tests/kits/locale/catalogTestAddOn.cpp haiku/trunk/src/tests/kits/locale/collatorSpeed.cpp haiku/trunk/src/tests/kits/locale/collatorTest.cpp haiku/trunk/src/tests/kits/locale/genericNumberFormatTest.cpp haiku/trunk/src/tests/kits/locale/localeTest.cpp haiku/trunk/src/tests/kits/locale/number_format/ haiku/trunk/src/tools/locale/ haiku/trunk/src/tools/locale/Jamfile haiku/trunk/src/tools/locale/genprops/ Removed: haiku/trunk/src/tools/locale/genprops/makefile Log: * Copied imported OpenTracker Locale Kit files from the vendor branch into their new homes (at least for now, might need some adjustment). Copied: haiku/trunk/headers/os/locale/Catalog.h (from rev 30537, haiku/vendor/opentracker-locale/current/include/Catalog.h) Copied: haiku/trunk/headers/os/locale/CatalogInAddOn.h (from rev 30537, haiku/vendor/opentracker-locale/current/include/CatalogInAddOn.h) Copied: haiku/trunk/headers/os/locale/Collator.h (from rev 30537, haiku/vendor/opentracker-locale/current/include/Collator.h) Copied: haiku/trunk/headers/os/locale/Country.h (from rev 30537, haiku/vendor/opentracker-locale/current/include/Country.h) Copied: haiku/trunk/headers/os/locale/Currency.h (from rev 30537, haiku/vendor/opentracker-locale/current/include/Currency.h) Copied: haiku/trunk/headers/os/locale/DefaultCatalog.h (from rev 30537, haiku/vendor/opentracker-locale/current/include/DefaultCatalog.h) Copied: haiku/trunk/headers/os/locale/FloatFormat.h (from rev 30537, haiku/vendor/opentracker-locale/current/include/FloatFormat.h) Copied: haiku/trunk/headers/os/locale/FloatFormatImpl.h (from rev 30537, haiku/vendor/opentracker-locale/current/include/FloatFormatImpl.h) Copied: haiku/trunk/headers/os/locale/FloatFormatParameters.h (from rev 30537, haiku/vendor/opentracker-locale/current/include/FloatFormatParameters.h) Copied: haiku/trunk/headers/os/locale/Format.h (from rev 30537, haiku/vendor/opentracker-locale/current/include/Format.h) Copied: haiku/trunk/headers/os/locale/FormatImpl.h (from rev 30537, haiku/vendor/opentracker-locale/current/include/FormatImpl.h) Copied: haiku/trunk/headers/os/locale/FormatParameters.h (from rev 30537, haiku/vendor/opentracker-locale/current/include/FormatParameters.h) Copied: haiku/trunk/headers/os/locale/GenericNumberFormat.h (from rev 30537, haiku/vendor/opentracker-locale/current/include/GenericNumberFormat.h) Copied: haiku/trunk/headers/os/locale/IntegerFormat.h (from rev 30537, haiku/vendor/opentracker-locale/current/include/IntegerFormat.h) Copied: haiku/trunk/headers/os/locale/IntegerFormatImpl.h (from rev 30537, haiku/vendor/opentracker-locale/current/include/IntegerFormatImpl.h) Copied: haiku/trunk/headers/os/locale/IntegerFormatParameters.h (from rev 30537, haiku/vendor/opentracker-locale/current/include/IntegerFormatParameters.h) Copied: haiku/trunk/headers/os/locale/Language.h (from rev 30537, haiku/vendor/opentracker-locale/current/include/Language.h) Copied: haiku/trunk/headers/os/locale/Locale.h (from rev 30537, haiku/vendor/opentracker-locale/current/include/Locale.h) Copied: haiku/trunk/headers/os/locale/LocaleBuild.h (from rev 30537, haiku/vendor/opentracker-locale/current/include/LocaleBuild.h) Copied: haiku/trunk/headers/os/locale/LocaleRoster.h (from rev 30537, haiku/vendor/opentracker-locale/current/include/LocaleRoster.h) Copied: haiku/trunk/headers/os/locale/LocaleStrings.h (from rev 30537, haiku/vendor/opentracker-locale/current/include/LocaleStrings.h) Copied: haiku/trunk/headers/os/locale/NumberFormat.h (from rev 30537, haiku/vendor/opentracker-locale/current/include/NumberFormat.h) Copied: haiku/trunk/headers/os/locale/NumberFormatImpl.h (from rev 30537, haiku/vendor/opentracker-locale/current/include/NumberFormatImpl.h) Copied: haiku/trunk/headers/os/locale/NumberFormatParameters.h (from rev 30537, haiku/vendor/opentracker-locale/current/include/NumberFormatParameters.h) Copied: haiku/trunk/headers/os/locale/UnicodeChar.h (from rev 30537, haiku/vendor/opentracker-locale/current/include/UnicodeChar.h) Copied: haiku/trunk/headers/posix/langinfo.h (from rev 30537, haiku/vendor/opentracker-locale/current/include/posix/langinfo.h) Copied: haiku/trunk/headers/posix/monetary.h (from rev 30537, haiku/vendor/opentracker-locale/current/include/posix/monetary.h) Copied: haiku/trunk/headers/private/locale/PropertyFile.h (from rev 30537, haiku/vendor/opentracker-locale/current/lib/PropertyFile.h) Copied: haiku/trunk/headers/private/locale/UnicodeProperties.h (from rev 30537, haiku/vendor/opentracker-locale/current/lib/UnicodeProperties.h) Copied: haiku/trunk/src/add-ons/locale/Jamfile (from rev 30537, haiku/vendor/opentracker-locale/current/add-ons/Jamfile) Copied: haiku/trunk/src/add-ons/locale/catalogs/Jamfile (from rev 30537, haiku/vendor/opentracker-locale/current/add-ons/catalogs/Jamfile) Copied: haiku/trunk/src/add-ons/locale/catalogs/zeta/Catalog.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/add-ons/catalogs/zeta/Catalog.cpp) Copied: haiku/trunk/src/add-ons/locale/catalogs/zeta/Jamfile (from rev 30537, haiku/vendor/opentracker-locale/current/add-ons/catalogs/zeta/Jamfile) Copied: haiku/trunk/src/add-ons/locale/collators/French.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/add-ons/collators/French.cpp) Copied: haiku/trunk/src/add-ons/locale/collators/GermanDIN-2.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/add-ons/collators/GermanDIN-2.cpp) Copied: haiku/trunk/src/add-ons/locale/collators/Jamfile (from rev 30537, haiku/vendor/opentracker-locale/current/add-ons/collators/Jamfile) Copied: haiku/trunk/src/bin/locale/Jamfile (from rev 30537, haiku/vendor/opentracker-locale/current/apps/Jamfile) Copied: haiku/trunk/src/bin/locale/collectcatkeys.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/apps/collectcatkeys.cpp) Copied: haiku/trunk/src/bin/locale/dumpcatalog.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/apps/dumpcatalog.cpp) Copied: haiku/trunk/src/bin/locale/linkcatkeys.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/apps/linkcatkeys.cpp) Copied: haiku/trunk/src/data/etc/locale/languages/Jamfile (from rev 30537, haiku/vendor/opentracker-locale/current/languages/Jamfile) Copied: haiku/trunk/src/data/etc/locale/languages/deutsch.language (from rev 30537, haiku/vendor/opentracker-locale/current/languages/deutsch.language) Copied: haiku/trunk/src/data/etc/locale/languages/francais.language (from rev 30537, haiku/vendor/opentracker-locale/current/languages/fran?\195?\167ais.language) Copied: haiku/trunk/src/kits/locale/Catalog.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/lib/Catalog.cpp) Copied: haiku/trunk/src/kits/locale/Collator.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/lib/Collator.cpp) Copied: haiku/trunk/src/kits/locale/Country.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/lib/Country.cpp) Copied: haiku/trunk/src/kits/locale/Currency.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/lib/Currency.cpp) Copied: haiku/trunk/src/kits/locale/DefaultCatalog.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/lib/DefaultCatalog.cpp) Copied: haiku/trunk/src/kits/locale/FloatFormat.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/lib/FloatFormat.cpp) Copied: haiku/trunk/src/kits/locale/FloatFormatImpl.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/lib/FloatFormatImpl.cpp) Copied: haiku/trunk/src/kits/locale/FloatFormatParameters.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/lib/FloatFormatParameters.cpp) Copied: haiku/trunk/src/kits/locale/Format.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/lib/Format.cpp) Copied: haiku/trunk/src/kits/locale/FormatImpl.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/lib/FormatImpl.cpp) Copied: haiku/trunk/src/kits/locale/FormatParameters.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/lib/FormatParameters.cpp) Copied: haiku/trunk/src/kits/locale/GenericNumberFormat.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/lib/GenericNumberFormat.cpp) Copied: haiku/trunk/src/kits/locale/IntegerFormat.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/lib/IntegerFormat.cpp) Copied: haiku/trunk/src/kits/locale/IntegerFormatImpl.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/lib/IntegerFormatImpl.cpp) Copied: haiku/trunk/src/kits/locale/IntegerFormatParameters.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/lib/IntegerFormatParameters.cpp) Copied: haiku/trunk/src/kits/locale/Jamfile (from rev 30537, haiku/vendor/opentracker-locale/current/lib/Jamfile) Copied: haiku/trunk/src/kits/locale/Language.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/lib/Language.cpp) Copied: haiku/trunk/src/kits/locale/LibraryInit.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/lib/LibraryInit.cpp) Copied: haiku/trunk/src/kits/locale/Locale.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/lib/Locale.cpp) Copied: haiku/trunk/src/kits/locale/LocaleRoster.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/lib/LocaleRoster.cpp) Copied: haiku/trunk/src/kits/locale/NumberFormat.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/lib/NumberFormat.cpp) Copied: haiku/trunk/src/kits/locale/NumberFormatImpl.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/lib/NumberFormatImpl.cpp) Copied: haiku/trunk/src/kits/locale/NumberFormatParameters.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/lib/NumberFormatParameters.cpp) Copied: haiku/trunk/src/kits/locale/PropertyFile.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/lib/PropertyFile.cpp) Copied: haiku/trunk/src/kits/locale/UnicodeChar.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/lib/UnicodeChar.cpp) Copied: haiku/trunk/src/kits/locale/adler32.c (from rev 30537, haiku/vendor/opentracker-locale/current/lib/adler32.c) Copied: haiku/trunk/src/kits/locale/cat.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/lib/cat.cpp) Copied: haiku/trunk/src/kits/locale/langinfo.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/lib/langinfo.cpp) Copied: haiku/trunk/src/kits/locale/makefile (from rev 30537, haiku/vendor/opentracker-locale/current/lib/makefile) Copied: haiku/trunk/src/kits/locale/strfmon.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/lib/strfmon.cpp) Copied: haiku/trunk/src/preferences/locale/Jamfile (from rev 30537, haiku/vendor/opentracker-locale/current/preferences/Jamfile) Copied: haiku/trunk/src/preferences/locale/Locale.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/preferences/Locale.cpp) Copied: haiku/trunk/src/preferences/locale/Locale.h (from rev 30537, haiku/vendor/opentracker-locale/current/preferences/Locale.h) Copied: haiku/trunk/src/preferences/locale/LocaleWindow.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/preferences/LocaleWindow.cpp) Copied: haiku/trunk/src/preferences/locale/LocaleWindow.h (from rev 30537, haiku/vendor/opentracker-locale/current/preferences/LocaleWindow.h) Copied: haiku/trunk/src/tests/kits/locale/Jamfile (from rev 30537, haiku/vendor/opentracker-locale/current/test/Jamfile) Copied: haiku/trunk/src/tests/kits/locale/catalogSpeed.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/test/catalogSpeed.cpp) Copied: haiku/trunk/src/tests/kits/locale/catalogTest.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/test/catalogTest.cpp) Copied: haiku/trunk/src/tests/kits/locale/catalogTestAddOn.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/test/catalogTestAddOn.cpp) Copied: haiku/trunk/src/tests/kits/locale/collatorSpeed.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/test/collatorSpeed.cpp) Copied: haiku/trunk/src/tests/kits/locale/collatorTest.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/test/collatorTest.cpp) Copied: haiku/trunk/src/tests/kits/locale/genericNumberFormatTest.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/test/genericNumberFormatTest.cpp) Copied: haiku/trunk/src/tests/kits/locale/localeTest.cpp (from rev 30537, haiku/vendor/opentracker-locale/current/test/localeTest.cpp) Copied: haiku/trunk/src/tests/kits/locale/number_format (from rev 30537, haiku/vendor/opentracker-locale/current/test/number_format) Copied: haiku/trunk/src/tools/locale/Jamfile (from rev 30537, haiku/vendor/opentracker-locale/current/tools/Jamfile) Copied: haiku/trunk/src/tools/locale/genprops (from rev 30537, haiku/vendor/opentracker-locale/current/tools/genprops) Deleted: haiku/trunk/src/tools/locale/genprops/makefile From marcusoverhagen at arcor.de Fri May 1 21:45:44 2009 From: marcusoverhagen at arcor.de (Marcus Overhagen) Date: Fri, 1 May 2009 21:45:44 +0200 (CEST) Subject: [Haiku-commits] r30535 - in haiku/trunk/src/add-ons: accelerants/nvidia accelerants/nvidia/engine kernel/drivers/graphics/nvidia In-Reply-To: <40302.85.223.98.72.1241200207.squirrel@webmail.inter.nl.net> References: <40302.85.223.98.72.1241200207.squirrel@webmail.inter.nl.net> <200905011505.n41F5h5s026208@sheep.berlios.de> <1544724.1241196498372.JavaMail.ngmail@webmail09.arcor-online.net> Message-ID: <9298278.1241207144909.JavaMail.ngmail@webmail16.arcor-online.net> Info.Be-Hold at inter.nl.net wrote: > since the restrictions shouldn't be hit at all. > If it happens anyway, it means I made a mistake somewhere. Ok I see. > What would be the speed penalty for this MIN thing BTW? (I removed all It's usually a simple if () else, and thus potentially slowing the whole thing down very much. > On a 'sidenote': > It would be nice if we would have YV12 (and such) support in Haiku to > increase speed more: On a FSB533Mhz/2,8Ghz/AGP+FW Pentium system I can't > playback video 1080p without dropping most frames. 720p nolonger drops > frames here now: at more or less 75% CPU load. Yes, we should definitively add more formats that are provided by the hardware. Are you sure that the naming is correct? We shouldn't copy the mistake to call YCbCr YIV ansd similar. BTW, as already pointed out by Rene, I made a mistake in the example > > moi->hsrcstv = MIN(moi->hsrcstv & 0xc, 0x07fffffc); should be: moi->hsrcstv = MIN(moi->hsrcstv & ~0x3, 0x07fffffc); or one of the two other examples in my other mail. regards Marcus Arcor.de Gaming Area - kostenfrei daddeln bis der Arzt kommt! Jetzt checken und aus ?ber 80 Spielen w?hlen! http://www.arcor.de/footer-gaming/ From bonefish at mail.berlios.de Fri May 1 22:54:05 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Fri, 1 May 2009 22:54:05 +0200 Subject: [Haiku-commits] r30541 - haiku/trunk/src/apps/debuganalyzer/gui/chart Message-ID: <200905012054.n41Ks5D8014722@sheep.berlios.de> Author: bonefish Date: 2009-05-01 22:54:03 +0200 (Fri, 01 May 2009) New Revision: 30541 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30541&view=rev Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/ChartLegend.h haiku/trunk/src/apps/debuganalyzer/gui/chart/StringChartLegend.cpp haiku/trunk/src/apps/debuganalyzer/gui/chart/StringChartLegend.h Log: Removed obsolete ChartLegendRenderer::MaximumLegendSize(). Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/ChartLegend.h =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/chart/ChartLegend.h 2009-05-01 19:23:59 UTC (rev 30540) +++ haiku/trunk/src/apps/debuganalyzer/gui/chart/ChartLegend.h 2009-05-01 20:54:03 UTC (rev 30541) @@ -33,7 +33,6 @@ virtual void GetMinimumLegendSpacing(BView* view, float* horizontal, float* vertical) = 0; - virtual BSize MaximumLegendSize(BView* view) = 0; virtual BSize LegendSize(ChartLegend* legend, BView* view) = 0; Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/StringChartLegend.cpp =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/chart/StringChartLegend.cpp 2009-05-01 19:23:59 UTC (rev 30540) +++ haiku/trunk/src/apps/debuganalyzer/gui/chart/StringChartLegend.cpp 2009-05-01 20:54:03 UTC (rev 30541) @@ -34,14 +34,6 @@ BSize -StringChartLegendRenderer::MaximumLegendSize(BView* view) -{ -// TODO: Implement for real! - return BSize(100, 20); -} - - -BSize StringChartLegendRenderer::LegendSize(ChartLegend* _legend, BView* view) { StringChartLegend* legend = dynamic_cast(_legend); Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/StringChartLegend.h =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/chart/StringChartLegend.h 2009-05-01 19:23:59 UTC (rev 30540) +++ haiku/trunk/src/apps/debuganalyzer/gui/chart/StringChartLegend.h 2009-05-01 20:54:03 UTC (rev 30541) @@ -26,7 +26,6 @@ public: virtual void GetMinimumLegendSpacing(BView* view, float* horizontal, float* vertical); - virtual BSize MaximumLegendSize(BView* view); virtual BSize LegendSize(ChartLegend* legend, BView* view); From bonefish at mail.berlios.de Fri May 1 22:59:18 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Fri, 1 May 2009 22:59:18 +0200 Subject: [Haiku-commits] r30542 - haiku/trunk/src/apps/debuganalyzer/gui/chart Message-ID: <200905012059.n41KxIkH015390@sheep.berlios.de> Author: bonefish Date: 2009-05-01 22:59:17 +0200 (Fri, 01 May 2009) New Revision: 30542 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30542&view=rev Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.cpp Log: When there's an axis set the low color to the panel background. This causes the axis legends to be antialiased against the right color. Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.cpp =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.cpp 2009-05-01 20:54:03 UTC (rev 30541) +++ haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.cpp 2009-05-01 20:59:17 UTC (rev 30542) @@ -223,11 +223,11 @@ // clear the axes background if (fLeftAxis.axis != NULL || fTopAxis.axis != NULL || fRightAxis.axis != NULL || fBottomAxis.axis != NULL) { - SetHighColor(background); + SetLowColor(background); BRegion clippingRegion(Bounds()); clippingRegion.Exclude(fChartFrame); ConstrainClippingRegion(&clippingRegion); - FillRect(Bounds()); + FillRect(Bounds(), B_SOLID_LOW); ConstrainClippingRegion(NULL); } From zooey at mail.berlios.de Fri May 1 23:17:37 2009 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Fri, 1 May 2009 23:17:37 +0200 Subject: [Haiku-commits] r30543 - haiku/trunk Message-ID: <200905012117.n41LHbla018816@sheep.berlios.de> Author: zooey Date: 2009-05-01 23:17:37 +0200 (Fri, 01 May 2009) New Revision: 30543 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30543&view=rev Modified: haiku/trunk/ Log: * added Eclipse project files to svn:ignore Property changes on: haiku/trunk ___________________________________________________________________ Name: svn:ignore - haiku.image generated* svn-commit.tmp + haiku.image generated* svn-commit.tmp .cproject .project From bonefish at mail.berlios.de Fri May 1 23:26:58 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Fri, 1 May 2009 23:26:58 +0200 Subject: [Haiku-commits] r30544 - haiku/trunk/src/apps/debuganalyzer/gui/chart Message-ID: <200905012126.n41LQw5A020237@sheep.berlios.de> Author: bonefish Date: 2009-05-01 23:26:56 +0200 (Fri, 01 May 2009) New Revision: 30544 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30544&view=rev Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/StringChartLegend.cpp haiku/trunk/src/apps/debuganalyzer/gui/chart/StringChartLegend.h Log: * StringChartLegendRenderer can now take a font on construction. * Resolved TODOs. Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/StringChartLegend.cpp =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/chart/StringChartLegend.cpp 2009-05-01 21:17:37 UTC (rev 30543) +++ haiku/trunk/src/apps/debuganalyzer/gui/chart/StringChartLegend.cpp 2009-05-01 21:26:56 UTC (rev 30544) @@ -23,13 +23,28 @@ // #pragma mark - StringChartLegendRenderer +StringChartLegendRenderer::StringChartLegendRenderer() + : + fFont(*be_plain_font) +{ + _Init(); +} + + +StringChartLegendRenderer::StringChartLegendRenderer(const BFont& font) + : + fFont(font) +{ + _Init(); +} + + void StringChartLegendRenderer::GetMinimumLegendSpacing(BView* view, float* horizontal, float* vertical) { -// TODO: Implement for real! - *horizontal = 40; - *vertical = 20; + *horizontal = 2 * fEmWidth; + *vertical = fFontHeight / 2; } @@ -40,16 +55,8 @@ if (legend == NULL) return BSize(); -// TODO: It's a bit expensive to do that for each legend! -// TODO: Have a font per renderer? - BFont font; - view->GetFont(&font); - font_height fh; - font.GetHeight(&fh); - float fontHeight = ceilf(fh.ascent) + ceilf(fh.descent); - float width = ceilf(font.StringWidth(legend->String())); - - return BSize(width, fontHeight); + float width = ceilf(fFont.StringWidth(legend->String())); + return BSize(width, fFontHeight); } @@ -61,12 +68,20 @@ if (legend == NULL) return; - BFont font; - view->GetFont(&font); - font_height fh; - font.GetHeight(&fh); - point.y += fh.ascent; + point.y += ceil(fFontAscent); + view->SetFont(&fFont); view->SetHighColor(rgb_color().set_to(0, 0, 0, 255)); view->DrawString(legend->String(), point); } + + +void +StringChartLegendRenderer::_Init() +{ + font_height fh; + fFont.GetHeight(&fh); + fFontAscent = ceilf(fh.ascent); + fFontHeight = fFontAscent + ceilf(fh.descent); + fEmWidth = ceilf(fFont.StringWidth("m", 1)); +} Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/StringChartLegend.h =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/chart/StringChartLegend.h 2009-05-01 21:17:37 UTC (rev 30543) +++ haiku/trunk/src/apps/debuganalyzer/gui/chart/StringChartLegend.h 2009-05-01 21:26:56 UTC (rev 30544) @@ -5,6 +5,7 @@ #ifndef STRING_CHART_LEGEND_H #define STRING_CHART_LEGEND_H +#include #include #include "chart/ChartLegend.h" @@ -24,6 +25,9 @@ class StringChartLegendRenderer : public ChartLegendRenderer { public: + StringChartLegendRenderer(); + StringChartLegendRenderer(const BFont& font); + virtual void GetMinimumLegendSpacing(BView* view, float* horizontal, float* vertical); @@ -31,6 +35,15 @@ BView* view); virtual void RenderLegend(ChartLegend* legend, BView* view, BPoint point); + +private: + void _Init(); + +private: + BFont fFont; + float fFontAscent; + float fFontHeight; + float fEmWidth; }; From zooey at mail.berlios.de Fri May 1 23:56:18 2009 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Fri, 1 May 2009 23:56:18 +0200 Subject: [Haiku-commits] r30545 - in haiku/trunk: . build/jam headers/os/locale headers/posix src/add-ons src/add-ons/locale src/add-ons/locale/catalogs src/add-ons/locale/catalogs/zeta src/add-ons/locale/collators src/bin src/bin/locale src/data/etc/locale/languages src/kits src/kits/locale src/preferences src/preferences/locale src/tests/kits src/tests/kits/locale src/tests/kits/locale/number_format src/tools src/tools/locale src/tools/locale/genprops Message-ID: <200905012156.n41LuImD022669@sheep.berlios.de> Author: zooey Date: 2009-05-01 23:56:16 +0200 (Fri, 01 May 2009) New Revision: 30545 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30545&view=rev Removed: haiku/trunk/headers/os/locale/LocaleBuild.h Modified: haiku/trunk/Jamfile haiku/trunk/build/jam/HaikuImage haiku/trunk/headers/os/locale/Catalog.h haiku/trunk/headers/os/locale/Collator.h haiku/trunk/headers/os/locale/Country.h haiku/trunk/headers/os/locale/Currency.h haiku/trunk/headers/os/locale/DefaultCatalog.h haiku/trunk/headers/os/locale/FloatFormat.h haiku/trunk/headers/os/locale/FloatFormatImpl.h haiku/trunk/headers/os/locale/FloatFormatParameters.h haiku/trunk/headers/os/locale/Format.h haiku/trunk/headers/os/locale/FormatImpl.h haiku/trunk/headers/os/locale/FormatParameters.h haiku/trunk/headers/os/locale/GenericNumberFormat.h haiku/trunk/headers/os/locale/IntegerFormat.h haiku/trunk/headers/os/locale/IntegerFormatImpl.h haiku/trunk/headers/os/locale/IntegerFormatParameters.h haiku/trunk/headers/os/locale/Language.h haiku/trunk/headers/os/locale/Locale.h haiku/trunk/headers/os/locale/LocaleRoster.h haiku/trunk/headers/os/locale/NumberFormat.h haiku/trunk/headers/os/locale/NumberFormatImpl.h haiku/trunk/headers/os/locale/NumberFormatParameters.h haiku/trunk/headers/os/locale/UnicodeChar.h haiku/trunk/headers/posix/langinfo.h haiku/trunk/headers/posix/monetary.h haiku/trunk/src/add-ons/Jamfile haiku/trunk/src/add-ons/locale/Jamfile haiku/trunk/src/add-ons/locale/catalogs/Jamfile haiku/trunk/src/add-ons/locale/catalogs/zeta/Jamfile haiku/trunk/src/add-ons/locale/collators/Jamfile haiku/trunk/src/bin/Jamfile haiku/trunk/src/bin/locale/Jamfile haiku/trunk/src/data/etc/locale/languages/Jamfile haiku/trunk/src/kits/Jamfile haiku/trunk/src/kits/locale/Jamfile haiku/trunk/src/kits/locale/LibraryInit.cpp haiku/trunk/src/kits/locale/adler32.c haiku/trunk/src/preferences/Jamfile haiku/trunk/src/preferences/locale/Jamfile haiku/trunk/src/tests/kits/Jamfile haiku/trunk/src/tests/kits/locale/Jamfile haiku/trunk/src/tests/kits/locale/number_format/Jamfile haiku/trunk/src/tools/Jamfile haiku/trunk/src/tools/locale/Jamfile haiku/trunk/src/tools/locale/genprops/Jamfile Log: Applied patch by PulkoMandy, adjusted and extended by myself: * integrating most of the locale kit into the build (and image) * removed LocaleBuild.h and _IMPEXP_LOCALE since that does not make sense for elf (which usually exports all symbols anyway) * added a couple of locale kit related pseudo targets for convenience Hey, some of that stuff already seems to work :-) Modified: haiku/trunk/Jamfile =================================================================== --- haiku/trunk/Jamfile 2009-05-01 21:26:56 UTC (rev 30544) +++ haiku/trunk/Jamfile 2009-05-01 21:56:16 UTC (rev 30545) @@ -132,6 +132,25 @@ Haiku ; +# Pseudo-target to build the locale kit only +NotFile LocaleKit ; +Depends LocaleKit : + liblocale.so + Locale + + # binaries for building localized software on haiku + collectcatkeys + dumpcatalog + linkcatkeys + + # addons + LocaleKitCollatorAddons + LocaleKitCatalogAddons + + # tests + LocaleKitTests +; + # Evaluate optional package dependencies and prepare the optional build # features before parsing the Jamfile tree. include [ FDirName $(HAIKU_BUILD_RULES_DIR) OptionalPackageDependencies ] ; Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2009-05-01 21:26:56 UTC (rev 30544) +++ haiku/trunk/build/jam/HaikuImage 2009-05-01 21:56:16 UTC (rev 30545) @@ -29,9 +29,10 @@ SYSTEM_BIN = "[" addattr alert arp base64 basename bash bc beep bootman bzip2 cal cat catattr checkfs chgrp chmod chop chown chroot cksum clear - clockconfig cmp comm compress copyattr CortexAddOnHost cp + clockconfig cmp collectcatkeys comm compress copyattr CortexAddOnHost cp csplit ctags cut date dc dd desklink df diff diff3 dircolors dirname - draggers driveinfo dstcheck du echo eject env error expand expr + draggers driveinfo dstcheck du dumpcatalog + echo eject env error expand expr factor false fdinfo ffm filepanel find finddir fmt fold fortune frcode ftp ftpd funzip fwcontrol @@ -39,7 +40,8 @@ id ident ideinfo idestatus ifconfig install installsound iroster isvolume join - keymap kill less lessecho lesskey link listarea listattr listimage listdev + keymap kill less lessecho lesskey link linkcatkeys listarea listattr + listimage listdev listport listres listsem listusb ln locate logger login logname ls lsindex makebootable md5sum merge mimeset mkdos mkdir mkfifo mkfs mkindex modifiers mount mount_nfs mountvolume mv @@ -68,8 +70,8 @@ StyledEdit Terminal TextSearch TV Workspaces ; SYSTEM_PREFERENCES = Appearance Backgrounds CPUFrequency DataTranslations E-mail - FileTypes Fonts Keyboard Keymap Media Menu Mouse Network Printers Screen - ScreenSaver Sounds Time Touchpad Tracker VirtualMemory + FileTypes Fonts Keyboard Keymap Locale Media Menu Mouse Network Printers + Screen ScreenSaver Sounds Time Touchpad Tracker VirtualMemory ; SYSTEM_DEMOS = BSnow Chart Clock Cortex FontDemo GLDirectMode GLTeapot Mandelbrot Pairs @@ -80,7 +82,7 @@ libmail.so libtextencoding.so libz.so libfreetype.so libpng.so libmidi.so libmidi2.so libdevice.so libgame.so libscreensaver.so libroot.so libGL.so libfluidsynth.so liblpsolve55.so liblinprog.so libalm.so - libilmimf.so libiconv.so + libilmimf.so libiconv.so liblocale.so ; SYSTEM_SERVERS = registrar debug_server syslog_daemon media_server net_server media_addon_server input_server app_server fake_app_server @@ -346,6 +348,11 @@ = [ FDirName $(HAIKU_TOP) src apps mail ] ; AddFilesToHaikuImage system etc word_dictionary : $(spellFiles) ; +# Locale kit language files +local languageDir = [ FDirName $(HAIKU_TOP) src data etc locale languages ] ; +local languages = [ Glob $(languageDir) : *.language ] ; +AddFilesToHaikuImage system etc locale languages : $(languages) ; + local etcFiles = bash_completion inputrc profile teapot.data ; etcFiles = $(etcFiles:G=etc) ; SEARCH on $(etcFiles) = [ FDirName $(HAIKU_TOP) data etc ] ; Modified: haiku/trunk/headers/os/locale/Catalog.h =================================================================== --- haiku/trunk/headers/os/locale/Catalog.h 2009-05-01 21:26:56 UTC (rev 30544) +++ haiku/trunk/headers/os/locale/Catalog.h 2009-05-01 21:56:16 UTC (rev 30545) @@ -1,8 +1,6 @@ #ifndef _CATALOG_H_ #define _CATALOG_H_ -#include - #include #include @@ -12,7 +10,7 @@ struct entry_ref; -class _IMPEXP_LOCALE BCatalog { +class BCatalog { public: BCatalog(); @@ -51,8 +49,8 @@ }; -extern _IMPEXP_LOCALE BCatalog* be_catalog; -extern _IMPEXP_LOCALE BCatalog* be_app_catalog; +extern BCatalog* be_catalog; +extern BCatalog* be_app_catalog; #ifndef B_AVOID_TRANSLATION_MACROS @@ -60,22 +58,22 @@ // you don't want these: #undef TR_CONTEXT - // In a single application, several strings (e.g. 'Ok') will be used - // more than once, in different contexts. + // In a single application, several strings (e.g. 'Ok') will be used + // more than once, in different contexts. // As the application programmer can not know if all translations of // this string will be the same for all languages, each occurrence of // the string must be translated on its own. // Specifying the context explicitly with each string allows the person // translating a catalog to separate these different occurrences of the - // same string and tell which strings appears in what context of the + // same string and tell which strings appears in what context of the // application. // In order to give the translator a useful hint, the application - // programmer needs to define TR_CONTEXT with the context he'd like + // programmer needs to define TR_CONTEXT with the context he'd like // to be associated with the strings used in this specifc source file. // example: // #define TR_CONTEXT "Folder-Window" - // Tip: Use a descriptive name of the class implemented in that - // source-file. + // Tip: Use a descriptive name of the class implemented in that + // source-file. // Translation macros which may be used to shorten translation requests: @@ -112,7 +110,7 @@ for (char **ch = choices; *ch; ch++) { menu->AddItem( new BMenuItem( - TR(*ch), + TR(*ch), new BMessage(...) ) ) @@ -130,25 +128,25 @@ #undef TR_MARK_ALL #define TR_MARK_ALL(str,ctx,cmt) \ BCatalogAddOn::MarkForTranslation((str), (ctx), (cmt)) - + #undef TR_MARK_ID #define TR_MARK_ID(id) \ BCatalogAddOn::MarkForTranslation((id)) - + #endif /* B_AVOID_TRANSLATION_MACROS */ /************************************************************************/ // For BCatalog add-on implementations: -class _IMPEXP_LOCALE BCatalogAddOn { +class BCatalogAddOn { friend class BLocaleRoster; public: BCatalogAddOn(const char *signature, const char *language, int32 fingerprint); virtual ~BCatalogAddOn(); - virtual const char *GetString(const char *string, + virtual const char *GetString(const char *string, const char *context=NULL, const char *comment=NULL) = 0; virtual const char *GetString(uint32 id) = 0; @@ -157,14 +155,14 @@ BCatalogAddOn *Next(); // the following could be used to localize non-textual data (e.g. icons), - // but these will only be implemented if there's demand for such a + // but these will only be implemented if there's demand for such a // feature: virtual bool CanHaveData() const; virtual status_t GetData(const char *name, BMessage *msg); virtual status_t GetData(uint32 id, BMessage *msg); // interface for catalog-editor-app and testing apps: - virtual status_t SetString(const char *string, + virtual status_t SetString(const char *string, const char *translated, const char *context=NULL, const char *comment=NULL); @@ -187,7 +185,7 @@ // magic marker functions which are used to mark a string/id // which will be translated elsewhere in the code (where it can // not be found since it is references by a variable): - static const char *MarkForTranslation(const char *str, const char *ctx, + static const char *MarkForTranslation(const char *str, const char *ctx, const char *cmt); static int32 MarkForTranslation(int32 id); @@ -199,29 +197,29 @@ BString fLanguageName; int32 fFingerprint; BCatalogAddOn *fNext; - + friend class BCatalog; friend status_t get_add_on_catalog(BCatalog*, const char *); }; // every catalog-add-on should export these symbols... // ...the function that instantiates a catalog for this add-on-type... -extern "C" _IMPEXP_LOCALE +extern "C" BCatalogAddOn *instantiate_catalog(const char *signature, const char *language, int32 fingerprint); // ...the function that creates an empty catalog for this add-on-type... -extern "C" _IMPEXP_LOCALE +extern "C" BCatalogAddOn *create_catalog(const char *signature, const char *language); // ...and the priority which will be used to order the catalog-add-ons: -extern _IMPEXP_LOCALE uint8 gCatalogAddOnPriority; +extern uint8 gCatalogAddOnPriority; /* * BCatalog - inlines for trivial accessors: */ inline status_t -BCatalog::GetSignature(BString *sig) +BCatalog::GetSignature(BString *sig) { if (!sig) return B_BAD_VALUE; @@ -232,8 +230,8 @@ } -inline status_t -BCatalog::GetLanguage(BString *lang) +inline status_t +BCatalog::GetLanguage(BString *lang) { if (!lang) return B_BAD_VALUE; @@ -241,11 +239,11 @@ return B_NO_INIT; *lang = fCatalog->fLanguageName; return B_OK; -} +} -inline status_t -BCatalog::GetFingerprint(int32 *fp) +inline status_t +BCatalog::GetFingerprint(int32 *fp) { if (!fp) return B_BAD_VALUE; @@ -259,13 +257,13 @@ inline status_t BCatalog::InitCheck() const { - return fCatalog - ? fCatalog->InitCheck() + return fCatalog + ? fCatalog->InitCheck() : B_NO_INIT; } -inline int32 +inline int32 BCatalog::CountItems() const { if (!fCatalog) @@ -275,7 +273,7 @@ inline BCatalogAddOn * -BCatalog::CatalogAddOn() +BCatalog::CatalogAddOn() { return fCatalog; } @@ -285,22 +283,22 @@ * BCatalogAddOn - inlines for trivial accessors: */ inline BCatalogAddOn * -BCatalogAddOn::Next() +BCatalogAddOn::Next() { return fNext; } inline const char * -BCatalogAddOn::MarkForTranslation(const char *str, const char *ctx, - const char *cmt) +BCatalogAddOn::MarkForTranslation(const char *str, const char *ctx, + const char *cmt) { return str; } inline int32 -BCatalogAddOn::MarkForTranslation(int32 id) +BCatalogAddOn::MarkForTranslation(int32 id) { return id; } @@ -311,14 +309,14 @@ /* * EditableCatalog */ -class _IMPEXP_LOCALE EditableCatalog : public BCatalog { +class EditableCatalog : public BCatalog { public: - EditableCatalog(const char *type, const char *signature, + EditableCatalog(const char *type, const char *signature, const char *language); ~EditableCatalog(); - status_t SetString(const char *string, + status_t SetString(const char *string, const char *translated, const char *context=NULL, const char *comment=NULL); Modified: haiku/trunk/headers/os/locale/Collator.h =================================================================== --- haiku/trunk/headers/os/locale/Collator.h 2009-05-01 21:26:56 UTC (rev 30544) +++ haiku/trunk/headers/os/locale/Collator.h 2009-05-01 21:56:16 UTC (rev 30545) @@ -5,8 +5,6 @@ #include #include -#include - class BString; class BCollatorAddOn; @@ -23,7 +21,7 @@ }; -class _IMPEXP_LOCALE BCollator : public BArchivable { +class BCollator : public BArchivable { public: BCollator(); BCollator(BCollatorAddOn *collator, int8 strength, bool ignorePunctuation); @@ -55,21 +53,21 @@ }; -inline bool +inline bool BCollator::Equal(const char *s1, const char *s2, int32 len, int8 strength) { return Compare(s1, s2, len, strength) == 0; } -inline bool +inline bool BCollator::Greater(const char *s1, const char *s2, int32 len, int8 strength) { return Compare(s1, s2, len, strength) > 0; } -inline bool +inline bool BCollator::GreaterOrEqual(const char *s1, const char *s2, int32 len, int8 strength) { return Compare(s1, s2, len, strength) >= 0; @@ -80,7 +78,7 @@ // For BCollator add-on implementations: -class _IMPEXP_LOCALE BCollatorAddOn : public BArchivable { +class BCollatorAddOn : public BArchivable { public: BCollatorAddOn(); BCollatorAddOn(BMessage *archive); @@ -114,6 +112,6 @@ // If your add-on should work with the standard tool to create a language, it // should export that function. However, once the language file has been written // only the archived collator is used, and that function won't be called anymore. -extern "C" _IMPEXP_LOCALE BCollatorAddOn *instantiate_collator(void); +extern "C" BCollatorAddOn *instantiate_collator(void); #endif /* _COLLATOR_H_ */ Modified: haiku/trunk/headers/os/locale/Country.h =================================================================== --- haiku/trunk/headers/os/locale/Country.h 2009-05-01 21:26:56 UTC (rev 30544) +++ haiku/trunk/headers/os/locale/Country.h 2009-05-01 21:56:16 UTC (rev 30545) @@ -3,7 +3,6 @@ #include -#include #include #include @@ -13,11 +12,11 @@ }; -class _IMPEXP_LOCALE BCountry { +class BCountry { public: BCountry(); virtual ~BCountry(); - + virtual const char *Name() const; // see definitions below Modified: haiku/trunk/headers/os/locale/Currency.h =================================================================== --- haiku/trunk/headers/os/locale/Currency.h 2009-05-01 21:26:56 UTC (rev 30544) +++ haiku/trunk/headers/os/locale/Currency.h 2009-05-01 21:56:16 UTC (rev 30545) @@ -5,11 +5,9 @@ #include #include -#include - class BLocale; -class _IMPEXP_LOCALE BCurrency : public BArchivable { +class BCurrency : public BArchivable { public: BCurrency(const BCurrency &other); BCurrency(BMessage *archive); Modified: haiku/trunk/headers/os/locale/DefaultCatalog.h =================================================================== --- haiku/trunk/headers/os/locale/DefaultCatalog.h 2009-05-01 21:26:56 UTC (rev 30544) +++ haiku/trunk/headers/os/locale/DefaultCatalog.h 2009-05-01 21:56:16 UTC (rev 30545) @@ -7,8 +7,6 @@ # include #endif -#include - #include #include #include @@ -45,9 +43,9 @@ * but it should also support being created from up to three strings, * which as a whole specify the key to the translated string. */ -struct _IMPEXP_LOCALE CatKey { +struct CatKey { BString fKey; - // the key-string consists of three values separated by a special + // the key-string consists of three values separated by a special // token: // - the native string // - the context of the string's usage @@ -73,7 +71,7 @@ * but the value-type might change to add support for shortcuts and/or * graphical data (button-images and the like). */ -class _IMPEXP_LOCALE DefaultCatalog : public BCatalogAddOn { +class DefaultCatalog : public BCatalogAddOn { public: DefaultCatalog(const char *signature, const char *language, @@ -81,10 +79,10 @@ // constructor for normal use DefaultCatalog(entry_ref *appOrAddOnRef); // constructor for embedded catalog - DefaultCatalog(const char *path, const char *signature, + DefaultCatalog(const char *path, const char *signature, const char *language); // constructor for editor-app - + ~DefaultCatalog(); // overrides of BCatalogAddOn: @@ -93,7 +91,7 @@ const char *GetString(uint32 id); const char *GetString(const CatKey& key); // - status_t SetString(const char *string, const char *translated, + status_t SetString(const char *string, const char *translated, const char *context = NULL, const char *comment = NULL); status_t SetString(int32 id, const char *translated); status_t SetString(const CatKey& key, const char *translated); @@ -145,50 +143,50 @@ CatMap::iterator fPos; CatMap::iterator fEnd; }; - status_t GetWalker(CatWalker *walker); + status_t GetWalker(CatWalker *walker); }; -inline +inline DefaultCatalog::CatWalker::CatWalker(CatMap &catMap) : fPos(catMap.begin()), fEnd(catMap.end()) { } -inline bool +inline bool DefaultCatalog::CatWalker::AtEnd() const { return fPos == fEnd; } -inline const CatKey & +inline const CatKey & DefaultCatalog::CatWalker::GetKey() const { assert(fPos != fEnd); return fPos->first; } -inline const char * +inline const char * DefaultCatalog::CatWalker::GetValue() const { assert(fPos != fEnd); return fPos->second.String(); } -inline void +inline void DefaultCatalog::CatWalker::Next() { ++fPos; } -inline status_t +inline status_t DefaultCatalog::GetWalker(CatWalker *walker) { if (!walker) return B_BAD_VALUE; *walker = CatWalker(fCatMap); return B_OK; -} +} } // namespace BPrivate Modified: haiku/trunk/headers/os/locale/FloatFormat.h =================================================================== --- haiku/trunk/headers/os/locale/FloatFormat.h 2009-05-01 21:26:56 UTC (rev 30544) +++ haiku/trunk/headers/os/locale/FloatFormat.h 2009-05-01 21:56:16 UTC (rev 30545) @@ -7,7 +7,7 @@ class BString; class BFloatFormatImpl; -class _IMPEXP_LOCALE BFloatFormat : public BNumberFormat, public BFloatFormatParameters { +class BFloatFormat : public BNumberFormat, public BFloatFormatParameters { public: BFloatFormat(const BFloatFormat &other); ~BFloatFormat(); Modified: haiku/trunk/headers/os/locale/FloatFormatImpl.h =================================================================== --- haiku/trunk/headers/os/locale/FloatFormatImpl.h 2009-05-01 21:26:56 UTC (rev 30544) +++ haiku/trunk/headers/os/locale/FloatFormatImpl.h 2009-05-01 21:56:16 UTC (rev 30545) @@ -7,7 +7,7 @@ class BFloatFormatParameters; class BString; -class _IMPEXP_LOCALE BFloatFormatImpl : public BNumberFormatImpl { +class BFloatFormatImpl : public BNumberFormatImpl { public: BFloatFormatImpl(); virtual ~BFloatFormatImpl(); Modified: haiku/trunk/headers/os/locale/FloatFormatParameters.h =================================================================== --- haiku/trunk/headers/os/locale/FloatFormatParameters.h 2009-05-01 21:26:56 UTC (rev 30544) +++ haiku/trunk/headers/os/locale/FloatFormatParameters.h 2009-05-01 21:56:16 UTC (rev 30545) @@ -10,7 +10,7 @@ // number to be formatted }; -class _IMPEXP_LOCALE BFloatFormatParameters : public BNumberFormatParameters { +class BFloatFormatParameters : public BNumberFormatParameters { public: BFloatFormatParameters(const BFloatFormatParameters *parent = NULL); BFloatFormatParameters(const BFloatFormatParameters &other); Modified: haiku/trunk/headers/os/locale/Format.h =================================================================== --- haiku/trunk/headers/os/locale/Format.h 2009-05-01 21:26:56 UTC (rev 30544) +++ haiku/trunk/headers/os/locale/Format.h 2009-05-01 21:56:16 UTC (rev 30545) @@ -24,7 +24,7 @@ }; // structure filled in while formatting -struct _IMPEXP_LOCALE format_field_position { +struct format_field_position { uint32 field_type; int32 start; int32 length; @@ -32,7 +32,7 @@ class BFormatImpl; -class _IMPEXP_LOCALE BFormat { +class BFormat { protected: BFormat(const BFormat &other); ~BFormat(); Modified: haiku/trunk/headers/os/locale/FormatImpl.h =================================================================== --- haiku/trunk/headers/os/locale/FormatImpl.h 2009-05-01 21:26:56 UTC (rev 30544) +++ haiku/trunk/headers/os/locale/FormatImpl.h 2009-05-01 21:56:16 UTC (rev 30545) @@ -3,11 +3,9 @@ #include -#include - class BFormatParameters; -class _IMPEXP_LOCALE BFormatImpl { +class BFormatImpl { public: BFormatImpl(); virtual ~BFormatImpl(); Modified: haiku/trunk/headers/os/locale/FormatParameters.h =================================================================== --- haiku/trunk/headers/os/locale/FormatParameters.h 2009-05-01 21:26:56 UTC (rev 30544) +++ haiku/trunk/headers/os/locale/FormatParameters.h 2009-05-01 21:56:16 UTC (rev 30545) @@ -3,14 +3,12 @@ #include -#include - enum format_alignment { B_ALIGN_FORMAT_LEFT, // reuse B_ALIGN_LEFT/B_ALIGN_RIGHT? B_ALIGN_FORMAT_RIGHT, }; -class _IMPEXP_LOCALE BFormatParameters { +class BFormatParameters { public: BFormatParameters(const BFormatParameters *parent = NULL); BFormatParameters(const BFormatParameters &other); Modified: haiku/trunk/headers/os/locale/GenericNumberFormat.h =================================================================== --- haiku/trunk/headers/os/locale/GenericNumberFormat.h 2009-05-01 21:26:56 UTC (rev 30544) +++ haiku/trunk/headers/os/locale/GenericNumberFormat.h 2009-05-01 21:56:16 UTC (rev 30545) @@ -7,7 +7,7 @@ class BString; struct format_field_position; -class _IMPEXP_LOCALE BGenericNumberFormat { +class BGenericNumberFormat { public: BGenericNumberFormat(); ~BGenericNumberFormat(); Modified: haiku/trunk/headers/os/locale/IntegerFormat.h =================================================================== --- haiku/trunk/headers/os/locale/IntegerFormat.h 2009-05-01 21:26:56 UTC (rev 30544) +++ haiku/trunk/headers/os/locale/IntegerFormat.h 2009-05-01 21:56:16 UTC (rev 30545) @@ -12,7 +12,7 @@ // and this class (and its base classes) should mirror the parameters // classes' accessor methods. // -class _IMPEXP_LOCALE BIntegerFormat : public BNumberFormat, public BIntegerFormatParameters { +class BIntegerFormat : public BNumberFormat, public BIntegerFormatParameters { public: BIntegerFormat(const BIntegerFormat &other); ~BIntegerFormat(); Modified: haiku/trunk/headers/os/locale/IntegerFormatImpl.h =================================================================== --- haiku/trunk/headers/os/locale/IntegerFormatImpl.h 2009-05-01 21:26:56 UTC (rev 30544) +++ haiku/trunk/headers/os/locale/IntegerFormatImpl.h 2009-05-01 21:56:16 UTC (rev 30545) @@ -7,7 +7,7 @@ class BIntegerFormatParameters; class BString; -class _IMPEXP_LOCALE BIntegerFormatImpl : public BNumberFormatImpl { +class BIntegerFormatImpl : public BNumberFormatImpl { public: BIntegerFormatImpl(); virtual ~BIntegerFormatImpl(); Modified: haiku/trunk/headers/os/locale/IntegerFormatParameters.h =================================================================== --- haiku/trunk/headers/os/locale/IntegerFormatParameters.h 2009-05-01 21:26:56 UTC (rev 30544) +++ haiku/trunk/headers/os/locale/IntegerFormatParameters.h 2009-05-01 21:56:16 UTC (rev 30545) @@ -3,7 +3,7 @@ #include -class _IMPEXP_LOCALE BIntegerFormatParameters : public BNumberFormatParameters { +class BIntegerFormatParameters : public BNumberFormatParameters { public: BIntegerFormatParameters(const BIntegerFormatParameters *parent = NULL); BIntegerFormatParameters(const BIntegerFormatParameters &other); Modified: haiku/trunk/headers/os/locale/Language.h =================================================================== --- haiku/trunk/headers/os/locale/Language.h 2009-05-01 21:26:56 UTC (rev 30544) +++ haiku/trunk/headers/os/locale/Language.h 2009-05-01 21:56:16 UTC (rev 30545) @@ -3,7 +3,6 @@ #include -#include #include @@ -14,7 +13,7 @@ }; -class _IMPEXP_LOCALE BLanguage { +class BLanguage { public: ~BLanguage(); Modified: haiku/trunk/headers/os/locale/Locale.h =================================================================== --- haiku/trunk/headers/os/locale/Locale.h 2009-05-01 21:26:56 UTC (rev 30544) +++ haiku/trunk/headers/os/locale/Locale.h 2009-05-01 21:56:16 UTC (rev 30545) @@ -2,8 +2,6 @@ #define _B_LOCALE_H_ -#include - #include #include #include @@ -13,7 +11,7 @@ class BString; -class _IMPEXP_LOCALE BLocale { +class BLocale { public: BLocale(); ~BLocale(); @@ -43,7 +41,7 @@ int StringCompare(const BString *, const BString *, int32 len = -1, int8 strength = B_COLLATE_DEFAULT) const; void GetSortKey(const char *string, BString *key); - + status_t GetAppCatalog(BCatalog *); protected: @@ -53,34 +51,34 @@ }; // global objects -extern _IMPEXP_LOCALE BLocale *be_locale; -extern _IMPEXP_LOCALE BLocaleRoster *be_locale_roster; +extern BLocale *be_locale; +extern BLocaleRoster *be_locale_roster; //---------------------------------------------------------------------- //--- country short-hands inlines --- -inline void +inline void BLocale::FormatDate(char *target, size_t maxSize, time_t timer, bool longFormat) { fCountry->FormatDate(target, maxSize, timer, longFormat); } -inline void +inline void BLocale::FormatDate(BString *target, time_t timer, bool longFormat) { fCountry->FormatDate(target, timer, longFormat); } -inline void +inline void BLocale::FormatTime(char *target, size_t maxSize, time_t timer, bool longFormat) { fCountry->FormatTime(target, maxSize, timer, longFormat); } -inline void +inline void BLocale::FormatTime(BString *target, time_t timer, bool longFormat) { fCountry->FormatTime(target, timer, longFormat); @@ -90,14 +88,14 @@ //--- locale short-hands inlines --- // #pragma mark - -inline int +inline int BLocale::StringCompare(const char *string1, const char *string2, int32 length, int8 strength) const { return fCollator->Compare(string1, string2, length, strength); } -inline int +inline int BLocale::StringCompare(const BString *string1, const BString *string2, int32 length, int8 strength) const { return fCollator->Compare(string1->String(), string2->String(), length, strength); Deleted: haiku/trunk/headers/os/locale/LocaleBuild.h Modified: haiku/trunk/headers/os/locale/LocaleRoster.h =================================================================== --- haiku/trunk/headers/os/locale/LocaleRoster.h 2009-05-01 21:26:56 UTC (rev 30544) +++ haiku/trunk/headers/os/locale/LocaleRoster.h 2009-05-01 21:56:16 UTC (rev 30545) @@ -1,8 +1,6 @@ #ifndef _LOCALE_ROSTER_H_ #define _LOCALE_ROSTER_H_ -#include - #include class BLanguage; @@ -20,7 +18,7 @@ B_LOCALE_CHANGED = '_LCC', }; -class _IMPEXP_LOCALE BLocaleRoster { +class BLocaleRoster { public: BLocaleRoster(); @@ -35,14 +33,14 @@ status_t GetDefaultCollator(BCollator **) const; status_t GetDefaultLanguage(BLanguage **) const; status_t GetDefaultCountry(BCountry **) const; - + status_t GetPreferredLanguages(BMessage *) const; status_t SetPreferredLanguages(BMessage *); - // the message contains one or more 'language'-string-fields + // the message contains one or more 'language'-string-fields // which contain the language-name(s) status_t GetInstalledLanguages(BMessage *) const; - // the message contains one or more 'language'-string-fields + // the message contains one or more 'language'-string-fields // which contain the language-name(s) status_t GetInstalledCatalogs(BMessage *, @@ -66,14 +64,14 @@ private: - BCatalogAddOn* LoadCatalog(const char *signature, + BCatalogAddOn* LoadCatalog(const char *signature, const char *language = NULL, int32 fingerprint = 0); BCatalogAddOn* LoadEmbeddedCatalog(entry_ref *appOrAddOnRef); status_t UnloadCatalog(BCatalogAddOn *addOn); // BCatalogAddOn* CreateCatalog(const char *type, - const char *signature, + const char *signature, const char *language); friend class BCatalog; Modified: haiku/trunk/headers/os/locale/NumberFormat.h =================================================================== --- haiku/trunk/headers/os/locale/NumberFormat.h 2009-05-01 21:26:56 UTC (rev 30544) +++ haiku/trunk/headers/os/locale/NumberFormat.h 2009-05-01 21:56:16 UTC (rev 30545) @@ -6,7 +6,7 @@ class BNumberFormatImpl; -class _IMPEXP_LOCALE BNumberFormat : public BFormat { +class BNumberFormat : public BFormat { protected: BNumberFormat(const BNumberFormat &other); ~BNumberFormat(); Modified: haiku/trunk/headers/os/locale/NumberFormatImpl.h =================================================================== --- haiku/trunk/headers/os/locale/NumberFormatImpl.h 2009-05-01 21:26:56 UTC (rev 30544) +++ haiku/trunk/headers/os/locale/NumberFormatImpl.h 2009-05-01 21:56:16 UTC (rev 30545) @@ -6,7 +6,7 @@ struct format_field_position; class BNumberFormatParameters; -class _IMPEXP_LOCALE BNumberFormatImpl : public BFormatImpl { +class BNumberFormatImpl : public BFormatImpl { public: BNumberFormatImpl(); virtual ~BNumberFormatImpl(); Modified: haiku/trunk/headers/os/locale/NumberFormatParameters.h =================================================================== --- haiku/trunk/headers/os/locale/NumberFormatParameters.h 2009-05-01 21:26:56 UTC (rev 30544) +++ haiku/trunk/headers/os/locale/NumberFormatParameters.h 2009-05-01 21:56:16 UTC (rev 30545) @@ -20,7 +20,7 @@ B_HEXADECIMAL_BASE = 16, }; -class _IMPEXP_LOCALE BNumberFormatParameters : public BFormatParameters { +class BNumberFormatParameters : public BFormatParameters { public: BNumberFormatParameters(const BNumberFormatParameters *parent = NULL); BNumberFormatParameters(const BNumberFormatParameters &other); Modified: haiku/trunk/headers/os/locale/UnicodeChar.h =================================================================== --- haiku/trunk/headers/os/locale/UnicodeChar.h 2009-05-01 21:26:56 UTC (rev 30544) +++ haiku/trunk/headers/os/locale/UnicodeChar.h 2009-05-01 21:56:16 UTC (rev 30545) @@ -3,8 +3,6 @@ #include -#include - enum unicode_char_category { // Non-category for unassigned and non-character code points. @@ -49,9 +47,9 @@ * This specifies the language directional property of a character set. */ -enum unicode_char_direction { - B_UNICODE_LEFT_TO_RIGHT = 0, - B_UNICODE_RIGHT_TO_LEFT = 1, +enum unicode_char_direction { + B_UNICODE_LEFT_TO_RIGHT = 0, + B_UNICODE_RIGHT_TO_LEFT = 1, B_UNICODE_EUROPEAN_NUMBER = 2, B_UNICODE_EUROPEAN_NUMBER_SEPARATOR = 3, B_UNICODE_EUROPEAN_NUMBER_TERMINATOR = 4, @@ -59,8 +57,8 @@ B_UNICODE_COMMON_NUMBER_SEPARATOR = 6, B_UNICODE_BLOCK_SEPARATOR = 7, B_UNICODE_SEGMENT_SEPARATOR = 8, - B_UNICODE_WHITE_SPACE_NEUTRAL = 9, - B_UNICODE_OTHER_NEUTRAL = 10, + B_UNICODE_WHITE_SPACE_NEUTRAL = 9, + B_UNICODE_OTHER_NEUTRAL = 10, B_UNICODE_LEFT_TO_RIGHT_EMBEDDING = 11, B_UNICODE_LEFT_TO_RIGHT_OVERRIDE = 12, B_UNICODE_RIGHT_TO_LEFT_ARABIC = 13, @@ -69,7 +67,7 @@ B_UNICODE_POP_DIRECTIONAL_FORMAT = 16, B_UNICODE_DIR_NON_SPACING_MARK = 17, B_UNICODE_BOUNDARY_NEUTRAL = 18, - + B_UNICODE_DIRECTION_COUNT }; @@ -188,7 +186,7 @@ }; [... truncated: 570 lines follow ...] From mmu_man at mail.berlios.de Sat May 2 02:54:14 2009 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sat, 2 May 2009 02:54:14 +0200 Subject: [Haiku-commits] r30546 - haiku/trunk/src/add-ons/kernel/file_systems/nfs Message-ID: <200905020054.n420sE8E017780@sheep.berlios.de> Author: mmu_man Date: 2009-05-02 02:54:10 +0200 (Sat, 02 May 2009) New Revision: 30546 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30546&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/nfs/nfs_add_on.c Log: Fix missing NULLs corresponding to io() and cancel_io() hooks which made all other calls shifted... This should fix #3500 and #3832. Modified: haiku/trunk/src/add-ons/kernel/file_systems/nfs/nfs_add_on.c =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/nfs/nfs_add_on.c 2009-05-01 21:56:16 UTC (rev 30545) +++ haiku/trunk/src/add-ons/kernel/file_systems/nfs/nfs_add_on.c 2009-05-02 00:54:10 UTC (rev 30546) @@ -2439,6 +2439,7 @@ } } + fs_volume_ops sNFSVolumeOps = { &fs_unmount, &fs_rfsstat, @@ -2465,6 +2466,7 @@ NULL, // &fs_rewind_query, }; + fs_vnode_ops sNFSVnodeOps = { /* vnode operations */ &fs_walk, @@ -2477,6 +2479,9 @@ NULL, // &fs_read_pages NULL, // &fs_write_pages + NULL, // io() + NULL, // cancel_io() + NULL, // &fs_get_file_map, NULL, // &fs_ioctl @@ -2557,4 +2562,3 @@ (module_info *)&sNFSFileSystem, NULL, }; - From anevilyak at mail.berlios.de Sat May 2 03:09:27 2009 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Sat, 2 May 2009 03:09:27 +0200 Subject: [Haiku-commits] r30547 - haiku/trunk/headers/os/locale Message-ID: <200905020109.n4219R97022348@sheep.berlios.de> Author: anevilyak Date: 2009-05-02 03:09:26 +0200 (Sat, 02 May 2009) New Revision: 30547 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30547&view=rev Modified: haiku/trunk/headers/os/locale/Locale.h Log: gcc4 build fix. Modified: haiku/trunk/headers/os/locale/Locale.h =================================================================== --- haiku/trunk/headers/os/locale/Locale.h 2009-05-02 00:54:10 UTC (rev 30546) +++ haiku/trunk/headers/os/locale/Locale.h 2009-05-02 01:09:26 UTC (rev 30547) @@ -6,8 +6,8 @@ #include #include - class BCatalog; +class BLocaleRoster; class BString; From anevilyak at gmail.com Sat May 2 03:34:34 2009 From: anevilyak at gmail.com (Rene Gollent) Date: Fri, 1 May 2009 20:34:34 -0500 Subject: [Haiku-commits] r30545 - in haiku/trunk: . build/jam headers/os/locale headers/posix src/add-ons src/add-ons/locale src/add-ons/locale/catalogs src/add-ons/locale/catalogs/zeta src/add-ons/locale/collators src/bin src/bin/locale src/data/etc/loca Message-ID: On Fri, May 1, 2009 at 4:56 PM, zooey at BerliOS wrote: > Author: zooey > Date: 2009-05-01 23:56:16 +0200 (Fri, 01 May 2009) > New Revision: 30545 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30545&view=rev > > Log: > Applied patch by PulkoMandy, adjusted and extended by myself: > * integrating most of the locale kit into the build (and image) > * removed LocaleBuild.h and _IMPEXP_LOCALE since that does not make > ?sense for elf (which usually exports all symbols anyway) > * added a couple of locale kit related pseudo targets for convenience > Hey, some of that stuff already seems to work :-) FYI, this fails to build on gcc4 at the moment...I made a diff of some partial fixes, but the ones that remain I'm uncertain as to the best way to work around...currently I fail with: C++ /usr/home/rene/devel/haiku/generated-gcc4/objects/haiku/x86/release/kits/locale/GenericNumberFormat.o /usr/home/rene/devel/haiku/src/kits/locale/GenericNumberFormat.cpp: In member function 'status_t BGenericNumberFormat::GroupingInfo::SetTo(const char**, int32, const size_t*, int32)': /usr/home/rene/devel/haiku/src/kits/locale/GenericNumberFormat.cpp:101: warning: suggest parentheses around && within || /usr/home/rene/devel/haiku/src/kits/locale/GenericNumberFormat.cpp: In member function 'const BGenericNumberFormat::Symbol* BGenericNumberFormat::GroupingInfo::SeparatorForDigit(int32) const': /usr/home/rene/devel/haiku/src/kits/locale/GenericNumberFormat.cpp:161: warning: suggest parentheses around && within || /usr/home/rene/devel/haiku/headers/os/locale/GenericNumberFormat.h: At global scope: /usr/home/rene/devel/haiku/headers/os/locale/GenericNumberFormat.h:107: error: 'struct BGenericNumberFormat::Symbol' is private /usr/home/rene/devel/haiku/src/kits/locale/GenericNumberFormat.cpp:410: error: within this context /usr/home/rene/devel/haiku/headers/os/locale/GenericNumberFormat.h:107: error: 'struct BGenericNumberFormat::Symbol' is private /usr/home/rene/devel/haiku/src/kits/locale/GenericNumberFormat.cpp:415: error: within this context /usr/home/rene/devel/haiku/src/kits/locale/GenericNumberFormat.cpp:66: error: 'class BGenericNumberFormat::GroupingInfo' is private /usr/home/rene/devel/haiku/src/kits/locale/GenericNumberFormat.cpp:433: error: within this context /usr/home/rene/devel/haiku/src/kits/locale/GenericNumberFormat.cpp:66: error: 'class BGenericNumberFormat::GroupingInfo' is private /usr/home/rene/devel/haiku/src/kits/locale/GenericNumberFormat.cpp:437: error: within this context /usr/home/rene/devel/haiku/headers/os/locale/GenericNumberFormat.h:107: error: 'struct BGenericNumberFormat::Symbol' is private /usr/home/rene/devel/haiku/src/kits/locale/GenericNumberFormat.cpp:442: error: within this context /usr/home/rene/devel/haiku/headers/os/locale/GenericNumberFormat.h:107: error: 'struct BGenericNumberFormat::Symbol' is private /usr/home/rene/devel/haiku/src/kits/locale/GenericNumberFormat.cpp:443: error: within this context /usr/home/rene/devel/haiku/headers/os/locale/GenericNumberFormat.h:107: error: 'struct BGenericNumberFormat::Symbol' is private /usr/home/rene/devel/haiku/src/kits/locale/GenericNumberFormat.cpp:447: error: within this context /usr/home/rene/devel/haiku/headers/os/locale/GenericNumberFormat.h:107: error: 'struct BGenericNumberFormat::Symbol' is private /usr/home/rene/devel/haiku/src/kits/locale/GenericNumberFormat.cpp:448: error: within this context /usr/home/rene/devel/haiku/headers/os/locale/GenericNumberFormat.h:107: error: 'struct BGenericNumberFormat::Symbol' is private /usr/home/rene/devel/haiku/src/kits/locale/GenericNumberFormat.cpp:451: error: within this context /usr/home/rene/devel/haiku/headers/os/locale/GenericNumberFormat.h:107: error: 'struct BGenericNumberFormat::Symbol' is private /usr/home/rene/devel/haiku/src/kits/locale/GenericNumberFormat.cpp:453: error: within this context /usr/home/rene/devel/haiku/headers/os/locale/GenericNumberFormat.h:107: error: 'struct BGenericNumberFormat::Symbol' is private /usr/home/rene/devel/haiku/src/kits/locale/GenericNumberFormat.cpp:457: error: within this context /usr/home/rene/devel/haiku/headers/os/locale/GenericNumberFormat.h:107: error: 'struct BGenericNumberFormat::Symbol' is private /usr/home/rene/devel/haiku/src/kits/locale/GenericNumberFormat.cpp:460: error: within this context /usr/home/rene/devel/haiku/src/kits/locale/GenericNumberFormat.cpp:181: error: 'class BGenericNumberFormat::SignSymbols' is private /usr/home/rene/devel/haiku/src/kits/locale/GenericNumberFormat.cpp:463: error: within this context /usr/home/rene/devel/haiku/src/kits/locale/GenericNumberFormat.cpp:181: error: 'class BGenericNumberFormat::SignSymbols' is private /usr/home/rene/devel/haiku/src/kits/locale/GenericNumberFormat.cpp:469: error: within this context /usr/home/rene/devel/haiku/src/kits/locale/GenericNumberFormat.cpp:181: error: 'class BGenericNumberFormat::SignSymbols' is private /usr/home/rene/devel/haiku/src/kits/locale/GenericNumberFormat.cpp:475: error: within this context /usr/home/rene/devel/haiku/src/kits/locale/GenericNumberFormat.cpp: In member function 'void BGenericNumberFormat::Float::FormatScientific(BGenericNumberFormat::BufferWriter&, const BGenericNumberFormat::Symbol*, const BGenericNumberFormat::Symbol*, const BGenericNumberFormat::Symbol*, const BGenericNumberFormat::SignSymbols*, const BGenericNumberFormat::SignSymbols*, const BGenericNumberFormat::SignSymbols*, number_format_sign_policy, int32, int32, int32, bool, bool) const': /usr/home/rene/devel/haiku/src/kits/locale/GenericNumberFormat.cpp:784: error: 'min' was not declared in this scope /usr/home/rene/devel/haiku/src/kits/locale/GenericNumberFormat.cpp:789: warning: array subscript has type 'char' /usr/home/rene/devel/haiku/src/kits/locale/GenericNumberFormat.cpp:804: warning: array subscript has type 'char' /usr/home/rene/devel/haiku/src/kits/locale/GenericNumberFormat.cpp: In member function 'void BGenericNumberFormat::Float::FormatFixedPoint(BGenericNumberFormat::BufferWriter&, const BGenericNumberFormat::Symbol*, const BGenericNumberFormat::Symbol*, const BGenericNumberFormat::SignSymbols*, const BGenericNumberFormat::SignSymbols*, number_format_sign_policy, const BGenericNumberFormat::GroupingInfo*, int32, int32, int32, bool, bool) const': /usr/home/rene/devel/haiku/src/kits/locale/GenericNumberFormat.cpp:867: error: 'min' was not declared in this scope /usr/home/rene/devel/haiku/src/kits/locale/GenericNumberFormat.cpp:892: warning: array subscript has type 'char' /usr/home/rene/devel/haiku/src/kits/locale/GenericNumberFormat.cpp:903: warning: array subscript has type 'char' /usr/home/rene/devel/haiku/src/kits/locale/GenericNumberFormat.cpp:911: warning: array subscript has type 'char' HTH, Rene -------------- next part -------------- A non-text attachment was scrubbed... Name: locale_diff Type: application/octet-stream Size: 7721 bytes Desc: not available URL: From revol at free.fr Sat May 2 04:31:43 2009 From: revol at free.fr (=?utf-8?q?Fran=C3=A7ois?= Revol) Date: Sat, 02 May 2009 04:31:43 +0200 CEST Subject: [Haiku-commits] =?utf-8?q?r30545_-_in_haiku/trunk=3A_=2E_build/ja?= =?utf-8?q?m_headers/os/locale_headers/posix_src/add-ons_src/add-ons/local?= =?utf-8?q?e_src/add-ons/locale/catalogs_src/add-ons/locale/catalogs/zeta_?= =?utf-8?q?src/add-ons/locale/collators_src/bin_src/bin/locale_src/data/et?= =?utf-8?q?c/loca?= In-Reply-To: Message-ID: <1468228533-BeMail@laptop> > On Fri, May 1, 2009 at 4:56 PM, zooey at BerliOS < > zooey at mail.berlios.de> wrote: > > Author: zooey > > Date: 2009-05-01 23:56:16 +0200 (Fri, 01 May 2009) > > New Revision: 30545 > > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30545&view=rev > > > > Log: > > Applied patch by PulkoMandy, adjusted and extended by myself: > > * integrating most of the locale kit into the build (and image) > > * removed LocaleBuild.h and _IMPEXP_LOCALE since that does not make > > ?sense for elf (which usually exports all symbols anyway) > > * added a couple of locale kit related pseudo targets for > > convenience > > Hey, some of that stuff already seems to work :-) > > FYI, this fails to build on gcc4 at the moment...I made a diff of > some > partial fixes, but the ones that remain I'm uncertain as to the best > way to work around...currently I fail with: For such large addition it'd be nice to others not to add to the image before you're sure it builds with both gcc... it's painful having to revert stuff locally due to this. Fran?ois. From dlmcpaul at mail.berlios.de Sat May 2 06:29:38 2009 From: dlmcpaul at mail.berlios.de (dlmcpaul at BerliOS) Date: Sat, 2 May 2009 06:29:38 +0200 Subject: [Haiku-commits] r30548 - haiku/trunk/src/add-ons/media/plugins/asf_reader Message-ID: <200905020429.n424Tc8q014149@sheep.berlios.de> Author: dlmcpaul Date: 2009-05-02 06:29:36 +0200 (Sat, 02 May 2009) New Revision: 30548 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30548&view=rev Modified: haiku/trunk/src/add-ons/media/plugins/asf_reader/ASFFileReader.cpp haiku/trunk/src/add-ons/media/plugins/asf_reader/ASFIndex.cpp haiku/trunk/src/add-ons/media/plugins/asf_reader/asf_reader.cpp Log: Now plays 2 out of 3 files and that is good yes Modified: haiku/trunk/src/add-ons/media/plugins/asf_reader/ASFFileReader.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/asf_reader/ASFFileReader.cpp 2009-05-02 01:09:26 UTC (rev 30547) +++ haiku/trunk/src/add-ons/media/plugins/asf_reader/ASFFileReader.cpp 2009-05-02 04:29:36 UTC (rev 30548) @@ -156,10 +156,6 @@ format->BitsPerSample = audioHeader->wBitsPerSample; format->extraDataSize = audioHeader->cbSize; format->extraData = audioHeader->data; - - if (stream->flags & ASF_STREAM_FLAG_EXTENDED) { - printf("num payloads for audio %d\n",stream->extended->num_payload_ext); - } return true; } @@ -189,8 +185,8 @@ if (stream->flags & ASF_STREAM_FLAG_EXTENDED) { format->FrameScale = stream->extended->avg_time_per_frame; - format->FrameRate = 10000000; - printf("num payloads for video %d\n",stream->extended->num_payload_ext); + format->FrameRate = 10000000L; + printf("num avg time per frame for video %Ld\n",stream->extended->avg_time_per_frame); } return true; @@ -221,7 +217,7 @@ } } - return asf_get_duration(asfFile) / 10; + return asf_get_duration(asfFile) / 10L; } uint32 @@ -303,16 +299,16 @@ while (asf_get_packet(asfFile, packet) > 0) { for (int i=0;ipayload_count;i++) { payload = (asf_payload_t *)(&packet->payloads[i]); -// printf("Payload %d Stream %d Keyframe %d send time %ld pts %ld id %d size %d\n",i+1,payload->stream_number,payload->key_frame, packet->send_time * 1000L, payload->pts * 1000L, payload->media_object_number, payload->datalen); + // printf("Payload %d Stream %d Keyframe %d send time %Ld pts %Ld id %d size %d\n",i+1,payload->stream_number,payload->key_frame, 1000L * bigtime_t(packet->send_time), 1000L * bigtime_t(payload->pts), payload->media_object_number, payload->datalen); if (payload->stream_number < streams.size()) { - streams[payload->stream_number].AddPayload(payload->media_object_number, payload->key_frame, packet->send_time * 1000, payload->datalen, false); + streams[payload->stream_number].AddPayload(payload->media_object_number, payload->key_frame, 1000L * payload->pts, payload->datalen, false); } } } for (uint32 i=0;isend_time + packet->duration) * 1000); + streams[i].setDuration(1000L * (packet->send_time + packet->duration)); } if (asf_seek_to_msec(asfFile,0) < 0) { @@ -326,7 +322,9 @@ { // Ok, Need to join payloads together that have the same payload->media_object_number asf_payload_t *payload; - + int64_t seekResult; + int packetSize; + IndexEntry indexEntry = GetIndex(streamIndex, pFrameNo); if (indexEntry.noPayloads == 0) { @@ -334,16 +332,42 @@ return false; } - while (packet->send_time * 1000 < indexEntry.pts) { - if (asf_get_packet(asfFile, packet) < 0) { - return false; - } - } +// printf("Stream %ld need pts %Ld, packet start %Ld packet end %Ld\n",streamIndex,indexEntry.pts,1000LL * packet->send_time,1000LL * (packet->send_time + packet->duration)); - if (packet->send_time * 1000 > indexEntry.pts) { - // seek back to pts - printf("seeking back to %Ld status %Ld\n",indexEntry.pts, asf_seek_to_msec(asfFile, indexEntry.pts/1000)); - if (asf_get_packet(asfFile, packet) < 0) { + if (1000LL * packet->send_time > indexEntry.pts || 1000LL * (packet->send_time + packet->duration) < indexEntry.pts) { + seekResult = asf_seek_to_msec(asfFile, indexEntry.pts/1000); + if (seekResult >= 0) { +// printf("Stream %ld seeked to %Ld got %Ld\n",streamIndex,indexEntry.pts, 1000L * seekResult); + packetSize = asf_get_packet(asfFile, packet); + if (packetSize <= 0) { + printf("Failed to Get Packet after seek result (%d)\n",packetSize); + return false; + } + } else if (seekResult == ASF_ERROR_SEEKABLE) { + // Stream not seekeable. Is what we want forward in the stream, if so seek using Get Packet + if (1000LL * (packet->send_time + packet->duration) < indexEntry.pts) { + while (1000LL * (packet->send_time + packet->duration) < indexEntry.pts) { + packetSize = asf_get_packet(asfFile, packet); + if (packetSize <= 0) { + printf("Failed to Seek using Get Packet result (%d)\n",packetSize); + return false; + } +// printf("Stream %ld searching forward for pts %Ld, got packet start %Ld packet end %Ld\n",streamIndex,indexEntry.pts,1000LL * packet->send_time,1000LL * (packet->send_time + packet->duration)); + } + } else { + // seek to 0 and read forward, going to be a killer on performance + seekResult = asf_seek_to_msec(asfFile, 0); + while (1000LL * (packet->send_time + packet->duration) < indexEntry.pts) { + packetSize = asf_get_packet(asfFile, packet); + if (packetSize <= 0) { + printf("Failed to Seek using Get Packet result (%d)\n",packetSize); + return false; + } +// printf("Stream %ld searching forward from 0 for pts %Ld, got packet start %Ld packet end %Ld\n",streamIndex,indexEntry.pts,1000LL * packet->send_time,1000LL * (packet->send_time + packet->duration)); + } + } + } else { + printf("Seek failed\n"); return false; } } @@ -373,7 +397,8 @@ } // combine packets into a single buffer - while ((asf_get_packet(asfFile, packet) > 0) && (expectedPayloads > 0)) { + packetSize = asf_get_packet(asfFile, packet); + while ((packetSize > 0) && (expectedPayloads > 0)) { for (int i=0;ipayload_count;i++) { payload = (asf_payload_t *)(&packet->payloads[i]); // find the first payload matching the id we want and then @@ -388,8 +413,15 @@ } } } + packetSize = asf_get_packet(asfFile, packet); } + if (packetSize == ASF_ERROR_EOF) { + printf("Unexpected EOF file truncated?\n"); + } else { + printf("EOF? %ld,%d\n",expectedPayloads, packetSize); + } + return false; } Modified: haiku/trunk/src/add-ons/media/plugins/asf_reader/ASFIndex.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/asf_reader/ASFIndex.cpp 2009-05-02 01:09:26 UTC (rev 30547) +++ haiku/trunk/src/add-ons/media/plugins/asf_reader/ASFIndex.cpp 2009-05-02 04:29:36 UTC (rev 30548) @@ -134,13 +134,17 @@ { if (isLast) { maxPTS = indexEntry.pts; - index.push_back(indexEntry); - printf("Stream Index Loaded for Stream %d Max Index %ld Max PTS %Ld\n",streamIndex, frameCount, maxPTS); + if (frameCount > 0) { + index.push_back(indexEntry); +// printf("Stream %d added Index %ld PTS %Ld payloads %d\n",streamIndex, indexEntry.frameNo, indexEntry.pts, indexEntry.noPayloads); + printf("Stream Index Loaded for Stream %d Max Frame %ld Max PTS %Ld size %ld\n",streamIndex, frameCount-1, maxPTS, index.size()); + } } else { - if (id > lastID) { - if (lastID != 0) { + if (id != lastID) { + if (frameCount != 0) { // add indexEntry to Index index.push_back(indexEntry); +// printf("Stream %d added Index %ld PTS %Ld payloads %d\n",streamIndex, indexEntry.frameNo, indexEntry.pts, indexEntry.noPayloads); } lastID = id; indexEntry.Clear(); Modified: haiku/trunk/src/add-ons/media/plugins/asf_reader/asf_reader.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/asf_reader/asf_reader.cpp 2009-05-02 01:09:26 UTC (rev 30547) +++ haiku/trunk/src/add-ons/media/plugins/asf_reader/asf_reader.cpp 2009-05-02 04:29:36 UTC (rev 30548) @@ -190,22 +190,18 @@ TRACE("frame_count %Ld\n", cookie->frame_count); TRACE("duration %.6f (%Ld)\n", cookie->duration / 1E6, cookie->duration); + TRACE("calculated fps=%ld\n", cookie->frame_count * 1000000LL / cookie->duration); // asf does not have a frame rate! The extended descriptor defines an average time per frame which is generally useless. - - cookie->frames_per_sec_rate = cookie->frame_count; - cookie->frames_per_sec_scale = cookie->duration / 1000000LL; - TRACE("frames_per_sec_rate %ld, frames_per_sec_scale %ld (using both)\n", cookie->frames_per_sec_rate, cookie->frames_per_sec_scale); - -// if (videoFormat.FrameScale && videoFormat.FrameRate) { -// cookie->frames_per_sec_rate = videoFormat.FrameRate; -// cookie->frames_per_sec_scale = videoFormat.FrameScale; -// TRACE("frames_per_sec_rate %ld, frames_per_sec_scale %ld (using both)\n", cookie->frames_per_sec_rate, cookie->frames_per_sec_scale); -// } else { -// cookie->frames_per_sec_rate = 25; -// cookie->frames_per_sec_scale = 1; -// TRACE("frames_per_sec_rate %ld, frames_per_sec_scale %ld (using fallback)\n", cookie->frames_per_sec_rate, cookie->frames_per_sec_scale); -// } + if (videoFormat.FrameScale && videoFormat.FrameRate) { + cookie->frames_per_sec_rate = videoFormat.FrameRate; + cookie->frames_per_sec_scale = videoFormat.FrameScale; + TRACE("frames_per_sec_rate %ld, frames_per_sec_scale %ld (using average time per frame)\n", cookie->frames_per_sec_rate, cookie->frames_per_sec_scale); + } else { + cookie->frames_per_sec_rate = cookie->frame_count; + cookie->frames_per_sec_scale = cookie->duration / 1000000LL; + TRACE("frames_per_sec_rate %ld, frames_per_sec_scale %ld (duration over frame count)\n", cookie->frames_per_sec_rate, cookie->frames_per_sec_scale); + } description.family = B_AVI_FORMAT_FAMILY; description.u.avi.codec = videoFormat.Compression; From dlmcpaul at mail.berlios.de Sat May 2 06:32:09 2009 From: dlmcpaul at mail.berlios.de (dlmcpaul at BerliOS) Date: Sat, 2 May 2009 06:32:09 +0200 Subject: [Haiku-commits] r30549 - haiku/trunk/src/add-ons/media/plugins/avcodec Message-ID: <200905020432.n424W9qA015409@sheep.berlios.de> Author: dlmcpaul Date: 2009-05-02 06:32:01 +0200 (Sat, 02 May 2009) New Revision: 30549 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30549&view=rev Modified: haiku/trunk/src/add-ons/media/plugins/avcodec/avcodec.cpp Log: return LAST_BUFFER_ERROR when last buffer reached Modified: haiku/trunk/src/add-ons/media/plugins/avcodec/avcodec.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/avcodec/avcodec.cpp 2009-05-02 04:29:36 UTC (rev 30548) +++ haiku/trunk/src/add-ons/media/plugins/avcodec/avcodec.cpp 2009-05-02 04:32:01 UTC (rev 30549) @@ -467,8 +467,13 @@ media_header chunk_mh; status_t err; err = GetNextChunk(&fChunkBuffer, &fChunkBufferSize, &chunk_mh); + if (err == B_LAST_BUFFER_ERROR) { + TRACE("Last Chunk with chunk size %ld\n",fChunkBufferSize); + fChunkBufferSize = 0; + return err; + } if (err != B_OK || fChunkBufferSize < 0) { - TRACE("GetNextChunk error %ld\n",fChunkBufferSize); + printf("GetNextChunk error %ld\n",fChunkBufferSize); fChunkBufferSize = 0; break; } From dlmcpaul at mail.berlios.de Sat May 2 06:38:52 2009 From: dlmcpaul at mail.berlios.de (dlmcpaul at BerliOS) Date: Sat, 2 May 2009 06:38:52 +0200 Subject: [Haiku-commits] r30550 - haiku/trunk/build/jam Message-ID: <200905020438.n424cqnC021460@sheep.berlios.de> Author: dlmcpaul Date: 2009-05-02 06:38:47 +0200 (Sat, 02 May 2009) New Revision: 30550 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30550&view=rev Modified: haiku/trunk/build/jam/HaikuImage Log: Add asf_reader to the image. Feedback welcome Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2009-05-02 04:32:01 UTC (rev 30549) +++ haiku/trunk/build/jam/HaikuImage 2009-05-02 04:38:47 UTC (rev 30550) @@ -120,7 +120,7 @@ #legacy.media_addon ; SYSTEM_ADD_ONS_MEDIA_PLUGINS = $(GPL_ONLY)ac3_decoder - aiff_reader au_reader $(X86_ONLY)avcodec avi_reader + aiff_reader asf_reader au_reader $(X86_ONLY)avcodec avi_reader matroska mov_reader mp3_decoder mp3_reader mp4_reader musepack From Info.Be-Hold at inter.nl.net Sat May 2 09:20:04 2009 From: Info.Be-Hold at inter.nl.net (Info.Be-Hold at inter.nl.net) Date: Sat, 2 May 2009 09:20:04 +0200 (CEST) Subject: [Haiku-commits] r30535 - in haiku/trunk/src/add-ons: accelerants/nvidia accelerants/nvidia/engine kernel/drivers/graphics/nvidia In-Reply-To: <9298278.1241207144909.JavaMail.ngmail@webmail16.arcor-online.net> References: <40302.85.223.98.72.1241200207.squirrel@webmail.inter.nl.net> <200905011505.n41F5h5s026208@sheep.berlios.de> <1544724.1241196498372.JavaMail.ngmail@webmail09.arcor-online.net> <9298278.1241207144909.JavaMail.ngmail@webmail16.arcor-online.net> Message-ID: <40360.85.223.98.72.1241248804.squirrel@webmail.inter.nl.net> Hi again, >> On a 'sidenote': >> It would be nice if we would have YV12 (and such) support in Haiku to >> increase speed more: On a FSB533Mhz/2,8Ghz/AGP+FW Pentium system I can't >> playback video 1080p without dropping most frames. 720p nolonger drops >> frames here now: at more or less 75% CPU load. > Yes, we should definitively add more formats that are provided by the > hardware. Are you sure that the naming is correct? We shouldn't copy the > mistake to call YCbCr YIV ansd similar. Correct naming is important indeed. I did not check, I just found yesterdaty that these days this format is known howto program for nVidia cards that have a working overlay engine (if I read that right). They point at: http://fourcc.org/yuv.php#YV12 > BTW, as already pointed out by Rene, I made a mistake in the example Noted, indeed. Thanks. Bye! Rudolf. From koki at haikuzone.net Sat May 2 09:28:43 2009 From: koki at haikuzone.net (Jorge G. Mare) Date: Sat, 02 May 2009 00:28:43 -0700 Subject: [Haiku-commits] r30550 - haiku/trunk/build/jam In-Reply-To: <200905020438.n424cqnC021460@sheep.berlios.de> References: <200905020438.n424cqnC021460@sheep.berlios.de> Message-ID: <49FBF62B.7030107@haikuzone.net> dlmcpaul at BerliOS wrote: > Author: dlmcpaul > Date: 2009-05-02 06:38:47 +0200 (Sat, 02 May 2009) > New Revision: 30550 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30550&view=rev > > Modified: > haiku/trunk/build/jam/HaikuImage > Log: > Add asf_reader to the image. Feedback welcome > Not thorough testing, but I did through a few wmv files that I had on my HDD, and they all played nicely in MediaPlayer. FWIW. Thanks so much for your work in this area! Cheers, Jorge From superstippi at gmx.de Sat May 2 09:46:21 2009 From: superstippi at gmx.de (Stephan Assmus) Date: Sat, 02 May 2009 09:46:21 +0200 Subject: [Haiku-commits] r30550 - haiku/trunk/build/jam In-Reply-To: <49FBF62B.7030107@haikuzone.net> References: <200905020438.n424cqnC021460@sheep.berlios.de> <49FBF62B.7030107@haikuzone.net> Message-ID: <20090502094621.596.1@bepc.1241249754.fake> On 2009-05-02 at 09:37:30 [+0200], Jorge G. Mare wrote: > dlmcpaul at BerliOS wrote: > > Author: dlmcpaul > > Date: 2009-05-02 06:38:47 +0200 (Sat, 02 May 2009) New Revision: 30550 > > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30550&view=rev > > > > Modified: > > haiku/trunk/build/jam/HaikuImage > > Log: > > Add asf_reader to the image. Feedback welcome > > > > Not thorough testing, but I did through a few wmv files that I had on my > HDD, and they all played nicely in MediaPlayer. FWIW. > > Thanks so much for your work in this area! Seconded! Pretty awesome! Best regards, -Stephan From dlmcpaul at gmail.com Sat May 2 09:57:45 2009 From: dlmcpaul at gmail.com (David McPaul) Date: Sat, 2 May 2009 17:57:45 +1000 Subject: [Haiku-commits] r30550 - haiku/trunk/build/jam In-Reply-To: <20090502094621.596.1@bepc.1241249754.fake> References: <200905020438.n424cqnC021460@sheep.berlios.de> <49FBF62B.7030107@haikuzone.net> <20090502094621.596.1@bepc.1241249754.fake> Message-ID: 2009/5/2 Stephan Assmus : > > On 2009-05-02 at 09:37:30 [+0200], Jorge G. Mare wrote: >> dlmcpaul at BerliOS wrote: >> > Author: dlmcpaul >> > Date: 2009-05-02 06:38:47 +0200 (Sat, 02 May 2009) New Revision: 30550 >> > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30550&view=rev >> > >> > Modified: >> > ? ?haiku/trunk/build/jam/HaikuImage >> > Log: >> > Add asf_reader to the image. ?Feedback welcome >> > >> >> Not thorough testing, but I did through a few wmv files that I had on my >> HDD, and they all played nicely in MediaPlayer. FWIW. >> >> Thanks so much for your work in this area! > > Seconded! Pretty awesome! Ah excellent, I still have a few test wmv that don't play properly so I there are still issues to be resolved. asf/wma/wmv is a really annoying format so I expect there is more to understand about it. -- Cheers David From zooey at mail.berlios.de Sat May 2 11:27:00 2009 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Sat, 2 May 2009 11:27:00 +0200 Subject: [Haiku-commits] r30551 - haiku/trunk/build/jam Message-ID: <200905020927.n429R01g006649@sheep.berlios.de> Author: zooey Date: 2009-05-02 11:27:00 +0200 (Sat, 02 May 2009) New Revision: 30551 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30551&view=rev Modified: haiku/trunk/build/jam/HaikuImage Log: * reverted the part of 30545 that added the locale kit to the image, since it does not build with gcc4 Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2009-05-02 04:38:47 UTC (rev 30550) +++ haiku/trunk/build/jam/HaikuImage 2009-05-02 09:27:00 UTC (rev 30551) @@ -29,10 +29,9 @@ SYSTEM_BIN = "[" addattr alert arp base64 basename bash bc beep bootman bzip2 cal cat catattr checkfs chgrp chmod chop chown chroot cksum clear - clockconfig cmp collectcatkeys comm compress copyattr CortexAddOnHost cp + clockconfig cmp comm compress copyattr CortexAddOnHost cp csplit ctags cut date dc dd desklink df diff diff3 dircolors dirname - draggers driveinfo dstcheck du dumpcatalog - echo eject env error expand expr + draggers driveinfo dstcheck du echo eject env error expand expr factor false fdinfo ffm filepanel find finddir fmt fold fortune frcode ftp ftpd funzip fwcontrol @@ -40,8 +39,7 @@ id ident ideinfo idestatus ifconfig install installsound iroster isvolume join - keymap kill less lessecho lesskey link linkcatkeys listarea listattr - listimage listdev + keymap kill less lessecho lesskey link listarea listattr listimage listdev listport listres listsem listusb ln locate logger login logname ls lsindex makebootable md5sum merge mimeset mkdos mkdir mkfifo mkfs mkindex modifiers mount mount_nfs mountvolume mv @@ -70,8 +68,8 @@ StyledEdit Terminal TextSearch TV Workspaces ; SYSTEM_PREFERENCES = Appearance Backgrounds CPUFrequency DataTranslations E-mail - FileTypes Fonts Keyboard Keymap Locale Media Menu Mouse Network Printers - Screen ScreenSaver Sounds Time Touchpad Tracker VirtualMemory + FileTypes Fonts Keyboard Keymap Media Menu Mouse Network Printers Screen + ScreenSaver Sounds Time Touchpad Tracker VirtualMemory ; SYSTEM_DEMOS = BSnow Chart Clock Cortex FontDemo GLDirectMode GLTeapot Mandelbrot Pairs @@ -82,7 +80,7 @@ libmail.so libtextencoding.so libz.so libfreetype.so libpng.so libmidi.so libmidi2.so libdevice.so libgame.so libscreensaver.so libroot.so libGL.so libfluidsynth.so liblpsolve55.so liblinprog.so libalm.so - libilmimf.so libiconv.so liblocale.so + libilmimf.so libiconv.so ; SYSTEM_SERVERS = registrar debug_server syslog_daemon media_server net_server media_addon_server input_server app_server fake_app_server @@ -348,11 +346,6 @@ = [ FDirName $(HAIKU_TOP) src apps mail ] ; AddFilesToHaikuImage system etc word_dictionary : $(spellFiles) ; -# Locale kit language files -local languageDir = [ FDirName $(HAIKU_TOP) src data etc locale languages ] ; -local languages = [ Glob $(languageDir) : *.language ] ; -AddFilesToHaikuImage system etc locale languages : $(languages) ; - local etcFiles = bash_completion inputrc profile teapot.data ; etcFiles = $(etcFiles:G=etc) ; SEARCH on $(etcFiles) = [ FDirName $(HAIKU_TOP) data etc ] ; From zooey at hirschkaefer.de Sat May 2 11:31:22 2009 From: zooey at hirschkaefer.de (Oliver Tappe) Date: Sat, 02 May 2009 11:31:22 +0200 Subject: [Haiku-commits] r30545 - in haiku/trunk: . build/jam headers/os/locale headers/posix src/add-ons src/add-ons/locale src/add-ons/locale/catalogs src/add-ons/locale/catalogs/zeta src/add-ons/locale/collators src/bin src/bin/locale src/data/etc/loca In-Reply-To: <1468228533-BeMail@laptop> References: <1468228533-BeMail@laptop> Message-ID: <20090502113122.522.1@bee.hirschkaefer.site> On 2009-05-02 at 04:31:43 [+0200], Fran?ois Revol wrote: [ ... ] > > > > FYI, this fails to build on gcc4 at the moment...I made a diff of > > some > > partial fixes, but the ones that remain I'm uncertain as to the best > > way to work around...currently I fail with: Rene, thanks for the diff - I will work on fixing the gcc4-build later today. > > For such large addition it'd be nice to others not to add to the image > before you're sure it builds with both gcc... it's painful having to > revert stuff locally due to this. Francois, you are right - I'll try to remember that next time round. I have removed the locale kit from the image again (r30551) until the gcc4 build has been fixed. cheers, Oliver From stippi at mail.berlios.de Sat May 2 11:35:14 2009 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sat, 2 May 2009 11:35:14 +0200 Subject: [Haiku-commits] r30552 - haiku/trunk/data/artwork/icons Message-ID: <200905020935.n429ZERg007346@sheep.berlios.de> Author: stippi Date: 2009-05-02 11:35:12 +0200 (Sat, 02 May 2009) New Revision: 30552 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30552&view=rev Added: haiku/trunk/data/artwork/icons/App_ArmyKnife haiku/trunk/data/artwork/icons/App_BeVexed haiku/trunk/data/artwork/icons/App_Generic_4 Log: New icons from zuMi. Thanks a lot! (Scott sent me those, I still want to keep all Haiku vector icons ever made in this folder... :-) The new generic app icon looks pretty cool (Haiku colors) and could replace our current generic icon (broken link icon needs to be updated as well then), feedback welcome. Added: haiku/trunk/data/artwork/icons/App_ArmyKnife =================================================================== (Binary files differ) Property changes on: haiku/trunk/data/artwork/icons/App_ArmyKnife ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: haiku/trunk/data/artwork/icons/App_BeVexed =================================================================== (Binary files differ) Property changes on: haiku/trunk/data/artwork/icons/App_BeVexed ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: haiku/trunk/data/artwork/icons/App_Generic_4 =================================================================== (Binary files differ) Property changes on: haiku/trunk/data/artwork/icons/App_Generic_4 ___________________________________________________________________ Name: svn:mime-type + application/octet-stream From rudolfc at mail.berlios.de Sat May 2 11:58:12 2009 From: rudolfc at mail.berlios.de (rudolfc at BerliOS) Date: Sat, 2 May 2009 11:58:12 +0200 Subject: [Haiku-commits] r30553 - in haiku/trunk/src/add-ons: accelerants/nvidia accelerants/nvidia/engine kernel/drivers/graphics/nvidia Message-ID: <200905020958.n429wCBQ009058@sheep.berlios.de> Author: rudolfc Date: 2009-05-02 11:58:11 +0200 (Sat, 02 May 2009) New Revision: 30553 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30553&view=rev Modified: haiku/trunk/src/add-ons/accelerants/nvidia/Jamfile haiku/trunk/src/add-ons/accelerants/nvidia/acc_std.h haiku/trunk/src/add-ons/accelerants/nvidia/engine/Jamfile haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_i2c.c haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_proto.h haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_std.h haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html Log: added partial DDC/EDID support using the accelerants common staticlibrary. Only dumping config, monitor info to logfile. logfiles are welcome as the CRTC/DAC to I2Cport relationchip is not known by me yet. Bumped version to 0.89. Modified: haiku/trunk/src/add-ons/accelerants/nvidia/Jamfile =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia/Jamfile 2009-05-02 09:35:12 UTC (rev 30552) +++ haiku/trunk/src/add-ons/accelerants/nvidia/Jamfile 2009-05-02 09:58:11 UTC (rev 30553) @@ -4,6 +4,7 @@ UsePrivateHeaders graphics ; UsePrivateHeaders [ FDirName graphics nvidia ] ; +UsePrivateHeaders [ FDirName graphics common ] ; UseHeaders [ FDirName $(SUBDIR) engine ] ; Addon nvidia.accelerant : @@ -18,7 +19,7 @@ Overlay.c ProposeDisplayMode.c SetDisplayMode.c - : libnvidia_engine.a + : libnvidia_engine.a libaccelerantscommon.a ; Package haiku-nvidia-cvs : Modified: haiku/trunk/src/add-ons/accelerants/nvidia/acc_std.h =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia/acc_std.h 2009-05-02 09:35:12 UTC (rev 30552) +++ haiku/trunk/src/add-ons/accelerants/nvidia/acc_std.h 2009-05-02 09:58:11 UTC (rev 30553) @@ -8,9 +8,15 @@ #include #include + +/* DDC/EDID library */ +//#include +#include +//#include + +/* Nvidia driver */ #include "DriverInterface.h" #include "nv_globals.h" -//apsed #include "nv_extern.h" #include "nv_proto.h" #include "be_driver_proto.h" Modified: haiku/trunk/src/add-ons/accelerants/nvidia/engine/Jamfile =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia/engine/Jamfile 2009-05-02 09:35:12 UTC (rev 30552) +++ haiku/trunk/src/add-ons/accelerants/nvidia/engine/Jamfile 2009-05-02 09:58:11 UTC (rev 30553) @@ -4,6 +4,7 @@ UsePrivateHeaders graphics ; UsePrivateHeaders [ FDirName graphics nvidia ] ; +UsePrivateHeaders [ FDirName graphics common ] ; StaticLibrary libnvidia_engine.a : nv_acc.c @@ -20,4 +21,5 @@ nv_i2c.c nv_info.c nv_support.c - ; + : +; Modified: haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c 2009-05-02 09:35:12 UTC (rev 30552) +++ haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c 2009-05-02 09:58:11 UTC (rev 30553) @@ -92,7 +92,7 @@ { status_t status; - LOG(1,("POWERUP: Haiku nVidia Accelerant 0.88 running.\n")); + LOG(1,("POWERUP: Haiku nVidia Accelerant 0.89 running.\n")); /* log VBLANK INT usability status */ if (si->ps.int_assigned) Modified: haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_i2c.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_i2c.c 2009-05-02 09:35:12 UTC (rev 30552) +++ haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_i2c.c 2009-05-02 09:58:11 UTC (rev 30553) @@ -2,7 +2,7 @@ * i2c interface. * Bus should be run at max. 100kHz: see original Philips I2C specification * - * Rudolf Cornelissen 12/2002-10/2005 + * Rudolf Cornelissen 12/2002-5/2009 */ #define MODULE_BIT 0x00004000 @@ -340,5 +340,244 @@ LOG(4,("I2C: bus #%d wiring check: failed\n", bus)); } + i2c_TestEDID(); + return result; } + +/*** DDC/EDID library use ***/ +typedef struct { + uint32 port; +} ddc_port_info; + +/* Dump EDID info in driver's logfile */ +static void +i2c_edid_dump(edid1_info *edid) +{ + int i, j; + + LOG(4,("Vendor: %s\n", edid->vendor.manufacturer)); + LOG(4,("Product ID: %d\n", (int)edid->vendor.prod_id)); + LOG(4,("Serial #: %d\n", (int)edid->vendor.serial)); + LOG(4,("Produced in week/year: %d/%d\n", edid->vendor.week, edid->vendor.year)); + + LOG(4,("EDID version: %d.%d\n", edid->version.version, edid->version.revision)); + + LOG(4,("Type: %s\n", edid->display.input_type ? "Digital" : "Analog")); + LOG(4,("Size: %d cm x %d cm\n", edid->display.h_size, edid->display.v_size)); + LOG(4,("Gamma=%.3f\n", (edid->display.gamma + 100) / 100.0)); + LOG(4,("White (X,Y)=(%.3f,%.3f)\n", edid->display.white_x / 1024.0, + edid->display.white_y / 1024.0)); + + LOG(4,("Supported Future Video Modes:\n")); + for (i = 0; i < EDID1_NUM_STD_TIMING; ++i) { + if (edid->std_timing[i].h_size <= 256) + continue; + + LOG(4,("%dx%d@%dHz (id=%d)\n", + edid->std_timing[i].h_size, edid->std_timing[i].v_size, + edid->std_timing[i].refresh, edid->std_timing[i].id)); + } + + LOG(4,("Supported VESA Video Modes:\n")); + if (edid->established_timing.res_720x400x70) + LOG(4,("720x400 at 70\n")); + if (edid->established_timing.res_720x400x88) + LOG(4,("720x400 at 88\n")); + if (edid->established_timing.res_640x480x60) + LOG(4,("640x480 at 60\n")); + if (edid->established_timing.res_640x480x67) + LOG(4,("640x480x67\n")); + if (edid->established_timing.res_640x480x72) + LOG(4,("640x480x72\n")); + if (edid->established_timing.res_640x480x75) + LOG(4,("640x480x75\n")); + if (edid->established_timing.res_800x600x56) + LOG(4,("800x600 at 56\n")); + if (edid->established_timing.res_800x600x60) + LOG(4,("800x600 at 60\n")); + + if (edid->established_timing.res_800x600x72) + LOG(4,("800x600 at 72\n")); + if (edid->established_timing.res_800x600x75) + LOG(4,("800x600 at 75\n")); + if (edid->established_timing.res_832x624x75) + LOG(4,("832x624 at 75\n")); + if (edid->established_timing.res_1024x768x87i) + LOG(4,("1024x768 at 87 interlaced\n")); + if (edid->established_timing.res_1024x768x60) + LOG(4,("1024x768 at 60\n")); + if (edid->established_timing.res_1024x768x70) + LOG(4,("1024x768 at 70\n")); + if (edid->established_timing.res_1024x768x75) + LOG(4,("1024x768 at 75\n")); + if (edid->established_timing.res_1280x1024x75) + LOG(4,("1280x1024 at 75\n")); + + if (edid->established_timing.res_1152x870x75) + LOG(4,("1152x870 at 75\n")); + + for (i = 0; i < EDID1_NUM_DETAILED_MONITOR_DESC; ++i) { + edid1_detailed_monitor *monitor = &edid->detailed_monitor[i]; + + switch(monitor->monitor_desc_type) { + case EDID1_SERIAL_NUMBER: + LOG(4,("Serial Number: %s\n", monitor->data.serial_number)); + break; + + case EDID1_ASCII_DATA: + LOG(4,(" %s\n", monitor->data.serial_number)); + break; + + case EDID1_MONITOR_RANGES: + { + edid1_monitor_range monitor_range = monitor->data.monitor_range; + + LOG(4,("Horizontal frequency range = %d..%d kHz\n", + monitor_range.min_h, monitor_range.max_h)); + LOG(4,("Vertical frequency range = %d..%d Hz\n", + monitor_range.min_v, monitor_range.max_v)); + LOG(4,("Maximum pixel clock = %d MHz\n", (uint16)monitor_range.max_clock * 10)); + break; + } + + case EDID1_MONITOR_NAME: + LOG(4,("Monitor Name: %s\n", monitor->data.monitor_name)); + break; + + case EDID1_ADD_COLOUR_POINTER: + { + for (j = 0; j < EDID1_NUM_EXTRA_WHITEPOINTS; ++j) { + edid1_whitepoint *whitepoint = &monitor->data.whitepoint[j]; + + if (whitepoint->index == 0) + continue; + + LOG(4,("Additional whitepoint: (X,Y)=(%f,%f) gamma=%f index=%i\n", + whitepoint->white_x / 1024.0, + whitepoint->white_y / 1024.0, + (whitepoint->gamma + 100) / 100.0, + whitepoint->index)); + } + break; + } + + case EDID1_ADD_STD_TIMING: + { + for (j = 0; j < EDID1_NUM_EXTRA_STD_TIMING; ++j) { + edid1_std_timing *timing = &monitor->data.std_timing[j]; + + if (timing->h_size <= 256) + continue; + + LOG(4,("%dx%d@%dHz (id=%d)\n", + timing->h_size, timing->v_size, + timing->refresh, timing->id)); + } + break; + } + + case EDID1_IS_DETAILED_TIMING: + { + edid1_detailed_timing *timing = &monitor->data.detailed_timing; + + LOG(4,("Additional Video Mode:\n")); + LOG(4,("clock=%f MHz\n", timing->pixel_clock / 100.0)); + LOG(4,("h: (%d, %d, %d, %d)\n", + timing->h_active, timing->h_active + timing->h_sync_off, + timing->h_active + timing->h_sync_off + timing->h_sync_width, + timing->h_active + timing->h_blank)); + LOG(4,("v: (%d, %d, %d, %d)\n", + timing->v_active, timing->v_active + timing->v_sync_off, + timing->v_active + timing->v_sync_off + timing->v_sync_width, + timing->v_active + timing->v_blank)); + LOG(4,("size: %.1f cm x %.1f cm\n", + timing->h_size / 10.0, timing->v_size / 10.0)); + LOG(4,("border: %.1f cm x %.1f cm\n", + timing->h_border / 10.0, timing->v_border / 10.0)); + break; + } + } + } +} + +/* callback for getting signals from I2C bus */ +static status_t +get_signals(void *cookie, int *clk, int *data) +{ + ddc_port_info *info = (ddc_port_info *)cookie; + + *clk = *data = 0x0000; + if (InSCL(info->port)) *clk = 0x0001; + if (InSDA(info->port)) *data = 0x0001; + + return B_OK; +} + +/* callback for setting signals on I2C bus */ +static status_t +set_signals(void *cookie, int clk, int data) +{ + ddc_port_info *info = (ddc_port_info *)cookie; + + if (clk) + OutSCL(info->port, true); + else + OutSCL(info->port, false); + + if (data) + OutSDA(info->port, true); + else + OutSDA(info->port, false); + + return B_OK; +} + +/* Read EDID information from monitor via the display data channel (DDC) */ +status_t +i2c_ReadEDID(uint8 BusNR, edid1_info *edid) +{ + i2c_bus bus; + ddc_port_info info; + + info.port = BusNR; + + bus.cookie = &info; + bus.set_signals = &set_signals; + bus.get_signals = &get_signals; + ddc2_init_timing(&bus); + + /* select GPU I/O pins set */ + i2c_select_bus_set(BusNR & 0x02); + + /* enable access to primary head */ + set_crtc_owner(0); + + if (ddc2_read_edid1(&bus, edid, NULL, NULL) == B_OK) { + LOG(4,("I2C: EDID succesfully read from monitor at bus %d\n", BusNR)); + LOG(4,("I2C: EDID dump follows (bus %d):\n", BusNR)); +// has_edid = true; + i2c_edid_dump(edid); + LOG(4,("I2C: end EDID dump (bus %d).\n", BusNR)); + } else { + LOG(4,("I2C: reading EDID failed at bus %d!\n", BusNR)); + return B_ERROR; + } + + return B_OK; +} + +void i2c_TestEDID(void) +{ + uint8 bus, buses; + + /* set number of buses to test for */ + buses = 2; + if (si->ps.secondary_head) buses = 4; + + /* test bus */ + for (bus = 0; bus < buses; bus++) { + edid1_info edid; + i2c_ReadEDID(bus, &edid); + } +} Modified: haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_proto.h =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_proto.h 2009-05-02 09:35:12 UTC (rev 30552) +++ haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_proto.h 2009-05-02 09:58:11 UTC (rev 30553) @@ -34,6 +34,8 @@ void i2c_readbuffer (uint8 BusNR, uint8* buf, uint8 size); void i2c_writebuffer (uint8 BusNR, uint8* buf, uint8 size); status_t i2c_init(void); +status_t i2c_ReadEDID(uint8 BusNR, edid1_info *edid); +void i2c_TestEDID(void); /* card info functions */ status_t parse_pins(void); Modified: haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_std.h =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_std.h 2009-05-02 09:35:12 UTC (rev 30552) +++ haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_std.h 2009-05-02 09:58:11 UTC (rev 30553) @@ -2,9 +2,15 @@ #include #include #include + +/* DDC/EDID library */ +//#include +#include +//#include + +/* Nvidia driver */ #include "DriverInterface.h" #include "nv_globals.h" -//apsed #include "nv_extern.h" #include "nv_proto.h" #include "nv_macros.h" #include "nv_acc.h" Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html 2009-05-02 09:35:12 UTC (rev 30552) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html 2009-05-02 09:58:11 UTC (rev 30553) @@ -4,7 +4,7 @@

      Changes done for each driverversion:

      -

      head (SVN 0.88, Rudolf)

      +

      head (SVN 0.89, Rudolf)

      • Fixed driver assuming enabling AGP mode succeeded on some occasions if it did not block it itself. Blocking AGP mode completely via the AGP busmanager (option 'block_agp') resulted in a crashing acceleration engine because it was setup for AGP transfers instead of using PCI transfers. Error was solved with help from user kraton.
      • Fixed shared_info struct problem occuring when 3D 'accelerant' is used (tested Alpha 4.1): the TVencoder type definition list apparantly gets some memory assigned these days when done inside the definition of shared_info. Moved encoder list outside the shared_info definition. @@ -18,6 +18,7 @@
      • Added 'block_acc' option in nvidia.settings to completely disable the acceleration engine. Use this as a work-around if the acceleration engine misbehaves.
      • Fixed card/system hanging after trying to log LVDS/TMDS distinction info. This (at least) fixes one NV34 trying to startup after a failed kernel VESA modeswitch without using the driver's coldstart option. Might very well help on other type cards too.
      • HDTV video upto/including 1920x1080p can now be played back using overlay on Geforce cards where overlay is supported. On TNT1/TNT2/TNT2-M64 this can't be done and bitmap output is used. +
      • Added partial DDC/EDID support: dumping monitor specs to logfile only for now.

      nv_driver 0.80 (Rudolf)

        From stippi at mail.berlios.de Sat May 2 12:08:20 2009 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sat, 2 May 2009 12:08:20 +0200 Subject: [Haiku-commits] r30554 - haiku/trunk/data/artwork/icons Message-ID: <200905021008.n42A8KMx010256@sheep.berlios.de> Author: stippi Date: 2009-05-02 12:08:18 +0200 (Sat, 02 May 2009) New Revision: 30554 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30554&view=rev Modified: haiku/trunk/data/artwork/icons/App_ArmyKnife Log: * Tweaks to shapes to make 32x32 and especially 16x16 a lot crisper. Uses available space slightly better. * Gave every icon object a name. Modified: haiku/trunk/data/artwork/icons/App_ArmyKnife =================================================================== (Binary files differ) From stippi at mail.berlios.de Sat May 2 12:10:55 2009 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sat, 2 May 2009 12:10:55 +0200 Subject: [Haiku-commits] r30555 - haiku/trunk/data/artwork/icons Message-ID: <200905021010.n42AAtJh010580@sheep.berlios.de> Author: stippi Date: 2009-05-02 12:10:54 +0200 (Sat, 02 May 2009) New Revision: 30555 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30555&view=rev Modified: haiku/trunk/data/artwork/icons/App_BeVexed Log: Shadow wasn't parallel with shape. Modified: haiku/trunk/data/artwork/icons/App_BeVexed =================================================================== (Binary files differ) From rudolfc at mail.berlios.de Sat May 2 12:15:31 2009 From: rudolfc at mail.berlios.de (rudolfc at BerliOS) Date: Sat, 2 May 2009 12:15:31 +0200 Subject: [Haiku-commits] r30556 - haiku/trunk/src/add-ons/accelerants/nvidia/engine Message-ID: <200905021015.n42AFVEi010982@sheep.berlios.de> Author: rudolfc Date: 2009-05-02 12:15:30 +0200 (Sat, 02 May 2009) New Revision: 30556 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30556&view=rev Modified: haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_i2c.c Log: EDID test: only check on wired buses. Modified: haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_i2c.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_i2c.c 2009-05-02 10:10:54 UTC (rev 30555) +++ haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_i2c.c 2009-05-02 10:15:30 UTC (rev 30556) @@ -569,15 +569,13 @@ void i2c_TestEDID(void) { - uint8 bus, buses; + uint8 bus; + edid1_info edid; + bool *i2c_bus = &(si->ps.i2c_bus0); - /* set number of buses to test for */ - buses = 2; - if (si->ps.secondary_head) buses = 4; - - /* test bus */ - for (bus = 0; bus < buses; bus++) { - edid1_info edid; - i2c_ReadEDID(bus, &edid); + /* test wired bus(es) */ + for (bus = 0; bus < 4; bus++) { + if (i2c_bus[bus]) + i2c_ReadEDID(bus, &edid); } } From stippi at mail.berlios.de Sat May 2 12:20:30 2009 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sat, 2 May 2009 12:20:30 +0200 Subject: [Haiku-commits] r30557 - haiku/trunk/build/jam Message-ID: <200905021020.n42AKUGI011456@sheep.berlios.de> Author: stippi Date: 2009-05-02 12:20:29 +0200 (Sat, 02 May 2009) New Revision: 30557 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30557&view=rev Modified: haiku/trunk/build/jam/FloppyBootImage Log: Apply Francois changes to enabling the ATA stack via "HAIKU_ATA_STACK = 1 ;" in the UserBuildConfig to the FloppyBootImage as well. Modified: haiku/trunk/build/jam/FloppyBootImage =================================================================== --- haiku/trunk/build/jam/FloppyBootImage 2009-05-02 10:15:30 UTC (rev 30556) +++ haiku/trunk/build/jam/FloppyBootImage 2009-05-02 10:20:29 UTC (rev 30557) @@ -16,6 +16,15 @@ GPL_ONLY = "" ; } +#HACK: remove when old ide code is removed! +local ATA_ONLY = ; +local IDE_ONLY = ; +if $(HAIKU_ATA_STACK) = 1 { + ATA_ONLY = "" ; +} else { + IDE_ONLY = "" ; +} + local NET_BOOT = 0 ; local BOOT_ADD_ONS_NET ; @@ -32,8 +41,8 @@ ; } -SYSTEM_ADD_ONS_BUS_MANAGERS = pci $(X86_ONLY)isa ide scsi - config_manager agp_gart usb +SYSTEM_ADD_ONS_BUS_MANAGERS = agp_gart $(ATA_ONLY)ata config_manager pci + $(IDE_ONLY)ide $(X86_ONLY)isa scsi usb ; SYSTEM_ADD_ONS_FILE_SYSTEMS = bfs iso9660 attribute_overlay write_overlay ; #cdda fat googlefs nfs ; @@ -52,7 +61,7 @@ AddFilesToFloppyBootArchive system add-ons kernel file_systems : $(SYSTEM_ADD_ONS_FILE_SYSTEMS) ; AddFilesToFloppyBootArchive system add-ons kernel generic - : ide_adapter locked_pool scsi_periph ; + : $(ATA_ONLY)ata_adapter $(IDE_ONLY)ide_adapter locked_pool scsi_periph ; AddFilesToFloppyBootArchive system add-ons kernel partitioning_systems : intel session ; AddFilesToFloppyBootArchive system add-ons kernel interrupt_controllers @@ -102,9 +111,10 @@ AddBootModuleSymlinksToFloppyBootArchive $(SYSTEM_ADD_ONS_BUS_MANAGERS) $(PPC_ONLY)openpic - ide_adapter locked_pool scsi_periph + $(ATA_ONLY)ata_adapter $(IDE_ONLY)ide_adapter locked_pool scsi_periph $(X86_ONLY)generic_x86 - ahci generic_ide_pci $(X86_ONLY)ide_isa silicon_image_3112 legacy_sata it8211 + ahci generic_ide_pci $(X86_ONLY)ide_isa silicon_image_3112 legacy_sata + it8211 uhci ohci ehci scsi_cd scsi_disk usb_disk intel session From bonefish at mail.berlios.de Sat May 2 12:24:07 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Sat, 2 May 2009 12:24:07 +0200 Subject: [Haiku-commits] r30558 - haiku/trunk/src/kits/interface Message-ID: <200905021024.n42AO7ZA012004@sheep.berlios.de> Author: bonefish Date: 2009-05-02 12:24:06 +0200 (Sat, 02 May 2009) New Revision: 30558 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30558&view=rev Modified: haiku/trunk/src/kits/interface/TabView.cpp Log: * BTabView::AddTab(): Call Select() only when already attached to the window. It's only necessary in this case and apparently there are applications that rely on Select() not being called before the tab is attached to the window. Fixes #3852. * Automatic white-space cleanup. Modified: haiku/trunk/src/kits/interface/TabView.cpp =================================================================== --- haiku/trunk/src/kits/interface/TabView.cpp 2009-05-02 10:20:29 UTC (rev 30557) +++ haiku/trunk/src/kits/interface/TabView.cpp 2009-05-02 10:24:06 UTC (rev 30558) @@ -2,7 +2,7 @@ * Copyright (c) 2001-2008, Haiku, Inc. * Distributed under the terms of the MIT license. * - * Authors: + * Authors: * Marc Flerackers (mflerackers at androme.be) * J?r?me Duval (korli at users.berlios.de) * Stephan A?mus @@ -163,7 +163,7 @@ if (removeView) View()->RemoveSelf(); } - + fSelected = false; } @@ -293,7 +293,7 @@ be_control_look->DrawInactiveTab(owner, frame, frame, no_tint, 0, borders); } - + DrawLabel(owner, frame); return; } @@ -340,7 +340,7 @@ owner->AddLine(BPoint(frame.left + slopeWidth, frame.top + 1), BPoint(frame.right, frame.top + 1), lightenmax); - if (full) { + if (full) { // full height right side owner->AddLine(BPoint(frame.right, frame.top), BPoint(frame.right + slopeWidth + 2, frame.bottom), darken2); @@ -390,7 +390,7 @@ } -BTabView::BTabView(BRect frame, const char *name, button_width width, +BTabView::BTabView(BRect frame, const char *name, button_width width, uint32 resizingMode, uint32 flags) : BView(frame, name, resizingMode, flags) { @@ -591,27 +591,27 @@ } } } - + if (handled) message->SendReply(&reply); else BView::MessageReceived(message); break; } - + case B_MOUSE_WHEEL_CHANGED: { float deltaX = 0.0f; float deltaY = 0.0f; message->FindFloat("be:wheel_delta_x", &deltaX); message->FindFloat("be:wheel_delta_y", &deltaY); - + if (deltaX == 0.0f && deltaY == 0.0f) return; - + if (deltaY == 0.0f) deltaY = deltaX; - + int32 selection = Selection(); int32 numTabs = CountTabs(); if (deltaY > 0 && selection < numTabs - 1) { @@ -624,7 +624,7 @@ } default: BView::MessageReceived(message); - break; + break; } } @@ -725,7 +725,7 @@ index = Selection(); BTab *tab = TabAt(Selection()); - + if (tab) tab->Deselect(); @@ -744,7 +744,7 @@ } Invalidate(); - + if (index != 0 && !Bounds().Contains(TabFrame(index))){ if (!Bounds().Contains(TabFrame(index).LeftTop())) fTabOffset += TabFrame(index).left - Bounds().left - 20.0f; @@ -960,12 +960,12 @@ for (int32 i = 0; i < tab_index; i++){ x += StringWidth(TabAt(i)->Label()) + 20.0; } - + return BRect(x, 0.0, x + StringWidth(TabAt(tab_index)->Label()) + 20.0, height); } - + case B_WIDTH_FROM_WIDEST: width = 0.0; for (int32 i = 0; i < CountTabs(); i++) { @@ -994,7 +994,7 @@ return BRect(x - fTabOffset, 0.0f, x - fTabOffset + StringWidth(TabAt(tab_index)->Label()) + 20.0f , fTabHeight); - + /*float x = X_OFFSET; for (int32 i = 0; i < tab_index; i++) x += StringWidth(TabAt(i)->Label()) + 20.0f; @@ -1134,8 +1134,9 @@ fTabList->AddItem(tab); - // When we don't have a any tabs yet, select this one. - if (CountTabs() == 1) + // When we haven't had a any tabs before, but are already attached to the + // window, select this one. + if (CountTabs() == 1 && Window() != NULL) Select(0); } @@ -1167,7 +1168,7 @@ if (fContainerView->GetLayout()) fContainerView->GetLayout()->RemoveItem(index); - + return tab; } @@ -1275,14 +1276,14 @@ fContainerView->SetLayout(new(std::nothrow) BCardLayout()); } else { BRect bounds = Bounds(); - + bounds.top += TabHeight(); bounds.InsetBy(3.0f, 3.0f); fContainerView = new BView(bounds, "view container", B_FOLLOW_ALL, B_WILL_DRAW); } - + fContainerView->SetViewColor(color); fContainerView->SetLowColor(color); From stippi at mail.berlios.de Sat May 2 13:02:58 2009 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sat, 2 May 2009 13:02:58 +0200 Subject: [Haiku-commits] r30559 - haiku/trunk/data/artwork/icons Message-ID: <200905021102.n42B2wWY005355@sheep.berlios.de> Author: stippi Date: 2009-05-02 13:02:56 +0200 (Sat, 02 May 2009) New Revision: 30559 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30559&view=rev Added: haiku/trunk/data/artwork/icons/Server_Bluetooth Log: Icon by Mark Erben, small tweaks by myself. Thanks a lot! Added: haiku/trunk/data/artwork/icons/Server_Bluetooth =================================================================== (Binary files differ) Property changes on: haiku/trunk/data/artwork/icons/Server_Bluetooth ___________________________________________________________________ Name: svn:mime-type + application/octet-stream From stippi at mail.berlios.de Sat May 2 13:04:44 2009 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sat, 2 May 2009 13:04:44 +0200 Subject: [Haiku-commits] r30560 - haiku/trunk/src/apps/aboutsystem Message-ID: <200905021104.n42B4ibU006631@sheep.berlios.de> Author: stippi Date: 2009-05-02 13:04:40 +0200 (Sat, 02 May 2009) New Revision: 30560 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30560&view=rev Modified: haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp Log: Added Mark to list of contributors. Modified: haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp =================================================================== --- haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp 2009-05-02 11:02:56 UTC (rev 30559) +++ haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp 2009-05-02 11:04:40 UTC (rev 30560) @@ -486,6 +486,7 @@ "David Dengg\n" "John Drinkwater\n" "Cian Duffy\n" + "Mark Erben\n" "Christian Fasshauer\n" "Andreas F?rber\n" "Marc Flerackers\n" From dev at m-phasis.de Sat May 2 13:06:09 2009 From: dev at m-phasis.de (Michael Weirauch) Date: Sat, 02 May 2009 13:06:09 +0200 Subject: [Haiku-commits] r30548 - haiku/trunk/src/add-ons/media/plugins/asf_reader In-Reply-To: <200905020429.n424Tc8q014149@sheep.berlios.de> References: <200905020429.n424Tc8q014149@sheep.berlios.de> Message-ID: <49FC2921.2020503@m-phasis.de> dlmcpaul at BerliOS schrieb: > Author: dlmcpaul > Date: 2009-05-02 06:29:36 +0200 (Sat, 02 May 2009) > New Revision: 30548 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30548&view=rev > > Modified: > haiku/trunk/src/add-ons/media/plugins/asf_reader/ASFFileReader.cpp > haiku/trunk/src/add-ons/media/plugins/asf_reader/ASFIndex.cpp > haiku/trunk/src/add-ons/media/plugins/asf_reader/asf_reader.cpp > Log: > Now plays 2 out of 3 files and that is good yes Can you include stdio.h for the gcc4 build in ASFIndex.cpp? Thx. Michael From stippi at mail.berlios.de Sat May 2 13:20:00 2009 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sat, 2 May 2009 13:20:00 +0200 Subject: [Haiku-commits] r30561 - haiku/trunk/data/artwork/icons Message-ID: <200905021120.n42BK0mQ025436@sheep.berlios.de> Author: stippi Date: 2009-05-02 13:19:51 +0200 (Sat, 02 May 2009) New Revision: 30561 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30561&view=rev Added: haiku/trunk/data/artwork/icons/Server_Bluetooth_2 Removed: haiku/trunk/data/artwork/icons/Server_Bluetooth Log: This was actually the second version of the Bluetooth server icon... Deleted: haiku/trunk/data/artwork/icons/Server_Bluetooth Copied: haiku/trunk/data/artwork/icons/Server_Bluetooth_2 (from rev 30559, haiku/trunk/data/artwork/icons/Server_Bluetooth) From stippi at mail.berlios.de Sat May 2 13:22:18 2009 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sat, 2 May 2009 13:22:18 +0200 Subject: [Haiku-commits] r30562 - haiku/trunk/data/artwork/icons Message-ID: <200905021122.n42BMIBu028416@sheep.berlios.de> Author: stippi Date: 2009-05-02 13:22:13 +0200 (Sat, 02 May 2009) New Revision: 30562 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30562&view=rev Added: haiku/trunk/data/artwork/icons/Prefs_Bluetooth haiku/trunk/data/artwork/icons/Server_Bluetooth Log: Added the icons which are the current Bluetooth server and prefs icons. Please always put new icons here first. Oliver, if you still have the original icons, with named paths and shapes and so on, please put them here and replace the ones I extracted from the binaries. Added: haiku/trunk/data/artwork/icons/Prefs_Bluetooth =================================================================== (Binary files differ) Property changes on: haiku/trunk/data/artwork/icons/Prefs_Bluetooth ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: haiku/trunk/data/artwork/icons/Server_Bluetooth =================================================================== (Binary files differ) Property changes on: haiku/trunk/data/artwork/icons/Server_Bluetooth ___________________________________________________________________ Name: svn:mime-type + application/octet-stream From stippi at mail.berlios.de Sat May 2 14:31:54 2009 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sat, 2 May 2009 14:31:54 +0200 Subject: [Haiku-commits] r30563 - haiku/trunk/src/servers/app Message-ID: <200905021231.n42CVsP9002471@sheep.berlios.de> Author: stippi Date: 2009-05-02 14:31:53 +0200 (Sat, 02 May 2009) New Revision: 30563 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30563&view=rev Modified: haiku/trunk/src/servers/app/ServerApp.cpp Log: Fixed warning. Modified: haiku/trunk/src/servers/app/ServerApp.cpp =================================================================== --- haiku/trunk/src/servers/app/ServerApp.cpp 2009-05-02 11:22:13 UTC (rev 30562) +++ haiku/trunk/src/servers/app/ServerApp.cpp 2009-05-02 12:31:53 UTC (rev 30563) @@ -1240,7 +1240,7 @@ fLink.StartMessage(B_OK); for (int32 i = 0; i < 3; i++) { - ServerFont* font; + ServerFont* font = NULL; switch (i) { case 0: font = &fPlainFont; From zooey at mail.berlios.de Sat May 2 15:27:17 2009 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Sat, 2 May 2009 15:27:17 +0200 Subject: [Haiku-commits] r30564 - haiku/trunk/src/tests/kits/locale Message-ID: <200905021327.n42DRHwn008834@sheep.berlios.de> Author: zooey Date: 2009-05-02 15:27:17 +0200 (Sat, 02 May 2009) New Revision: 30564 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30564&view=rev Modified: haiku/trunk/src/tests/kits/locale/Jamfile Log: * catalogTestAddOn was missing from LocaleKitTests Modified: haiku/trunk/src/tests/kits/locale/Jamfile =================================================================== --- haiku/trunk/src/tests/kits/locale/Jamfile 2009-05-02 12:31:53 UTC (rev 30563) +++ haiku/trunk/src/tests/kits/locale/Jamfile 2009-05-02 13:27:17 UTC (rev 30564) @@ -8,6 +8,7 @@ : catalogSpeed catalogTest + catalogTestAddOn collatorSpeed collatorTest localeTest From mmlr at mail.berlios.de Sat May 2 15:36:50 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Sat, 2 May 2009 15:36:50 +0200 Subject: [Haiku-commits] r30565 - haiku/trunk/src/add-ons/kernel/busses/usb Message-ID: <200905021336.n42Dao5F009501@sheep.berlios.de> Author: mmlr Date: 2009-05-02 15:36:49 +0200 (Sat, 02 May 2009) New Revision: 30565 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30565&view=rev Modified: haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp Log: We are generally interested in those error bits so print them always. Modified: haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp 2009-05-02 13:27:17 UTC (rev 30564) +++ haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp 2009-05-02 13:36:49 UTC (rev 30565) @@ -1713,12 +1713,12 @@ } if (status & UHCI_USBSTS_HOSTERR) { - TRACE_MODULE("host system error\n"); + TRACE_MODULE_ERROR("host system error\n"); acknowledge |= UHCI_USBSTS_HOSTERR; } if (status & UHCI_USBSTS_HCPRERR) { - TRACE_MODULE("process error\n"); + TRACE_MODULE_ERROR("process error\n"); acknowledge |= UHCI_USBSTS_HCPRERR; } From zooey at mail.berlios.de Sat May 2 15:44:36 2009 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Sat, 2 May 2009 15:44:36 +0200 Subject: [Haiku-commits] r30566 - in haiku/trunk: headers/os/locale src/add-ons/locale/collators src/kits/locale src/tests/kits/locale Message-ID: <200905021344.n42Diaef010095@sheep.berlios.de> Author: zooey Date: 2009-05-02 15:44:35 +0200 (Sat, 02 May 2009) New Revision: 30566 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30566&view=rev Modified: haiku/trunk/headers/os/locale/DefaultCatalog.h haiku/trunk/headers/os/locale/GenericNumberFormat.h haiku/trunk/src/add-ons/locale/collators/French.cpp haiku/trunk/src/kits/locale/DefaultCatalog.cpp haiku/trunk/src/kits/locale/GenericNumberFormat.cpp haiku/trunk/src/kits/locale/Language.cpp haiku/trunk/src/kits/locale/langinfo.cpp haiku/trunk/src/tests/kits/locale/catalogTest.cpp haiku/trunk/src/tests/kits/locale/localeTest.cpp Log: * applied several fixes to make locale kit buildable with gcc4, too * actually, all those fixes were already contained in PulkoMandys patch, but I just missed that :-/ Modified: haiku/trunk/headers/os/locale/DefaultCatalog.h =================================================================== --- haiku/trunk/headers/os/locale/DefaultCatalog.h 2009-05-02 13:36:49 UTC (rev 30565) +++ haiku/trunk/headers/os/locale/DefaultCatalog.h 2009-05-02 13:44:35 UTC (rev 30566) @@ -4,16 +4,21 @@ #ifdef __MWERKS__ # include #else +# if __GNUC__ > 2 +# include +# else # include +# endif #endif +#include + #include #include #include class BFile; - namespace BPrivate { struct CatKey; } @@ -29,11 +34,23 @@ }; #endif +#if __GNUC__ > 2 +namespace __gnu_cxx { +#endif // __GNUC__ > 2 + +template<> struct hash { size_t operator() (const BPrivate::CatKey &key) const; }; +#if __GNUC__ > 2 +} // namespace __gnu_cxx +using namespace __gnu_cxx; +#endif // __GNUC__ > 2 + +using namespace std; + namespace BPrivate { /* Modified: haiku/trunk/headers/os/locale/GenericNumberFormat.h =================================================================== --- haiku/trunk/headers/os/locale/GenericNumberFormat.h 2009-05-02 13:36:49 UTC (rev 30565) +++ haiku/trunk/headers/os/locale/GenericNumberFormat.h 2009-05-02 13:44:35 UTC (rev 30566) @@ -1,5 +1,5 @@ -#ifndef _B_GENERIC_NUMBER_FORMAT_H_ -#define _B_GENERIC_NUMBER_FORMAT_H_ +#ifndef _B_GENERIC_NUMBER_FORMAT_H_ +#define _B_GENERIC_NUMBER_FORMAT_H_ #include #include @@ -116,6 +116,24 @@ void Unset() { SetTo(NULL); } }; + static const Symbol kDefaultDigitSymbols[]; + static const Symbol kDefaultFractionSeparator; + static const Symbol kDefaultExponentSymbol; + static const Symbol kDefaultUpperCaseExponentSymbol; + static const Symbol kDefaultNaNSymbol; + static const Symbol kDefaultUpperCaseNaNSymbol; + static const Symbol kDefaultInfinitySymbol; + static const Symbol kDefaultUpperCaseInfinitySymbol; + static const Symbol kDefaultNegativeInfinitySymbol; + static const Symbol kDefaultUpperCaseNegativeInfinitySymbol; + + static const GroupingInfo kDefaultGroupingInfo; + static const GroupingInfo kNoGroupingInfo; + + static const SignSymbols kDefaultSignSymbols; + static const SignSymbols kDefaultMantissaSignSymbols; + static const SignSymbols kDefaultExponentSignSymbols; + status_t FormatInteger(const BIntegerFormatParameters *parameters, const Integer &integer, char *buffer, size_t bufferSize, @@ -157,4 +175,4 @@ SignSymbols *fExponentSignSymbols; }; -#endif // _B_GENERIC_NUMBER_FORMAT_H_ +#endif // _B_GENERIC_NUMBER_FORMAT_H_ Modified: haiku/trunk/src/add-ons/locale/collators/French.cpp =================================================================== --- haiku/trunk/src/add-ons/locale/collators/French.cpp 2009-05-02 13:36:49 UTC (rev 30565) +++ haiku/trunk/src/add-ons/locale/collators/French.cpp 2009-05-02 13:44:35 UTC (rev 30566) @@ -1,4 +1,4 @@ -/* +/* ** Copyright 2003, Axel D??rfler, axeld at pinc-software.de. All rights reserved. ** Distributed under the terms of the OpenBeOS License. */ @@ -12,24 +12,24 @@ #include -struct compare_context { - compare_context(bool ignorePunctuation) - : - inputA(ignorePunctuation), - inputB(ignorePunctuation) - { - } +class FrenchCollator : public BCollatorAddOn { + struct compare_context { + compare_context(bool ignorePunctuation) + : + inputA(ignorePunctuation), + inputB(ignorePunctuation) + { + } - typedef BCollatorAddOn::input_context input_context; + typedef BCollatorAddOn::input_context input_context; - const char *a; - const char *b; - input_context inputA; - input_context inputB; - size_t length; -}; + const char *a; + const char *b; + input_context inputA; + input_context inputB; + size_t length; + }; -class FrenchCollator : public BCollatorAddOn { public: FrenchCollator(); FrenchCollator(BMessage *archive); @@ -105,7 +105,7 @@ } -status_t +status_t FrenchCollator::GetSortKey(const char *string, BString *key, int8 strength, bool ignorePunctuation) { @@ -187,7 +187,7 @@ } -int +int FrenchCollator::Compare(const char *a, const char *b, int32 length, int8 strength, bool ignorePunctuation) { @@ -238,7 +238,7 @@ } -status_t +status_t FrenchCollator::Archive(BMessage *archive, bool deep) const { status_t status = BArchivable::Archive(archive, deep); Modified: haiku/trunk/src/kits/locale/DefaultCatalog.cpp =================================================================== --- haiku/trunk/src/kits/locale/DefaultCatalog.cpp 2009-05-02 13:36:49 UTC (rev 30565) +++ haiku/trunk/src/kits/locale/DefaultCatalog.cpp 2009-05-02 13:44:35 UTC (rev 30566) @@ -42,7 +42,7 @@ /* * CatKey */ -size_t hash::operator()(const CatKey &key) const +size_t hash::operator()(const CatKey &key) const { return key.fHashVal; } @@ -98,10 +98,10 @@ } -bool +bool CatKey::operator== (const CatKey& right) const { - // Two keys are equal if their hashval and key (string,context,comment) + // Two keys are equal if their hashval and key (string,context,comment) // are equal: return fHashVal == right.fHashVal && fKey == right.fKey; @@ -140,26 +140,26 @@ } -size_t CatKey::HashFun(const char* s) { - unsigned long h = 0; - for ( ; *s; ++s) - h = 5*h + *s; +size_t CatKey::HashFun(const char* s) { + unsigned long h = 0; + for ( ; *s; ++s) + h = 5*h + *s; - return size_t(h); + return size_t(h); } static const char *kCatFolder = "catalogs"; static const char *kCatExtension = ".catalog"; -const char *DefaultCatalog::kCatMimeType +const char *DefaultCatalog::kCatMimeType = "locale/x-vnd.Be.locale-catalog.default"; static int16 kCatArchiveVersion = 1; // version of the catalog archive structure, bump this if you change it! -/* +/* * constructs a DefaultCatalog with given signature and language and reads * the catalog from disk. * InitCheck() will be B_OK if catalog could be loaded successfully, it will @@ -178,9 +178,9 @@ nref.node = appInfo.ref.directory; BDirectory appDir(&nref); BString catalogName("locale/"); - catalogName << kCatFolder - << "/" << fSignature - << "/" << fLanguageName + catalogName << kCatFolder + << "/" << fSignature + << "/" << fLanguageName << kCatExtension; BPath catalogPath(&appDir, catalogName.String()); status_t status = ReadFromFile(catalogPath.Path()); @@ -190,10 +190,10 @@ BPath commonEtcPath; find_directory(B_COMMON_ETC_DIRECTORY, &commonEtcPath); if (commonEtcPath.InitCheck() == B_OK) { - catalogName = BString(commonEtcPath.Path()) - << "/locale/" << kCatFolder - << "/" << fSignature - << "/" << fLanguageName + catalogName = BString(commonEtcPath.Path()) + << "/locale/" << kCatFolder + << "/" << fSignature + << "/" << fLanguageName << kCatExtension; status = ReadFromFile(catalogName.String()); } @@ -204,9 +204,9 @@ BPath systemEtcPath; find_directory(B_BEOS_ETC_DIRECTORY, &systemEtcPath); if (systemEtcPath.InitCheck() == B_OK) { - catalogName = BString(systemEtcPath.Path()) - << "/locale/" << kCatFolder - << "/" << fSignature + catalogName = BString(systemEtcPath.Path()) + << "/locale/" << kCatFolder + << "/" << fSignature << "/" << fLanguageName << kCatExtension; status = ReadFromFile(catalogName.String()); @@ -214,7 +214,7 @@ } fInitCheck = status; - log_team(LOG_DEBUG, + log_team(LOG_DEBUG, "trying to load default-catalog(sig=%s, lang=%s) results in %s", signature, language, strerror(fInitCheck)); } @@ -231,7 +231,7 @@ BCatalogAddOn("", "", 0) { fInitCheck = ReadFromResource(appOrAddOnRef); - log_team(LOG_DEBUG, + log_team(LOG_DEBUG, "trying to load embedded catalog from resources results in %s", strerror(fInitCheck)); } @@ -242,7 +242,7 @@ * This is used for editing/testing purposes. * InitCheck() will always be B_OK. */ -DefaultCatalog::DefaultCatalog(const char *path, const char *signature, +DefaultCatalog::DefaultCatalog(const char *path, const char *signature, const char *language) : BCatalogAddOn(signature, language, 0), @@ -279,7 +279,7 @@ log_team(LOG_ERR, "couldn't get size for catalog-file %s", path); return res; } - + auto_ptr buf(new char [sz]); res = catalogFile.Read(buf.get(), sz); if (res < B_OK) { @@ -287,7 +287,7 @@ return res; } if (res < sz) { - log_team(LOG_ERR, "only got %lu instead of %Lu bytes from catalog-file %s", + log_team(LOG_ERR, "only got %lu instead of %Lu bytes from catalog-file %s", res, sz, path); return res; } @@ -295,8 +295,8 @@ res = Unflatten(&memIO); if (res == B_OK) { - // some information living in member variables needs to be copied - // to attributes. Although these attributes should have been written + // some information living in member variables needs to be copied + // to attributes. Although these attributes should have been written // when creating the catalog, we make sure that they exist there: UpdateAttributes(catalogFile); } @@ -315,14 +315,14 @@ status_t res = node.SetTo(appOrAddOnRef); if (res != B_OK) { log_team(LOG_ERR, "couldn't find app or add-on (dev=%lu, dir=%Lu, name=%s)", - appOrAddOnRef->device, appOrAddOnRef->directory, + appOrAddOnRef->device, appOrAddOnRef->directory, appOrAddOnRef->name); return B_ENTRY_NOT_FOUND; } - log_team(LOG_DEBUG, + log_team(LOG_DEBUG, "looking for embedded catalog-attribute in app/add-on" - "(dev=%lu, dir=%Lu, name=%s)", appOrAddOnRef->device, + "(dev=%lu, dir=%Lu, name=%s)", appOrAddOnRef->device, appOrAddOnRef->directory, appOrAddOnRef->name); attr_info attrInfo; @@ -360,14 +360,14 @@ status_t res = file.SetTo(appOrAddOnRef, B_READ_ONLY); if (res != B_OK) { log_team(LOG_ERR, "couldn't find app or add-on (dev=%lu, dir=%Lu, name=%s)", - appOrAddOnRef->device, appOrAddOnRef->directory, + appOrAddOnRef->device, appOrAddOnRef->directory, appOrAddOnRef->name); return B_ENTRY_NOT_FOUND; } - log_team(LOG_DEBUG, + log_team(LOG_DEBUG, "looking for embedded catalog-resource in app/add-on" - "(dev=%lu, dir=%Lu, name=%s)", appOrAddOnRef->device, + "(dev=%lu, dir=%Lu, name=%s)", appOrAddOnRef->device, appOrAddOnRef->directory, appOrAddOnRef->name); BResources rsrc; @@ -378,7 +378,7 @@ } size_t sz; - const void *buf = rsrc.LoadResource(B_MESSAGE_TYPE, + const void *buf = rsrc.LoadResource(B_MESSAGE_TYPE, BLocaleRoster::kEmbeddedCatResId, &sz); if (!buf) { log_team(LOG_DEBUG, "file has no catalog-resource"); @@ -416,11 +416,11 @@ // set mimetype-, language- and signature-attributes: UpdateAttributes(catalogFile); // finally write fingerprint: - catalogFile.WriteAttr(BLocaleRoster::kCatFingerprintAttr, B_INT32_TYPE, + catalogFile.WriteAttr(BLocaleRoster::kCatFingerprintAttr, B_INT32_TYPE, 0, &fFingerprint, sizeof(int32)); } if (res == B_OK) - UpdateAttributes(catalogFile); + UpdateAttributes(catalogFile); return res; } @@ -435,7 +435,7 @@ status_t res = node.SetTo(appOrAddOnRef); if (res != B_OK) return res; - + BMallocIO mallocIO; mallocIO.SetBlockSize(max(fCatMap.size()*20, 256UL)); // set a largish block-size in order to avoid reallocs @@ -495,7 +495,7 @@ const char * -DefaultCatalog::GetString(const char *string, const char *context, +DefaultCatalog::GetString(const char *string, const char *context, const char *comment) { CatKey key(string, context, comment); @@ -523,7 +523,7 @@ status_t -DefaultCatalog::SetString(const char *string, const char *translated, +DefaultCatalog::SetString(const char *string, const char *translated, const char *context, const char *comment) { CatKey key(string, context, comment); @@ -590,19 +590,19 @@ char buf[bufSize]; if (catalogFile.ReadAttr("BEOS:TYPE", B_MIME_STRING_TYPE, 0, &buf, bufSize) <= 0 || strcmp(kCatMimeType, buf) != 0) { - catalogFile.WriteAttr("BEOS:TYPE", B_MIME_STRING_TYPE, 0, + catalogFile.WriteAttr("BEOS:TYPE", B_MIME_STRING_TYPE, 0, kCatMimeType, strlen(kCatMimeType)+1); } - if (catalogFile.ReadAttr(BLocaleRoster::kCatLangAttr, B_STRING_TYPE, 0, + if (catalogFile.ReadAttr(BLocaleRoster::kCatLangAttr, B_STRING_TYPE, 0, &buf, bufSize) <= 0 || fLanguageName != buf) { - catalogFile.WriteAttr(BLocaleRoster::kCatLangAttr, B_STRING_TYPE, 0, + catalogFile.WriteAttr(BLocaleRoster::kCatLangAttr, B_STRING_TYPE, 0, fLanguageName.String(), fLanguageName.Length()+1); } - if (catalogFile.ReadAttr(BLocaleRoster::kCatSigAttr, B_STRING_TYPE, 0, + if (catalogFile.ReadAttr(BLocaleRoster::kCatSigAttr, B_STRING_TYPE, 0, &buf, bufSize) <= 0 || fSignature != buf) { - catalogFile.WriteAttr(BLocaleRoster::kCatSigAttr, B_STRING_TYPE, 0, + catalogFile.WriteAttr(BLocaleRoster::kCatSigAttr, B_STRING_TYPE, 0, fSignature.String(), fSignature.Length()+1); } } @@ -647,7 +647,7 @@ int16 version; BMessage archiveMsg; status_t res = archiveMsg.Unflatten(dataIO); - + if (res == B_OK) { res = archiveMsg.FindInt16("c:ver", &version) || archiveMsg.FindInt32("c:sz", &count); @@ -660,7 +660,7 @@ // if a specific fingerprint has been requested and the catalog does in fact // have a fingerprint, both are compared. If they mismatch, we do not accept // this catalog: - if (foundFingerprint != 0 && fFingerprint != 0 + if (foundFingerprint != 0 && fFingerprint != 0 && foundFingerprint != fFingerprint) { log_team(LOG_INFO, "default-catalog(sig=%s, lang=%s) " "has mismatching fingerprint (%ld instead of the requested %ld), " @@ -706,7 +706,7 @@ BCatalogAddOn * -DefaultCatalog::Instantiate(const char *signature, const char *language, +DefaultCatalog::Instantiate(const char *signature, const char *language, int32 fingerprint) { DefaultCatalog *catalog = new DefaultCatalog(signature, language, fingerprint); Modified: haiku/trunk/src/kits/locale/GenericNumberFormat.cpp =================================================================== --- haiku/trunk/src/kits/locale/GenericNumberFormat.cpp 2009-05-02 13:36:49 UTC (rev 30565) +++ haiku/trunk/src/kits/locale/GenericNumberFormat.cpp 2009-05-02 13:44:35 UTC (rev 30566) @@ -8,6 +8,8 @@ #include #include +using namespace std; + // constants (more below the helper classes) static const int kMaxIntDigitCount = 20; // int64: 19 + sign, uint64: 20 @@ -98,7 +100,8 @@ // unset old Unset(); // set new - if (!separators && separatorCount <= 0 || !sizes && sizeCount <= 0) + if ((!separators && separatorCount <= 0) + || (!sizes && sizeCount <= 0)) return B_OK; // allocate arrays fSeparators = new(nothrow) Symbol[separatorCount]; @@ -157,8 +160,8 @@ for (int i = fSizeCount - 1; i >= 0; i--) { if (fSumSizes[i] <= position) { if (fSumSizes[i] == position - || i == fSizeCount - 1 - && (position - fSumSizes[i]) % fSizes[i] == 0) { + || (i == fSizeCount - 1 + && (position - fSumSizes[i]) % fSizes[i] == 0)) { return fSumSeparators[i]; } return NULL; @@ -407,12 +410,14 @@ // constants // digit symbols -static const BGenericNumberFormat::Symbol kDefaultDigitSymbols[] = { - "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" -}; +const BGenericNumberFormat::Symbol + BGenericNumberFormat::kDefaultDigitSymbols[] = { + "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" + }; // decimal separator symbol -static const BGenericNumberFormat::Symbol kDefaultFractionSeparator = "."; +const BGenericNumberFormat::Symbol + BGenericNumberFormat::kDefaultFractionSeparator = "."; // grouping separator symbols static const char *kDefaultGroupingSeparators[] = { "," }; @@ -429,53 +434,61 @@ static const int32 kNoGroupingSizeCount = 0; // grouping info -static const BGenericNumberFormat::GroupingInfo kDefaultGroupingInfo( - kDefaultGroupingSeparators, kDefaultGroupingSeparatorCount, - kDefaultGroupingSizes, kDefaultGroupingSizeCount -); -static const BGenericNumberFormat::GroupingInfo kNoGroupingInfo( - kNoGroupingSeparators, kNoGroupingSeparatorCount, - kNoGroupingSizes, kNoGroupingSizeCount -); +const BGenericNumberFormat::GroupingInfo + BGenericNumberFormat::kDefaultGroupingInfo( + kDefaultGroupingSeparators, kDefaultGroupingSeparatorCount, + kDefaultGroupingSizes, kDefaultGroupingSizeCount + ); +const BGenericNumberFormat::GroupingInfo + BGenericNumberFormat::kNoGroupingInfo( + kNoGroupingSeparators, kNoGroupingSeparatorCount, + kNoGroupingSizes, kNoGroupingSizeCount + ); // exponent symbol -static const BGenericNumberFormat::Symbol kDefaultExponentSymbol = "e"; -static const BGenericNumberFormat::Symbol kDefaultUpperCaseExponentSymbol - = "E"; +const BGenericNumberFormat::Symbol + BGenericNumberFormat::kDefaultExponentSymbol = "e"; +const BGenericNumberFormat::Symbol + BGenericNumberFormat::kDefaultUpperCaseExponentSymbol = "E"; // NaN symbol -static const BGenericNumberFormat::Symbol kDefaultNaNSymbol = "NaN"; -static const BGenericNumberFormat::Symbol kDefaultUpperCaseNaNSymbol = "NaN"; +const BGenericNumberFormat::Symbol + BGenericNumberFormat::kDefaultNaNSymbol = "NaN"; +const BGenericNumberFormat::Symbol + BGenericNumberFormat::kDefaultUpperCaseNaNSymbol = "NaN"; // infinity symbol -static const BGenericNumberFormat::Symbol kDefaultInfinitySymbol - = "infinity"; -static const BGenericNumberFormat::Symbol kDefaultUpperCaseInfinitySymbol - = "INFINITY"; +const BGenericNumberFormat::Symbol + BGenericNumberFormat::kDefaultInfinitySymbol = "infinity"; +const BGenericNumberFormat::Symbol + BGenericNumberFormat::kDefaultUpperCaseInfinitySymbol = "INFINITY"; // negative infinity symbol -static const BGenericNumberFormat::Symbol kDefaultNegativeInfinitySymbol - = "-infinity"; -static const BGenericNumberFormat::Symbol - kDefaultUpperCaseNegativeInfinitySymbol = "-INFINITY"; +const BGenericNumberFormat::Symbol + BGenericNumberFormat::kDefaultNegativeInfinitySymbol = "-infinity"; +const BGenericNumberFormat::Symbol + BGenericNumberFormat::kDefaultUpperCaseNegativeInfinitySymbol = "-INFINITY"; // sign symbols -static const BGenericNumberFormat::SignSymbols kDefaultSignSymbols( - "+", "-", " ", "", // prefixes - "", "", "", "" // suffixes -); +const BGenericNumberFormat::SignSymbols + BGenericNumberFormat::kDefaultSignSymbols( + "+", "-", " ", "", // prefixes + "", "", "", "" // suffixes + ); // mantissa sign symbols -static const BGenericNumberFormat::SignSymbols kDefaultMantissaSignSymbols( - "", "", "", "", // prefixes - "", "", "", "" // suffixes -); +const BGenericNumberFormat::SignSymbols + BGenericNumberFormat::kDefaultMantissaSignSymbols( + "", "", "", "", // prefixes + "", "", "", "" // suffixes + ); // exponent sign symbols -static const BGenericNumberFormat::SignSymbols kDefaultExponentSignSymbols( - "+", "-", " ", "", // prefixes - "", "", "", "" // suffixes -); +const BGenericNumberFormat::SignSymbols + BGenericNumberFormat::kDefaultExponentSignSymbols( + "+", "-", " ", "", // prefixes + "", "", "", "" // suffixes + ); // Integer @@ -786,7 +799,7 @@ // integer part int32 existingIntegerDigits = min(integerDigits, digitCount); for (int i = 0; i < existingIntegerDigits; i++) - writer.Append(digitSymbols[digits[digitCount - i - 1]]); + writer.Append(digitSymbols[(int)digits[digitCount - i - 1]]); // pad with zeros to get the desired number of integer digits if (existingIntegerDigits < integerDigits) { writer.Append(digitSymbols, @@ -801,7 +814,7 @@ int32 existingFractionDigits = min(digitCount - integerDigits, fractionDigits); for (int i = existingFractionDigits - 1; i >= 0; i--) - writer.Append(digitSymbols[digits[i]]); + writer.Append(digitSymbols[(int)digits[i]]); // pad with zeros to get the desired number of fraction digits if (fractionDigits > existingFractionDigits) { writer.Append(digitSymbols, @@ -888,7 +901,7 @@ for (int i = existingIntegerDigits - 1; i >= 0; i--) { if (i != integerDigits - 1) writer.Append(groupingInfo->SeparatorForDigit(i)); - writer.Append(digitSymbols[digits[ + writer.Append(digitSymbols[(int)digits[ digitCount - existingIntegerDigits + i]]); } } else { @@ -899,8 +912,10 @@ integerDigits - existingIntegerDigits); } // write digits - for (int i = 0; i < existingIntegerDigits; i++) - writer.Append(digitSymbols[digits[digitCount - i - 1]]); + for (int i = 0; i < existingIntegerDigits; i++) { + writer.Append( + digitSymbols[(int)digits[digitCount - i - 1]]); + } } // fraction part if (fractionDigits > 0 || forceFractionSeparator) @@ -908,7 +923,7 @@ int32 existingFractionDigits = min(digitCount - existingIntegerDigits, fractionDigits); for (int i = existingFractionDigits - 1; i >= 0; i--) - writer.Append(digitSymbols[digits[i]]); + writer.Append(digitSymbols[(int)digits[i]]); // pad with zeros to get the desired number of fraction digits if (fractionDigits > existingFractionDigits) { writer.Append(digitSymbols, Modified: haiku/trunk/src/kits/locale/Language.cpp =================================================================== --- haiku/trunk/src/kits/locale/Language.cpp 2009-05-02 13:36:49 UTC (rev 30565) +++ haiku/trunk/src/kits/locale/Language.cpp 2009-05-02 13:44:35 UTC (rev 30566) @@ -1,4 +1,4 @@ -/* +/* ** Copyright 2003, Axel D??rfler, axeld at pinc-software.de. All rights reserved. ** Distributed under the terms of the OpenBeOS License. */ @@ -15,12 +15,12 @@ #include -static char *gBuiltInStrings[] = { +static const char *gBuiltInStrings[] = { "Yesterday", "Today", "Tomorrow", "Future", - + "Sunday", "Monday", "Tuesday", @@ -28,7 +28,7 @@ "Thursday", "Friday", "Saturday", - + "Sun", "Mon", "Tue", @@ -36,7 +36,7 @@ "Thu", "Fri", "Sat", - + "January", "February", "March", @@ -49,7 +49,7 @@ "October", "November", "December", - + "Jan", "Feb", "Mar", @@ -62,7 +62,7 @@ "Oct", "Nov", "Dec", - + "^[yY]", "^[nN]", "yes", @@ -130,7 +130,7 @@ break; *family++ = '\0'; - // set the direction of writing + // set the direction of writing char *direction = strchr(family, ','); if (direction != NULL) { *direction++ = '\0'; @@ -158,7 +158,7 @@ if (string == NULL) continue; - fStrings[count++] = string; + fStrings[count++] = string; } } @@ -171,7 +171,7 @@ BLanguage::~BLanguage() { - if (fName != NULL) + if (fName != NULL) free(fName); if (fCode != NULL) free(fCode); @@ -198,7 +198,7 @@ } -uint8 +uint8 BLanguage::Direction() const { return fDirection; Modified: haiku/trunk/src/kits/locale/langinfo.cpp =================================================================== --- haiku/trunk/src/kits/locale/langinfo.cpp 2009-05-02 13:36:49 UTC (rev 30565) +++ haiku/trunk/src/kits/locale/langinfo.cpp 2009-05-02 13:44:35 UTC (rev 30566) @@ -1,4 +1,4 @@ -/* +/* ** Copyright 2003, Axel D??rfler, axeld at pinc-software.de. All rights reserved. ** Distributed under the terms of the OpenBeOS License. */ @@ -14,7 +14,7 @@ if (be_locale != NULL) be_locale->GetString(id); - // ToDo: return default values! - return ""; + // ToDo: return default values! + return (char*)""; } Modified: haiku/trunk/src/tests/kits/locale/catalogTest.cpp =================================================================== --- haiku/trunk/src/tests/kits/locale/catalogTest.cpp 2009-05-02 13:36:49 UTC (rev 30565) +++ haiku/trunk/src/tests/kits/locale/catalogTest.cpp 2009-05-02 13:44:35 UTC (rev 30566) @@ -1,4 +1,4 @@ -/* +/* ** Copyright 2003, Oliver Tappe, zooey at hirschkaefer.de. All rights reserved. ** Distributed under the terms of the OpenBeOS License. */ @@ -27,8 +27,8 @@ #define catSig "x-vnd.Be.locale.catalogTest" #define catName catSig".catalog" -void -CatalogTest::Run() +void +CatalogTest::Run() { printf("app..."); status_t res; @@ -46,12 +46,12 @@ res = cata.SetString("string", "Schnur", TR_CONTEXT); assert(res == B_OK); res = cata.SetString(hashVal, "Schnur_id"); - // add a second entry for the same hash-value, but with different + // add a second entry for the same hash-value, but with different // translation assert(res == B_OK); res = cata.SetString("string", "String", "programming"); assert(res == B_OK); - res = cata.SetString("string", "Textpuffer", "programming", + res = cata.SetString("string", "Textpuffer", "programming", "Deutsches Fachbuch"); assert(res == B_OK); res = cata.SetString("string", "Leine", TR_CONTEXT, "Deutsches Fachbuch"); @@ -80,7 +80,7 @@ // the following id is unique to the embedded catalog: res = catb.SetString(32, "hashed string"); assert(res == B_OK); - // the following string will be hidden by the definition inside the + // the following string will be hidden by the definition inside the // german catalog: res = catb.SetString("string", "hidden", TR_CONTEXT); assert(res == B_OK); @@ -96,8 +96,8 @@ } -void -CatalogTest::Check() +void +CatalogTest::Check() { status_t res; printf("app-check..."); @@ -106,13 +106,13 @@ size_t hashVal = CatKey::HashFun(s.String()); // ok, we now try to re-load the catalog that has just been written: // - // actually, the following code can be seen as an example of what an + // actually, the following code can be seen as an example of what an // app needs in order to translate strings: BCatalog cat; res = be_locale->GetAppCatalog(&cat); assert(res == B_OK); // fetch basic data: - int32 fingerprint; + int32 fingerprint = 0; res = cat.GetFingerprint(&fingerprint); assert(res == B_OK); BString lang; @@ -140,7 +140,7 @@ // the following id doesn't exist anywhere (hopefully): s = TR_ID(-1); assert(s == ""); - // the following string exists twice, in the embedded as well as in the + // the following string exists twice, in the embedded as well as in the // external catalog. So we should get the external translation (as it should // override the embedded one): s = TR("string"); @@ -163,9 +163,9 @@ int main(int argc, char **argv) { - BApplication* testApp + BApplication* testApp = new BApplication("application/"catSig); - + // change to app-folder: app_info appInfo; be_app->GetAppInfo(&appInfo); Modified: haiku/trunk/src/tests/kits/locale/localeTest.cpp =================================================================== --- haiku/trunk/src/tests/kits/locale/localeTest.cpp 2009-05-02 13:36:49 UTC (rev 30565) +++ haiku/trunk/src/tests/kits/locale/localeTest.cpp 2009-05-02 13:44:35 UTC (rev 30566) @@ -31,7 +31,7 @@ BUnicodeChar::IsUpper(i), BUnicodeChar::IsDefined(i), BUnicodeChar::Type(i)); } - uint32 chars[] = {(uint8)'?', (uint8)'?', (uint8)'?', (uint8)'?', (uint8)'?', (uint8)'?', 0}; + uint32 chars[] = {(uint8)'???', (uint8)'???', (uint8)'???', (uint8)'???', (uint8)'???', (uint8)'???', 0}; for (int32 j = 0, i; (i = chars[j]) != 0; j++) { unicode_char_to_string(i, text); printf("%s: alpha == %d, alNum == %d, lower == %d, upper == %d, defined == %d, charType == %d\n", @@ -45,7 +45,7 @@ printf("toLower == %s\n", text); } - char *utf8chars[] = {"??", "??", "??", "??", "??", "??", NULL}; + const char *utf8chars[] = {"??", "??", "??", "??", "??", "??", NULL}; for (int32 j = 0, i; (i = BUnicodeChar::FromUTF8(utf8chars[j])) != 0; j++) { unicode_char_to_string(i, text); printf("%s: alpha == %d, alNum == %d, lower == %d, upper == %d, defined == %d, charType == %d\n", @@ -63,9 +63,9 @@ // Test BCollator class BCollator *collator = be_locale->Collator(); - char *strings[] = {"gehen", "g??hen", "aus", "??U??", "auss", "??U??", "WO", + const char *strings[] = {"gehen", "g??hen", "aus", "??U??", "auss", "??U??", "WO", "w??", "SO", "so", "a????", "acn", NULL}; - char *strengths[] = {"primary: ", "secondary:", "tertiary: "}; + const char *strengths[] = {"primary: ", "secondary:", "tertiary: "}; for (int32 i = 0; strings[i]; i += 2) { for (int32 strength = B_COLLATE_PRIMARY; strength < 4; strength++) { BString a, b; From revol at free.fr Sat May 2 15:48:25 2009 From: revol at free.fr (=?utf-8?q?Fran=C3=A7ois?= Revol) Date: Sat, 02 May 2009 15:48:25 +0200 CEST Subject: [Haiku-commits] r30559 - haiku/trunk/data/artwork/icons In-Reply-To: <200905021102.n42B2wWY005355@sheep.berlios.de> Message-ID: <1929062564-BeMail@laptop> > Author: stippi > Date: 2009-05-02 13:02:56 +0200 (Sat, 02 May 2009) > New Revision: 30559 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30559&view=rev > > Added: > haiku/trunk/data/artwork/icons/Server_Bluetooth > Log: > Icon by Mark Erben, small tweaks by myself. Thanks a lot! Btw, I'd make use of a networked volume icon for NFS now that it's fixed ;) Fran?ois. From zooey at mail.berlios.de Sat May 2 16:20:40 2009 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Sat, 2 May 2009 16:20:40 +0200 Subject: [Haiku-commits] r30567 - haiku/trunk/headers/os/locale Message-ID: <200905021420.n42EKepk013724@sheep.berlios.de> Author: zooey Date: 2009-05-02 16:20:40 +0200 (Sat, 02 May 2009) New Revision: 30567 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30567&view=rev Modified: haiku/trunk/headers/os/locale/DefaultCatalog.h Log: * removed codewarrior-specific compatibility cruft Modified: haiku/trunk/headers/os/locale/DefaultCatalog.h =================================================================== --- haiku/trunk/headers/os/locale/DefaultCatalog.h 2009-05-02 13:44:35 UTC (rev 30566) +++ haiku/trunk/headers/os/locale/DefaultCatalog.h 2009-05-02 14:20:40 UTC (rev 30567) @@ -1,14 +1,10 @@ #ifndef _DEFAULT_CATALOG_H_ #define _DEFAULT_CATALOG_H_ -#ifdef __MWERKS__ -# include -#else -# if __GNUC__ > 2 +#if __GNUC__ > 2 # include -# else +#else # include -# endif #endif #include @@ -23,17 +19,6 @@ struct CatKey; } -/* - * the hash-access functor which is being used to access the hash-value - * stored inside of each key. - */ -#ifdef __MWERKS__ - // Codewarrior doesn't provide this declaration, so we do: -template struct hash : public unary_function { - size_t operator() (const T &key) const; -}; -#endif - #if __GNUC__ > 2 namespace __gnu_cxx { #endif // __GNUC__ > 2 From zooey at mail.berlios.de Sat May 2 16:28:33 2009 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Sat, 2 May 2009 16:28:33 +0200 Subject: [Haiku-commits] r30568 - in haiku/trunk: headers/os/locale src/bin/locale src/kits/locale Message-ID: <200905021428.n42ESXbQ014427@sheep.berlios.de> Author: zooey Date: 2009-05-02 16:28:32 +0200 (Sat, 02 May 2009) New Revision: 30568 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30568&view=rev Modified: haiku/trunk/headers/os/locale/DefaultCatalog.h haiku/trunk/src/bin/locale/linkcatkeys.cpp haiku/trunk/src/kits/locale/DefaultCatalog.cpp Log: * followed advice by Rene to explicitly import the used std-classes instead of simply importing the whole namespace - thanks for proofreading! Modified: haiku/trunk/headers/os/locale/DefaultCatalog.h =================================================================== --- haiku/trunk/headers/os/locale/DefaultCatalog.h 2009-05-02 14:20:40 UTC (rev 30567) +++ haiku/trunk/headers/os/locale/DefaultCatalog.h 2009-05-02 14:28:32 UTC (rev 30568) @@ -31,11 +31,11 @@ #if __GNUC__ > 2 } // namespace __gnu_cxx -using namespace __gnu_cxx; +using __gnu_cxx::hash; +using __gnu_cxx::hash_map; +using __gnu_cxx::equal_to; #endif // __GNUC__ > 2 -using namespace std; - namespace BPrivate { /* Modified: haiku/trunk/src/bin/locale/linkcatkeys.cpp =================================================================== --- haiku/trunk/src/bin/locale/linkcatkeys.cpp 2009-05-02 14:20:40 UTC (rev 30567) +++ haiku/trunk/src/bin/locale/linkcatkeys.cpp 2009-05-02 14:28:32 UTC (rev 30568) @@ -1,4 +1,4 @@ -/* +/* ** Copyright 2003, Oliver Tappe, zooey at hirschkaefer.de. All rights reserved. ** Distributed under the terms of the OpenBeOS License. */ @@ -13,8 +13,10 @@ #include #include +using std::vector; + void -usage() +usage() { fprintf(stderr, "usage: linkcatkeys [-v] [-t(a|f|r)] [-o ] [-l ]\n" @@ -80,17 +82,17 @@ } if (inputFiles.empty() || !catalogSig || !outputFile.Length()) usage(); - + EditableCatalog targetCatalog("Default", catalogSig, catalogLang); if ((res = targetCatalog.InitCheck()) != B_OK) { - fprintf(stderr, "couldn't construct target-catalog %s - error: %s\n", + fprintf(stderr, "couldn't construct target-catalog %s - error: %s\n", outputFile.String(), strerror(res)); exit(-1); } DefaultCatalog* targetCatImpl = dynamic_cast(targetCatalog.CatalogAddOn()); if (!targetCatImpl) { - fprintf(stderr, "couldn't access impl of target-catalog %s\n", + fprintf(stderr, "couldn't access impl of target-catalog %s\n", outputFile.String()); exit(-1); } @@ -99,14 +101,14 @@ for( uint32 i=0; i(inputCatalog.CatalogAddOn()); if (!inputCatImpl) { - fprintf(stderr, "couldn't access impl of input-catalog %s\n", + fprintf(stderr, "couldn't access impl of input-catalog %s\n", inputFiles[i]); exit(-1); } @@ -116,7 +118,7 @@ // but this should be fast enough). DefaultCatalog::CatWalker walker; if ((res = inputCatImpl->GetWalker(&walker)) != B_OK) { - fprintf(stderr, "couldn't get walker for input-catalog %s - error: %s\n", + fprintf(stderr, "couldn't get walker for input-catalog %s - error: %s\n", inputFiles[i], strerror(res)); exit(-1); } @@ -135,7 +137,7 @@ entry.GetRef(&eref); res = targetCatalog.WriteToAttribute(&eref); if (res != B_OK) { - fprintf(stderr, "couldn't write target-attribute to %s - error: %s\n", + fprintf(stderr, "couldn't write target-attribute to %s - error: %s\n", outputFile.String(), strerror(res)); exit(-1); } @@ -147,7 +149,7 @@ entry.GetRef(&eref); res = targetCatalog.WriteToResource(&eref); if (res != B_OK) { - fprintf(stderr, "couldn't write target-resource to %s - error: %s\n", + fprintf(stderr, "couldn't write target-resource to %s - error: %s\n", outputFile.String(), strerror(res)); exit(-1); } @@ -155,7 +157,7 @@ default: { res = targetCatalog.WriteToFile(outputFile.String()); if (res != B_OK) { - fprintf(stderr, "couldn't write target-catalog to %s - error: %s\n", + fprintf(stderr, "couldn't write target-catalog to %s - error: %s\n", outputFile.String(), strerror(res)); exit(-1); } Modified: haiku/trunk/src/kits/locale/DefaultCatalog.cpp =================================================================== --- haiku/trunk/src/kits/locale/DefaultCatalog.cpp 2009-05-02 14:20:40 UTC (rev 30567) +++ haiku/trunk/src/kits/locale/DefaultCatalog.cpp 2009-05-02 14:28:32 UTC (rev 30568) @@ -24,6 +24,12 @@ #include +using std::auto_ptr; +using std::min; +using std::max; +using std::pair; + + /* * This file implements the default catalog-type for the opentracker locale kit. * Alternatively, this could be used as a full add-on, but currently this From anevilyak at mail.berlios.de Sat May 2 16:45:56 2009 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Sat, 2 May 2009 16:45:56 +0200 Subject: [Haiku-commits] r30569 - haiku/trunk/src/add-ons/media/plugins/asf_reader Message-ID: <200905021445.n42Eju8B016238@sheep.berlios.de> Author: anevilyak Date: 2009-05-02 16:45:56 +0200 (Sat, 02 May 2009) New Revision: 30569 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30569&view=rev Modified: haiku/trunk/src/add-ons/media/plugins/asf_reader/ASFIndex.cpp Log: gcc4 build fix. Modified: haiku/trunk/src/add-ons/media/plugins/asf_reader/ASFIndex.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/asf_reader/ASFIndex.cpp 2009-05-02 14:28:32 UTC (rev 30568) +++ haiku/trunk/src/add-ons/media/plugins/asf_reader/ASFIndex.cpp 2009-05-02 14:45:56 UTC (rev 30569) @@ -25,6 +25,8 @@ #include "ASFIndex.h" +#include + void IndexEntry::Clear() { From anevilyak at mail.berlios.de Sat May 2 16:52:54 2009 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Sat, 2 May 2009 16:52:54 +0200 Subject: [Haiku-commits] r30570 - in haiku/trunk: headers/os/locale src/kits/locale Message-ID: <200905021452.n42Eqsmr016784@sheep.berlios.de> Author: anevilyak Date: 2009-05-02 16:52:54 +0200 (Sat, 02 May 2009) New Revision: 30570 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30570&view=rev Modified: haiku/trunk/headers/os/locale/DefaultCatalog.h haiku/trunk/src/kits/locale/DefaultCatalog.cpp haiku/trunk/src/kits/locale/GenericNumberFormat.cpp Log: Move using directives into the cpp files so they don't leak into apps making use of the locale kit. Modified: haiku/trunk/headers/os/locale/DefaultCatalog.h =================================================================== --- haiku/trunk/headers/os/locale/DefaultCatalog.h 2009-05-02 14:45:56 UTC (rev 30569) +++ haiku/trunk/headers/os/locale/DefaultCatalog.h 2009-05-02 14:52:54 UTC (rev 30570) @@ -30,10 +30,6 @@ #if __GNUC__ > 2 } // namespace __gnu_cxx - -using __gnu_cxx::hash; -using __gnu_cxx::hash_map; -using __gnu_cxx::equal_to; #endif // __GNUC__ > 2 namespace BPrivate { @@ -125,7 +121,13 @@ int32 ComputeFingerprint() const; void UpdateAttributes(BFile& catalogFile); - typedef hash_map, equal_to > CatMap; +#if __GNUC__ > 2 + typedef __gnu_cxx::hash_map, std::equal_to > CatMap; +#else + typedef hash_map, + std::equal_to > CatMap; +#endif CatMap fCatMap; mutable BString fPath; Modified: haiku/trunk/src/kits/locale/DefaultCatalog.cpp =================================================================== --- haiku/trunk/src/kits/locale/DefaultCatalog.cpp 2009-05-02 14:45:56 UTC (rev 30569) +++ haiku/trunk/src/kits/locale/DefaultCatalog.cpp 2009-05-02 14:52:54 UTC (rev 30570) @@ -24,6 +24,7 @@ #include +using __gnu_cxx::hash; using std::auto_ptr; using std::min; using std::max; Modified: haiku/trunk/src/kits/locale/GenericNumberFormat.cpp =================================================================== --- haiku/trunk/src/kits/locale/GenericNumberFormat.cpp 2009-05-02 14:45:56 UTC (rev 30569) +++ haiku/trunk/src/kits/locale/GenericNumberFormat.cpp 2009-05-02 14:52:54 UTC (rev 30570) @@ -8,7 +8,11 @@ #include #include -using namespace std; +#if __GNUC__ > 2 +using std::max; +using std::min; +using std::nothrow; +#endif // constants (more below the helper classes) From zooey at mail.berlios.de Sat May 2 16:58:42 2009 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Sat, 2 May 2009 16:58:42 +0200 Subject: [Haiku-commits] r30571 - haiku/trunk/src/kits/locale Message-ID: <200905021458.n42EwgHH017604@sheep.berlios.de> Author: zooey Date: 2009-05-02 16:58:41 +0200 (Sat, 02 May 2009) New Revision: 30571 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30571&view=rev Modified: haiku/trunk/src/kits/locale/DefaultCatalog.cpp Log: fix gcc2 build: * __gnu_cxx namespace is unknown to gcc2 Modified: haiku/trunk/src/kits/locale/DefaultCatalog.cpp =================================================================== --- haiku/trunk/src/kits/locale/DefaultCatalog.cpp 2009-05-02 14:52:54 UTC (rev 30570) +++ haiku/trunk/src/kits/locale/DefaultCatalog.cpp 2009-05-02 14:58:41 UTC (rev 30571) @@ -24,7 +24,10 @@ #include +#if __GCC__ > 2 using __gnu_cxx::hash; +#endif + using std::auto_ptr; using std::min; using std::max; From zooey at mail.berlios.de Sat May 2 17:00:45 2009 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Sat, 2 May 2009 17:00:45 +0200 Subject: [Haiku-commits] r30572 - haiku/trunk/src/kits/locale Message-ID: <200905021500.n42F0jM8018040@sheep.berlios.de> Author: zooey Date: 2009-05-02 17:00:44 +0200 (Sat, 02 May 2009) New Revision: 30572 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30572&view=rev Modified: haiku/trunk/src/kits/locale/DefaultCatalog.cpp Log: err, fix for my fix: * its __GNUC__, not __GCC__, tsk! Modified: haiku/trunk/src/kits/locale/DefaultCatalog.cpp =================================================================== --- haiku/trunk/src/kits/locale/DefaultCatalog.cpp 2009-05-02 14:58:41 UTC (rev 30571) +++ haiku/trunk/src/kits/locale/DefaultCatalog.cpp 2009-05-02 15:00:44 UTC (rev 30572) @@ -24,7 +24,7 @@ #include -#if __GCC__ > 2 +#if __GNUC__ > 2 using __gnu_cxx::hash; #endif From zooey at mail.berlios.de Sat May 2 17:39:50 2009 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Sat, 2 May 2009 17:39:50 +0200 Subject: [Haiku-commits] r30573 - haiku/trunk/build/jam Message-ID: <200905021539.n42Fdok8022021@sheep.berlios.de> Author: zooey Date: 2009-05-02 17:39:49 +0200 (Sat, 02 May 2009) New Revision: 30573 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30573&view=rev Modified: haiku/trunk/build/jam/HaikuImage Log: * now that it builds for gcc4 and gcc2, added locale kit back to image Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2009-05-02 15:00:44 UTC (rev 30572) +++ haiku/trunk/build/jam/HaikuImage 2009-05-02 15:39:49 UTC (rev 30573) @@ -29,9 +29,10 @@ SYSTEM_BIN = "[" addattr alert arp base64 basename bash bc beep bootman bzip2 cal cat catattr checkfs chgrp chmod chop chown chroot cksum clear - clockconfig cmp comm compress copyattr CortexAddOnHost cp + clockconfig cmp collectcatkeys comm compress copyattr CortexAddOnHost cp csplit ctags cut date dc dd desklink df diff diff3 dircolors dirname - draggers driveinfo dstcheck du echo eject env error expand expr + draggers driveinfo dstcheck du dumpcatalog + echo eject env error expand expr factor false fdinfo ffm filepanel find finddir fmt fold fortune frcode ftp ftpd funzip fwcontrol @@ -39,7 +40,8 @@ id ident ideinfo idestatus ifconfig install installsound iroster isvolume join - keymap kill less lessecho lesskey link listarea listattr listimage listdev + keymap kill less lessecho lesskey link linkcatkeys listarea listattr + listimage listdev listport listres listsem listusb ln locate logger login logname ls lsindex makebootable md5sum merge mimeset mkdos mkdir mkfifo mkfs mkindex modifiers mount mount_nfs mountvolume mv @@ -68,8 +70,8 @@ StyledEdit Terminal TextSearch TV Workspaces ; SYSTEM_PREFERENCES = Appearance Backgrounds CPUFrequency DataTranslations E-mail - FileTypes Fonts Keyboard Keymap Media Menu Mouse Network Printers Screen - ScreenSaver Sounds Time Touchpad Tracker VirtualMemory + FileTypes Fonts Keyboard Keymap Locale Media Menu Mouse Network Printers + Screen ScreenSaver Sounds Time Touchpad Tracker VirtualMemory ; SYSTEM_DEMOS = BSnow Chart Clock Cortex FontDemo GLDirectMode GLTeapot Mandelbrot Pairs @@ -80,7 +82,7 @@ libmail.so libtextencoding.so libz.so libfreetype.so libpng.so libmidi.so libmidi2.so libdevice.so libgame.so libscreensaver.so libroot.so libGL.so libfluidsynth.so liblpsolve55.so liblinprog.so libalm.so - libilmimf.so libiconv.so + libilmimf.so libiconv.so liblocale.so ; SYSTEM_SERVERS = registrar debug_server syslog_daemon media_server net_server media_addon_server input_server app_server fake_app_server @@ -346,6 +348,11 @@ = [ FDirName $(HAIKU_TOP) src apps mail ] ; AddFilesToHaikuImage system etc word_dictionary : $(spellFiles) ; +# Locale kit language files +local languageDir = [ FDirName $(HAIKU_TOP) src data etc locale languages ] ; +local languages = [ Glob $(languageDir) : *.language ] ; +AddFilesToHaikuImage system etc locale languages : $(languages) ; + local etcFiles = bash_completion inputrc profile teapot.data ; etcFiles = $(etcFiles:G=etc) ; SEARCH on $(etcFiles) = [ FDirName $(HAIKU_TOP) data etc ] ; From zooey at mail.berlios.de Sat May 2 17:41:49 2009 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Sat, 2 May 2009 17:41:49 +0200 Subject: [Haiku-commits] r30574 - haiku/trunk/src/tests/kits/locale Message-ID: <200905021541.n42FfnKO022180@sheep.berlios.de> Author: zooey Date: 2009-05-02 17:41:48 +0200 (Sat, 02 May 2009) New Revision: 30574 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30574&view=rev Modified: haiku/trunk/src/tests/kits/locale/collatorSpeed.cpp Log: * fixed one more gcc4 warning Modified: haiku/trunk/src/tests/kits/locale/collatorSpeed.cpp =================================================================== --- haiku/trunk/src/tests/kits/locale/collatorSpeed.cpp 2009-05-02 15:39:49 UTC (rev 30573) +++ haiku/trunk/src/tests/kits/locale/collatorSpeed.cpp 2009-05-02 15:41:48 UTC (rev 30574) @@ -1,4 +1,4 @@ -/* +/* ** Copyright 2003, Axel D?rfler, axeld at pinc-software.de. All rights reserved. ** Distributed under the terms of the OpenBeOS License. */ @@ -119,7 +119,7 @@ if (collator == NULL) { collator = be_locale->Collator(); - addon = "default"; + addon = (char*)"default"; } // test key creation speed From jackburton at mail.berlios.de Sat May 2 18:04:20 2009 From: jackburton at mail.berlios.de (jackburton at mail.berlios.de) Date: Sat, 2 May 2009 18:04:20 +0200 Subject: [Haiku-commits] r30575 - in haiku/trunk: headers/os/drivers src/add-ons/kernel/bus_managers/acpi Message-ID: <200905021604.n42G4Kr8024703@sheep.berlios.de> Author: jackburton Date: 2009-05-02 18:04:15 +0200 (Sat, 02 May 2009) New Revision: 30575 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30575&view=rev Modified: haiku/trunk/headers/os/drivers/ACPI.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_module.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.cpp haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_priv.h Log: get_device_hid() now has a 'size_t bufferLength' parameter, to avoid the risk of buffer overflow Modified: haiku/trunk/headers/os/drivers/ACPI.h =================================================================== --- haiku/trunk/headers/os/drivers/ACPI.h 2009-05-02 15:41:48 UTC (rev 30574) +++ haiku/trunk/headers/os/drivers/ACPI.h 2009-05-02 16:04:15 UTC (rev 30575) @@ -39,7 +39,7 @@ status_t (*get_device)(const char *hid, uint32 index, char *result, size_t resultLength); - status_t (*get_device_hid)(const char *path, char *hid); + status_t (*get_device_hid)(const char *path, char *hid, size_t hidLength); uint32 (*get_object_type)(const char *path); status_t (*get_object)(const char *path, acpi_object_type **_returnValue); Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c 2009-05-02 15:41:48 UTC (rev 30574) +++ haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c 2009-05-02 16:04:15 UTC (rev 30575) @@ -274,7 +274,7 @@ status_t -get_device_hid(const char *path, char *hid) +get_device_hid(const char *path, char *hid, size_t bufferLength) { ACPI_HANDLE handle; ACPI_OBJECT info; @@ -284,6 +284,9 @@ if (AcpiGetHandle(NULL, (ACPI_STRING)path, &handle) != AE_OK) return B_ENTRY_NOT_FOUND; + if (bufferLength < ACPI_DEVICE_ID_LENGTH) + return B_BUFFER_OVERFLOW; + infoBuffer.Pointer = &info; infoBuffer.Length = sizeof(ACPI_OBJECT); info.String.Pointer = hid; Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_module.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_module.c 2009-05-02 15:41:48 UTC (rev 30574) +++ haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_module.c 2009-05-02 16:04:15 UTC (rev 30575) @@ -109,7 +109,7 @@ { NULL } }; - get_device_hid(result, hid); + get_device_hid(result, hid, sizeof(hid)); if (gDeviceManager->register_node(node, ACPI_DEVICE_MODULE_NAME, attrs, NULL, &deviceNode) == B_OK) Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.cpp 2009-05-02 15:41:48 UTC (rev 30574) +++ haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.cpp 2009-05-02 16:04:15 UTC (rev 30575) @@ -107,7 +107,7 @@ break; case ACPI_TYPE_DEVICE: hid[0] = 0; /* zero-terminate string; get_device_hid can (and will) fail! */ - device->acpi->get_device_hid(result, hid); + device->acpi->get_device_hid(result, hid, sizeof(hid)); snprintf(output, sizeof(output), "%s DEVICE (%s)", output, hid); break; case ACPI_TYPE_EVENT: @@ -146,7 +146,6 @@ toWrite++; if (ringBuffer.Lock()) { if (ringBuffer.WritableAmount() < toWrite) { - //dprintf("not enough space\n"); if (!make_space(device, toWrite)) { panic("couldn't make space"); exit_thread(0); @@ -154,7 +153,6 @@ } written = ringBuffer.Write(output, toWrite); - //dprintf("written %ld bytes\n", written); ringBuffer.Unlock(); } @@ -225,38 +223,29 @@ acpi_ns_device_info *device = (acpi_ns_device_info *)_cookie; size_t bytesRead = 0; size_t readable = 0; - //dprintf("acpi_namespace_read(cookie: %p, position: %lld, buffer: %p, size: %ld)\n", - // _cookie, position, buf, *num_bytes); - + RingBuffer &ringBuffer = *device->buffer; if (ringBuffer.Lock()) { readable = ringBuffer.ReadableAmount(); - //dprintf("%ld bytes readable\n", readable); if (readable <= 0) { - //dprintf("acquiring read sem...\n"); ringBuffer.Unlock(); status_t status = acquire_sem_etc(device->read_sem, 1, B_CAN_INTERRUPT, 0); if (status == B_INTERRUPTED) { - //dprintf("read: acquire_sem returned %s\n", strerror(status)); *num_bytes = 0; return status; } - //dprintf("read sem acquired\n"); if (!ringBuffer.Lock()) { - dprintf("read: couldn't acquire lock. bailing\n"); *num_bytes = 0; return B_ERROR; } } - //dprintf("readable %ld\n", ringBuffer.ReadableAmount()); bytesRead = ringBuffer.Read(buf, *num_bytes); ringBuffer.Unlock(); } - //dprintf("read: read %ld bytes\n", bytesRead); if (bytesRead < 0) { *num_bytes = 0; return bytesRead; @@ -275,7 +264,6 @@ static status_t acpi_namespace_write(void* cookie, off_t position, const void* buffer, size_t* num_bytes) { - dprintf("acpi_ns_dump: device_write\n"); *num_bytes = 0; /* tell caller nothing was written */ return B_IO_ERROR; } Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_priv.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_priv.h 2009-05-02 15:41:48 UTC (rev 30574) +++ haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_priv.h 2009-05-02 16:04:15 UTC (rev 30575) @@ -47,7 +47,7 @@ status_t (*get_device)(const char *hid, uint32 index, char *result, size_t resultLength); - status_t (*get_device_hid)(const char *path, char *hid); + status_t (*get_device_hid)(const char *path, char *hid, size_t hidLength); uint32 (*get_object_type)(const char *path); status_t (*get_object)(const char *path, acpi_object_type **_returnValue); @@ -86,7 +86,7 @@ status_t get_device(const char *hid, uint32 index, char *result, size_t resultLength); -status_t get_device_hid(const char *path, char *hid); +status_t get_device_hid(const char *path, char *hid, size_t hidLength); uint32 get_object_type(const char *path); status_t get_object(const char *path, acpi_object_type **return_value); status_t get_object_typed(const char *path, acpi_object_type **return_value, From revol at free.fr Sat May 2 18:17:58 2009 From: revol at free.fr (=?utf-8?q?Fran=C3=A7ois?= Revol) Date: Sat, 02 May 2009 18:17:58 +0200 CEST Subject: [Haiku-commits] r30574 - haiku/trunk/src/tests/kits/locale In-Reply-To: <200905021541.n42FfnKO022180@sheep.berlios.de> Message-ID: <10902343487-BeMail@laptop> > Author: zooey > Date: 2009-05-02 17:41:48 +0200 (Sat, 02 May 2009) > New Revision: 30574 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30574&view=rev > > Modified: > haiku/trunk/src/tests/kits/locale/collatorSpeed.cpp Wow this looks like the name of a videogame ;) Fran?ois. From axeld at pinc-software.de Sat May 2 18:36:35 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Sat, 02 May 2009 18:36:35 +0200 CEST Subject: [Haiku-commits] =?utf-8?q?r30569_-_haiku/trunk/src/add-ons/media/?= =?utf-8?q?plugins/asf=5Freader?= In-Reply-To: <200905021445.n42Eju8B016238@sheep.berlios.de> Message-ID: <28495837634-BeMail@zon> anevilyak at BerliOS wrote: > +#include > + > void > IndexEntry::Clear() Two blank lines... :-) Bye, Axel. From dev at m-phasis.de Sat May 2 18:40:42 2009 From: dev at m-phasis.de (Michael Weirauch) Date: Sat, 2 May 2009 18:40:42 +0200 Subject: [Haiku-commits] r30573 - haiku/trunk/build/jam In-Reply-To: <200905021539.n42Fdok8022021@sheep.berlios.de> References: <200905021539.n42Fdok8022021@sheep.berlios.de> Message-ID: 2009/5/2 zooey at BerliOS : > Author: zooey > Date: 2009-05-02 17:39:49 +0200 (Sat, 02 May 2009) > New Revision: 30573 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30573&view=rev > > Modified: > haiku/trunk/build/jam/HaikuImage > Log: > * now that it builds for gcc4 and gcc2, added locale kit back to image Can it be that $(TARGET_LIBSTDC++) is required in the Jamfile? Getting undefined reference to `std::__throw_bad_alloc()' on gcc4 native install. Michael From mmu_man at mail.berlios.de Sat May 2 19:23:56 2009 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sat, 2 May 2009 19:23:56 +0200 Subject: [Haiku-commits] r30576 - haiku/trunk/src/bin Message-ID: <200905021723.n42HNuP1007922@sheep.berlios.de> Author: mmu_man Date: 2009-05-02 19:23:54 +0200 (Sat, 02 May 2009) New Revision: 30576 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30576&view=rev Modified: haiku/trunk/src/bin/urlwrapper.cpp Log: Actually no need to pass the NULL either... Modified: haiku/trunk/src/bin/urlwrapper.cpp =================================================================== --- haiku/trunk/src/bin/urlwrapper.cpp 2009-05-02 16:04:15 UTC (rev 30575) +++ haiku/trunk/src/bin/urlwrapper.cpp 2009-05-02 17:23:54 UTC (rev 30576) @@ -540,8 +540,7 @@ #ifdef HANDLE_VLC if (u.proto == "mms" || u.proto == "rtp" || u.proto == "rtsp") { args[0] = (char *)u.String(); - args[1] = NULL; - be_roster->Launch(kVLCSig, 2, args); + be_roster->Launch(kVLCSig, 1, args); return; } #endif From stippi at mail.berlios.de Sat May 2 19:31:25 2009 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sat, 2 May 2009 19:31:25 +0200 Subject: [Haiku-commits] r30577 - haiku/trunk/src/tests/servers/app/benchmark Message-ID: <200905021731.n42HVPP8017418@sheep.berlios.de> Author: stippi Date: 2009-05-02 19:31:24 +0200 (Sat, 02 May 2009) New Revision: 30577 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30577&view=rev Modified: haiku/trunk/src/tests/servers/app/benchmark/Benchmark.cpp haiku/trunk/src/tests/servers/app/benchmark/DrawingModeToString.cpp Log: GCC4 build fixes. Modified: haiku/trunk/src/tests/servers/app/benchmark/Benchmark.cpp =================================================================== --- haiku/trunk/src/tests/servers/app/benchmark/Benchmark.cpp 2009-05-02 17:23:54 UTC (rev 30576) +++ haiku/trunk/src/tests/servers/app/benchmark/Benchmark.cpp 2009-05-02 17:31:24 UTC (rev 30577) @@ -5,6 +5,8 @@ #include #include +#include +#include #include #include @@ -137,8 +139,8 @@ argc--; argv++; } - + // find and create the test Test* test = NULL; try { Modified: haiku/trunk/src/tests/servers/app/benchmark/DrawingModeToString.cpp =================================================================== --- haiku/trunk/src/tests/servers/app/benchmark/DrawingModeToString.cpp 2009-05-02 17:23:54 UTC (rev 30576) +++ haiku/trunk/src/tests/servers/app/benchmark/DrawingModeToString.cpp 2009-05-02 17:31:24 UTC (rev 30577) @@ -5,6 +5,9 @@ #include "DrawingModeToString.h" +#include + + struct DrawingModeString { const char* string; drawing_mode mode; From anevilyak at mail.berlios.de Sat May 2 19:42:15 2009 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Sat, 2 May 2009 19:42:15 +0200 Subject: [Haiku-commits] r30578 - haiku/trunk/src/add-ons/media/plugins/asf_reader Message-ID: <200905021742.n42HgF1h000567@sheep.berlios.de> Author: anevilyak Date: 2009-05-02 19:42:13 +0200 (Sat, 02 May 2009) New Revision: 30578 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30578&view=rev Modified: haiku/trunk/src/add-ons/media/plugins/asf_reader/ASFIndex.cpp Log: If I owed Axel a beer for every style violation, I'd quite likely be bankrupt by now... Modified: haiku/trunk/src/add-ons/media/plugins/asf_reader/ASFIndex.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/asf_reader/ASFIndex.cpp 2009-05-02 17:31:24 UTC (rev 30577) +++ haiku/trunk/src/add-ons/media/plugins/asf_reader/ASFIndex.cpp 2009-05-02 17:42:13 UTC (rev 30578) @@ -27,6 +27,7 @@ #include + void IndexEntry::Clear() { From axeld at mail.berlios.de Sat May 2 19:43:55 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sat, 2 May 2009 19:43:55 +0200 Subject: [Haiku-commits] r30579 - haiku/trunk/src/servers/app Message-ID: <200905021743.n42Hht7s009248@sheep.berlios.de> Author: axeld Date: 2009-05-02 19:43:54 +0200 (Sat, 02 May 2009) New Revision: 30579 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30579&view=rev Modified: haiku/trunk/src/servers/app/Desktop.cpp haiku/trunk/src/servers/app/ServerWindow.cpp Log: * The direct connection update in ServerWindow::{_Show()|_Hide()} is superfluous since Korli's change in r30440. * 80 character per line limit. Modified: haiku/trunk/src/servers/app/Desktop.cpp =================================================================== --- haiku/trunk/src/servers/app/Desktop.cpp 2009-05-02 17:42:13 UTC (rev 30578) +++ haiku/trunk/src/servers/app/Desktop.cpp 2009-05-02 17:43:54 UTC (rev 30579) @@ -1898,7 +1898,8 @@ } else MarkDirty(dirty); - window->ServerWindow()->HandleDirectConnection(B_DIRECT_START | B_BUFFER_RESET); + window->ServerWindow()->HandleDirectConnection( + B_DIRECT_START | B_BUFFER_RESET); } Modified: haiku/trunk/src/servers/app/ServerWindow.cpp =================================================================== --- haiku/trunk/src/servers/app/ServerWindow.cpp 2009-05-02 17:42:13 UTC (rev 30578) +++ haiku/trunk/src/servers/app/ServerWindow.cpp 2009-05-02 17:43:54 UTC (rev 30579) @@ -385,9 +385,6 @@ fDesktop->UnlockSingleWindow(); fDesktop->ShowWindow(fWindow); fDesktop->LockSingleWindow(); - - if (fDirectWindowData != NULL) - HandleDirectConnection(B_DIRECT_START | B_BUFFER_RESET); } @@ -397,15 +394,11 @@ void ServerWindow::_Hide() { - // NOTE: if you do something else, other than sending a port message, PLEASE lock STRACE(("ServerWindow %s: _Hide\n", Title())); if (fWindow->IsHidden() || fWindow->IsOffscreenWindow()) return; - if (fDirectWindowData != NULL) - HandleDirectConnection(B_DIRECT_STOP); - fDesktop->UnlockSingleWindow(); fDesktop->HideWindow(fWindow); fDesktop->LockSingleWindow(); From superstippi at gmx.de Sat May 2 19:49:23 2009 From: superstippi at gmx.de (Stephan Assmus) Date: Sat, 02 May 2009 19:49:23 +0200 Subject: [Haiku-commits] r30578 - haiku/trunk/src/add-ons/media/plugins/asf_reader In-Reply-To: <200905021742.n42HgF1h000567@sheep.berlios.de> References: <200905021742.n42HgF1h000567@sheep.berlios.de> Message-ID: <20090502194923.585.1@bepc.1241285607.fake> On 2009-05-02 at 19:47:50 [+0200], anevilyak at BerliOS wrote: > Author: anevilyak > Date: 2009-05-02 19:42:13 +0200 (Sat, 02 May 2009) New Revision: 30578 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30578&view=rev > > Modified: > haiku/trunk/src/add-ons/media/plugins/asf_reader/ASFIndex.cpp > Log: > If I owed Axel a beer for every style violation, I'd quite likely be > bankrupt by now... ... and Axel very drunk! The beer would just pour in from everywhere and everyone... Best regards, -Stephan From kirilla at mail.berlios.de Sat May 2 20:20:15 2009 From: kirilla at mail.berlios.de (kirilla at BerliOS) Date: Sat, 2 May 2009 20:20:15 +0200 Subject: [Haiku-commits] r30580 - buildtools/trunk/gcc/gcc/config/mips Message-ID: <200905021820.n42IKFZ8012823@sheep.berlios.de> Author: kirilla Date: 2009-05-02 20:20:14 +0200 (Sat, 02 May 2009) New Revision: 30580 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30580&view=rev Modified: buildtools/trunk/gcc/gcc/config/mips/haiku.h Log: Tweaks. Removing superflous config. Cleaner and closer to defaults, hopefully. Modified: buildtools/trunk/gcc/gcc/config/mips/haiku.h =================================================================== --- buildtools/trunk/gcc/gcc/config/mips/haiku.h 2009-05-02 17:43:54 UTC (rev 30579) +++ buildtools/trunk/gcc/gcc/config/mips/haiku.h 2009-05-02 18:20:14 UTC (rev 30580) @@ -20,7 +20,8 @@ Boston, MA 02111-1307, USA. */ -#define TARGET_VERSION fprintf (stderr, " (mips Haiku/ELF)"); +#undef TARGET_VERSION +#define TARGET_VERSION fprintf (stderr, " (MIPSEL Haiku/ELF)"); #undef SIZE_TYPE #define SIZE_TYPE "long unsigned int" @@ -34,15 +35,12 @@ #undef WCHAR_TYPE_SIZE #define WCHAR_TYPE_SIZE 16 -/* If we don't set MASK_ABICALLS, we can't default to PIC. */ -#undef TARGET_DEFAULT -#define TARGET_DEFAULT MASK_ABICALLS - #define TARGET_OS_CPP_BUILTINS() \ do \ { \ builtin_define ("__HAIKU__"); \ builtin_define ("__MIPS__"); \ + builtin_define ("__MIPSEL__"); \ builtin_define ("_MIPSEL_"); \ builtin_define ("__stdcall=__attribute__((__stdcall__))"); \ builtin_define ("__cdecl=__attribute__((__cdecl__))"); \ @@ -61,76 +59,6 @@ } \ while (0) -/* Provide a LINK_SPEC appropriate for Haiku. Here we provide support - for the special GCC options -static and -shared, which allow us to - link things in one of these three modes by applying the appropriate - combinations of options at link-time. */ - -/* If ELF is the default format, we should not use /lib/elf. */ - #undef LINK_SPEC #define LINK_SPEC "%{!o*:-o %b} -m elf_mipsel_haiku -shared -Bsymbolic %{nostart:-e 0}" -/* A C statement (sans semicolon) to output to the stdio stream - FILE the assembler definition of uninitialized global DECL named - NAME whose size is SIZE bytes and alignment is ALIGN bytes. - Try to use asm_output_aligned_bss to implement this macro. */ - -#define BSS_SECTION_ASM_OP "\t.section\t.bss" - -#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ - asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN) - -#undef ASM_DECLARE_OBJECT_NAME -#define ASM_DECLARE_OBJECT_NAME mips_declare_object_name - -#undef FUNCTION_NAME_ALREADY_DECLARED -#define FUNCTION_NAME_ALREADY_DECLARED 1 - -/* The glibc _mcount stub will save $v0 for us. Don't mess with saving - it, since ASM_OUTPUT_REG_PUSH/ASM_OUTPUT_REG_POP do not work in the - presence of $gp-relative calls. */ -#undef ASM_OUTPUT_REG_PUSH -#undef ASM_OUTPUT_REG_POP - -/* The MIPS assembler has different syntax for .set. We set it to - .dummy to trap any errors. */ -#undef SET_ASM_OP -#define SET_ASM_OP "\t.dummy\t" - -#undef ASM_OUTPUT_DEF -#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \ - do { \ - fputc ( '\t', FILE); \ - assemble_name (FILE, LABEL1); \ - fputs ( " = ", FILE); \ - assemble_name (FILE, LABEL2); \ - fputc ( '\n', FILE); \ - } while (0) - -#undef ASM_DECLARE_FUNCTION_NAME -#define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \ - do { \ - if (!flag_inhibit_size_directive) \ - { \ - fputs ("\t.ent\t", STREAM); \ - assemble_name (STREAM, NAME); \ - putc ('\n', STREAM); \ - } \ - ASM_OUTPUT_TYPE_DIRECTIVE (STREAM, NAME, "function"); \ - assemble_name (STREAM, NAME); \ - fputs (":\n", STREAM); \ - } while (0) - -#undef ASM_DECLARE_FUNCTION_SIZE -#define ASM_DECLARE_FUNCTION_SIZE(STREAM, NAME, DECL) \ - do { \ - if (!flag_inhibit_size_directive) \ - { \ - fputs ("\t.end\t", STREAM); \ - assemble_name (STREAM, NAME); \ - putc ('\n', STREAM); \ - } \ - } while (0) - - From kirilla at mail.berlios.de Sat May 2 20:30:37 2009 From: kirilla at mail.berlios.de (kirilla at BerliOS) Date: Sat, 2 May 2009 20:30:37 +0200 Subject: [Haiku-commits] r30581 - in haiku/trunk: headers/posix/arch headers/posix/arch/mipsel src/add-ons/kernel/bus_managers/config_manager/arch src/add-ons/kernel/bus_managers/pci/arch src/add-ons/kernel/cpu src/add-ons/kernel/debugger/disasm src/add-ons/kernel/drivers/arch src/system/boot/arch src/system/glue/arch src/system/kernel/arch src/system/kernel/lib/arch src/system/libroot/os/arch src/system/libroot/posix/arch src/system/libroot/posix/glibc/arch src/system/libroot/posix/string/arch src/system/runtime_loader/arch Message-ID: <200905021830.n42IUb5k013871@sheep.berlios.de> Author: kirilla Date: 2009-05-02 20:30:28 +0200 (Sat, 02 May 2009) New Revision: 30581 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30581&view=rev Added: haiku/trunk/headers/posix/arch/mipsel/ haiku/trunk/headers/posix/arch/mipsel/arch_setjmp.h haiku/trunk/headers/posix/arch/mipsel/signal.h haiku/trunk/src/add-ons/kernel/bus_managers/config_manager/arch/mipsel/ haiku/trunk/src/add-ons/kernel/bus_managers/pci/arch/mipsel/ haiku/trunk/src/add-ons/kernel/cpu/mipsel/ haiku/trunk/src/add-ons/kernel/debugger/disasm/mipsel/ haiku/trunk/src/add-ons/kernel/drivers/arch/mipsel/ haiku/trunk/src/system/boot/arch/mipsel/ haiku/trunk/src/system/glue/arch/mipsel/ haiku/trunk/src/system/kernel/arch/mipsel/ haiku/trunk/src/system/kernel/lib/arch/mipsel/ haiku/trunk/src/system/libroot/os/arch/mipsel/ haiku/trunk/src/system/libroot/posix/arch/mipsel/ haiku/trunk/src/system/libroot/posix/glibc/arch/mipsel/ haiku/trunk/src/system/libroot/posix/string/arch/mipsel/ haiku/trunk/src/system/runtime_loader/arch/mipsel/ Log: Adding a few directories for mipsel. Added: haiku/trunk/headers/posix/arch/mipsel/arch_setjmp.h =================================================================== --- haiku/trunk/headers/posix/arch/mipsel/arch_setjmp.h 2009-05-02 18:20:14 UTC (rev 30580) +++ haiku/trunk/headers/posix/arch/mipsel/arch_setjmp.h 2009-05-02 18:30:28 UTC (rev 30581) @@ -0,0 +1,11 @@ +/* + * Copyright 2008, Haiku, Inc. + * Distributed under the terms of the MIT License. + */ +#ifndef _ARCH_SETJMP_H_ +#define _ARCH_SETJMP_H_ + +typedef int __jmp_buf[42]; +#warning MIPSEL: fix jmpbuf size + +#endif /* _ARCH_SETJMP_H_ */ Added: haiku/trunk/headers/posix/arch/mipsel/signal.h =================================================================== --- haiku/trunk/headers/posix/arch/mipsel/signal.h 2009-05-02 18:20:14 UTC (rev 30580) +++ haiku/trunk/headers/posix/arch/mipsel/signal.h 2009-05-02 18:30:28 UTC (rev 30581) @@ -0,0 +1,23 @@ +/* + * Copyright 2008, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _ARCH_SIGNAL_H_ +#define _ARCH_SIGNAL_H_ + +/* + * Architecture-specific structure passed to signal handlers + */ + +#if __MIPSEL__ +struct vregs +{ + ulong r0; + /* r1, r2, ... */ + +#warning MIPSEL: fixme +}; +#endif /* __MIPSEL__ */ + + +#endif /* _ARCH_SIGNAL_H_ */ From zooey at mail.berlios.de Sat May 2 20:59:36 2009 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Sat, 2 May 2009 20:59:36 +0200 Subject: [Haiku-commits] r30582 - in haiku/trunk/src/tests/kits/locale: . number_format Message-ID: <200905021859.n42IxaAv016183@sheep.berlios.de> Author: zooey Date: 2009-05-02 20:59:35 +0200 (Sat, 02 May 2009) New Revision: 30582 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30582&view=rev Modified: haiku/trunk/src/tests/kits/locale/Jamfile haiku/trunk/src/tests/kits/locale/number_format/Jamfile haiku/trunk/src/tests/kits/locale/number_format/NumberFormatTestAddOn.cpp Log: * added number format tests to build of locale kit Modified: haiku/trunk/src/tests/kits/locale/Jamfile =================================================================== --- haiku/trunk/src/tests/kits/locale/Jamfile 2009-05-02 18:30:28 UTC (rev 30581) +++ haiku/trunk/src/tests/kits/locale/Jamfile 2009-05-02 18:59:35 UTC (rev 30582) @@ -12,7 +12,7 @@ collatorSpeed collatorTest localeTest -# NumberFormatTests + libNumberFormatTests.so ; rule LocaleTest @@ -35,14 +35,4 @@ : be liblocale.so ; -# For the unit tests we need liblocale.so to live in the `lib' subdirectory -# of the UnitTester application. We simply create a symlink that can be -# referred to by `liblocale.so'. -#{ -# local symlink = liblocale.so ; -# MakeLocate $(symlink) : [ FDirName $(LOCALE_UNITTESTS_DIR) lib ] ; -# RelSymLink $(symlink) : liblocale.so ; -#} - -# TODO: activate this again, once it's working! -# SubInclude HAIKU_TOP src tests kits locale number_format ; +SubInclude HAIKU_TOP src tests kits locale number_format ; Modified: haiku/trunk/src/tests/kits/locale/number_format/Jamfile =================================================================== --- haiku/trunk/src/tests/kits/locale/number_format/Jamfile 2009-05-02 18:30:28 UTC (rev 30581) +++ haiku/trunk/src/tests/kits/locale/number_format/Jamfile 2009-05-02 18:59:35 UTC (rev 30582) @@ -4,12 +4,12 @@ SEARCH_SOURCE += [ FDirName $(SUBDIR) generic_number_format ] ; -UnitTest NumberFormatTests +UnitTestLib libNumberFormatTests.so : NumberFormatTestAddOn.cpp # BGenericNumberFormat GenericNumberFormatTests.cpp GenericNumberFormatConstructorTest.cpp - : be liblocale.so + : be $(TARGET_LIBSTDC++) liblocale.so ; Modified: haiku/trunk/src/tests/kits/locale/number_format/NumberFormatTestAddOn.cpp =================================================================== --- haiku/trunk/src/tests/kits/locale/number_format/NumberFormatTestAddOn.cpp 2009-05-02 18:30:28 UTC (rev 30581) +++ haiku/trunk/src/tests/kits/locale/number_format/NumberFormatTestAddOn.cpp 2009-05-02 18:59:35 UTC (rev 30582) @@ -4,13 +4,12 @@ #include "generic_number_format/GenericNumberFormatTests.h" // getTestSuite -_EXPORT BTestSuite* getTestSuite() { BTestSuite *suite = new BTestSuite("NumberFormat"); suite->addTest("BGenericNumberFormat", GenericNumberFormatTestSuite()); - + return suite; } From zooey at mail.berlios.de Sat May 2 21:01:33 2009 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Sat, 2 May 2009 21:01:33 +0200 Subject: [Haiku-commits] r30583 - in haiku/trunk/src/tests/add-ons/translators: . bmptranslator pngtranslator stxttranslator tgatranslator tifftranslator Message-ID: <200905021901.n42J1XcV016588@sheep.berlios.de> Author: zooey Date: 2009-05-02 21:01:32 +0200 (Sat, 02 May 2009) New Revision: 30583 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30583&view=rev Modified: haiku/trunk/src/tests/add-ons/translators/TranslatorTestAddOn.cpp haiku/trunk/src/tests/add-ons/translators/bmptranslator/BMPTranslatorTest.h haiku/trunk/src/tests/add-ons/translators/pngtranslator/PNGTranslatorTest.h haiku/trunk/src/tests/add-ons/translators/stxttranslator/STXTTranslatorTest.h haiku/trunk/src/tests/add-ons/translators/tgatranslator/TGATranslatorTest.h haiku/trunk/src/tests/add-ons/translators/tifftranslator/TIFFTranslatorTest.h Log: * fix gcc4 build of translator add-on tests Modified: haiku/trunk/src/tests/add-ons/translators/TranslatorTestAddOn.cpp =================================================================== --- haiku/trunk/src/tests/add-ons/translators/TranslatorTestAddOn.cpp 2009-05-02 18:59:35 UTC (rev 30582) +++ haiku/trunk/src/tests/add-ons/translators/TranslatorTestAddOn.cpp 2009-05-02 19:01:32 UTC (rev 30583) @@ -1,6 +1,7 @@ // TranslatorTestAddOn.cpp #include +#include #include #include #include "TranslatorTestAddOn.h" @@ -36,14 +37,14 @@ off_t alen = 0, blen = 0; const uint32 kbuflen = 2048; uint8 abuf[kbuflen], bbuf[kbuflen]; - + a.Seek(0, SEEK_END); alen = a.Position(); b.Seek(0, SEEK_END); - blen = b.Position(); + blen = b.Position(); if (alen != blen) return false; - + if (a.Seek(0, SEEK_SET) != 0) return false; if (b.Seek(0, SEEK_SET) != 0) @@ -56,13 +57,13 @@ return false; if (b.Read(bbuf, read) != read) return false; - + if (memcmp(abuf, bbuf, read) != 0) return false; - + alen -= read; } - + return true; } @@ -94,7 +95,7 @@ CPPUNIT_ASSERT(pright->MIME); CPPUNIT_ASSERT(pleft->name); CPPUNIT_ASSERT(pright->name); - + if (pleft->group != pright->group) return false; if (pleft->type != pright->type) @@ -109,13 +110,13 @@ return false; if (strcmp(pleft->name, pright->name) != 0) return false; - + return true; } // Apply a number of tests to a BTranslator * to a TGATranslator object void -TestBTranslator(BTestCase *ptest, BTranslator *ptran, +TestBTranslator(BTestCase *ptest, BTranslator *ptran, const translation_format *pExpectedIns, uint32 nExpectedIns, const translation_format *pExpectedOuts, uint32 nExpectedOuts, int32 expectedVer) @@ -123,68 +124,68 @@ const uint32 knmatches = 50; uint8 matches[knmatches]; CPPUNIT_ASSERT(nExpectedIns <= knmatches && nExpectedOuts <= knmatches); - + // The translator should only have one reference ptest->NextSubTest(); CPPUNIT_ASSERT(ptran->ReferenceCount() == 1); - + // Make sure Acquire returns a BTranslator even though its // already been Acquired once ptest->NextSubTest(); CPPUNIT_ASSERT(ptran->Acquire() == ptran); - + // Acquired twice, refcount should be 2 ptest->NextSubTest(); CPPUNIT_ASSERT(ptran->ReferenceCount() == 2); - + // Release should return ptran because it is still acquired ptest->NextSubTest(); CPPUNIT_ASSERT(ptran->Release() == ptran); - + ptest->NextSubTest(); CPPUNIT_ASSERT(ptran->ReferenceCount() == 1); - + ptest->NextSubTest(); CPPUNIT_ASSERT(ptran->Acquire() == ptran); - + ptest->NextSubTest(); CPPUNIT_ASSERT(ptran->ReferenceCount() == 2); - + ptest->NextSubTest(); CPPUNIT_ASSERT(ptran->Release() == ptran); - + ptest->NextSubTest(); CPPUNIT_ASSERT(ptran->ReferenceCount() == 1); - + // A name would be nice ptest->NextSubTest(); const char *tranname = ptran->TranslatorName(); CPPUNIT_ASSERT(tranname); printf(" {%s} ", tranname); - + // More info would be nice ptest->NextSubTest(); const char *traninfo = ptran->TranslatorInfo(); CPPUNIT_ASSERT(traninfo); printf(" {%s} ", traninfo); - + // What version are you? // (when ver == 100, that means that version is 1.00) ptest->NextSubTest(); int32 ver = ptran->TranslatorVersion(); CPPUNIT_ASSERT(ver == expectedVer); printf(" {0x%.8lx} ", ver); - + // Input formats? ptest->NextSubTest(); { printf("input:"); - + int32 incount = 0; const translation_format *pins = ptran->InputFormats(&incount); CPPUNIT_ASSERT((unsigned)incount == nExpectedIns); CPPUNIT_ASSERT(pins); - + memset(matches, 0, sizeof(uint8) * nExpectedIns); for (int32 i = 0; i < incount; i++) { bool bmatch = false; @@ -193,25 +194,25 @@ if (bmatch) matches[k] = 1; } - + CPPUNIT_ASSERT(bmatch); } - + // make sure that each expected input format was matched for (uint32 i = 0; i < nExpectedIns; i++) CPPUNIT_ASSERT(matches[i]); } - + // Output formats? ptest->NextSubTest(); { printf("output:"); - + int32 outcount = 0; const translation_format *pouts = ptran->OutputFormats(&outcount); CPPUNIT_ASSERT((unsigned)outcount == nExpectedOuts); CPPUNIT_ASSERT(pouts); - + memset(matches, 0, sizeof(uint8) * nExpectedOuts); for (int32 i = 0; i < outcount; i++) { bool bmatch = false; @@ -220,15 +221,15 @@ if (bmatch) matches[k] = 1; } - + CPPUNIT_ASSERT(bmatch); } - + // make sure that each expected input format was matched for (uint32 i = 0; i < nExpectedOuts; i++) CPPUNIT_ASSERT(matches[i]); } - + // Release should return NULL because Release has been called // as many times as it has been acquired ptest->NextSubTest(); @@ -246,7 +247,7 @@ ptest->NextSubTest(); image_id image = load_add_on(path); CPPUNIT_ASSERT(image >= 0); - + // Load in function to make the object ptest->NextSubTest(); BTranslator *(*pMakeNthTranslator)(int32 n,image_id you,uint32 flags,...); @@ -258,7 +259,7 @@ ptest->NextSubTest(); BTranslator *ptran = pMakeNthTranslator(0, image, 0); CPPUNIT_ASSERT(ptran); - + // Make sure the function only returns one BTranslator ptest->NextSubTest(); CPPUNIT_ASSERT(!pMakeNthTranslator(1, image, 0)); @@ -266,14 +267,14 @@ CPPUNIT_ASSERT(!pMakeNthTranslator(3, image, 0)); CPPUNIT_ASSERT(!pMakeNthTranslator(16, image, 0)); CPPUNIT_ASSERT(!pMakeNthTranslator(1023, image, 0)); - + // Run a number of tests on the BTranslator object TestBTranslator(ptest, ptran, pExpectedIns, nExpectedIns, pExpectedOuts, nExpectedOuts, expectedVer); // NOTE: this function Release()s ptran ptran = NULL; - + // Unload Add-on ptest->NextSubTest(); - CPPUNIT_ASSERT(unload_add_on(image) == B_OK); + CPPUNIT_ASSERT(unload_add_on(image) == B_OK); } Modified: haiku/trunk/src/tests/add-ons/translators/bmptranslator/BMPTranslatorTest.h =================================================================== --- haiku/trunk/src/tests/add-ons/translators/bmptranslator/BMPTranslatorTest.h 2009-05-02 18:59:35 UTC (rev 30582) +++ haiku/trunk/src/tests/add-ons/translators/bmptranslator/BMPTranslatorTest.h 2009-05-02 19:01:32 UTC (rev 30583) @@ -9,15 +9,17 @@ #define BBT_MIME_STRING "image/x-be-bitmap" #define BMP_MIME_STRING "image/x-bmp" -class CppUnit::Test; +namespace CppUnit { +class Test; +} class BMPTranslatorTest : public BTestCase { public: static CppUnit::Test* Suite(); - + // This function called before *each* test added in Suite() void setUp(); - + // This function called after *each* test added in Suite() void tearDown(); Modified: haiku/trunk/src/tests/add-ons/translators/pngtranslator/PNGTranslatorTest.h =================================================================== --- haiku/trunk/src/tests/add-ons/translators/pngtranslator/PNGTranslatorTest.h 2009-05-02 18:59:35 UTC (rev 30582) +++ haiku/trunk/src/tests/add-ons/translators/pngtranslator/PNGTranslatorTest.h 2009-05-02 19:01:32 UTC (rev 30583) @@ -9,15 +9,17 @@ #define BBT_MIME_STRING "image/x-be-bitmap" #define PNG_MIME_STRING "image/png" -class CppUnit::Test; +namespace CppUnit { +class Test; +} class PNGTranslatorTest : public BTestCase { public: static CppUnit::Test* Suite(); - + // This function called before *each* test added in Suite() void setUp(); - + // This function called after *each* test added in Suite() void tearDown(); Modified: haiku/trunk/src/tests/add-ons/translators/stxttranslator/STXTTranslatorTest.h =================================================================== --- haiku/trunk/src/tests/add-ons/translators/stxttranslator/STXTTranslatorTest.h 2009-05-02 18:59:35 UTC (rev 30582) +++ haiku/trunk/src/tests/add-ons/translators/stxttranslator/STXTTranslatorTest.h 2009-05-02 19:01:32 UTC (rev 30583) @@ -9,15 +9,17 @@ #define TEXT_MIME_STRING "text/plain" #define STXT_MIME_STRING "text/x-vnd.Be-stxt" -class CppUnit::Test; +namespace CppUnit { +class Test; +} class STXTTranslatorTest : public BTestCase { public: static CppUnit::Test* Suite(); - + // This function called before *each* test added in Suite() void setUp(); - + // This function called after *each* test added in Suite() void tearDown(); Modified: haiku/trunk/src/tests/add-ons/translators/tgatranslator/TGATranslatorTest.h =================================================================== --- haiku/trunk/src/tests/add-ons/translators/tgatranslator/TGATranslatorTest.h 2009-05-02 18:59:35 UTC (rev 30582) +++ haiku/trunk/src/tests/add-ons/translators/tgatranslator/TGATranslatorTest.h 2009-05-02 19:01:32 UTC (rev 30583) @@ -9,15 +9,17 @@ #define BBT_MIME_STRING "image/x-be-bitmap" #define TGA_MIME_STRING "image/x-targa" -class CppUnit::Test; +namespace CppUnit { +class Test; +} class TGATranslatorTest : public BTestCase { public: static CppUnit::Test* Suite(); - + // This function called before *each* test added in Suite() void setUp(); - + // This function called after *each* test added in Suite() void tearDown(); Modified: haiku/trunk/src/tests/add-ons/translators/tifftranslator/TIFFTranslatorTest.h =================================================================== --- haiku/trunk/src/tests/add-ons/translators/tifftranslator/TIFFTranslatorTest.h 2009-05-02 18:59:35 UTC (rev 30582) +++ haiku/trunk/src/tests/add-ons/translators/tifftranslator/TIFFTranslatorTest.h 2009-05-02 19:01:32 UTC (rev 30583) @@ -9,15 +9,17 @@ #define BBT_MIME_STRING "image/x-be-bitmap" #define TIFF_MIME_STRING "image/tiff" -class CppUnit::Test; +namespace CppUnit { +class Test; +} class TIFFTranslatorTest : public BTestCase { public: static CppUnit::Test* Suite(); - + // This function called before *each* test added in Suite() void setUp(); - + // This function called after *each* test added in Suite() void tearDown(); From zooey at mail.berlios.de Sat May 2 21:02:28 2009 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Sat, 2 May 2009 21:02:28 +0200 Subject: [Haiku-commits] r30584 - haiku/trunk/src/kits/translation Message-ID: <200905021902.n42J2SHO016667@sheep.berlios.de> Author: zooey Date: 2009-05-02 21:02:27 +0200 (Sat, 02 May 2009) New Revision: 30584 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30584&view=rev Modified: haiku/trunk/src/kits/translation/TranslatorRoster.cpp Log: * fix gcc4 warning * automatic whitespace cleanup Modified: haiku/trunk/src/kits/translation/TranslatorRoster.cpp =================================================================== --- haiku/trunk/src/kits/translation/TranslatorRoster.cpp 2009-05-02 19:01:32 UTC (rev 30583) +++ haiku/trunk/src/kits/translation/TranslatorRoster.cpp 2009-05-02 19:02:27 UTC (rev 30584) @@ -155,7 +155,7 @@ || !strcasecmp(parameter, "enable") || !strcmp(parameter, "1")) fSafeMode = true; } - + #ifdef HAIKU_TARGET_PLATFORM_HAIKU if (_kern_get_safemode_option(B_SAFEMODE_DISABLE_USER_ADD_ONS, parameter, ¶meterLength) == B_OK) #else @@ -193,7 +193,7 @@ while (iterator != fTranslators.end()) { BTranslator* translator = iterator->second.translator; - + translator->fOwningRoster = NULL; // we don't want to be notified about this anymore @@ -553,7 +553,7 @@ if (status == B_OK) { // If the translator add-on supports the post R4.5 // translator creation mechanism, keep loading translators - // until MakeNthTranslator stops returning them. + // until MakeNthTranslator stops returning them. BTranslator* translator = NULL; int32 created = 0; for (int32 n = 0; (translator = makeNthTranslator(n, image, 0)) != NULL; n++) { @@ -627,7 +627,7 @@ BTranslatorRoster::Private::StopWatching(BMessenger target) { MessengerList::iterator iterator = fMessengers.begin(); - + while (iterator != fMessengers.end()) { if (*iterator == target) { fMessengers.erase(iterator); @@ -783,7 +783,7 @@ while (iterator != fTranslators.end()) { array[count++] = iterator->first; iterator++; - } + } *_ids = array; *_count = count; @@ -882,8 +882,9 @@ // scan for suitable format for (int32 i = 0; i < formatsCount && formats[i].type; i++) { if (formats[i].type == hintType - || hintMIME && ((super && !strncmp(formats[i].MIME, hintMIME, super)) - || !strcmp(formats[i].MIME, hintMIME))) + || (hintMIME + && ((super && !strncmp(formats[i].MIME, hintMIME, super)) + || !strcmp(formats[i].MIME, hintMIME)))) return &formats[i]; } @@ -1138,7 +1139,7 @@ { // If the default BTranslatorRoster is being // deleted, set the pointer to the default - // BTranslatorRoster to NULL + // BTranslatorRoster to NULL if (sDefaultRoster == this) sDefaultRoster = NULL; @@ -1159,7 +1160,7 @@ status_t status = BArchivable::Archive(into, deep); if (status != B_OK) return status; - + return fPrivate->StoreTranslators(*into); } @@ -1240,7 +1241,7 @@ BTranslatorRoster \return B_BAD_VALUE, if translator is NULL, - B_OK if all went well + B_OK if all went well */ status_t BTranslatorRoster::AddTranslator(BTranslator* translator) @@ -1281,7 +1282,7 @@ /*! This function determines which translator is best suited - to convert the data from \a source. + to convert the data from \a source. \param source the data to be identified \param ioExtension the configuration data for the translator @@ -1348,7 +1349,7 @@ Returns an array in \a _ids of all of the translators stored by this object. You must free the array using delete[] when you are done with it. - + \param _ids the array is stored there (you own the array). \param _count number of IDs in the array. */ @@ -1385,7 +1386,7 @@ BAutolock locker(fPrivate); - BTranslator* translator = fPrivate->FindTranslator(id); + BTranslator* translator = fPrivate->FindTranslator(id); if (translator == NULL) return B_NO_TRANSLATOR; @@ -1422,7 +1423,7 @@ BAutolock locker(fPrivate); - BTranslator* translator = fPrivate->FindTranslator(id); + BTranslator* translator = fPrivate->FindTranslator(id); if (translator == NULL) return B_NO_TRANSLATOR; @@ -1453,7 +1454,7 @@ BAutolock locker(fPrivate); - BTranslator* translator = fPrivate->FindTranslator(id); + BTranslator* translator = fPrivate->FindTranslator(id); if (translator == NULL) return B_NO_TRANSLATOR; @@ -1573,7 +1574,7 @@ off_t pos = source->Seek(0, SEEK_SET); if (pos == 0) { translator_info info; - status = translator->Identify(source, NULL, ioExtension, &info, wantOutType); + status = translator->Identify(source, NULL, ioExtension, &info, wantOutType); if (status >= B_OK) { off_t pos = source->Seek(0, SEEK_SET); if (pos != 0) @@ -1613,7 +1614,7 @@ BAutolock locker(fPrivate); - BTranslator* translator = fPrivate->FindTranslator(id); + BTranslator* translator = fPrivate->FindTranslator(id); if (translator == NULL) return B_NO_TRANSLATOR; @@ -1640,7 +1641,7 @@ BAutolock locker(fPrivate); - BTranslator* translator = fPrivate->FindTranslator(id); + BTranslator* translator = fPrivate->FindTranslator(id); if (translator == NULL) return B_NO_TRANSLATOR; From kirilla at mail.berlios.de Sat May 2 21:03:20 2009 From: kirilla at mail.berlios.de (kirilla at BerliOS) Date: Sat, 2 May 2009 21:03:20 +0200 Subject: [Haiku-commits] r30585 - haiku/trunk/build/jam Message-ID: <200905021903.n42J3Kbg016725@sheep.berlios.de> Author: kirilla Date: 2009-05-02 21:03:19 +0200 (Sat, 02 May 2009) New Revision: 30585 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30585&view=rev Modified: haiku/trunk/build/jam/BuildSetup Log: Prepare mipsel for jamming. Adding mipsel target case, a simple boot platform and a -fno-pic setting for the kernel. Modified: haiku/trunk/build/jam/BuildSetup =================================================================== --- haiku/trunk/build/jam/BuildSetup 2009-05-02 19:02:27 UTC (rev 30584) +++ haiku/trunk/build/jam/BuildSetup 2009-05-02 19:03:19 UTC (rev 30585) @@ -163,6 +163,7 @@ case i686-* : HAIKU_CPU = x86 ; case powerpc-* : HAIKU_CPU = ppc ; case m68k-* : HAIKU_CPU = m68k ; + case mipsel-* : HAIKU_CPU = mipsel ; case * : Exit "Unsupported gcc target machine:" $(HAIKU_GCC_MACHINE) ; } @@ -196,6 +197,14 @@ # offset in floppy image (>= sizeof(haiku_loader)) HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 150 ; # in kB } + case mipsel : + { + HAIKU_DEFINES += __MIPSEL__ ; + # RouterBOARD firmware (ELF image over TFTP) + HAIKU_BOOT_PLATFORM = routerboot_mipsel ; + # offset in floppy image (>= sizeof(haiku_loader)) + HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 192 ; # in kB - todo/fixme + } case * : Exit "Currently unsupported target CPU:" $(HAIKU_CPU) ; } @@ -264,6 +273,11 @@ HAIKU_KERNEL_CCFLAGS += -m68020-60 ; HAIKU_KERNEL_C++FLAGS += -m68020-60 ; } +if $(HAIKU_ARCH) = mipsel { + # todo: verify correctness of this + HAIKU_KERNEL_PIC_CCFLAGS = -fno-pic ; + HAIKU_KERNEL_PIC_LINKFLAGS = ; +} # If the environment variable DEBUG_PRINTF is defined we define an equally # named macro to the variable value. Some components use the macro to allow @@ -642,6 +656,8 @@ HOST_DEFINES += __POWERPC__ ; } else if $(HOST_CPU) = m68k { HOST_DEFINES += __M68K__ ; + } else if $(HOST_CPU) = mipsel { + HOST_DEFINES += __MIPSEL__ ; } # Supposing this is a glibc platform, let's try to get features like large From zooey at mail.berlios.de Sat May 2 21:04:55 2009 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Sat, 2 May 2009 21:04:55 +0200 Subject: [Haiku-commits] r30586 - in haiku/trunk: headers/tools/cppunit headers/tools/cppunit/cppunit headers/tools/cppunit/cppunit/extensions src/tools/cppunit src/tools/cppunit/cppunit Message-ID: <200905021904.n42J4tPR016843@sheep.berlios.de> Author: zooey Date: 2009-05-02 21:04:52 +0200 (Sat, 02 May 2009) New Revision: 30586 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30586&view=rev Modified: haiku/trunk/headers/tools/cppunit/TestCase.h haiku/trunk/headers/tools/cppunit/TestListener.h haiku/trunk/headers/tools/cppunit/TestShell.h haiku/trunk/headers/tools/cppunit/TestSuite.h haiku/trunk/headers/tools/cppunit/TestUtils.h haiku/trunk/headers/tools/cppunit/ThreadedTestCaller.h haiku/trunk/headers/tools/cppunit/ThreadedTestCase.h haiku/trunk/headers/tools/cppunit/cppunit/Asserter.h haiku/trunk/headers/tools/cppunit/cppunit/CompilerOutputter.h haiku/trunk/headers/tools/cppunit/cppunit/Exception.h haiku/trunk/headers/tools/cppunit/cppunit/NotEqualException.h haiku/trunk/headers/tools/cppunit/cppunit/Portability.h haiku/trunk/headers/tools/cppunit/cppunit/SourceLine.h haiku/trunk/headers/tools/cppunit/cppunit/Test.h haiku/trunk/headers/tools/cppunit/cppunit/TestAssert.h haiku/trunk/headers/tools/cppunit/cppunit/TestCaller.h haiku/trunk/headers/tools/cppunit/cppunit/TestCase.h haiku/trunk/headers/tools/cppunit/cppunit/TestFailure.h haiku/trunk/headers/tools/cppunit/cppunit/TestResult.h haiku/trunk/headers/tools/cppunit/cppunit/TestResultCollector.h haiku/trunk/headers/tools/cppunit/cppunit/TestSuite.h haiku/trunk/headers/tools/cppunit/cppunit/TextOutputter.h haiku/trunk/headers/tools/cppunit/cppunit/TextTestResult.h haiku/trunk/headers/tools/cppunit/cppunit/XmlOutputter.h haiku/trunk/headers/tools/cppunit/cppunit/extensions/RepeatedTest.h haiku/trunk/headers/tools/cppunit/cppunit/extensions/TestDecorator.h haiku/trunk/headers/tools/cppunit/cppunit/extensions/TestFactoryRegistry.h haiku/trunk/headers/tools/cppunit/cppunit/extensions/TypeInfoHelper.h haiku/trunk/src/tools/cppunit/BTestCase.cpp haiku/trunk/src/tools/cppunit/BTestSuite.cpp haiku/trunk/src/tools/cppunit/TestApp.cpp haiku/trunk/src/tools/cppunit/TestListener.cpp haiku/trunk/src/tools/cppunit/TestShell.cpp haiku/trunk/src/tools/cppunit/TestUtils.cpp haiku/trunk/src/tools/cppunit/ThreadedTestCase.cpp haiku/trunk/src/tools/cppunit/cppunit/Asserter.cpp haiku/trunk/src/tools/cppunit/cppunit/CompilerOutputter.cpp haiku/trunk/src/tools/cppunit/cppunit/Exception.cpp haiku/trunk/src/tools/cppunit/cppunit/NotEqualException.cpp haiku/trunk/src/tools/cppunit/cppunit/RepeatedTest.cpp haiku/trunk/src/tools/cppunit/cppunit/SourceLine.cpp haiku/trunk/src/tools/cppunit/cppunit/TestCase.cpp haiku/trunk/src/tools/cppunit/cppunit/TestFactoryRegistry.cpp haiku/trunk/src/tools/cppunit/cppunit/TestFailure.cpp haiku/trunk/src/tools/cppunit/cppunit/TestRunner.cpp haiku/trunk/src/tools/cppunit/cppunit/TextOutputter.cpp haiku/trunk/src/tools/cppunit/cppunit/TextTestProgressListener.cpp haiku/trunk/src/tools/cppunit/cppunit/TextTestResult.cpp haiku/trunk/src/tools/cppunit/cppunit/TypeInfoHelper.cpp haiku/trunk/src/tools/cppunit/cppunit/XmlOutputter.cpp Log: * fix gcc4 build of cppunit library by explicitly spelling out std:: in the headers and importing the required classes in the implementation files * automatic whitespace cleanup Modified: haiku/trunk/headers/tools/cppunit/TestCase.h =================================================================== --- haiku/trunk/headers/tools/cppunit/TestCase.h 2009-05-02 19:03:19 UTC (rev 30585) +++ haiku/trunk/headers/tools/cppunit/TestCase.h 2009-05-02 19:04:52 UTC (rev 30586) @@ -9,30 +9,30 @@ //! Base class for single threaded unit tests class CPPUNIT_API BTestCase : public CppUnit::TestCase { public: - BTestCase(string Name = ""); - + BTestCase(std::string Name = ""); + //! Displays the next sub test progress indicator (i.e. [0][1][2][3]...). virtual void NextSubTest(); - + //! Starts a new sub test block (i.e. prints a newline :-) virtual void NextSubTestBlock(); - + /*! \brief Prints to standard out just like printf, except shell verbosity settings are honored. */ virtual void Outputf(const char *str, ...); - - //! Saves the location of the current working directory. + + //! Saves the location of the current working directory. void SaveCWD(); - + virtual void tearDown(); - - //! Restores the current working directory to last directory saved by a call to SaveCWD(). + + //! Restores the current working directory to last directory saved by a call to SaveCWD(). void RestoreCWD(const char *alternate = NULL); protected: bool fValidCWD; - char fCurrentWorkingDir[B_PATH_NAME_LENGTH+1]; - int32 fSubTestNum; + char fCurrentWorkingDir[B_PATH_NAME_LENGTH+1]; + int32 fSubTestNum; }; #endif // _beos_test_case_h_ Modified: haiku/trunk/headers/tools/cppunit/TestListener.h =================================================================== --- haiku/trunk/headers/tools/cppunit/TestListener.h 2009-05-02 19:03:19 UTC (rev 30585) +++ haiku/trunk/headers/tools/cppunit/TestListener.h 2009-05-02 19:04:52 UTC (rev 30586) @@ -4,15 +4,17 @@ #include #include -class CppUnit::Test; -class CppUnit::TestFailure; -class CppUnit::Exception; +namespace CppUnit { +class Test; +class TestFailure; +class Exception; +} //! Handles printing of test information /*! Receives notification of the beginning and end of each test, and notification of all failures and errors. Prints out said information in a standard format to standard output. - + You should not need to explicitly use this class in any of your tests. */ Modified: haiku/trunk/headers/tools/cppunit/TestShell.h =================================================================== --- haiku/trunk/headers/tools/cppunit/TestShell.h 2009-05-02 19:03:19 UTC (rev 30585) +++ haiku/trunk/headers/tools/cppunit/TestShell.h 2009-05-02 19:04:52 UTC (rev 30586) @@ -48,9 +48,9 @@ */ class CPPUNIT_API BTestShell { public: - BTestShell(const string &description = "", SyncObject *syncObject = 0); + BTestShell(const std::string &description = "", SyncObject *syncObject = 0); virtual ~BTestShell(); - + // This function is used to add the tests for a given kit (as contained // in a BTestSuite object) to the list of available tests. The shell assumes // ownership of the BTestSuite object. Each test in the kit is added to @@ -64,7 +64,7 @@ // when the program is run with "--list" as an argument. Usually the // given suite would be a test suite for an entire class, but that's // not a requirement. - void AddTest(const string &name, CppUnit::Test* test); + void AddTest(const std::string &name, CppUnit::Test* test); // This function loads all the test addons it finds in the given // directory, returning the number of tests actually loaded. @@ -75,7 +75,7 @@ // help, or lists installed tests, or whatever, depending on the // command-line arguments passed in. int Run(int argc, char *argv[]); - + // Verbosity Level enumeration and accessor function enum VerbosityLevel { v0, v1, v2, v3, v4 }; VerbosityLevel Verbosity() const; @@ -92,9 +92,9 @@ // have to (and always make sure the pointer it returns isn't NULL // before you try to use it :-). static BTestShell* GlobalShell() { return fGlobalShell; }; - + // Sets the global BTestShell pointer. The BTestShell class does - // not assume ownership of the object. + // not assume ownership of the object. static void SetGlobalShell(BTestShell *shell) { fGlobalShell = shell; }; const char* TestDir() const; @@ -104,18 +104,18 @@ bool WasDebuggerCalled(); protected: - typedef map TestMap; - typedef map SuiteMap; + typedef std::map TestMap; + typedef std::map SuiteMap; VerbosityLevel fVerbosityLevel; - set fTestsToRun; - set fSuitesToRun; + std::set fTestsToRun; + std::set fSuitesToRun; TestMap fTests; SuiteMap fSuites; - set fLibDirs; + std::set fLibDirs; CppUnit::TestResult fTestResults; CppUnit::TestResultCollector fResultsCollector; - string fDescription; + std::string fDescription; static BTestShell* fGlobalShell; static const char indent[]; bool fListTestsAndExit; @@ -134,7 +134,7 @@ //! Prints out command line argument instructions void PrintHelp(); - + /*! \brief Prints out the list of valid command line arguments. Called by PrintHelp(). */ @@ -142,15 +142,15 @@ //! Prints out a list of all the currently available tests void PrintInstalledTests(); - + /*! \brief Handles command line arguments; returns true if everything goes okay, false if not (or if the program just needs to terminate without running any tests). Modifies settings in "settings" as necessary. */ bool ProcessArguments(int argc, char *argv[]); - + //! Processes a single argument, given by the \c arg parameter. - virtual bool ProcessArgument(string arg, int argc, char *argv[]); + virtual bool ProcessArgument(std::string arg, int argc, char *argv[]); //! Makes any necessary pre-test preparations void InitOutput(); @@ -159,12 +159,12 @@ the specified verbosity level. */ void PrintResults(); - + /*! \brief Searches all the paths in \c fLibDirs, loading any dynamically loadable suites it finds. */ virtual void LoadDynamicSuites(); - + //! Sets the current test directory. void UpdateTestDir(char *argv[]); @@ -187,7 +187,7 @@ static image_id _LoadAddOnHook(const char* path); static status_t _UnloadAddOnHook(image_id image); #endif // ! NO_ELF_SYMBOL_PATCHING - + }; // class BTestShell #endif // _beos_test_shell_h_ Modified: haiku/trunk/headers/tools/cppunit/TestSuite.h =================================================================== --- haiku/trunk/headers/tools/cppunit/TestSuite.h 2009-05-02 19:03:19 UTC (rev 30585) +++ haiku/trunk/headers/tools/cppunit/TestSuite.h 2009-05-02 19:04:52 UTC (rev 30586) @@ -6,31 +6,33 @@ #include #include -class CppUnit::TestResult; +namespace CppUnit { +class TestResult; +} //! Groups together a set of tests for a given kit. class CPPUNIT_API BTestSuite : public CppUnit::Test { public: - BTestSuite( string name = "" ); + BTestSuite(std::string name = ""); virtual ~BTestSuite(); - virtual void run( CppUnit::TestResult *result ); + virtual void run(CppUnit::TestResult *result); virtual int countTestCases() const; - virtual string getName() const; - virtual string toString() const; + virtual std::string getName() const; + virtual std::string toString() const; - virtual void addTest(string name, CppUnit::Test *test); + virtual void addTest(std::string name, CppUnit::Test *test); virtual void deleteContents(); - const map &getTests() const; + const std::map &getTests() const; protected: - map fTests; - const string fName; + std::map fTests; + const std::string fName; private: BTestSuite(const BTestSuite &other); - BTestSuite& operator=(const BTestSuite &other); + BTestSuite& operator=(const BTestSuite &other); }; Modified: haiku/trunk/headers/tools/cppunit/TestUtils.h =================================================================== --- haiku/trunk/headers/tools/cppunit/TestUtils.h 2009-05-02 19:03:19 UTC (rev 30585) +++ haiku/trunk/headers/tools/cppunit/TestUtils.h 2009-05-02 19:04:52 UTC (rev 30586) @@ -28,7 +28,7 @@ } // Returns a string version of the given integer -extern CPPUNIT_API string IntToStr(int i); +extern CPPUNIT_API std::string IntToStr(int i); // Calls system() with the concatenated string of command and parameter. extern CPPUNIT_API void ExecCommand(const char *command, const char *parameter); @@ -40,5 +40,5 @@ // Calls system() with the given command (kind of silly, but it's consistent :-) extern CPPUNIT_API void ExecCommand(const char *command); - + #endif // __beos_test_utils_h__ Modified: haiku/trunk/headers/tools/cppunit/ThreadedTestCaller.h =================================================================== --- haiku/trunk/headers/tools/cppunit/ThreadedTestCaller.h 2009-05-02 19:03:19 UTC (rev 30585) +++ haiku/trunk/headers/tools/cppunit/ThreadedTestCaller.h 2009-05-02 19:04:52 UTC (rev 30586) @@ -14,23 +14,23 @@ class TestResult; template -class CPPUNIT_API BThreadedTestCaller : public CppUnit::TestCase { +class CPPUNIT_API BThreadedTestCaller : public CppUnit::TestCase { public: /*! \brief Pointer to a test function in the given class. Each ThreadMethod added with addThread() is run in its own thread. */ typedef void (TestClass::*ThreadMethod)(); - BThreadedTestCaller(std::string name); - BThreadedTestCaller(std::string name, TestClass &object); - BThreadedTestCaller(std::string name, TestClass *object); + BThreadedTestCaller(std::string name); + BThreadedTestCaller(std::string name, TestClass &object); + BThreadedTestCaller(std::string name, TestClass *object); virtual ~BThreadedTestCaller(); - + virtual CppUnit::TestResult *run(); virtual void run(CppUnit::TestResult *result); //! Adds a thread to the test. \c threadName must be unique to this BThreadedTestCaller. - void addThread(std::string threadName, ThreadMethod method); + void addThread(std::string threadName, ThreadMethod method); protected: virtual void setUp(); @@ -42,9 +42,9 @@ bool fOwnObject; TestClass *fObject; ThreadManagerMap fThreads; - + sem_id fThreadSem; - + }; @@ -78,19 +78,19 @@ template BThreadedTestCaller::~BThreadedTestCaller() { if (fOwnObject) - delete fObject; - for (ThreadManagerMap::iterator it = fThreads.begin(); it != fThreads.end (); ++it) { + delete fObject; + for (typename ThreadManagerMap::iterator it = fThreads.begin(); it != fThreads.end (); ++it) { delete it->second; } } - + template void BThreadedTestCaller::addThread(std::string threadName, ThreadMethod method) { if (fThreads.find(threadName) == fThreads.end()) { // Unused name, go ahead and add - fThreads[threadName] = new BThreadManager(threadName, fObject, method, fThreadSem); + fThreads[threadName] = new BThreadManager(threadName, fObject, method, fThreadSem); } else { // Duplicate name, throw an exception throw CppUnit::Exception("BThreadedTestCaller::addThread() - Attempt to add thread under duplicated name ('" @@ -110,11 +110,11 @@ void BThreadedTestCaller::run(CppUnit::TestResult *result) { result->startTest(this); - + if (fThreads.size() <= 0) throw CppUnit::Exception("BThreadedTestCaller::run() -- No threads added to BThreadedTestCaller()"); - try { + try { setUp(); // This try/catch block should never actually have to catch @@ -131,13 +131,13 @@ // blocked; their output appears later...). // // Each thread will acquire the semaphore once when launched, - // thus the initial thread count is equal the number of threads. + // thus the initial thread count is equal the number of threads. fThreadSem = create_sem(fThreads.size(), "ThreadSem"); if (fThreadSem < B_OK) - throw CppUnit::Exception("BThreadedTestCaller::run() -- Error creating fThreadSem"); + throw CppUnit::Exception("BThreadedTestCaller::run() -- Error creating fThreadSem"); // Launch all the threads. - for (ThreadManagerMap::iterator i = fThreads.begin(); + for (typename ThreadManagerMap::iterator i = fThreads.begin(); i != fThreads.end (); ++i) { @@ -146,7 +146,7 @@ result->addError(this, new CppUnit::Exception("Error launching thread '" + i->second->getName() + "'")); // printf("Launch(%s)\n", i->second->getName().c_str()); } - + // Now we loop. Before you faint, there is a reason for this: // Calls to NextSubTest() from other threads don't actually // print anything while the main thread is blocked waiting @@ -158,13 +158,13 @@ // any pending updates, and tries to acquire the semaphore // again. When it finally manages to acquire it, all the // test threads have terminated, and it's safe to clean up. - + status_t err; do { // Try to acquire the semaphore err = acquire_sem_etc(fThreadSem, fThreads.size(), B_RELATIVE_TIMEOUT, 500000); - - // Empty the UpdateList + + // Empty the UpdateList std::vector &list = fObject->AcquireUpdateList(); for (std::vector::iterator i = list.begin(); i != list.end(); @@ -172,16 +172,16 @@ { // Only print to standard out if the current global shell // lets us (or if no global shell is designated). - if (BTestShell::GlobalBeVerbose()) { + if (BTestShell::GlobalBeVerbose()) { printf("%s", (*i).c_str()); fflush(stdout); } } list.clear(); - fObject->ReleaseUpdateList(); - + fObject->ReleaseUpdateList(); + } while (err != B_OK); - + // If we get this far, we actually managed to acquire the semaphore, // so we should release it now. release_sem_etc(fThreadSem, fThreads.size(), 0); @@ -189,9 +189,9 @@ // Print out a newline for asthetics :-) printf("\n"); -/* - - +/* + + // Wait for them all to finish, then clean up for (ThreadManagerMap::iterator i = fThreads.begin(); i != fThreads.end (); @@ -206,21 +206,21 @@ */ fThreads.clear(); - + } catch ( CppUnit::Exception &e ) { // Add on the a note that this exception was caught by the // thread caller (which is a bad thing), then note the exception CppUnit::Exception *threadException = new CppUnit::Exception( std::string(e.what()) + " (NOTE: caught by BThreadedTestCaller)", e.sourceLine() - ); + ); result->addFailure( fObject, threadException ); } catch ( std::exception &e ) { // Add on the thread name, then note the exception CppUnit::Exception *threadException = new CppUnit::Exception( std::string(e.what()) + " (NOTE: caught by BThreadedTestCaller)" - ); + ); result->addError( fObject, threadException ); } catch (...) { @@ -237,7 +237,7 @@ tearDown(); } catch (...) { result->addError(this, new CppUnit::Exception("tearDown() failed")); - } + } } catch (...) { result->addError(this, new CppUnit::Exception("setUp() failed")); } // setUp() try/catch block @@ -253,7 +253,7 @@ throw CppUnit::Exception("BThreadedTestCaller::runTest() -- NULL fObject pointer"); if (!fObject->RegisterForUse()) throw CppUnit::Exception("BThreadedTestCaller::runTest() -- Attempt to reuse ThreadedTestCase object already in use"); - + fObject->setUp(); } @@ -265,8 +265,8 @@ template std::string -BThreadedTestCaller::toString() const { - return std::string("BThreadedTestCaller for ") + getName(); +BThreadedTestCaller::toString() const { + return std::string("BThreadedTestCaller for ") + getName(); } #endif // _beos_threaded_test_caller_h_ Modified: haiku/trunk/headers/tools/cppunit/ThreadedTestCase.h =================================================================== --- haiku/trunk/headers/tools/cppunit/ThreadedTestCase.h 2009-05-02 19:03:19 UTC (rev 30585) +++ haiku/trunk/headers/tools/cppunit/ThreadedTestCase.h 2009-05-02 19:04:52 UTC (rev 30586) @@ -11,46 +11,46 @@ //! Base class for single threaded unit tests class CPPUNIT_API BThreadedTestCase : public BTestCase { public: - BThreadedTestCase(string Name = "", string progressSeparator = "."); + BThreadedTestCase(std::string Name = "", std::string progressSeparator = "."); virtual ~BThreadedTestCase(); - + /*! \brief Displays the next sub test progress indicator for the thread in which it's called (i.e. [A.0][B.0][A.1][A.2][B.1]...). */ virtual void NextSubTest(); - + /*! \brief Prints to standard out just like printf, except shell verbosity settings are honored, and output from threads other than the main thread happens before the test is over. - + \note Currently your output is limited to a length of 1024 characters. If you really need to print a single string that's long than that, fix the function yourself :-). */ virtual void Outputf(const char *str, ...); - - //! Saves the location of the current working directory. + + //! Saves the location of the current working directory. void SaveCWD(); - - //! Restores the current working directory to last directory saved by a call to SaveCWD(). + + //! Restores the current working directory to last directory saved by a call to SaveCWD(). void RestoreCWD(const char *alternate = NULL); - void InitThreadInfo(thread_id id, string threadName); + void InitThreadInfo(thread_id id, std::string threadName); bool RegisterForUse(); void UnregisterForUse(); - - vector& AcquireUpdateList(); + + std::vector& AcquireUpdateList(); void ReleaseUpdateList(); protected: bool fInUse; // friend class ThreadManager; - string fProgressSeparator; + std::string fProgressSeparator; struct ThreadSubTestInfo { - string name; - int32 subTestNum; + std::string name; + int32 subTestNum; }; - map fNumberMap; - vector fUpdateList; + std::map fNumberMap; + std::vector fUpdateList; BLocker *fUpdateLock; }; Modified: haiku/trunk/headers/tools/cppunit/cppunit/Asserter.h =================================================================== --- haiku/trunk/headers/tools/cppunit/cppunit/Asserter.h 2009-05-02 19:03:19 UTC (rev 30585) +++ haiku/trunk/headers/tools/cppunit/cppunit/Asserter.h 2009-05-02 19:04:52 UTC (rev 30586) @@ -16,23 +16,23 @@ * \code * #include * #include - * - * void + * + * void * checkXmlEqual( string expectedXml, * string actualXml, * CppUnit::SourceLine sourceLine ) * { * string expected = XmlUniformiser( expectedXml ).stripped(); * string actual = XmlUniformiser( actualXml ).stripped(); - * + * * if ( expected == actual ) * return; - * + * * ::CppUnit::Asserter::failNotEqual( expected, * actual, * sourceLine ); * } - * + * * /// Asserts that two XML strings are equivalent. * #define CPPUNITTEST_ASSERT_XML_EQUAL( expected, actual ) \ * checkXmlEqual( expected, actual, \ @@ -44,7 +44,7 @@ /*! Throws a Exception with the specified message and location. */ - void CPPUNIT_API fail( string message, + void CPPUNIT_API fail( std::string message, SourceLine sourceLine = SourceLine() ); /*! Throws a Exception with the specified message and location. @@ -53,8 +53,8 @@ * \param message Message explaining the assertion failiure. * \param sourceLine Location of the assertion. */ - void CPPUNIT_API failIf( bool shouldFail, - string message, + void CPPUNIT_API failIf( bool shouldFail, + std::string message, SourceLine sourceLine = SourceLine() ); /*! Throws a NotEqualException with the specified message and location. @@ -64,10 +64,10 @@ * where the "difference" is located. * \param sourceLine Location of the assertion. */ - void CPPUNIT_API failNotEqual( string expected, - string actual, + void CPPUNIT_API failNotEqual( std::string expected, + std::string actual, SourceLine sourceLine = SourceLine(), - string additionalMessage ="" ); + std::string additionalMessage ="" ); /*! Throws a NotEqualException with the specified message and location. * \param shouldFail if \c true then the exception is thrown. Otherwise @@ -79,10 +79,10 @@ * \param sourceLine Location of the assertion. */ void CPPUNIT_API failNotEqualIf( bool shouldFail, - string expected, - string actual, + std::string expected, + std::string actual, SourceLine sourceLine = SourceLine(), - string additionalMessage ="" ); + std::string additionalMessage ="" ); } // namespace Asserter } // namespace CppUnit Modified: haiku/trunk/headers/tools/cppunit/cppunit/CompilerOutputter.h =================================================================== --- haiku/trunk/headers/tools/cppunit/cppunit/CompilerOutputter.h 2009-05-02 19:03:19 UTC (rev 30585) +++ haiku/trunk/headers/tools/cppunit/cppunit/CompilerOutputter.h 2009-05-02 19:04:52 UTC (rev 30586) @@ -15,7 +15,7 @@ class TestFailure; class TestResultCollector; -/*! +/*! * \brief Outputs a TestResultCollector in a compiler compatible format. * \ingroup WritingTestResult * @@ -33,23 +33,23 @@ * int main( int argc, char* argv[] ) { * // if command line contains "-selftest" then this is the post build check * // => the output must be in the compiler error format. - * bool selfTest = (argc > 1) && + * bool selfTest = (argc > 1) && * (string("-selftest") == argv[1]); * * CppUnit::TextUi::TestRunner runner; * runner.addTest( CppUnitTest::suite() ); // Add the top suite to the test runner - * + * * if ( selfTest ) * { // Change the default outputter to a compiler error format outputter * // The test runner owns the new outputter. - * runner.setOutputter( CppUnit::CompilerOutputter::defaultOutputter( + * runner.setOutputter( CppUnit::CompilerOutputter::defaultOutputter( * &runner.result(), * cerr ) ); * } - * + * * // Run the test and don't wait a key if post build check. * bool wasSucessful = runner.run( "", !selfTest ); - * + * * // Return error code 1 if the one of test failed. * return wasSucessful ? 0 : 1; * } @@ -61,7 +61,7 @@ /*! Constructs a CompilerOutputter object. */ CompilerOutputter( TestResultCollector *result, - ostream &stream ); + std::ostream &stream ); /// Destructor. virtual ~CompilerOutputter(); @@ -69,7 +69,7 @@ /*! Creates an instance of an outputter that matches your current compiler. */ static CompilerOutputter *defaultOutputter( TestResultCollector *result, - ostream &stream ); + std::ostream &stream ); void write(); @@ -84,7 +84,7 @@ virtual void printFailureMessage( TestFailure *failure ); virtual void printNotEqualMessage( Exception *thrownException ); virtual void printDefaultMessage( Exception *thrownException ); - virtual string wrap( string message ); + virtual std::string wrap( std::string message ); private: /// Prevents the use of the copy constructor. @@ -93,12 +93,12 @@ /// Prevents the use of the copy operator. void operator =( const CompilerOutputter © ); - typedef vector Lines; - static Lines splitMessageIntoLines( string message ); + typedef std::vector Lines; + static Lines splitMessageIntoLines( std::string message ); private: TestResultCollector *m_result; - ostream &m_stream; + std::ostream &m_stream; }; Modified: haiku/trunk/headers/tools/cppunit/cppunit/Exception.h =================================================================== --- haiku/trunk/headers/tools/cppunit/cppunit/Exception.h 2009-05-02 19:03:19 UTC (rev 30585) +++ haiku/trunk/headers/tools/cppunit/cppunit/Exception.h 2009-05-02 19:04:52 UTC (rev 30586) @@ -14,31 +14,31 @@ * Exception is an exception that serves * descriptive strings through its what() method */ -class CPPUNIT_API Exception : public exception +class CPPUNIT_API Exception : public std::exception { public: class Type { public: - Type( string type ) : m_type ( type ) {} + Type( std::string type ) : m_type ( type ) {} bool operator ==( const Type &other ) const { return m_type == other.m_type; } private: - const string m_type; + const std::string m_type; }; - Exception( string message = "", + Exception( std::string message = "", SourceLine sourceLine = SourceLine() ); #ifdef CPPUNIT_ENABLE_SOURCELINE_DEPRECATED - Exception( string message, - long lineNumber, - string fileName ); + Exception( std::string message, + long lineNumber, + std::string fileName ); #endif Exception (const Exception& other); @@ -55,12 +55,12 @@ long lineNumber() const; string fileName() const; - static const string UNKNOWNFILENAME; + static const std::string UNKNOWNFILENAME; static const long UNKNOWNLINENUMBER; #endif virtual Exception *clone() const; - + virtual bool isInstanceOf( const Type &type ) const; static Type type(); @@ -68,9 +68,9 @@ private: // VC++ does not recognize call to parent class when prefixed // with a namespace. This is a workaround. - typedef exception SuperClass; + typedef std::exception SuperClass; - string m_message; + std::string m_message; SourceLine m_sourceLine; }; Modified: haiku/trunk/headers/tools/cppunit/cppunit/NotEqualException.h =================================================================== --- haiku/trunk/headers/tools/cppunit/cppunit/NotEqualException.h 2009-05-02 19:03:19 UTC (rev 30585) +++ haiku/trunk/headers/tools/cppunit/cppunit/NotEqualException.h 2009-05-02 19:04:52 UTC (rev 30586) @@ -19,16 +19,16 @@ * \param additionalMessage Additionnal information provided to further qualify * the inequality. */ - NotEqualException( string expected, - string actual, + NotEqualException( std::string expected, + std::string actual, SourceLine sourceLine = SourceLine(), - string additionalMessage = "" ); + std::string additionalMessage = "" ); #ifdef CPPUNIT_ENABLE_SOURCELINE_DEPRECATED - NotEqualException( string expected, - string actual, - long lineNumber, - string fileName ); + NotEqualException( std::string expected, + std::string actual, + long lineNumber, + std::string fileName ); #endif NotEqualException( const NotEqualException &other ); @@ -36,11 +36,11 @@ virtual ~NotEqualException() throw(); - string expectedValue() const; + std::string expectedValue() const; - string actualValue() const; + std::string actualValue() const; - string additionalMessage() const; + std::string additionalMessage() const; /*! Copy operator. * @param other Object to copy. @@ -55,9 +55,9 @@ static Type type(); private: - string m_expected; - string m_actual; - string m_additionalMessage; + std::string m_expected; + std::string m_actual; + std::string m_additionalMessage; }; } // namespace CppUnit Modified: haiku/trunk/headers/tools/cppunit/cppunit/Portability.h =================================================================== --- haiku/trunk/headers/tools/cppunit/cppunit/Portability.h 2009-05-02 19:03:19 UTC (rev 30585) +++ haiku/trunk/headers/tools/cppunit/cppunit/Portability.h 2009-05-02 19:04:52 UTC (rev 30586) @@ -21,6 +21,10 @@ #undef CPPUNIT_FUNC_STRING_COMPARE_STRING_FIRST #endif +#if __GNUC__ > 2 +#undef CPPUNIT_FUNC_STRING_COMPARE_STRING_FIRST +#endif + /* Define to 1 if you wish to have the old-style macros assert(), assertEqual(), assertDoublesEqual(), and assertLongsEqual() */ #ifndef CPPUNIT_ENABLE_NAKED_ASSERT @@ -33,7 +37,7 @@ #define CPPUNIT_ENABLE_CU_TEST_MACROS 0 #endif -/* Define to 1 if the preprocessor expands (#foo) to "foo" (quotes incl.) +/* Define to 1 if the preprocessor expands (#foo) to "foo" (quotes incl.) I don't think there is any C preprocess that does NOT support this! */ #ifndef CPPUNIT_HAVE_CPP_SOURCE_ANNOTATION #define CPPUNIT_HAVE_CPP_SOURCE_ANNOTATION 1 @@ -60,11 +64,11 @@ #if CPPUNIT_HAVE_SSTREAM # include namespace CppUnit { - class OStringStream : public ostringstream + class OStringStream : public ostringstream { }; } -#else +#else #if CPPUNIT_HAVE_CLASS_STRSTREAM # include # if CPPUNIT_HAVE_STRSTREAM @@ -74,14 +78,14 @@ # endif namespace CppUnit { - class OStringStream : public ostrstream + class OStringStream : public std::ostrstream { public: - string str() + std::string str() { (*this) << '\0'; - string msg(ostrstream::str()); - ostrstream::freeze(false); + std::string msg(std::ostrstream::str()); + std::ostrstream::freeze(false); return msg; } }; Modified: haiku/trunk/headers/tools/cppunit/cppunit/SourceLine.h =================================================================== --- haiku/trunk/headers/tools/cppunit/cppunit/SourceLine.h 2009-05-02 19:03:19 UTC (rev 30585) +++ haiku/trunk/headers/tools/cppunit/cppunit/SourceLine.h 2009-05-02 19:04:52 UTC (rev 30586) @@ -21,7 +21,7 @@ * \ingroup BrowsingCollectedTestResult * * Used to capture the failure location in assertion. - * + * * Use the CPPUNIT_SOURCELINE() macro to construct that object. Typically used when * writing an assertion macro in association with Asserter. * @@ -32,7 +32,7 @@ public: SourceLine(); - SourceLine( const string &fileName, + SourceLine( const std::string &fileName, int lineNumber ); /// Destructor. @@ -42,13 +42,13 @@ int lineNumber() const; - string fileName() const; + std::string fileName() const; bool operator ==( const SourceLine &other ) const; bool operator !=( const SourceLine &other ) const; private: - string m_fileName; + std::string m_fileName; int m_lineNumber; }; Modified: haiku/trunk/headers/tools/cppunit/cppunit/Test.h =================================================================== --- haiku/trunk/headers/tools/cppunit/cppunit/Test.h 2009-05-02 19:03:19 UTC (rev 30585) +++ haiku/trunk/headers/tools/cppunit/cppunit/Test.h 2009-05-02 19:04:52 UTC (rev 30586) @@ -13,7 +13,7 @@ * * All test objects should be a subclass of Test. Some test objects, * TestCase for example, represent one individual test. Other test - * objects, such as TestSuite, are comprised of several tests. + * objects, such as TestSuite, are comprised of several tests. * * When a Test is run, the result is collected by a TestResult object. * @@ -38,20 +38,20 @@ virtual int countTestCases () const = 0; /*! \brief Returns the test name. - * + * * Each test has a name. This name may be used to find the * test in a suite or registry of tests. */ - virtual string getName () const = 0; + virtual std::string getName () const = 0; /*! \brief Description of the test, for diagnostic output. * * The test description will typically include the test name, * but may have additional description. For example, a test - * suite named complex_add may be described as + * suite named complex_add may be described as * suite complex_add. */ - virtual string toString () const = 0; + virtual std::string toString () const = 0; }; Modified: haiku/trunk/headers/tools/cppunit/cppunit/TestAssert.h =================================================================== --- haiku/trunk/headers/tools/cppunit/cppunit/TestAssert.h 2009-05-02 19:03:19 UTC (rev 30585) +++ haiku/trunk/headers/tools/cppunit/cppunit/TestAssert.h 2009-05-02 19:04:52 UTC (rev 30586) @@ -20,7 +20,7 @@ * { * return x == y; * } - * + * * static string toString( const string& x ) * { * string text = '"' + x + '"'; // adds quote around the string to see whitespace @@ -32,14 +32,14 @@ * \endcode */ [... truncated: 2932 lines follow ...] From kirilla at mail.berlios.de Sat May 2 21:05:29 2009 From: kirilla at mail.berlios.de (kirilla at BerliOS) Date: Sat, 2 May 2009 21:05:29 +0200 Subject: [Haiku-commits] r30587 - haiku/trunk/headers/posix Message-ID: <200905021905.n42J5TDY016888@sheep.berlios.de> Author: kirilla Date: 2009-05-02 21:05:28 +0200 (Sat, 02 May 2009) New Revision: 30587 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30587&view=rev Modified: haiku/trunk/headers/posix/setjmp.h haiku/trunk/headers/posix/signal.h Log: Adding mipsel arch. Modified: haiku/trunk/headers/posix/setjmp.h =================================================================== --- haiku/trunk/headers/posix/setjmp.h 2009-05-02 19:04:52 UTC (rev 30586) +++ haiku/trunk/headers/posix/setjmp.h 2009-05-02 19:05:28 UTC (rev 30587) @@ -14,6 +14,8 @@ #include #elif __M68K__ #include +#elif __MIPSEL__ + #include #else #error #include /arch_setjmp.h> #endif Modified: haiku/trunk/headers/posix/signal.h =================================================================== --- haiku/trunk/headers/posix/signal.h 2009-05-02 19:04:52 UTC (rev 30586) +++ haiku/trunk/headers/posix/signal.h 2009-05-02 19:05:28 UTC (rev 30587) @@ -257,6 +257,8 @@ #include #elif __M68K__ #include +#elif __MIPSEL__ + #include #else #error #include /signal.h> #endif From zooey at hirschkaefer.de Sat May 2 21:11:08 2009 From: zooey at hirschkaefer.de (Oliver Tappe) Date: Sat, 02 May 2009 21:11:08 +0200 Subject: [Haiku-commits] r30573 - haiku/trunk/build/jam In-Reply-To: References: <200905021539.n42Fdok8022021@sheep.berlios.de> Message-ID: <20090502211108.1534.2@bee.hirschkaefer.site> On 2009-05-02 at 18:40:42 [+0200], Michael Weirauch wrote: > 2009/5/2 zooey at BerliOS : > > Author: zooey > > Date: 2009-05-02 17:39:49 +0200 (Sat, 02 May 2009) > > New Revision: 30573 > > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30573&view=rev > > > > Modified: > > haiku/trunk/build/jam/HaikuImage > > Log: > > * now that it builds for gcc4 and gcc2, added locale kit back to image > > Can it be that $(TARGET_LIBSTDC++) is required in the Jamfile? Getting > undefined reference to `std::__throw_bad_alloc()' > on gcc4 native install. Possible - but what target triggered the error? cheers, Oliver From zooey at mail.berlios.de Sat May 2 21:15:42 2009 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Sat, 2 May 2009 21:15:42 +0200 Subject: [Haiku-commits] r30588 - haiku/trunk/src/kits/locale Message-ID: <200905021915.n42JFgHd017674@sheep.berlios.de> Author: zooey Date: 2009-05-02 21:15:42 +0200 (Sat, 02 May 2009) New Revision: 30588 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30588&view=rev Modified: haiku/trunk/src/kits/locale/Jamfile Log: * should be linked against target-c++-lib (as I'm told by Rene) Modified: haiku/trunk/src/kits/locale/Jamfile =================================================================== --- haiku/trunk/src/kits/locale/Jamfile 2009-05-02 19:05:28 UTC (rev 30587) +++ haiku/trunk/src/kits/locale/Jamfile 2009-05-02 19:15:42 UTC (rev 30588) @@ -33,5 +33,5 @@ PropertyFile.cpp strfmon.cpp UnicodeChar.cpp - : be -; + : be $(TARGET_LIBSTDC++) + ; From oruizdorantes at mail.berlios.de Sat May 2 22:19:48 2009 From: oruizdorantes at mail.berlios.de (oruizdorantes at BerliOS) Date: Sat, 2 May 2009 22:19:48 +0200 Subject: [Haiku-commits] r30589 - in haiku/trunk/src: preferences/bluetooth servers/bluetooth Message-ID: <200905022019.n42KJmMr021935@sheep.berlios.de> Author: oruizdorantes Date: 2009-05-02 22:19:47 +0200 (Sat, 02 May 2009) New Revision: 30589 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30589&view=rev Modified: haiku/trunk/src/preferences/bluetooth/BluetoothMain.cpp haiku/trunk/src/preferences/bluetooth/DeviceListItem.cpp haiku/trunk/src/servers/bluetooth/DeviceManager.cpp Log: Fix spelling errors Modified: haiku/trunk/src/preferences/bluetooth/BluetoothMain.cpp =================================================================== --- haiku/trunk/src/preferences/bluetooth/BluetoothMain.cpp 2009-05-02 19:15:42 UTC (rev 30588) +++ haiku/trunk/src/preferences/bluetooth/BluetoothMain.cpp 2009-05-02 20:19:47 UTC (rev 30589) @@ -38,7 +38,7 @@ " - Luroh\n" " - Pieter Panman\n\n" "Economically:\n" - " - Karl von Dorf, Andrea Bernardi (OSDrawer),\n" + " - Karl vom Dorff, Andrea Bernardi (OSDrawer),\n" " - Matt M, Doug F, Hubert H,\n" " - Sebastian B, Andrew M, Jared E,\n" " - Frederik H, Tom S, Ferry B,\n" Modified: haiku/trunk/src/preferences/bluetooth/DeviceListItem.cpp =================================================================== --- haiku/trunk/src/preferences/bluetooth/DeviceListItem.cpp 2009-05-02 19:15:42 UTC (rev 30588) +++ haiku/trunk/src/preferences/bluetooth/DeviceListItem.cpp 2009-05-02 20:19:47 UTC (rev 30589) @@ -18,7 +18,7 @@ namespace Bluetooth { -DeviceListItem::DeviceListItem(BluetoothDevice* bDevice) +DeviceListItem::DeviceListItem(BluetoothDevice* bDevice) : BListItem(), fDevice(bDevice) { @@ -26,7 +26,7 @@ } -DeviceListItem::DeviceListItem(bdaddr_t bdaddr, DeviceClass dClass, int32 rssi) +DeviceListItem::DeviceListItem(bdaddr_t bdaddr, DeviceClass dClass, int32 rssi) : BListItem(), fDevice(NULL), fAddress(bdaddr), Modified: haiku/trunk/src/servers/bluetooth/DeviceManager.cpp =================================================================== --- haiku/trunk/src/servers/bluetooth/DeviceManager.cpp 2009-05-02 19:15:42 UTC (rev 30588) +++ haiku/trunk/src/servers/bluetooth/DeviceManager.cpp 2009-05-02 20:19:47 UTC (rev 30589) @@ -233,7 +233,7 @@ if (error != B_OK) return error; - Output::Instance()->Postf(BLACKBOARD_DEVICEMANAGER, "%s path being monitorized\n", path.Path()); + Output::Instance()->Postf(BLACKBOARD_DEVICEMANAGER, "%s path being monitored\n", path.Path()); // We are monitoring the root we may have already directories inside // to be monitored From stpere at mail.berlios.de Sat May 2 22:25:09 2009 From: stpere at mail.berlios.de (stpere at mail.berlios.de) Date: Sat, 2 May 2009 22:25:09 +0200 Subject: [Haiku-commits] r30590 - haiku/trunk/src/apps/stylededit Message-ID: <200905022025.n42KP91s022627@sheep.berlios.de> Author: stpere Date: 2009-05-02 22:24:53 +0200 (Sat, 02 May 2009) New Revision: 30590 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30590&view=rev Modified: haiku/trunk/src/apps/stylededit/StyledEditWindow.cpp haiku/trunk/src/apps/stylededit/StyledEditWindow.h Log: StyledEdit didn't clear the marks on the Font Styles in the font menu. It resulted in several bogus checkmarks. (ticket #2984) Also, The last font was always checked by default. The error was that instead than Marking the "left align" item, it was checking that font because of the wrong variable used. Modified: haiku/trunk/src/apps/stylededit/StyledEditWindow.cpp =================================================================== --- haiku/trunk/src/apps/stylededit/StyledEditWindow.cpp 2009-05-02 20:19:47 UTC (rev 30589) +++ haiku/trunk/src/apps/stylededit/StyledEditWindow.cpp 2009-05-02 20:24:53 UTC (rev 30590) @@ -5,6 +5,7 @@ * Authors: * Mattias Sundblad * Andrew Bachmann + * Philippe Saint-Pierre */ #include "Constants.h" @@ -225,12 +226,10 @@ fFontColorMenu->AddItem(fYellowItem = new ColorMenuItem("Yellow", YELLOW, new BMessage(FONT_COLOR))); fFontMenu->AddSeparatorItem(); - // Available fonts, mark "be_plain_font" item + // Available fonts - font_family plainFamily; - font_style plainStyle; - be_plain_font->GetFamilyAndStyle(&plainFamily, &plainStyle); fCurrentFontItem = 0; + fCurrentStyleItem = 0; BMenu* subMenu; int32 numFamilies = count_font_families(); @@ -239,13 +238,9 @@ if (get_font_family(i, &family) == B_OK) { subMenu = new BMenu(family); subMenu->SetRadioMode(true); - fFontMenu->AddItem(menuItem = new BMenuItem(subMenu, new BMessage(FONT_FAMILY))); + fFontMenu->AddItem(menuItem = new BMenuItem(subMenu, + new BMessage(FONT_FAMILY))); - if (!strcmp(plainFamily, family)) { - menuItem->SetMarked(true); - fCurrentFontItem = menuItem; - } - int32 numStyles = count_font_styles(family); for (int32 j = 0; j < numStyles; j++) { font_style style; @@ -253,9 +248,6 @@ if (get_font_style(family, j, &style, &flags) == B_OK) { subMenu->AddItem(menuItem = new BMenuItem(style, new BMessage(FONT_STYLE))); - - if (!strcmp(plainStyle, style)) - menuItem->SetMarked(true); } } } @@ -270,7 +262,7 @@ subMenu->SetRadioMode(true); subMenu->AddItem(fAlignLeft = new BMenuItem("Left", new BMessage(ALIGN_LEFT))); - menuItem->SetMarked(true); + fAlignLeft->SetMarked(true); subMenu->AddItem(fAlignCenter = new BMenuItem("Center", new BMessage(ALIGN_CENTER))); subMenu->AddItem(fAlignRight = new BMenuItem("Right", new BMessage(ALIGN_RIGHT))); @@ -444,8 +436,8 @@ const char* fontStyle = NULL; void* ptr; if (message->FindPointer("source", &ptr) == B_OK) { - fCurrentFontItem = static_cast(ptr); - fontFamily = fCurrentFontItem->Label(); + BMenuItem* item = static_cast(ptr); + fontFamily = item->Label(); } SetFontStyle(fontFamily, fontStyle); break; @@ -460,9 +452,9 @@ fontStyle = item->Label(); BMenu* menu = item->Menu(); if (menu != NULL) { - fCurrentFontItem = menu->Superitem(); - if (fCurrentFontItem != NULL) - fontFamily = fCurrentFontItem->Label(); + BMenuItem* super_item = menu->Superitem(); + if (super_item != NULL) + fontFamily = super_item->Label(); } } SetFontStyle(fontFamily, fontStyle); @@ -629,9 +621,21 @@ // update the font menu // unselect the old values - if (fCurrentFontItem != NULL) + if (fCurrentFontItem != NULL) { fCurrentFontItem->SetMarked(false); + BMenu* menu = fCurrentFontItem->Submenu(); + if (menu != NULL) { + BMenuItem* item = menu->FindMarked(); + if (item != NULL) { + item->SetMarked(false); + } + } + } + if (fCurrentStyleItem != NULL) { + fCurrentStyleItem->SetMarked(false); + } + BMenuItem* oldColorItem = fFontColorMenu->FindMarked(); if (oldColorItem != NULL) oldColorItem->SetMarked(false); @@ -689,18 +693,20 @@ } } - if (sameProperties & B_FONT_FAMILY_AND_STYLE) { - font_family family; - font_style style; - font.GetFamilyAndStyle(&family, &style); - fCurrentFontItem = fFontMenu->FindItem(family); - if (fCurrentFontItem != NULL) { - fCurrentFontItem->SetMarked(true); - BMenu* menu = fCurrentFontItem->Submenu(); - if (menu != NULL) { - BMenuItem* item = menu->FindItem(style); - if (item != NULL) - item->SetMarked(true); + font_family family; + font_style style; + font.GetFamilyAndStyle(&family, &style); + + fCurrentFontItem = fFontMenu->FindItem(family); + + if (fCurrentFontItem != NULL) { + fCurrentFontItem->SetMarked(true); + BMenu* menu = fCurrentFontItem->Submenu(); + if (menu != NULL) { + BMenuItem* item = menu->FindItem(style); + fCurrentStyleItem = item; + if (fCurrentStyleItem != NULL) { + item->SetMarked(true); } } } @@ -1278,8 +1284,15 @@ // clear that family's bit on the menu, if necessary if (strcmp(oldFamily, fontFamily)) { BMenuItem* oldItem = fFontMenu->FindItem(oldFamily); - if (oldItem != NULL) + if (oldItem != NULL) { oldItem->SetMarked(false); + BMenu* menu = oldItem->Submenu(); + if (menu != NULL) { + oldItem = menu->FindItem(oldStyle); + if (oldItem != NULL) + oldItem->SetMarked(false); + } + } } font.SetFamilyAndStyle(fontFamily, fontStyle); @@ -1287,8 +1300,10 @@ BMenuItem* superItem; superItem = fFontMenu->FindItem(fontFamily); - if (superItem != NULL) + if (superItem != NULL) { superItem->SetMarked(true); + fCurrentFontItem = superItem; + } _UpdateCleanUndoRedoSaveRevert(); } Modified: haiku/trunk/src/apps/stylededit/StyledEditWindow.h =================================================================== --- haiku/trunk/src/apps/stylededit/StyledEditWindow.h 2009-05-02 20:19:47 UTC (rev 30589) +++ haiku/trunk/src/apps/stylededit/StyledEditWindow.h 2009-05-02 20:24:53 UTC (rev 30590) @@ -70,6 +70,7 @@ BMenu *fFontSizeMenu; BMenu *fFontColorMenu; BMenuItem *fCurrentFontItem; + BMenuItem *fCurrentStyleItem; BMenuItem *fSaveItem; BMenuItem *fRevertItem; From stippi at mail.berlios.de Sat May 2 22:58:27 2009 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sat, 2 May 2009 22:58:27 +0200 Subject: [Haiku-commits] r30591 - haiku/trunk/src/servers/app Message-ID: <200905022058.n42KwRpg026850@sheep.berlios.de> Author: stippi Date: 2009-05-02 22:58:24 +0200 (Sat, 02 May 2009) New Revision: 30591 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30591&view=rev Modified: haiku/trunk/src/servers/app/FontManager.cpp haiku/trunk/src/servers/app/FontManager.h Log: * Small style cleanup and some comments added for clarity. * FontManager::GetFamily() removed second call to _FindFamily() with no action in between -- why would it suddenly work the second time? Modified: haiku/trunk/src/servers/app/FontManager.cpp =================================================================== --- haiku/trunk/src/servers/app/FontManager.cpp 2009-05-02 20:24:53 UTC (rev 30590) +++ haiku/trunk/src/servers/app/FontManager.cpp 2009-05-02 20:58:24 UTC (rev 30591) @@ -445,6 +445,7 @@ status_t FontManager::_SetDefaultFonts() { + // plain font FontStyle* style = _GetDefaultStyle(DEFAULT_PLAIN_FONT_FAMILY, DEFAULT_PLAIN_FONT_STYLE, FALLBACK_PLAIN_FONT_FAMILY, DEFAULT_PLAIN_FONT_STYLE, @@ -457,6 +458,7 @@ if (fDefaultPlainFont == NULL) return B_NO_MEMORY; + // bold font style = _GetDefaultStyle(DEFAULT_BOLD_FONT_FAMILY, DEFAULT_BOLD_FONT_STYLE, FALLBACK_BOLD_FONT_FAMILY, DEFAULT_BOLD_FONT_STYLE, B_BOLD_FACE); @@ -465,6 +467,7 @@ if (fDefaultBoldFont == NULL) return B_NO_MEMORY; + // fixed font style = _GetDefaultStyle(DEFAULT_FIXED_FONT_FAMILY, DEFAULT_FIXED_FONT_STYLE, FALLBACK_FIXED_FONT_FAMILY, DEFAULT_FIXED_FONT_STYLE, B_REGULAR_FACE); @@ -474,6 +477,7 @@ return B_NO_MEMORY; fDefaultFixedFont->SetSpacing(B_FIXED_SPACING); + return B_OK; } @@ -918,11 +922,6 @@ if (fScanned) return NULL; - // try again - family = _FindFamily(name); - if (family != NULL) - return family; - // try font mappings before failing if (_AddMappedFont(name) == B_OK) return _FindFamily(name); Modified: haiku/trunk/src/servers/app/FontManager.h =================================================================== --- haiku/trunk/src/servers/app/FontManager.h 2009-05-02 20:24:53 UTC (rev 30590) +++ haiku/trunk/src/servers/app/FontManager.h 2009-05-02 20:58:24 UTC (rev 30591) @@ -112,6 +112,6 @@ }; extern FT_Library gFreeTypeLibrary; -extern FontManager *gFontManager; +extern FontManager* gFontManager; #endif /* FONT_MANAGER_H */ From axeld at pinc-software.de Sat May 2 23:00:56 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Sat, 02 May 2009 23:00:56 +0200 CEST Subject: [Haiku-commits] r30578 - haiku/trunk/src/add-ons/media/plugins/asf_reader In-Reply-To: <20090502194923.585.1@bepc.1241285607.fake> Message-ID: <44356214001-BeMail@zon> Stephan Assmus wrote: > On 2009-05-02 at 19:47:50 [+0200], anevilyak at BerliOS > wrote: > > Author: anevilyak > > Date: 2009-05-02 19:42:13 +0200 (Sat, 02 May 2009) New Revision: > > 30578 > > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30578&view=rev > > > > Modified: > > haiku/trunk/src/add-ons/media/plugins/asf_reader/ASFIndex.cpp > > Log: > > If I owed Axel a beer for every style violation, I'd quite likely > > be > > bankrupt by now... > ... and Axel very drunk! The beer would just pour in from everywhere > and > everyone... Maybe we should open a cash pool for this - every style violation costs 10 cents. Then we could use this to pay for something nice for the developers at meetings :-) Bye, Axel. From axeld at pinc-software.de Sat May 2 23:16:58 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Sat, 02 May 2009 23:16:58 +0200 CEST Subject: [Haiku-commits] r30552 - haiku/trunk/data/artwork/icons In-Reply-To: <200905020935.n429ZERg007346@sheep.berlios.de> Message-ID: <45318981508-BeMail@zon> stippi at mail.berlios.de wrote: > The new generic app icon looks pretty cool (Haiku colors) and could > replace > our current generic icon (broken link icon needs to be updated as > well then), > feedback welcome. I somehow like the old one better (I guess because it looks a bit more colorful and balanced), but I wouldn't mind switching either for getting the Haiku colors there. Bye, Axel. From stippi at mail.berlios.de Sat May 2 23:32:34 2009 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sat, 2 May 2009 23:32:34 +0200 Subject: [Haiku-commits] r30592 - haiku/trunk/src/servers/app Message-ID: <200905022132.n42LWYvt028681@sheep.berlios.de> Author: stippi Date: 2009-05-02 23:32:33 +0200 (Sat, 02 May 2009) New Revision: 30592 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30592&view=rev Modified: haiku/trunk/src/servers/app/FontManager.h Log: * Update header indentation * Unify pointer style, it was a mix before Modified: haiku/trunk/src/servers/app/FontManager.h =================================================================== --- haiku/trunk/src/servers/app/FontManager.h 2009-05-02 20:58:24 UTC (rev 30591) +++ haiku/trunk/src/servers/app/FontManager.h 2009-05-02 21:32:33 UTC (rev 30592) @@ -1,5 +1,5 @@ /* - * Copyright 2001-2005, Haiku. + * Copyright 2001-2009, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -32,83 +32,103 @@ \brief Manager for the largest part of the font subsystem */ class FontManager : public BLooper { - public: - FontManager(); - virtual ~FontManager(); +public: + FontManager(); + virtual ~FontManager(); - status_t InitCheck() { return fInitStatus; } - void SaveRecentFontMappings(); + status_t InitCheck() { return fInitStatus; } + void SaveRecentFontMappings(); - virtual void MessageReceived(BMessage* message); + virtual void MessageReceived(BMessage* message); - int32 CheckRevision(uid_t user); - int32 CountFamilies(); + int32 CheckRevision(uid_t user); + int32 CountFamilies(); - int32 CountStyles(const char *family); - int32 CountStyles(uint16 familyID); - FontFamily* FamilyAt(int32 index) const; + int32 CountStyles(const char* family); + int32 CountStyles(uint16 familyID); + FontFamily* FamilyAt(int32 index) const; - FontFamily *GetFamily(uint16 familyID) const; - FontFamily *GetFamily(const char *name); + FontFamily* GetFamily(uint16 familyID) const; + FontFamily* GetFamily(const char* name); - FontStyle *GetStyleByIndex(const char *family, int32 index); - FontStyle *GetStyleByIndex(uint16 familyID, int32 index); - FontStyle *GetStyle(const char *family, const char *style, uint16 familyID = 0xffff, - uint16 styleID = 0xffff, uint16 face = 0); - FontStyle *GetStyle(const char *family, uint16 styleID); - FontStyle *GetStyle(uint16 familyID, uint16 styleID) const; - FontStyle* FindStyleMatchingFace(uint16 face) const; + FontStyle* GetStyleByIndex(const char* family, + int32 index); + FontStyle* GetStyleByIndex(uint16 familyID, int32 index); + FontStyle* GetStyle(const char* family, const char* style, + uint16 familyID = 0xffff, + uint16 styleID = 0xffff, uint16 face = 0); + FontStyle* GetStyle(const char *family, uint16 styleID); + FontStyle* GetStyle(uint16 familyID, + uint16 styleID) const; + FontStyle* FindStyleMatchingFace(uint16 face) const; - void RemoveStyle(FontStyle* style); - // this call must not be used by anything else than class FontStyle + void RemoveStyle(FontStyle* style); + // This call must not be used by anything else than class + // FontStyle. - const ServerFont* DefaultPlainFont() const; - const ServerFont* DefaultBoldFont() const; - const ServerFont* DefaultFixedFont() const; + const ServerFont* DefaultPlainFont() const; + const ServerFont* DefaultBoldFont() const; + const ServerFont* DefaultFixedFont() const; - void AttachUser(uid_t userID); - void DetachUser(uid_t userID); + void AttachUser(uid_t userID); + void DetachUser(uid_t userID); - private: - struct font_directory; - struct font_mapping; +private: + struct font_directory; + struct font_mapping; - void _AddDefaultMapping(const char* family, const char* style, const char* path); - bool _LoadRecentFontMappings(); - status_t _AddMappedFont(const char* family, const char* style = NULL); - FontStyle* _GetDefaultStyle(const char* familyName, const char* styleName, - const char* fallbackFamily, const char* fallbackStyle, - uint16 fallbackFace); - status_t _SetDefaultFonts(); - void _AddSystemPaths(); - font_directory* _FindDirectory(node_ref& nodeRef); - void _RemoveDirectory(font_directory* directory); - status_t _CreateDirectories(const char* path); - status_t _AddPath(const char* path); - status_t _AddPath(BEntry& entry, font_directory** _newDirectory = NULL); + void _AddDefaultMapping(const char* family, + const char* style, const char* path); + bool _LoadRecentFontMappings(); + status_t _AddMappedFont(const char* family, + const char* style = NULL); + FontStyle* _GetDefaultStyle(const char* familyName, + const char* styleName, + const char* fallbackFamily, + const char* fallbackStyle, + uint16 fallbackFace); + status_t _SetDefaultFonts(); + void _AddSystemPaths(); + font_directory* _FindDirectory(node_ref& nodeRef); + void _RemoveDirectory(font_directory* directory); + status_t _CreateDirectories(const char* path); + status_t _AddPath(const char* path); + status_t _AddPath(BEntry& entry, + font_directory** _newDirectory = NULL); - void _RemoveStyle(font_directory& directory, FontStyle* style); - void _RemoveStyle(dev_t device, uint64 directory, uint64 node); - FontFamily* _FindFamily(const char* family) const; + void _RemoveStyle(font_directory& directory, + FontStyle* style); + void _RemoveStyle(dev_t device, uint64 directory, + uint64 node); + FontFamily* _FindFamily(const char* family) const; - void _ScanFontsIfNecessary(); - void _ScanFonts(); - status_t _ScanFontDirectory(font_directory& directory); - status_t _AddFont(font_directory& directory, BEntry& entry); + void _ScanFontsIfNecessary(); + void _ScanFonts(); + status_t _ScanFontDirectory(font_directory& directory); + status_t _AddFont(font_directory& directory, + BEntry& entry); - FT_CharMap _GetSupportedCharmap(const FT_Face &face); + FT_CharMap _GetSupportedCharmap(const FT_Face& face); - private: - status_t fInitStatus; - BObjectList fDirectories; - BObjectList fMappings; - BObjectList fFamilies; - HashTable fStyleHashTable; - ServerFont* fDefaultPlainFont; - ServerFont* fDefaultBoldFont; - ServerFont* fDefaultFixedFont; - bool fScanned; - int32 fNextID; +private: + status_t fInitStatus; + + typedef BObjectList DirectoryList; + typedef BObjectList MappingList; + typedef BObjectList FamilyList; + + DirectoryList fDirectories; + MappingList fMappings; + FamilyList fFamilies; + + HashTable fStyleHashTable; + + ServerFont* fDefaultPlainFont; + ServerFont* fDefaultBoldFont; + ServerFont* fDefaultFixedFont; + + bool fScanned; + int32 fNextID; }; extern FT_Library gFreeTypeLibrary; From stpere at mail.berlios.de Sun May 3 00:58:29 2009 From: stpere at mail.berlios.de (stpere at mail.berlios.de) Date: Sun, 3 May 2009 00:58:29 +0200 Subject: [Haiku-commits] r30593 - haiku/trunk/src/apps/screenshot Message-ID: <200905022258.n42MwTj6019633@sheep.berlios.de> Author: stpere Date: 2009-05-03 00:58:04 +0200 (Sun, 03 May 2009) New Revision: 30593 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30593&view=rev Added: haiku/trunk/src/apps/screenshot/PreviewView.cpp haiku/trunk/src/apps/screenshot/PreviewView.h Modified: haiku/trunk/src/apps/screenshot/Jamfile haiku/trunk/src/apps/screenshot/ScreenshotWindow.cpp haiku/trunk/src/apps/screenshot/ScreenshotWindow.h Log: Cosmetic change for the border around the screenshot preview, as suggested in #3367. Modified: haiku/trunk/src/apps/screenshot/Jamfile =================================================================== --- haiku/trunk/src/apps/screenshot/Jamfile 2009-05-02 21:32:33 UTC (rev 30592) +++ haiku/trunk/src/apps/screenshot/Jamfile 2009-05-02 22:58:04 UTC (rev 30593) @@ -6,6 +6,7 @@ Application Screenshot : main.cpp PNGDump.cpp + PreviewView.cpp Screenshot.cpp ScreenshotWindow.cpp : be tracker translation libpng.so libz.so Added: haiku/trunk/src/apps/screenshot/PreviewView.cpp =================================================================== --- haiku/trunk/src/apps/screenshot/PreviewView.cpp 2009-05-02 21:32:33 UTC (rev 30592) +++ haiku/trunk/src/apps/screenshot/PreviewView.cpp 2009-05-02 22:58:04 UTC (rev 30593) @@ -0,0 +1,27 @@ +/* + * Copyright 2009, Philippe Saint-Pierre, stpere at gmail.com + * Distributed under the terms of the MIT License. + */ + +#include "PreviewView.h" +#include + + +PreviewView::PreviewView() + : BView("preview", B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE) +{ +} + + +PreviewView::~PreviewView() +{ +} + + +void +PreviewView::Draw(BRect updateRect) +{ + BRect rect = Frame(); + be_control_look->DrawTextControlBorder(this, rect, rect, + ui_color(B_PANEL_BACKGROUND_COLOR)); +} Added: haiku/trunk/src/apps/screenshot/PreviewView.h =================================================================== --- haiku/trunk/src/apps/screenshot/PreviewView.h 2009-05-02 21:32:33 UTC (rev 30592) +++ haiku/trunk/src/apps/screenshot/PreviewView.h 2009-05-02 22:58:04 UTC (rev 30593) @@ -0,0 +1,22 @@ +/* + * Copyright 2009, Philippe Saint-Pierre, stpere at gmail.com + * Distributed under the terms of the MIT License. + */ + +#ifndef PREVIEW_VIEW_H +#define PREVIEW_VIEW_H + + +#include + + +class PreviewView : public BView { +public: + PreviewView(); + ~PreviewView(); + +protected: + virtual void Draw(BRect updateRect); +}; + +#endif /* PREVIEW_VIEW_H */ Modified: haiku/trunk/src/apps/screenshot/ScreenshotWindow.cpp =================================================================== --- haiku/trunk/src/apps/screenshot/ScreenshotWindow.cpp 2009-05-02 21:32:33 UTC (rev 30592) +++ haiku/trunk/src/apps/screenshot/ScreenshotWindow.cpp 2009-05-02 22:58:04 UTC (rev 30593) @@ -7,7 +7,6 @@ #include "PNGDump.h" - #include #include #include @@ -324,9 +323,7 @@ void ScreenshotWindow::_SetupSecondLayoutItem(BCardLayout* layout) { - fPreviewBox = new BBox(BRect(0.0, 0.0, 200.0, 150.0)); - fPreviewBox->SetExplicitMinSize(BSize(200.0, B_SIZE_UNSET)); - fPreviewBox->SetFlags(fPreviewBox->Flags() | B_FULL_UPDATE_ON_RESIZE); + fPreview = new PreviewView(); fNameControl = new BTextControl("", "Name:", "screenshot1", NULL); @@ -354,7 +351,7 @@ layout->AddView(1, BGroupLayoutBuilder(B_VERTICAL) .Add(BGroupLayoutBuilder(B_HORIZONTAL, 10.0) - .Add(fPreviewBox) + .Add(fPreview) .AddGroup(B_VERTICAL) .Add(gridLayout->View()) .AddGlue() @@ -514,13 +511,13 @@ fScreenshot->Bounds().Width()) * width; } - fPreviewBox->SetExplicitMinSize(BSize(width, height)); - fPreviewBox->SetExplicitMaxSize(BSize(width, height)); + fPreview->SetExplicitMinSize(BSize(width, height)); + fPreview->SetExplicitMaxSize(BSize(width, height)); - fPreviewBox->ClearViewBitmap(); - fPreviewBox->SetViewBitmap(fScreenshot, fScreenshot->Bounds(), - fPreviewBox->Bounds(), B_FOLLOW_ALL, 0); - + fPreview->ClearViewBitmap(); + fPreview->SetViewBitmap(fScreenshot, fScreenshot->Bounds(), + fPreview->Bounds(), B_FOLLOW_ALL, 0); + BCardLayout* layout = dynamic_cast (GetLayout()); if (layout) layout->SetVisibleItem(1L); Modified: haiku/trunk/src/apps/screenshot/ScreenshotWindow.h =================================================================== --- haiku/trunk/src/apps/screenshot/ScreenshotWindow.h 2009-05-02 21:32:33 UTC (rev 30592) +++ haiku/trunk/src/apps/screenshot/ScreenshotWindow.h 2009-05-02 22:58:04 UTC (rev 30593) @@ -5,6 +5,7 @@ #include #include +#include "PreviewView.h" class BBitmap; class BBox; @@ -57,7 +58,7 @@ void _SaveScreenshotSilent() const; private: - BBox* fPreviewBox; + PreviewView* fPreview; BRadioButton* fActiveWindow; BRadioButton* fWholeDesktop; BTextControl* fDelayControl; From stpere at mail.berlios.de Sun May 3 01:44:15 2009 From: stpere at mail.berlios.de (stpere at mail.berlios.de) Date: Sun, 3 May 2009 01:44:15 +0200 Subject: [Haiku-commits] r30594 - haiku/trunk/src/preferences/fonts Message-ID: <200905022344.n42NiFYS012399@sheep.berlios.de> Author: stpere Date: 2009-05-03 01:44:05 +0200 (Sun, 03 May 2009) New Revision: 30594 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30594&view=rev Modified: haiku/trunk/src/preferences/fonts/MainWindow.cpp Log: As suggested in ticket #3717, I commented out the tabView in fonts preflet. I added a BBox with fancy borders to group the controls together, as I didn't like the view. Modified: haiku/trunk/src/preferences/fonts/MainWindow.cpp =================================================================== --- haiku/trunk/src/preferences/fonts/MainWindow.cpp 2009-05-02 22:58:04 UTC (rev 30593) +++ haiku/trunk/src/preferences/fonts/MainWindow.cpp 2009-05-02 23:44:05 UTC (rev 30594) @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -46,20 +47,24 @@ new BMessage(kMsgRevert), B_WILL_DRAW); fRevertButton->SetEnabled(false); - BTabView* tabView = new BTabView("tabview", B_WIDTH_FROM_LABEL); +// BTabView* tabView = new BTabView("tabview", B_WIDTH_FROM_LABEL); + BBox* box = new BBox(B_FANCY_BORDER, NULL); + fFontsView = new FontView(); - tabView->AddTab(fFontsView); +// tabView->AddTab(fFontsView); + box->AddChild(fFontsView); fFontsView->UpdateFonts(); SetLayout(new BGroupLayout(B_VERTICAL)); - const float kInset = 8; + const float kInset = 10; AddChild(BGroupLayoutBuilder(B_VERTICAL) - .Add(tabView) + .Add(box) +// .Add(tabView) .Add(BSpaceLayoutItem::CreateVerticalStrut(kInset)) .Add(BGroupLayoutBuilder(B_HORIZONTAL) .Add(fDefaultsButton) From stpere at mail.berlios.de Sun May 3 03:00:55 2009 From: stpere at mail.berlios.de (stpere at mail.berlios.de) Date: Sun, 3 May 2009 03:00:55 +0200 Subject: [Haiku-commits] r30595 - haiku/trunk/src/apps/pulse Message-ID: <200905030100.n4310tJK026401@sheep.berlios.de> Author: stpere Date: 2009-05-03 03:00:42 +0200 (Sun, 03 May 2009) New Revision: 30595 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30595&view=rev Modified: haiku/trunk/src/apps/pulse/PulseApp.cpp Log: Pulse couldn't work in mini-mode since it was reverting to normal mode in every cases except when successfully launched in deskbar mode. That was the cause of bug #3384. Modified: haiku/trunk/src/apps/pulse/PulseApp.cpp =================================================================== --- haiku/trunk/src/apps/pulse/PulseApp.cpp 2009-05-02 23:44:05 UTC (rev 30594) +++ haiku/trunk/src/apps/pulse/PulseApp.cpp 2009-05-03 01:00:42 UTC (rev 30595) @@ -125,7 +125,7 @@ if (prefs->window_mode == DESKBAR_MODE && LoadInDeskbar()) { PostMessage(new BMessage(B_QUIT_REQUESTED)); return; - } else + } else if (prefs->window_mode == DESKBAR_MODE) prefs->window_mode = NORMAL_WINDOW_MODE; PulseWindow *pulseWindow = NULL; From stpere at mail.berlios.de Sun May 3 03:23:24 2009 From: stpere at mail.berlios.de (stpere at mail.berlios.de) Date: Sun, 3 May 2009 03:23:24 +0200 Subject: [Haiku-commits] r30596 - haiku/trunk/src/kits/interface Message-ID: <200905030123.n431NOlS028484@sheep.berlios.de> Author: stpere Date: 2009-05-03 03:23:12 +0200 (Sun, 03 May 2009) New Revision: 30596 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30596&view=rev Modified: haiku/trunk/src/kits/interface/ScrollBar.cpp Log: There was an "off by one" error in the routine used to detect if a click was inside the arrow buttons. Reported by mmadia in ticket #3611. Thanks! Modified: haiku/trunk/src/kits/interface/ScrollBar.cpp =================================================================== --- haiku/trunk/src/kits/interface/ScrollBar.cpp 2009-05-03 01:00:42 UTC (rev 30595) +++ haiku/trunk/src/kits/interface/ScrollBar.cpp 2009-05-03 01:23:12 UTC (rev 30596) @@ -1478,7 +1478,7 @@ } BRect rect(bounds.left, bounds.top, - bounds.left + buttonSize - 1.0, bounds.top + buttonSize - 1.0); + bounds.left + buttonSize, bounds.top + buttonSize); if (fOrientation == B_VERTICAL) { if (rect.Contains(where)) From anevilyak at gmail.com Sun May 3 04:22:43 2009 From: anevilyak at gmail.com (Rene Gollent) Date: Sat, 2 May 2009 21:22:43 -0500 Subject: [Haiku-commits] r30578 - haiku/trunk/src/add-ons/media/plugins/asf_reader In-Reply-To: <44356214001-BeMail@zon> References: <20090502194923.585.1@bepc.1241285607.fake> <44356214001-BeMail@zon> Message-ID: On Sat, May 2, 2009 at 4:00 PM, Axel D?rfler wrote: > > Maybe we should open a cash pool for this - every style violation costs > 10 cents. Then we could use this to pay for something nice for the > developers at meetings :-) Fun idea, but that'd be logistically difficult to manage considering how spread out we all are :) Thanks for the proofreading (and patience) as always in any event. Regards, Rene From stpere at mail.berlios.de Sun May 3 05:23:35 2009 From: stpere at mail.berlios.de (stpere at mail.berlios.de) Date: Sun, 3 May 2009 05:23:35 +0200 Subject: [Haiku-commits] r30597 - haiku/trunk/src/apps/terminal Message-ID: <200905030323.n433NZNj016361@sheep.berlios.de> Author: stpere Date: 2009-05-03 05:23:17 +0200 (Sun, 03 May 2009) New Revision: 30597 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30597&view=rev Modified: haiku/trunk/src/apps/terminal/TermWindow.cpp haiku/trunk/src/apps/terminal/TermWindow.h Log: Small tweaks regarding the scrollbars of terminal when used in fullscreen mode : * if there is only one tab open, no functional change * when there is two or more tabs open, display the scroll bar in the _ActiveTermView It simply didn't make sense to not display the scrollbars in the _ActiveTermView since it was already shown in the other tabs. On the other hand, I can understand not showing the scrollbar when there is no tabview visible, as it mimic a real terminal. That fixes bug reported in ticket #3300. Modified: haiku/trunk/src/apps/terminal/TermWindow.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermWindow.cpp 2009-05-03 01:23:12 UTC (rev 30596) +++ haiku/trunk/src/apps/terminal/TermWindow.cpp 2009-05-03 03:23:17 UTC (rev 30597) @@ -152,7 +152,8 @@ fFindSelection(false), fForwardSearch(false), fMatchCase(false), - fMatchWord(false) + fMatchWord(false), + fFullScreen(false) { _InitWindow(); _AddTab(args); @@ -473,7 +474,7 @@ case MSG_FULL_SIZE_CHANGED: { BFont font; - _GetPreferredFont(font); + _GetPreferredFont(font); _ActiveTermView()->SetTermFont(&font); _ResizeView(_ActiveTermView()); @@ -486,7 +487,9 @@ float mbHeight = fMenubar->Bounds().Height() + 1; fSavedFrame = Frame(); BScreen screen(this); - _ActiveTermView()->ScrollBar()->Hide(); + if (fTabView->CountTabs() == 1) + _ActiveTermView()->ScrollBar()->Hide(); + fMenubar->Hide(); fTabView->ResizeBy(0, mbHeight); fTabView->MoveBy(0, -mbHeight); @@ -495,6 +498,7 @@ SetLook(B_NO_BORDER_WINDOW_LOOK); ResizeTo(screen.Frame().Width()+1, screen.Frame().Height()+1); MoveTo(screen.Frame().left, screen.Frame().top); + fFullScreen = true; } else { // exit fullscreen _ActiveTermView()->DisableResizeView(); float mbHeight = fMenubar->Bounds().Height() + 1; @@ -506,6 +510,7 @@ fTabView->MoveBy(0, mbHeight); SetLook(fSavedLook); fSavedFrame = BRect(0,0,-1,-1); + fFullScreen = false; } break; @@ -565,8 +570,11 @@ } case kNewTab: - if (fTabView->CountTabs() < kMaxTabs) + if (fTabView->CountTabs() < kMaxTabs) { + if (fFullScreen) + _ActiveTermView()->ScrollBar()->Show(); _AddTab(NULL); + } break; case kCloseView: @@ -574,13 +582,14 @@ TermView* termView; if (message->FindPointer("termView", (void**)&termView) == B_OK) { int32 index = _IndexOfTermView(termView); - if (index >= 0) + if (index >= 0) { _RemoveTab(index); + } } break; } - case kIncreaseFontSize: + case kIncreaseFontSize: case kDecreaseFontSize: { message->PrintToStream(); @@ -783,6 +792,8 @@ if (Session* session = (Session*)fSessions.RemoveItem(index)) { delete session; delete fTabView->RemoveTab(index); + if (fFullScreen) + _ActiveTermView()->ScrollBar()->Hide(); } } else PostMessage(B_QUIT_REQUESTED); Modified: haiku/trunk/src/apps/terminal/TermWindow.h =================================================================== --- haiku/trunk/src/apps/terminal/TermWindow.h 2009-05-03 01:23:12 UTC (rev 30596) +++ haiku/trunk/src/apps/terminal/TermWindow.h 2009-05-03 03:23:17 UTC (rev 30597) @@ -111,6 +111,8 @@ bool fForwardSearch; bool fMatchCase; bool fMatchWord; + + bool fFullScreen; }; #endif // __TERMWINDOW_H From rudolfc at mail.berlios.de Sun May 3 09:40:23 2009 From: rudolfc at mail.berlios.de (rudolfc at BerliOS) Date: Sun, 3 May 2009 09:40:23 +0200 Subject: [Haiku-commits] r30598 - in haiku/trunk/src/add-ons: accelerants/nvidia/engine kernel/drivers/graphics/nvidia Message-ID: <200905030740.n437eNtk031043@sheep.berlios.de> Author: rudolfc Date: 2009-05-03 09:40:22 +0200 (Sun, 03 May 2009) New Revision: 30598 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30598&view=rev Modified: haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/driver.c Log: added Andrea's card 01d7: G72M [Quadro NVS 110M/GeForce Go 7300] Modified: haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c 2009-05-03 03:23:17 UTC (rev 30597) +++ haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c 2009-05-03 07:40:22 UTC (rev 30598) @@ -705,9 +705,18 @@ sprintf(si->adi.chipset, "G72"); status = nvxx_general_powerup(); break; - case 0x01d810de: /* Nvidia GeForce 7400 GO */ + case 0x01d710de: /* Nvidia Quadro NVS 110M/GeForce 7300 Go */ si->ps.card_type = G72; si->ps.card_arch = NV40A; + si->ps.laptop = true; + sprintf(si->adi.name, "Nvidia Quadro NVS M/GF 7300 Go"); + sprintf(si->adi.chipset, "G72"); + status = nvxx_general_powerup(); + break; + case 0x01d810de: /* Nvidia GeForce 7400 Go */ + si->ps.card_type = G72; + si->ps.card_arch = NV40A; + si->ps.laptop = true; sprintf(si->adi.name, "Nvidia GeForce 7400 Go"); sprintf(si->adi.chipset, "G72"); status = nvxx_general_powerup(); Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/driver.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/driver.c 2009-05-03 03:23:17 UTC (rev 30597) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/driver.c 2009-05-03 07:40:22 UTC (rev 30598) @@ -220,6 +220,7 @@ 0x01a0, /* Nvidia GeForce2 Integrated GPU */ 0x01d1, /* Nvidia GeForce 7300 LE */ 0x01d3, /* Nvidia GeForce 7300 SE */ + 0x01d7, /* Nvidia Quadro NVS 110M/GeForce 7300 Go */ 0x01d8, /* Nvidia GeForce 7400 GO */ 0x01dd, /* Nvidia GeForce 7500 LE */ 0x01df, /* Nvidia GeForce 7300 GS */ From stippi at mail.berlios.de Sun May 3 10:32:19 2009 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sun, 3 May 2009 10:32:19 +0200 Subject: [Haiku-commits] r30599 - in haiku/trunk: headers/os/interface src/servers/input Message-ID: <200905030832.n438WJms001967@sheep.berlios.de> Author: stippi Date: 2009-05-03 10:32:17 +0200 (Sun, 03 May 2009) New Revision: 30599 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30599&view=rev Modified: haiku/trunk/headers/os/interface/InterfaceDefs.h haiku/trunk/src/servers/input/InputServer.cpp Log: Patch by Shinta: The key code was misnamed. Thanks a lot! Modified: haiku/trunk/headers/os/interface/InterfaceDefs.h =================================================================== --- haiku/trunk/headers/os/interface/InterfaceDefs.h 2009-05-03 07:40:22 UTC (rev 30598) +++ haiku/trunk/headers/os/interface/InterfaceDefs.h 2009-05-03 08:32:17 UTC (rev 30599) @@ -64,8 +64,9 @@ B_FUNCTION_KEY = 0x10, + // for Japanese keyboards B_KATAKANA_HIRAGANA = 0xf2, - B_ZENKAKU_HANKAKU = 0xf3 + B_HANKAKU_ZENKAKU = 0xf3 }; enum { Modified: haiku/trunk/src/servers/input/InputServer.cpp =================================================================== --- haiku/trunk/src/servers/input/InputServer.cpp 2009-05-03 07:40:22 UTC (rev 30598) +++ haiku/trunk/src/servers/input/InputServer.cpp 2009-05-03 08:32:17 UTC (rev 30599) @@ -1504,7 +1504,7 @@ byte = 0; if (((fKeyInfo.modifiers & B_COMMAND_KEY) != 0 && byte == ' ') - || byte == B_ZENKAKU_HANKAKU) { + || byte == B_HANKAKU_ZENKAKU) { SetNextMethod(!(fKeyInfo.modifiers & B_SHIFT_KEY)); // this event isn't sent to the user From stippi at mail.berlios.de Sun May 3 11:32:28 2009 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sun, 3 May 2009 11:32:28 +0200 Subject: [Haiku-commits] r30600 - haiku/trunk/src/apps/installer Message-ID: <200905030932.n439WSFb006451@sheep.berlios.de> Author: stippi Date: 2009-05-03 11:32:24 +0200 (Sun, 03 May 2009) New Revision: 30600 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30600&view=rev Added: haiku/trunk/src/apps/installer/WorkerThread.cpp haiku/trunk/src/apps/installer/WorkerThread.h Removed: haiku/trunk/src/apps/installer/CopyEngine.cpp haiku/trunk/src/apps/installer/CopyEngine.h haiku/trunk/src/apps/installer/FSUtils.cpp haiku/trunk/src/apps/installer/FSUtils.h haiku/trunk/src/apps/installer/InstallerCopyLoopControl.cpp haiku/trunk/src/apps/installer/InstallerCopyLoopControl.h haiku/trunk/src/apps/installer/Vector.h Modified: haiku/trunk/src/apps/installer/InstallerWindow.cpp haiku/trunk/src/apps/installer/InstallerWindow.h haiku/trunk/src/apps/installer/Jamfile haiku/trunk/src/apps/installer/PackageViews.cpp Log: First round of cleanup: * Renamed CopyEngine to WorkerThread, since it's used for other things than just copying. * Removed the code borrowed from Tracker. * Removed the InstallerCopyLoopControl, since the CopyEngine handles notifications and cancelling by itself now. * Renamed a few message constants. * Since we only support BFS partitions as install targets, I removed the FS type from the target menu item label. However, I am going to solve this differently. I guess all partitions should be seen in the target list, just disabled if they are not a valid target, and with a reason given too. Deleted: haiku/trunk/src/apps/installer/CopyEngine.cpp Deleted: haiku/trunk/src/apps/installer/CopyEngine.h Deleted: haiku/trunk/src/apps/installer/FSUtils.cpp Deleted: haiku/trunk/src/apps/installer/FSUtils.h Deleted: haiku/trunk/src/apps/installer/InstallerCopyLoopControl.cpp Deleted: haiku/trunk/src/apps/installer/InstallerCopyLoopControl.h Modified: haiku/trunk/src/apps/installer/InstallerWindow.cpp =================================================================== --- haiku/trunk/src/apps/installer/InstallerWindow.cpp 2009-05-03 08:32:17 UTC (rev 30599) +++ haiku/trunk/src/apps/installer/InstallerWindow.cpp 2009-05-03 09:32:24 UTC (rev 30600) @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -35,10 +36,10 @@ #include "tracker_private.h" -#include "CopyEngine.h" #include "DialogPane.h" #include "PackageViews.h" #include "PartitionMenuItem.h" +#include "WorkerThread.h" #define DRIVESETUP_SIG "application/x-vnd.Haiku-DriveSetup" @@ -209,7 +210,7 @@ fNeedsToCenterOnScreen(true), fDriveSetupLaunched(false), fInstallStatus(kReadyForInstall), - fCopyEngine(new CopyEngine(this)), + fWorkerThread(new WorkerThread(this)), fCopyEngineLock(NULL) { LogoView* logoView = new LogoView(); @@ -265,7 +266,7 @@ "Setup partitions" B_UTF8_ELLIPSIS, new BMessage(SETUP_MESSAGE)); fMakeBootableButton = new BButton("makebootable_button", - "Write Boot Sector", new BMessage(kWriteBootSector)); + "Write Boot Sector", new BMessage(MSG_WRITE_BOOT_SECTOR)); fMakeBootableButton->SetEnabled(false); SetLayout(new BGroupLayout(B_HORIZONTAL)); @@ -357,7 +358,7 @@ InstallerWindow::MessageReceived(BMessage *msg) { switch (msg->what) { - case RESET_INSTALL: + case MSG_RESET: delete fCopyEngineLock; fCopyEngineLock = NULL; @@ -383,11 +384,11 @@ BList* list = new BList(); int32 size = 0; fPackagesView->GetPackagesToInstall(list, &size); - fCopyEngine->SetLock(fCopyEngineLock); - fCopyEngine->SetPackagesList(list); - fCopyEngine->SetSpaceRequired(size); + fWorkerThread->SetLock(fCopyEngineLock); + fWorkerThread->SetPackagesList(list); + fWorkerThread->SetSpaceRequired(size); fInstallStatus = kInstalling; - BMessenger(fCopyEngine).SendMessage(ENGINE_START); + fWorkerThread->StartInstall(); fBeginButton->SetLabel("Stop"); _DisableInterface(true); @@ -402,7 +403,7 @@ case kInstalling: { _QuitCopyEngine(true); -// if (fCopyEngine->Cancel()) { +// if (fWorkerThread->Cancel()) { // fInstallStatus = kCancelled; // _SetStatusMessage("Installation cancelled."); // fProgressLayoutItem->SetVisible(false); @@ -440,7 +441,7 @@ fSizeView->SetText(string); break; } - case STATUS_MESSAGE: + case MSG_STATUS_MESSAGE: { // TODO: Was this supposed to prevent status messages still arriving // after the copy engine was shut down? @@ -472,7 +473,7 @@ } break; } - case INSTALL_FINISHED: + case MSG_INSTALL_FINISHED: { delete fCopyEngineLock; fCopyEngineLock = NULL; @@ -512,8 +513,8 @@ } break; } - case kWriteBootSector: - fCopyEngine->WriteBootSector(fDestMenu); + case MSG_WRITE_BOOT_SECTOR: + fWorkerThread->WriteBootSector(fDestMenu); break; default: @@ -533,7 +534,7 @@ return false; } _QuitCopyEngine(false); - fCopyEngine->PostMessage(B_QUIT_REQUESTED); + fWorkerThread->PostMessage(B_QUIT_REQUESTED); be_app->PostMessage(B_QUIT_REQUESTED); return true; } @@ -597,7 +598,7 @@ while ((item = fDestMenu->RemoveItem((int32)0))) delete item; - fCopyEngine->ScanDisksPartitions(fSrcMenu, fDestMenu); + fWorkerThread->ScanDisksPartitions(fSrcMenu, fDestMenu); if (fSrcMenu->ItemAt(0)) { _PublishPackages(); Modified: haiku/trunk/src/apps/installer/InstallerWindow.h =================================================================== --- haiku/trunk/src/apps/installer/InstallerWindow.h 2009-05-03 08:32:17 UTC (rev 30599) +++ haiku/trunk/src/apps/installer/InstallerWindow.h 2009-05-03 09:32:24 UTC (rev 30600) @@ -22,8 +22,8 @@ class BStatusBar; class BStringView; class BTextView; -class CopyEngine; class PackagesView; +class WorkerThread; enum InstallStatus { kReadyForInstall, @@ -32,10 +32,10 @@ kCancelled }; -const uint32 STATUS_MESSAGE = 'iSTM'; -const uint32 INSTALL_FINISHED = 'iIFN'; -const uint32 RESET_INSTALL = 'iRSI'; -const uint32 kWriteBootSector = 'iWBS'; +const uint32 MSG_STATUS_MESSAGE = 'iSTM'; +const uint32 MSG_INSTALL_FINISHED = 'iIFN'; +const uint32 MSG_RESET = 'iRSI'; +const uint32 MSG_WRITE_BOOT_SECTOR = 'iWBS'; const char PACKAGES_DIRECTORY[] = "_packages_"; const char VAR_DIRECTORY[] = "var"; @@ -92,7 +92,7 @@ bool fDriveSetupLaunched; InstallStatus fInstallStatus; - CopyEngine* fCopyEngine; + WorkerThread* fWorkerThread; BString fLastStatus; BLocker* fCopyEngineLock; }; Modified: haiku/trunk/src/apps/installer/Jamfile =================================================================== --- haiku/trunk/src/apps/installer/Jamfile 2009-05-03 08:32:17 UTC (rev 30599) +++ haiku/trunk/src/apps/installer/Jamfile 2009-05-03 09:32:24 UTC (rev 30600) @@ -4,13 +4,11 @@ SubDirHdrs [ FDirName $(HAIKU_TOP) src kits tracker ] ; Application Installer : - CopyEngine.cpp CopyEngine2.cpp - FSUtils.cpp InstallerApp.cpp - InstallerCopyLoopControl.cpp InstallerWindow.cpp PackageViews.cpp PartitionMenuItem.cpp + WorkerThread.cpp : be tracker translation $(TARGET_LIBSTDC++) : Installer.rdef ; Modified: haiku/trunk/src/apps/installer/PackageViews.cpp =================================================================== --- haiku/trunk/src/apps/installer/PackageViews.cpp 2009-05-03 08:32:17 UTC (rev 30599) +++ haiku/trunk/src/apps/installer/PackageViews.cpp 2009-05-03 09:32:24 UTC (rev 30600) @@ -178,11 +178,11 @@ { printf("%s called\n", __PRETTY_FUNCTION__); if (transit == B_ENTERED_VIEW) { - BMessage msg(STATUS_MESSAGE); + BMessage msg(MSG_STATUS_MESSAGE); msg.AddString("status", fPackage->Description()); BMessenger(NULL, Window()).SendMessage(&msg); } else if (transit == B_EXITED_VIEW) { - BMessage msg(STATUS_MESSAGE); + BMessage msg(MSG_STATUS_MESSAGE); BMessenger(NULL, Window()).SendMessage(&msg); } } Deleted: haiku/trunk/src/apps/installer/Vector.h Copied: haiku/trunk/src/apps/installer/WorkerThread.cpp (from rev 30598, haiku/trunk/src/apps/installer/CopyEngine.cpp) =================================================================== --- haiku/trunk/src/apps/installer/CopyEngine.cpp 2009-05-03 07:40:22 UTC (rev 30598) +++ haiku/trunk/src/apps/installer/WorkerThread.cpp 2009-05-03 09:32:24 UTC (rev 30600) @@ -0,0 +1,567 @@ +/* + * Copyright 2009, Stephan A?mus . + * Copyright 2005-2008, J?r?me DUVAL. + * All rights reserved. Distributed under the terms of the MIT License. + */ + +#include "WorkerThread.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "AutoLocker.h" +#include "CopyEngine2.h" +#include "InstallerWindow.h" +#include "PackageViews.h" +#include "PartitionMenuItem.h" + + +//#define COPY_TRACE +#ifdef COPY_TRACE +#define CALLED() printf("CALLED %s\n",__PRETTY_FUNCTION__) +#define ERR2(x, y...) fprintf(stderr, "WorkerThread: "x" %s\n", y, strerror(err)) +#define ERR(x) fprintf(stderr, "WorkerThread: "x" %s\n", strerror(err)) +#else +#define CALLED() +#define ERR(x) +#define ERR2(x, y...) +#endif + +const char BOOT_PATH[] = "/boot"; + +extern void SizeAsString(off_t size, char *string); + + +const uint32 MSG_START_INSTALLING = 'eSRT'; + + +class SourceVisitor : public BDiskDeviceVisitor +{ + public: + SourceVisitor(BMenu *menu); + virtual bool Visit(BDiskDevice *device); + virtual bool Visit(BPartition *partition, int32 level); + private: + BMenu *fMenu; +}; + + +class TargetVisitor : public BDiskDeviceVisitor +{ + public: + TargetVisitor(BMenu *menu); + virtual bool Visit(BDiskDevice *device); + virtual bool Visit(BPartition *partition, int32 level); + private: + void _MakeLabel(BPartition *partition, char *label, char *menuLabel); + BMenu *fMenu; +}; + + +// #pragma mark - WorkerThread + + +WorkerThread::WorkerThread(InstallerWindow *window) + : BLooper("copy_engine"), + fWindow(window), + fPackages(NULL), + fSpaceRequired(0) +{ + Run(); +} + + +void +WorkerThread::MessageReceived(BMessage* message) +{ + CALLED(); + + switch (message->what) { + case MSG_START_INSTALLING: + _PerformInstall(fWindow->GetSourceMenu(), fWindow->GetTargetMenu()); + break; + + case MSG_WRITE_BOOT_SECTOR: + { + int32 id; + if (message->FindInt32("id", &id) != B_OK) { + _SetStatusMessage("Boot sector not written because of an " + " internal error."); + break; + } + + // TODO: Refactor with _PerformInstall() + BPath targetDirectory; + BDiskDevice device; + BPartition* partition; + + if (fDDRoster.GetPartitionWithID(id, &device, &partition) == B_OK) { + if (!partition->IsMounted()) { + if (partition->Mount() < B_OK) { + _SetStatusMessage("The partition can't be mounted. " + "Please choose a different partition."); + break; + } + } + if (partition->GetMountPoint(&targetDirectory) != B_OK) { + _SetStatusMessage("The mount point could not be retrieve."); + break; + } + } else if (fDDRoster.GetDeviceWithID(id, &device) == B_OK) { + if (!device.IsMounted()) { + if (device.Mount() < B_OK) { + _SetStatusMessage("The disk can't be mounted. Please " + "choose a different disk."); + break; + } + } + if (device.GetMountPoint(&targetDirectory) != B_OK) { + _SetStatusMessage("The mount point could not be retrieve."); + break; + } + } + + _LaunchFinishScript(targetDirectory); + // TODO: Get error from executing script! + _SetStatusMessage("Boot sector successfully written."); + } + default: + BLooper::MessageReceived(message); + } +} + + + + +void +WorkerThread::ScanDisksPartitions(BMenu *srcMenu, BMenu *targetMenu) +{ + // NOTE: This is actually executed in the window thread. + BDiskDevice device; + BPartition *partition = NULL; + + printf("\nScanDisksPartitions source partitions begin\n"); + SourceVisitor srcVisitor(srcMenu); + fDDRoster.VisitEachMountedPartition(&srcVisitor, &device, &partition); + + printf("\nScanDisksPartitions target partitions begin\n"); + TargetVisitor targetVisitor(targetMenu); + fDDRoster.VisitEachPartition(&targetVisitor, &device, &partition); +} + + +void +WorkerThread::SetPackagesList(BList *list) +{ + // Executed in window thread. + BAutolock _(this); + + delete fPackages; + fPackages = list; +} + + +void +WorkerThread::StartInstall() +{ + // Executed in window thread. + PostMessage(MSG_START_INSTALLING, this); +} + + +void +WorkerThread::WriteBootSector(BMenu* targetMenu) +{ + // Executed in window thread. + CALLED(); + + PartitionMenuItem* item = (PartitionMenuItem*)targetMenu->FindMarked(); + if (item == NULL) { + ERR("bad menu items\n"); + return; + } + + BMessage message(MSG_WRITE_BOOT_SECTOR); + message.AddInt32("id", item->ID()); + PostMessage(&message, this); +} + + +// #pragma mark - + + +void +WorkerThread::_LaunchInitScript(BPath &path) +{ + BPath bootPath; + find_directory(B_BEOS_BOOT_DIRECTORY, &bootPath); + BString command("/bin/sh "); + command += bootPath.Path(); + command += "/InstallerInitScript "; + command += path.Path(); + _SetStatusMessage("Starting Installation."); + system(command.String()); +} + + +void +WorkerThread::_LaunchFinishScript(BPath &path) +{ + BPath bootPath; + find_directory(B_BEOS_BOOT_DIRECTORY, &bootPath); + BString command("/bin/sh "); + command += bootPath.Path(); + command += "/InstallerFinishScript "; + command += path.Path(); + _SetStatusMessage("Finishing Installation."); + system(command.String()); +} + + +void +WorkerThread::_PerformInstall(BMenu *srcMenu, BMenu *targetMenu) +{ + CALLED(); + + BPath targetDirectory, srcDirectory; + BDirectory targetDir; + BDiskDevice device; + BPartition *partition; + BVolume targetVolume; + status_t err = B_OK; + int32 entries = 0; + entry_ref testRef; + + BMessenger messenger(fWindow); + CopyEngine2 engine(messenger, new BMessage(MSG_STATUS_MESSAGE)); + + PartitionMenuItem *targetItem = (PartitionMenuItem *)targetMenu->FindMarked(); + PartitionMenuItem *srcItem = (PartitionMenuItem *)srcMenu->FindMarked(); + if (!srcItem || !targetItem) { + ERR("bad menu items\n"); + goto error; + } + + // check if target is initialized + // ask if init or mount as is + + if (fDDRoster.GetPartitionWithID(targetItem->ID(), &device, &partition) == B_OK) { + if (!partition->IsMounted()) { + if ((err = partition->Mount()) < B_OK) { + _SetStatusMessage("The disk can't be mounted. Please choose a " + "different disk."); + ERR("BPartition::Mount"); + goto error; + } + } + if ((err = partition->GetVolume(&targetVolume)) != B_OK) { + ERR("BPartition::GetVolume"); + goto error; + } + if ((err = partition->GetMountPoint(&targetDirectory)) != B_OK) { + ERR("BPartition::GetMountPoint"); + goto error; + } + } else if (fDDRoster.GetDeviceWithID(targetItem->ID(), &device) == B_OK) { + if (!device.IsMounted()) { + if ((err = device.Mount()) < B_OK) { + _SetStatusMessage("The disk can't be mounted. Please choose a " + "different disk."); + ERR("BDiskDevice::Mount"); + goto error; + } + } + if ((err = device.GetVolume(&targetVolume)) != B_OK) { + ERR("BDiskDevice::GetVolume"); + goto error; + } + if ((err = device.GetMountPoint(&targetDirectory)) != B_OK) { + ERR("BDiskDevice::GetMountPoint"); + goto error; + } + } else + goto error; // shouldn't happen + + // check if target has enough space + if ((fSpaceRequired > 0 && targetVolume.FreeBytes() < fSpaceRequired) + && ((new BAlert("", "The destination disk may not have enough space. " + "Try choosing a different disk or choose to not install optional " + "items.", "Try installing anyway", "Cancel", 0, + B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go() != 0)) { + goto error; + } + + if (fDDRoster.GetPartitionWithID(srcItem->ID(), &device, &partition) == B_OK) { + if ((err = partition->GetMountPoint(&srcDirectory)) != B_OK) { + ERR("BPartition::GetMountPoint"); + goto error; + } + } else if (fDDRoster.GetDeviceWithID(srcItem->ID(), &device) == B_OK) { + if ((err = device.GetMountPoint(&srcDirectory)) != B_OK) { + ERR("BDiskDevice::GetMountPoint"); + goto error; + } + } else + goto error; // shouldn't happen + + // check not installing on itself + if (strcmp(srcDirectory.Path(), targetDirectory.Path()) == 0) { + _SetStatusMessage("You can't install the contents of a disk onto " + "itself. Please choose a different disk."); + goto error; + } + + // check not installing on boot volume + if ((strncmp(BOOT_PATH, targetDirectory.Path(), strlen(BOOT_PATH)) == 0) + && ((new BAlert("", "Are you sure you want to install onto the " + "current boot disk? The Installer will have to reboot your " + "machine if you proceed.", "OK", "Cancel", 0, + B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go() != 0)) { + _SetStatusMessage("Installation stopped."); + goto error; + } + + targetDir.SetTo(targetDirectory.Path()); + + // check target volume not empty + // NOTE: It's ok if exactly this path exists: home/Desktop/Trash + // and nothing else. + while (targetDir.GetNextRef(&testRef) == B_OK) { + if (strcmp(testRef.name, "home") == 0) { + BDirectory homeDir(&testRef); + while (homeDir.GetNextRef(&testRef) == B_OK) { + if (strcmp(testRef.name, "Desktop") == 0) { + BDirectory desktopDir(&testRef); + while (desktopDir.GetNextRef(&testRef) == B_OK) { + if (strcmp(testRef.name, "Trash") == 0) { + BDirectory trashDir(&testRef); + while (trashDir.GetNextRef(&testRef) == B_OK) { + // Something in the Trash + entries++; + break; + } + } else { + // Something besides Trash + entries++; + } + + if (entries > 0) + break; + } + } else { + // Something besides Desktop + entries++; + } + + if (entries > 0) + break; + } + } else { + // Something besides home + entries++; + } + + if (entries > 0) + break; + } + if (entries != 0 + && ((new BAlert("", "The target volume is not empty. Are you sure you " + "want to install anyways?", "Install Anyways", "Cancel", 0, + B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go() != 0)) { + err = B_CANCELED; + goto error; + } + + + _LaunchInitScript(targetDirectory); + + // copy source volume + err = engine.CopyFolder(srcDirectory.Path(), targetDirectory.Path(), + fCancelLock); + if (err != B_OK) + goto error; + + // copy selected packages + if (fPackages) { + srcDirectory.Append(PACKAGES_DIRECTORY); + int32 count = fPackages->CountItems(); + for (int32 i = 0; i < count; i++) { + Package *p = static_cast(fPackages->ItemAt(i)); + BPath packageDir(srcDirectory.Path(), p->Folder()); + err = engine.CopyFolder(packageDir.Path(), targetDirectory.Path(), + fCancelLock); + if (err != B_OK) + goto error; + } + } + + _LaunchFinishScript(targetDirectory); + + BMessenger(fWindow).SendMessage(MSG_INSTALL_FINISHED); + + return; +error: + BMessage statusMessage(MSG_RESET); + if (err == B_CANCELED) + _SetStatusMessage("Installation canceled."); + else + statusMessage.AddInt32("error", err); + ERR("_PerformInstall failed"); + BMessenger(fWindow).SendMessage(&statusMessage); +} + + +void +WorkerThread::_SetStatusMessage(const char *status) +{ + BMessage msg(MSG_STATUS_MESSAGE); + msg.AddString("status", status); + BMessenger(fWindow).SendMessage(&msg); +} + + +// #pragma mark - SourceVisitor + + +SourceVisitor::SourceVisitor(BMenu *menu) + : fMenu(menu) +{ +} + +bool +SourceVisitor::Visit(BDiskDevice *device) +{ + return Visit(device, 0); +} + + +bool +SourceVisitor::Visit(BPartition *partition, int32 level) +{ + BPath path; + if (partition->GetPath(&path) == B_OK) + printf("SourceVisitor::Visit(BPartition *) : %s\n", path.Path()); + printf("SourceVisitor::Visit(BPartition *) : %s\n", partition->ContentName()); + + if (partition->ContentType() == NULL) + return false; + + bool isBootPartition = false; + if (partition->IsMounted()) { + BPath mountPoint; + partition->GetMountPoint(&mountPoint); + isBootPartition = strcmp(BOOT_PATH, mountPoint.Path()) == 0; + } + + if (!isBootPartition + && strcmp(partition->ContentType(), kPartitionTypeBFS) != 0) { + // Except only BFS partitions, except this is the boot partition + // (ISO9660 with write overlay for example). + return false; + } + + // TODO: We could probably check if this volume contains + // the Haiku kernel or something. Does it make sense to "install" + // from your BFS volume containing the music collection? + // TODO: Then the check for BFS could also be removed above. + + PartitionMenuItem *item = new PartitionMenuItem(NULL, + partition->ContentName(), NULL, new BMessage(SRC_PARTITION), + partition->ID()); + item->SetMarked(isBootPartition); + fMenu->AddItem(item); + return false; +} + + +// #pragma mark - TargetVisitor + + +TargetVisitor::TargetVisitor(BMenu *menu) + : fMenu(menu) +{ +} + + +bool +TargetVisitor::Visit(BDiskDevice *device) +{ + if (device->IsReadOnlyMedia()) + return false; + return Visit(device, 0); +} + + +bool +TargetVisitor::Visit(BPartition *partition, int32 level) +{ + BPath path; + if (partition->GetPath(&path) == B_OK) + printf("TargetVisitor::Visit(BPartition *) : %s\n", path.Path()); + printf("TargetVisitor::Visit(BPartition *) : %s\n", partition->ContentName()); + + if (partition->ContentType() == NULL + || strcmp(partition->ContentType(), kPartitionTypeBFS) != 0) { + // Except only valid BFS partitions + printf(" not BFS\n"); + return false; + } + + if (partition->ContentSize() < 20 * 1024 * 1024) { + // reject partitions which are too small anyways + // TODO: Could depend on the source size + printf(" too small\n"); + return false; + } + + if (partition->CountChildren() > 0) { + // Looks like an extended partition, or the device itself. + // Do not accept this as target... + printf(" no leaf partition\n"); + return false; + } + + // TODO: After running DriveSetup and doing another scan, it would + // be great to pick the partition which just appeared! + + char label[255], menuLabel[255]; + _MakeLabel(partition, label, menuLabel); + fMenu->AddItem(new PartitionMenuItem(partition->ContentName(), label, + menuLabel, new BMessage(TARGET_PARTITION), partition->ID())); + return false; +} + + +void +TargetVisitor::_MakeLabel(BPartition *partition, char *label, char *menuLabel) +{ + char size[15]; + SizeAsString(partition->ContentSize(), size); + BPath path; + partition->GetPath(&path); + + // TODO: Reenable the printing of the content type once Haiku supports + // installing to other file systems than BFS. +// sprintf(label, "%s - %s [%s] [%s]", partition->ContentName(), +// size, partition->ContentType(), path.Path()); +// sprintf(menuLabel, "%s - %s [%s]", partition->ContentName(), size, +// partition->ContentType()); + + sprintf(label, "%s - %s - %s", partition->ContentName(), size, + path.Path()); + sprintf(menuLabel, "%s - %s", partition->ContentName(), size); +} + Copied: haiku/trunk/src/apps/installer/WorkerThread.h (from rev 30598, haiku/trunk/src/apps/installer/CopyEngine.h) =================================================================== --- haiku/trunk/src/apps/installer/CopyEngine.h 2009-05-03 07:40:22 UTC (rev 30598) +++ haiku/trunk/src/apps/installer/WorkerThread.h 2009-05-03 09:32:24 UTC (rev 30600) @@ -0,0 +1,56 @@ +/* + * Copyright 2009, Stephan A?mus . + * Copyright 2005, J?r?me DUVAL. + * All rights reserved. Distributed under the terms of the MIT License. + */ +#ifndef WORKER_THREAD_H +#define WORKER_THREAD_H + +#include +#include +#include +#include +#include +#include + +class BList; +class BLocker; +class BMenu; +class InstallerWindow; + +class WorkerThread : public BLooper { +public: + WorkerThread(InstallerWindow* window); + + virtual void MessageReceived(BMessage* message); + + void ScanDisksPartitions(BMenu* srcMenu, + BMenu* dstMenu); + + void SetPackagesList(BList* list); + void SetSpaceRequired(off_t bytes) + { fSpaceRequired = bytes; }; + + bool Cancel(); + void SetLock(BLocker* lock) + { fCancelLock = lock; } + + void StartInstall(); + void WriteBootSector(BMenu* dstMenu); + +private: + void _LaunchInitScript(BPath& path); + void _LaunchFinishScript(BPath& path); + + void _PerformInstall(BMenu* srcMenu, BMenu* dstMenu); + + void _SetStatusMessage(const char* status); + + InstallerWindow* fWindow; + BDiskDeviceRoster fDDRoster; + BList* fPackages; + off_t fSpaceRequired; + BLocker* fCancelLock; +}; + +#endif // WORKER_THREAD_H From stippi at mail.berlios.de Sun May 3 11:35:45 2009 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sun, 3 May 2009 11:35:45 +0200 Subject: [Haiku-commits] r30601 - haiku/trunk/src/apps/installer Message-ID: <200905030935.n439ZjaA006587@sheep.berlios.de> Author: stippi Date: 2009-05-03 11:35:42 +0200 (Sun, 03 May 2009) New Revision: 30601 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30601&view=rev Added: haiku/trunk/src/apps/installer/CopyEngine.cpp haiku/trunk/src/apps/installer/CopyEngine.h Removed: haiku/trunk/src/apps/installer/CopyEngine2.cpp haiku/trunk/src/apps/installer/CopyEngine2.h Modified: haiku/trunk/src/apps/installer/Jamfile haiku/trunk/src/apps/installer/WorkerThread.cpp Log: Cleanup round 2: Renamed CopyEngine2 back to CopyEngine. Copied: haiku/trunk/src/apps/installer/CopyEngine.cpp (from rev 30598, haiku/trunk/src/apps/installer/CopyEngine2.cpp) =================================================================== --- haiku/trunk/src/apps/installer/CopyEngine2.cpp 2009-05-03 07:40:22 UTC (rev 30598) +++ haiku/trunk/src/apps/installer/CopyEngine.cpp 2009-05-03 09:35:42 UTC (rev 30601) @@ -0,0 +1,477 @@ +/* + * Copyright 2008-2009, Stephan A?mus + * All rights reserved. Distributed under the terms of the MIT License. + */ + +#include "CopyEngine.h" + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "AutoLocker.h" +#include "InstallerWindow.h" + // TODO: For PACKAGES_DIRECTORY and VAR_DIRECTORY, not so nice... + +using std::nothrow; + + +CopyEngine::CopyEngine(const BMessenger& messenger, BMessage* message) + : + fBufferQueue(), + fWriterThread(-1), + fQuitting(false), + + fBytesRead(0), + fItemsCopied(0), + fTimeRead(0), + + fBytesWritten(0), + fTimeWritten(0), + + fBytesToCopy(0), + fItemsToCopy(0), + + fCurrentTargetFolder(NULL), + fCurrentItem(NULL), + + fMessenger(messenger), + fMessage(message) +{ + fWriterThread = spawn_thread(_WriteThreadEntry, "buffer writer", + B_NORMAL_PRIORITY, this); + + if (fWriterThread >= B_OK) + resume_thread(fWriterThread); +} + + +CopyEngine::~CopyEngine() +{ + while (fBufferQueue.Size() > 0) + snooze(10000); + + fQuitting = true; + if (fWriterThread >= B_OK) { + int32 exitValue; + wait_for_thread(fWriterThread, &exitValue); + } + + delete fMessage; +} + + +status_t +CopyEngine::CopyFolder(const char* source, const char* destination, + BLocker* locker) +{ + fBytesRead = 0; + fItemsCopied = 0; + fTimeRead = 0; + + fBytesWritten = 0; + fTimeWritten = 0; + + fBytesToCopy = 0; + fItemsToCopy = 0; + + fCurrentTargetFolder = NULL; + fCurrentItem = NULL; + + int32 level = 0; + status_t ret = _CollectCopyInfo(source, level); + if (ret < B_OK) + return ret; + + if (fMessage) { + BMessage message(*fMessage); + message.AddString("status", "Performing installation."); + fMessenger.SendMessage(&message); + } + +printf("%lld bytes to read in %lld files\n", fBytesToCopy, fItemsToCopy); + + level = 0; + return _CopyFolder(source, destination, level, locker); +} + + +status_t +CopyEngine::CopyFile(const BEntry& _source, const BEntry& _destination, + BLocker* locker) +{ + AutoLocker lock(locker); + if (locker != NULL && !lock.IsLocked()) { + // We are supposed to quit +printf("CopyFile - cancled\n"); + return B_CANCELED; + } + + BFile source(&_source, B_READ_ONLY); + status_t ret = source.InitCheck(); + if (ret < B_OK) + return ret; + + BFile* destination = new (nothrow) BFile(&_destination, + B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE); + ret = destination->InitCheck(); + if (ret < B_OK) { + delete destination; + return ret; + } + + int32 loopIteration = 0; + + while (true) { + if (fBufferQueue.Size() >= BUFFER_COUNT) { + // the queue is "full", just wait a bit, the + // write thread will empty it + snooze(1000); + continue; + } + + // allocate buffer + Buffer* buffer = new (nothrow) Buffer(destination); + if (!buffer || !buffer->buffer) { + delete destination; + delete buffer; + fprintf(stderr, "reading loop: out of memory\n"); + return B_NO_MEMORY; + } + + // fill buffer + ssize_t read = source.Read(buffer->buffer, buffer->size); + if (read < 0) { + ret = (status_t)read; + fprintf(stderr, "Failed to read data: %s\n", strerror(ret)); + break; + } + + fBytesRead += read; + loopIteration += 1; + if (loopIteration % 10 == 0) + _UpdateProgress(); + + buffer->deleteFile = read == 0; + if (read > 0) + buffer->validBytes = (size_t)read; + else + buffer->validBytes = 0; + + // enqueue the buffer + ret = fBufferQueue.Push(buffer); + if (ret < B_OK) { + buffer->deleteFile = false; + delete buffer; + delete destination; + return ret; + } + + // quit if done + if (read == 0) + break; + } + + return ret; +} + + +// #pragma mark - + + +status_t +CopyEngine::_CollectCopyInfo(const char* _source, int32& level) +{ + level++; + + BDirectory source(_source); + status_t ret = source.InitCheck(); + if (ret < B_OK) + return ret; + + BEntry entry; + while (source.GetNextEntry(&entry) == B_OK) { + struct stat statInfo; + entry.GetStat(&statInfo); + + char name[B_FILE_NAME_LENGTH]; + status_t ret = entry.GetName(name); + if (ret < B_OK) + return ret; + + if (!_ShouldCopyEntry(name, statInfo, level)) + continue; + + if (S_ISDIR(statInfo.st_mode)) { + // handle recursive directory copy + BPath srcFolder; + ret = entry.GetPath(&srcFolder); + if (ret < B_OK) + return ret; + + ret = _CollectCopyInfo(srcFolder.Path(), level); + if (ret < B_OK) + return ret; + } else if (S_ISLNK(statInfo.st_mode)) { + // link, ignore size + } else { + // file data + fBytesToCopy += statInfo.st_size; + } + + fItemsToCopy++; + } + + level--; + return B_OK; +} + + +status_t +CopyEngine::_CopyFolder(const char* _source, const char* _destination, + int32& level, BLocker* locker) +{ + level++; + fCurrentTargetFolder = _destination; + + BDirectory source(_source); + status_t ret = source.InitCheck(); + if (ret < B_OK) + return ret; + + ret = create_directory(_destination, 0777); + if (ret < B_OK && ret != B_FILE_EXISTS) + return ret; + + BDirectory destination(_destination); + ret = destination.InitCheck(); + if (ret < B_OK) + return ret; + + BEntry entry; + while (source.GetNextEntry(&entry) == B_OK) { + AutoLocker lock(locker); + if (locker != NULL && !lock.IsLocked()) { + // We are supposed to quit + return B_CANCELED; + } + + char name[B_FILE_NAME_LENGTH]; + status_t ret = entry.GetName(name); + if (ret < B_OK) + return ret; + + struct stat statInfo; + entry.GetStat(&statInfo); + + if (!_ShouldCopyEntry(name, statInfo, level)) + continue; + + fItemsCopied++; + fCurrentItem = name; + _UpdateProgress(); + + BEntry copy(&destination, name); + bool copyAttributes = true; + + if (S_ISDIR(statInfo.st_mode)) { + // handle recursive directory copy + + if (copy.Exists()) { + // Do not overwrite attributes on folders that exist. + // This should work better when the install target already + // contains a Haiku installation. + copyAttributes = false; + } + + BPath srcFolder; + ret = entry.GetPath(&srcFolder); + if (ret < B_OK) + return ret; + + BPath dstFolder; + ret = copy.GetPath(&dstFolder); + if (ret < B_OK) + return ret; + + if (locker != NULL) + lock.Unlock(); + + ret = _CopyFolder(srcFolder.Path(), dstFolder.Path(), level, + locker); + if (ret < B_OK) + return ret; + + if (locker != NULL && !lock.Lock()) { + // We are supposed to quit + return B_CANCELED; + } + } else if (S_ISLNK(statInfo.st_mode)) { + // copy symbolic links + BSymLink srcLink(&entry); + if (ret < B_OK) + return ret; + + char linkPath[B_PATH_NAME_LENGTH]; + ssize_t read = srcLink.ReadLink(linkPath, B_PATH_NAME_LENGTH - 1); + if (read < 0) + return (status_t)read; + + // just in case it already exists... + copy.Remove(); + + BSymLink dstLink; + ret = destination.CreateSymLink(name, linkPath, &dstLink); + if (ret < B_OK) + return ret; + } else { + // copy file data + // NOTE: Do not pass the locker, we simply keep holding the lock! + ret = CopyFile(entry, copy); + if (ret < B_OK) + return ret; + } + + if (!copyAttributes) + continue; + + // copy attributes + BNode sourceNode(&entry); + BNode targetNode(©); + char attrName[B_ATTR_NAME_LENGTH]; + while (sourceNode.GetNextAttrName(attrName) == B_OK) { + attr_info info; + if (sourceNode.GetAttrInfo(attrName, &info) < B_OK) + continue; + size_t size = 4096; + uint8 buffer[size]; + off_t offset = 0; + ssize_t read = sourceNode.ReadAttr(attrName, info.type, + offset, buffer, min_c(size, info.size)); + // NOTE: It's important to still write the attribute even if + // we have read 0 bytes! + while (read >= 0) { + targetNode.WriteAttr(attrName, info.type, offset, buffer, read); + offset += read; + read = sourceNode.ReadAttr(attrName, info.type, + offset, buffer, min_c(size, info.size - offset)); + if (read == 0) + break; + } + } + + // copy basic attributes + copy.SetPermissions(statInfo.st_mode); + copy.SetOwner(statInfo.st_uid); + copy.SetGroup(statInfo.st_gid); + copy.SetModificationTime(statInfo.st_mtime); + copy.SetCreationTime(statInfo.st_crtime); + } + + level--; + return B_OK; +} + + +void +CopyEngine::_UpdateProgress() +{ + if (fMessage != NULL) { + BMessage message(*fMessage); + float progress = 100.0 * fBytesRead / fBytesToCopy; + message.AddFloat("progress", progress); + message.AddInt32("current", fItemsCopied); + message.AddInt32("maximum", fItemsToCopy); + message.AddString("item", fCurrentItem); + message.AddString("folder", fCurrentTargetFolder); + fMessenger.SendMessage(&message); + } +} + + +bool +CopyEngine::_ShouldCopyEntry(const char* name, const struct stat& statInfo, + int32 level) const +{ + if (level == 1 && S_ISDIR(statInfo.st_mode)) { + if (strcmp(VAR_DIRECTORY, name) == 0) { + printf("ignoring '%s'.\n", name); + return false; + } + if (strcmp(PACKAGES_DIRECTORY, name) == 0) { + printf("ignoring '%s'.\n", name); + return false; + } + } + return true; +} + + +int32 +CopyEngine::_WriteThreadEntry(void* cookie) +{ + CopyEngine* engine = (CopyEngine*)cookie; + engine->_WriteThread(); + return B_OK; +} + + +void +CopyEngine::_WriteThread() +{ + bigtime_t bufferWaitTimeout = 100000; + + while (!fQuitting) { + + bigtime_t now = system_time(); + + Buffer* buffer; + status_t ret = fBufferQueue.Pop(&buffer, bufferWaitTimeout); + if (ret == B_TIMED_OUT) { + // no buffer, timeout + continue; + } else if (ret == B_NO_INIT) { + // real error + return; + } else if (ret != B_OK) { + // no buffer, queue error + snooze(10000); + continue; + } + + if (!buffer->deleteFile) { + ssize_t written = buffer->file->Write(buffer->buffer, + buffer->validBytes); + if (written != (ssize_t)buffer->validBytes) { + // TODO: this should somehow be propagated back + // to the main thread! + fprintf(stderr, "Failed to write data: %s\n", + strerror((status_t)written)); + } + fBytesWritten += written; + } + + delete buffer; + + // measure performance + fTimeWritten += system_time() - now; + } + + double megaBytes = (double)fBytesWritten / (1024 * 1024); + double seconds = (fTimeWritten / 1000000); + if (seconds > 0) { + printf("%.2f MB written (%.2f MB/s)\n", megaBytes, + megaBytes / seconds); + } +} + + Copied: haiku/trunk/src/apps/installer/CopyEngine.h (from rev 30598, haiku/trunk/src/apps/installer/CopyEngine2.h) =================================================================== --- haiku/trunk/src/apps/installer/CopyEngine2.h 2009-05-03 07:40:22 UTC (rev 30598) +++ haiku/trunk/src/apps/installer/CopyEngine.h 2009-05-03 09:35:42 UTC (rev 30601) @@ -0,0 +1,103 @@ +/* + * Copyright 2008-2009, Stephan A?mus + * All rights reserved. Distributed under the terms of the MIT License. + */ +#ifndef COPY_ENGINE_H +#define COPY_ENGINE_H + + +#include + +#include +#include +#include + +#include "BlockingQueue.h" + +class BFile; +class BLocker; +class BMessage; +class BMessenger; + +class CopyEngine { +public: + CopyEngine(const BMessenger& messenger, + BMessage* message); + virtual ~CopyEngine(); + + status_t CopyFolder(const char* source, + const char* destination, + BLocker* locker = NULL); + + status_t CopyFile(const BEntry& entry, + const BEntry& destination, + BLocker* locker = NULL); + +private: + status_t _CollectCopyInfo(const char* source, + int32& level); + status_t _CopyFolder(const char* source, + const char* destination, + int32& level, + BLocker* locker = NULL); + + bool _ShouldCopyEntry(const char* name, + const struct stat& statInfo, + int32 level) const; + + void _UpdateProgress(); + + static int32 _WriteThreadEntry(void* cookie); + void _WriteThread(); + +private: + enum { + BUFFER_COUNT = 16, + BUFFER_SIZE = 1024 * 1024 + }; + struct Buffer { + Buffer(BFile* file) + : file(file) + , buffer(malloc(BUFFER_SIZE)) + , size(BUFFER_SIZE) + , validBytes(0) + , deleteFile(false) + { + } + ~Buffer() + { + if (deleteFile) + delete file; + free(buffer); + } + BFile* file; + void* buffer; + size_t size; + size_t validBytes; + bool deleteFile; + }; + + BlockingQueue fBufferQueue; + + thread_id fWriterThread; + volatile bool fQuitting; + + off_t fBytesRead; + uint64 fItemsCopied; + bigtime_t fTimeRead; + + off_t fBytesWritten; + bigtime_t fTimeWritten; + + off_t fBytesToCopy; + uint64 fItemsToCopy; + + const char* fCurrentTargetFolder; + const char* fCurrentItem; + + BMessenger fMessenger; + BMessage* fMessage; +}; + + +#endif // COPY_ENGINE_2_H Deleted: haiku/trunk/src/apps/installer/CopyEngine2.cpp Deleted: haiku/trunk/src/apps/installer/CopyEngine2.h Modified: haiku/trunk/src/apps/installer/Jamfile =================================================================== --- haiku/trunk/src/apps/installer/Jamfile 2009-05-03 09:32:24 UTC (rev 30600) +++ haiku/trunk/src/apps/installer/Jamfile 2009-05-03 09:35:42 UTC (rev 30601) @@ -4,7 +4,7 @@ SubDirHdrs [ FDirName $(HAIKU_TOP) src kits tracker ] ; Application Installer : - CopyEngine2.cpp + CopyEngine.cpp InstallerApp.cpp InstallerWindow.cpp PackageViews.cpp Modified: haiku/trunk/src/apps/installer/WorkerThread.cpp =================================================================== --- haiku/trunk/src/apps/installer/WorkerThread.cpp 2009-05-03 09:32:24 UTC (rev 30600) +++ haiku/trunk/src/apps/installer/WorkerThread.cpp 2009-05-03 09:35:42 UTC (rev 30601) @@ -23,7 +23,7 @@ #include #include "AutoLocker.h" -#include "CopyEngine2.h" +#include "CopyEngine.h" #include "InstallerWindow.h" #include "PackageViews.h" #include "PartitionMenuItem.h" @@ -246,7 +246,7 @@ entry_ref testRef; BMessenger messenger(fWindow); - CopyEngine2 engine(messenger, new BMessage(MSG_STATUS_MESSAGE)); + CopyEngine engine(messenger, new BMessage(MSG_STATUS_MESSAGE)); PartitionMenuItem *targetItem = (PartitionMenuItem *)targetMenu->FindMarked(); PartitionMenuItem *srcItem = (PartitionMenuItem *)srcMenu->FindMarked(); From stippi at mail.berlios.de Sun May 3 11:58:11 2009 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sun, 3 May 2009 11:58:11 +0200 Subject: [Haiku-commits] r30602 - haiku/trunk/src/apps/installer Message-ID: <200905030958.n439wBCD007863@sheep.berlios.de> Author: stippi Date: 2009-05-03 11:58:09 +0200 (Sun, 03 May 2009) New Revision: 30602 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30602&view=rev Modified: haiku/trunk/src/apps/installer/CopyEngine.cpp haiku/trunk/src/apps/installer/CopyEngine.h haiku/trunk/src/apps/installer/InstallerWindow.cpp haiku/trunk/src/apps/installer/WorkerThread.cpp Log: * Refactored the way targets are collected before copy process begins, this way, the optional packages (if there would be any) can be collected as well before the actual process starts and the progress bar will reflect them correctly. Before this change, the progress bar would have reset itself for every optional package. * In one of my previous commits, I added the error, if there was any, to the reset message. Now the Installer window looks for the error and tells the user about it. Modified: haiku/trunk/src/apps/installer/CopyEngine.cpp =================================================================== --- haiku/trunk/src/apps/installer/CopyEngine.cpp 2009-05-03 09:35:42 UTC (rev 30601) +++ haiku/trunk/src/apps/installer/CopyEngine.cpp 2009-05-03 09:58:09 UTC (rev 30602) @@ -70,9 +70,8 @@ } -status_t -CopyEngine::CopyFolder(const char* source, const char* destination, - BLocker* locker) +void +CopyEngine::ResetTargets() { fBytesRead = 0; fItemsCopied = 0; @@ -87,20 +86,35 @@ fCurrentTargetFolder = NULL; fCurrentItem = NULL; + if (fMessage) { + BMessage message(*fMessage); + message.AddString("status", "Collecting copy information."); + fMessenger.SendMessage(&message); + } +} + + +status_t +CopyEngine::CollectTargets(const char* source) +{ int32 level = 0; - status_t ret = _CollectCopyInfo(source, level); - if (ret < B_OK) - return ret; + return _CollectCopyInfo(source, level); +} + +status_t +CopyEngine::CopyFolder(const char* source, const char* destination, + BLocker* locker = NULL) +{ + printf("%lld bytes to read in %lld files\n", fBytesToCopy, fItemsToCopy); + if (fMessage) { BMessage message(*fMessage); message.AddString("status", "Performing installation."); fMessenger.SendMessage(&message); } -printf("%lld bytes to read in %lld files\n", fBytesToCopy, fItemsToCopy); - - level = 0; + int32 level = 0; return _CopyFolder(source, destination, level, locker); } Modified: haiku/trunk/src/apps/installer/CopyEngine.h =================================================================== --- haiku/trunk/src/apps/installer/CopyEngine.h 2009-05-03 09:35:42 UTC (rev 30601) +++ haiku/trunk/src/apps/installer/CopyEngine.h 2009-05-03 09:58:09 UTC (rev 30602) @@ -25,6 +25,9 @@ BMessage* message); virtual ~CopyEngine(); + void ResetTargets(); + status_t CollectTargets(const char* source); + status_t CopyFolder(const char* source, const char* destination, BLocker* locker = NULL); Modified: haiku/trunk/src/apps/installer/InstallerWindow.cpp =================================================================== --- haiku/trunk/src/apps/installer/InstallerWindow.cpp 2009-05-03 09:35:42 UTC (rev 30601) +++ haiku/trunk/src/apps/installer/InstallerWindow.cpp 2009-05-03 09:58:09 UTC (rev 30602) @@ -359,9 +359,19 @@ { switch (msg->what) { case MSG_RESET: + { delete fCopyEngineLock; fCopyEngineLock = NULL; + status_t error; + if (msg->FindInt32("error", &error) == B_OK) { + char errorMessage[2048]; + snprintf(errorMessage, sizeof(errorMessage), "An error was " + "encountered and the installation was not completed:\n\n" + "Error: %s", strerror(error)); + (new BAlert("error", errorMessage, "Ok"))->Go(); + } + fInstallStatus = kReadyForInstall; fBeginButton->SetEnabled(true); _DisableInterface(false); @@ -372,6 +382,7 @@ fBeginButton->SetLabel("Begin"); break; + } case START_SCAN: _ScanPartitions(); break; @@ -530,7 +541,7 @@ if (fDriveSetupLaunched) { (new BAlert("driveSetup", "Please close the DriveSetup window before closing the " - "Installer window.", "OK"))->Go(); + "Installer window.", "Ok"))->Go(); return false; } _QuitCopyEngine(false); Modified: haiku/trunk/src/apps/installer/WorkerThread.cpp =================================================================== --- haiku/trunk/src/apps/installer/WorkerThread.cpp 2009-05-03 09:35:42 UTC (rev 30601) +++ haiku/trunk/src/apps/installer/WorkerThread.cpp 2009-05-03 09:58:09 UTC (rev 30602) @@ -388,6 +388,25 @@ _LaunchInitScript(targetDirectory); + // let the engine collect information for the progress bar later on + engine.ResetTargets(); + err = engine.CollectTargets(srcDirectory.Path()); + if (err != B_OK) + goto error; + + // collect selected packages also + if (fPackages) { + BPath pkgRootDir(srcDirectory.Path(), PACKAGES_DIRECTORY); + int32 count = fPackages->CountItems(); + for (int32 i = 0; i < count; i++) { + Package *p = static_cast(fPackages->ItemAt(i)); + BPath packageDir(pkgRootDir.Path(), p->Folder()); + err = engine.CollectTargets(packageDir.Path()); + if (err != B_OK) + goto error; + } + } + // copy source volume err = engine.CopyFolder(srcDirectory.Path(), targetDirectory.Path(), fCancelLock); @@ -396,11 +415,11 @@ // copy selected packages if (fPackages) { - srcDirectory.Append(PACKAGES_DIRECTORY); + BPath pkgRootDir(srcDirectory.Path(), PACKAGES_DIRECTORY); int32 count = fPackages->CountItems(); for (int32 i = 0; i < count; i++) { Package *p = static_cast(fPackages->ItemAt(i)); - BPath packageDir(srcDirectory.Path(), p->Folder()); + BPath packageDir(pkgRootDir.Path(), p->Folder()); err = engine.CopyFolder(packageDir.Path(), targetDirectory.Path(), fCancelLock); if (err != B_OK) From kirilla at mail.berlios.de Sun May 3 13:50:31 2009 From: kirilla at mail.berlios.de (kirilla at BerliOS) Date: Sun, 3 May 2009 13:50:31 +0200 Subject: [Haiku-commits] r30603 - haiku/trunk/src/data/beos_mime/audio Message-ID: <200905031150.n43BoVf1027960@sheep.berlios.de> Author: kirilla Date: 2009-05-03 13:50:28 +0200 (Sun, 03 May 2009) New Revision: 30603 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30603&view=rev Added: haiku/trunk/src/data/beos_mime/audio/x-mdx Log: Adding mimetype for SHARP X68000 MDX (Music Data for mXdrv) Sound File Added: haiku/trunk/src/data/beos_mime/audio/x-mdx =================================================================== --- haiku/trunk/src/data/beos_mime/audio/x-mdx 2009-05-03 09:58:09 UTC (rev 30602) +++ haiku/trunk/src/data/beos_mime/audio/x-mdx 2009-05-03 11:50:28 UTC (rev 30603) @@ -0,0 +1,16 @@ + +resource(0, "BEOS:TYPE") #'MIMS' "application/x-vnd.Be-meta-mime"; + +resource(1, "META:TYPE") "audio/x-mdx"; + +resource(2, "META:S:DESC") #'MSDC' "MDX Sound File"; + +resource(3, "META:L:DESC") #'MLDC' "SHARP X68000 MDX (Music Data for mXdrv) Sound File"; + +resource(4, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-MediaPlayer"; + +resource(5, "META:EXTENS") message(234) { + "extensions" = "mdx", + "type" = "audio/x-mdx" +}; + From bonefish at mail.berlios.de Sun May 3 14:19:25 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Sun, 3 May 2009 14:19:25 +0200 Subject: [Haiku-commits] r30604 - haiku/trunk/src/apps/installer Message-ID: <200905031219.n43CJPWq029717@sheep.berlios.de> Author: bonefish Date: 2009-05-03 14:19:24 +0200 (Sun, 03 May 2009) New Revision: 30604 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30604&view=rev Modified: haiku/trunk/src/apps/installer/CopyEngine.cpp Log: Build fix. Modified: haiku/trunk/src/apps/installer/CopyEngine.cpp =================================================================== --- haiku/trunk/src/apps/installer/CopyEngine.cpp 2009-05-03 11:50:28 UTC (rev 30603) +++ haiku/trunk/src/apps/installer/CopyEngine.cpp 2009-05-03 12:19:24 UTC (rev 30604) @@ -104,7 +104,7 @@ status_t CopyEngine::CopyFolder(const char* source, const char* destination, - BLocker* locker = NULL) + BLocker* locker) { printf("%lld bytes to read in %lld files\n", fBytesToCopy, fItemsToCopy); From bonefish at mail.berlios.de Sun May 3 14:32:21 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Sun, 3 May 2009 14:32:21 +0200 Subject: [Haiku-commits] r30605 - haiku/trunk/src/system/kernel/vm Message-ID: <200905031232.n43CWLEH030650@sheep.berlios.de> Author: bonefish Date: 2009-05-03 14:32:20 +0200 (Sun, 03 May 2009) New Revision: 30605 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30605&view=rev Modified: haiku/trunk/src/system/kernel/vm/vm_cache.cpp Log: VMCache::Resize(): When shrinking the cache unmap the pages we're removing. Theoretically, not doing that could have caused still mapped pages to get into the free queue. This could have been a cause of #3110, but the reported circumstances don't look quite fitting. Modified: haiku/trunk/src/system/kernel/vm/vm_cache.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm_cache.cpp 2009-05-03 12:19:24 UTC (rev 30604) +++ haiku/trunk/src/system/kernel/vm/vm_cache.cpp 2009-05-03 12:32:20 UTC (rev 30605) @@ -789,6 +789,10 @@ } // remove the page and put it into the free queue + vm_remove_all_page_mappings(page, NULL); + ASSERT(page->wired_count == 0); + // TODO: Find a real solution! Unmapping is probably fine, but + // we have no way of unmapping wired pages here. RemovePage(page); vm_page_free(this, page); // Note: When iterating through a IteratableSplayTree From bonefish at mail.berlios.de Sun May 3 14:37:53 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Sun, 3 May 2009 14:37:53 +0200 Subject: [Haiku-commits] r30606 - haiku/trunk/src/system/kernel/vm Message-ID: <200905031237.n43Cbrkb030941@sheep.berlios.de> Author: bonefish Date: 2009-05-03 14:37:51 +0200 (Sun, 03 May 2009) New Revision: 30606 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30606&view=rev Modified: haiku/trunk/src/system/kernel/vm/vm_page.cpp Log: panic() when a page that is still mapped is freed. Modified: haiku/trunk/src/system/kernel/vm/vm_page.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm_page.cpp 2009-05-03 12:32:20 UTC (rev 30605) +++ haiku/trunk/src/system/kernel/vm/vm_page.cpp 2009-05-03 12:37:51 UTC (rev 30606) @@ -770,8 +770,12 @@ if (sPageDeficit > 0) sFreePageCondition.NotifyOne(); - if (pageState != PAGE_STATE_INACTIVE && page->cache != NULL) - panic("to be freed page %p has cache", page); + if (pageState != PAGE_STATE_INACTIVE) { + if (page->cache != NULL) + panic("to be freed page %p has cache", page); + if (!page->mappings.IsEmpty() || page->wired_count > 0) + panic("to be freed page %p has mappings", page); + } } if (page->cache != NULL && page->cache->temporary) { if (pageState == PAGE_STATE_MODIFIED) From kirilla at mail.berlios.de Sun May 3 15:49:12 2009 From: kirilla at mail.berlios.de (kirilla at BerliOS) Date: Sun, 3 May 2009 15:49:12 +0200 Subject: [Haiku-commits] r30607 - haiku/trunk/src/apps/deskbar Message-ID: <200905031349.n43DnCw1004399@sheep.berlios.de> Author: kirilla Date: 2009-05-03 15:49:11 +0200 (Sun, 03 May 2009) New Revision: 30607 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30607&view=rev Modified: haiku/trunk/src/apps/deskbar/BeMenu.cpp Log: Comment on reach of method TBeMenu::ResetTargets(). Modified: haiku/trunk/src/apps/deskbar/BeMenu.cpp =================================================================== --- haiku/trunk/src/apps/deskbar/BeMenu.cpp 2009-05-03 12:37:51 UTC (rev 30606) +++ haiku/trunk/src/apps/deskbar/BeMenu.cpp 2009-05-03 13:49:11 UTC (rev 30607) @@ -410,6 +410,10 @@ void TBeMenu::ResetTargets() { + // This method does not recurse into submenus + // and does not affect menu items in submenus. + // (e.g. "Restart System" and "Power Off") + BNavMenu::ResetTargets(); // if we are dragging, set the target to whatever was set @@ -452,7 +456,8 @@ case CMD_REBOOT_SYSTEM: case CMD_SUSPEND_SYSTEM: case CMD_SHUTDOWN_SYSTEM: - // restart/shutdown + // Unreachable cases. + // See comment at start of method. #ifdef __HAIKU__ item->SetTarget(be_app); #else From zooey at mail.berlios.de Sun May 3 16:50:49 2009 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Sun, 3 May 2009 16:50:49 +0200 Subject: [Haiku-commits] r30608 - haiku/trunk/src/preferences/locale Message-ID: <200905031450.n43Eonwx011690@sheep.berlios.de> Author: zooey Date: 2009-05-03 16:50:42 +0200 (Sun, 03 May 2009) New Revision: 30608 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30608&view=rev Added: haiku/trunk/src/preferences/locale/Locale.rdef Modified: haiku/trunk/src/preferences/locale/Jamfile Log: Applied a patch done by VinDuv, which PulkoMandy passed on to me (thanks!): * added resource definition file which adds proper declarations and an icon to the Locale prefs (the icon is the world used for HTML-files, too) * I removed a garbage character from the long version description and adjusted its format to comply with the other prefs Modified: haiku/trunk/src/preferences/locale/Jamfile =================================================================== --- haiku/trunk/src/preferences/locale/Jamfile 2009-05-03 13:49:11 UTC (rev 30607) +++ haiku/trunk/src/preferences/locale/Jamfile 2009-05-03 14:50:42 UTC (rev 30608) @@ -4,5 +4,5 @@ Locale.cpp LocaleWindow.cpp : be liblocale.so -# : Locale.rdef + : Locale.rdef ; Added: haiku/trunk/src/preferences/locale/Locale.rdef =================================================================== --- haiku/trunk/src/preferences/locale/Locale.rdef 2009-05-03 13:49:11 UTC (rev 30607) +++ haiku/trunk/src/preferences/locale/Locale.rdef 2009-05-03 14:50:42 UTC (rev 30608) @@ -0,0 +1,199 @@ + +resource file_types message; + +#ifdef HAIKU_TARGET_PLATFORM_HAIKU + +resource vector_icon { + $"6E636966040501020106033D0AFE000000000000BD0AFE48F10748A0780032B4" + $"FF910066FFFF0034CC020106033D0AFE000000000000BD0AFE48F10748207854" + $"09B4B6D8033784FF051D61020106043D950B0000000000003D950B494FBC469B" + $"EC00FFFFFF2C00FF008600B200FF0080000C0204BFC2B3C3BBC5B3C3C3BFB3C3" + $"C6FABAFBC6FAB6FEC6FABEF8BFC2C233C3BFC233BBC5C233B88ABAFBB88ABEF8" + $"B88AB6FE026EC5DCB71EC713B908C4CAB56EC110B3E1C307B43DC0A2B3CDBFC2" + $"B3C3C032B3C3BDBCB3C3BA69B622BBC5B4A2B8F9B7B7B89DBC04B84FB9E6B8C7" + $"BD02B924BDDFB8E0BD4FB9DEBF87BCE0C19ABB38C0E1BEC5C26DC2D8C182C0FB" + $"C264C2C6C129C22FC11FC27AC126C22FC11FC227C11FC227C11FC227C11FC241" + $"C125C241C125C206C118C199C143C1D0C133C159C156C0D4C145C115C14DC051" + $"C136BF43C17BBFB0C11CBF3DC17BBF36C17BBF36C17BBF36C17BBF20C17BBF20" + $"C17BBF20C17BBDEDC17BBE23C17BBDB9C155BD57C147BD87C14BBD54C144BD3E" + $"C12BBD3EC12BBD31C11CBD13C10DBD26C113BD13C10DBCA4C0E6BCA4C0E6BCA4" + $"C0E6BC31C0BCBC31C0BCBC27C0B9BC12C0B7BC1DC0B8BC10C0B3BC0FC0AABC11" + $"C0AEBC0FC0AABBF5C081BBF5C081BBD3C046BB68BFFDBBAEC00CBB71BFD6BB58" + $"BF91BB63BFB6BB4BBF69BB4BBF15BB48BF3FBB4BBF15BB4EBEEFBB4EBEEFBB52" + $"BEBCBB4DBE56BB55BE89BB9EBDFBBBA9BD27BBB0BD9EBBA9BD27BBA7BCFBBBA7" + $"BCFBBBA7BCBBBBBCBC97BBA8BCB3BBBCBC97BBC7BC89BBC7BC89BC00BC3DBBE3" + $"BB64BC5BBBA5BBE3BB64BAB7BAC0BAB7BAC0BAB7BAC0BA8BBAACBA90BAAEBA8B" + $"BAACBA8BBAAABA8BBAAABA89BA52BA23B9E1BA6ABA15BA23B9E1BA12B9D3BA12" + $"B9D3BA12B9D3B9F8B9B1B9F8B9B1B9F8B9B1B9AEB958B9AEB958B97EB92BB928" + $"B919B950B91DB924B911B91BB902B920B909B984B8D6B9DEB7FFB9B5B861B9F6" + $"B7C5BA36B758BA0BB787BA5EB72CBA78B6C6BA83B706BACCB6A5BB61B64FBB18" + $"B67BBB61B64FBB6BB649BB6BB649BB6BB649BBFEB5EFBBFEB5EFBC65B5B2BCB6" + $"B4ECBC94B55EBCF5B4F2BD58B4CDBD2DB4E3BDA8B4FDBE6DB4B9BE29B4FFBE6F" + $"B4B8BE88B4B7BE7CB4B7BE62B508BEE1B597BE88B576BEE4B59BBEE9B5A6BEE5" + $"B5A2BED8B5ACBEC6B5B2BEC6B5B2BEC6B5B2BE75B60DBE75B60DBE63B645BE90" + $"B6B1BE74B67FBE91B6B4BE92B6BABE92B6BABE94B6C4BE9DB6E2BE97B6D3BE94" + $"B6ECBE8CB6F5BE8CB6F5BE3AB758BD92B7F7BDB7B76EBD92B7F7BD8DB809BD8D" + $"B809BD64B840BD7EB8BDBD59B881BD7BB8C4BD77B8CBBD77B8CBBD56B908BD4D" + $"B994BD39B94EBD60B9D8BDCCBA36BD98BA0ABDFFBA62BE73BAA7BE33BA8FBEBE" + $"BAC4BF5EBAAABF12BABEBF5EBAAABFAC33BFAC33BFD0BA86C01CBA77BFF5BA73" + $"C046BA7CC083BAB6C066BA9DC04DBB41C0F4BC42C0B6BBCBC0F4BC42C107BC61" + $"C102BC5AC0BABCECC127BDF9C0B2BD85C127BDF9C133BE05C133BE05C131BE77" + $"C1C5BF61C135BF3EC259BF84C348BEC1C2EEBF31C348BEC1C36BBE97C36BBE97" + $"C36BBE97C388BE81C388BE81C3A8BE6BC3DBBE2DC3C9BE50C3EEBE08C409BDBA" + $"C3F0BDDBC409BDBAC409BDBBC409BDBBC40DBE02C495BE29C450BE36C4EBBE1B" + $"C542BD78C51FBDBEC542BD78C551BD5AC551BD5AC551BD5AC555BD53C555BD53" + $"C57FBD0BC568BC64C59EBCAFC53ABC23C4A3BC47C4E1BC12C4A3BC32C4A3BC1D" + $"C4A3BC1DC4A3BC1DC4A5BB99C4A5BB99C4A8BB86C4E8BB47C4D2BB5DC4E8BB47" + $"C4FEBB31C4FEBB31C4FEBB31C516BB1BC516BB1BC545BAF3C582BA88C571BAC6" + $"C58CBA6DC588BA24C586BA41C588BA24C587BA10C587BA10C587BA10C588BA05" + $"C588BA05C58DB9C94EB962C584B98CC58AB942C5C2B8C5C5B0B90AC5C4B8CAC5" + $"CBB8D8C5CBB8D8C5D9B8F6C60FB93CC5EDB91BC60AB987C648BA12C627B9CFC6" + $"69BA53C66FBAE3C670BA9BC66FBAE3C672BB2CC672BB2CC674BB52C66EBB9FC6" + $"78BB79C664BBC2C649BC04C652BBE1C633BC54C62CBCFAC62DBCA7C621BD3DC6" + $"7FBD94C648BD7EC750BB770006BC12B54CBC12B54CBC32B518BC55B4A0BC47B4" + $"DCBB81B513BA2BB66ABAC4B5AFBA88B64BBB30B5E6BADDB618BB59B5CDBBAAB5" + $"9BBB82B5B5BBCBB585BC12B54CBBFCB56FBC12B54C001DBACDBE39BACDBE39BA" + $"EBBE12BB29BDC4BB13BDF1BB43BD8CBB34BCFBBB34BD38BB34BCB5BB60BC52BB" + $"34BC8DBB80BC26BBABBBC8BBA1BC00BB48BB92BA81BB26BAE5BB5BBA67BB19BA" + $"20BAEBBA2DBB08BA0FBAC3BA0DBA6ABA1FBA90B9FEBA4DB9BABA1EB9D0BA38B9" + $"9BB9F9B95FB9ACB983B9CEB93DB98CB8F0B995B91CB97EB8C0B9B0B8BEB947B8" + $"C3B967B8B1B97CB89FB9E6B8A7B9B1B8C9B9E6B8C5BA1AB8C3B9F2B8C6BA43B8" + $"C9BA96B8C7BA6DB8D0BAA8B8BABAB1B8CBBAB1B8B4BAB3B8AABAB6B8AFBAB5B8" + $"A0BABFB893BAB3B898BABEB882BAB2B88FBB78B88EBB68B893BBB1B8E1BC4FB8" + $"8DBC6BB90DBC6CB923BCDDB906BCB3B946BD10B985BD68B973BD29B997BDA6B9" + $"A3BE29B998BDE9B9B0BE79BA17BEC7B9DBBE96BA25BF1BBA75BF8FBA3DBF4FBA" + $"8FBFACBAC0BFE7BAA9BFC8BAD8C007BAFCBFE4BAE4C005BADDBFA2BAD7BF0EBA" + $"D3BF57BADBBEC9BACDBE39BAEABE7BBACDBE390009BD5EB43FBD5EB43FBD81B4" + $"56BDB1B476BD84B46DBDD0B47BBE19B469BE01B482BE55B42BBEF6B42CBEB0B4" + $"57BF2DB40ABFA3B3C6BF5BB3C6BFCEB3C5C00CB3F4BFE9B3E0C03CB40FC090B3" + $"CEC064B3DDBF3AB3A9BCA7B476BDDDB3E2BCECB48BBD5EB43FBD29B469BD5EB4" + $"3F0005BF35B552BF35B552BF55B554BF9AB55DBF7BB56ABFCEB548BF87B4E5BF" + $"9CB4FBBF78B4D5BF3CB4CCBF2FB48BBF45B4F8BF35B552BF6BB534BF35B55200" + $"04BA07B6E7BA07B6E7BA0CB6D0B9EFB6B8B9FEB6C7B982B74CB8F0B89DB92CB7" + $"F0B97E2DBA07B6E7B974B758BA07B6E70066C6F7BA8CC6F7BA8CC6DCB972C600" + $"2BC68BB85AC5B9B6E4C4FFB604C563B66DC4CEB5D0C463B571C49AB59FC452B5" + $"63C428B557C440B54AC412B562C407B529C401B539C316B477C0D0B3D7C1F9B4" + $"02C0FBB3F3C15FB404C131B3F1C170B40AC179B431C19FB425C12DB44AC08AB4" + $"31C0D7B42CC05AB435C03FB476C043B445C03DB491C040B4DEC036B4C5C04BB4" + $"FCC0B6B4C7C0A8B4D7C0CDB4ABC0F1B482C0B1B470C108B4B3C0D0B519C13AB5" + $"3EC0B5B50FC066B4F1C083B4E4C064B4F2C05DB517C05FB513C053B528C031B5" + $"38C044B533BFE6B54DBF94B5A9BFB0B557BF87B5D1BF5DB5F9BF88B5E9BF3BB6" + $"05BEF7B61ABF17B60CBECCB62FBEFAB684BEEAB667BF06B698BF19B6D4BF03B6" + $"C8BF59B6F9BFBEB648BFA3B66ABFE1B61BC038B615C008B625C04FB60EC084B5" + $"DFC06CB5D6C0D3B5FDC0F8B6A6C0EBB65CC110B6A7C135B678C100B66AC10DB6" + $"4DC0ECB5D843B613C125B5FDC15FB665C14DB625C170B6A5C1C2B688C18EB6C8" + $"C1CFB67BC1FDB63DC1E2B625C214B652C1F1B6A0C215B697C206B6B3C23AB6A5" + $"C222B6ABC25AB69CC28BB6AAC26CB69EC2AFB6B8C2FAB6BFC2D5B6BCC320B6C1" + $"C347B700C335B6E3C377B74FC24AB72DC259B72EC228B72BC1E2B738C202B72A" + $"C1C9B742C199B758C1B62BC179B74DC13FB71EC15BB730C118B704C0C5B6DAC0" + $"EFB6EDC07FB6BBBFE3B6B7C02FB6A7BFBFB6BEBF7FB6E4BF9CB6CEBF5CB6FFBF" + $"11B70CBF35B6E7BEDCB744BE6EB7AABEB6B787BE51B7B8BE19B7DEBE2EB7C4BE" + $"04B7F8BDF6B839BE04B81CBDE9B856BDE2B885BDCAB864BDF8B8A4BDEFB8DEBD" + $"FEB8BBBDD9B911BDC9B98FBD9FB957BDF231BE71BA24BE3AB9FCBEAFBA51BF41" + $"BA3ABEFBBA4DBF83BA29C009BA04BFC5BA09C05FB9FEC0DDBA6BC0A1BA35C104" + $"BA8EC0F5BACFC114BA9CC0D3BB07C103BB68C0E8BB30C11FBB9FC159BC0BC13C" + $"BBD5C166BC22C182BC50C177BC38C18EBC6CC16DBC95C17BBC7DC152BCC6C13F" + $"BD37C13FBCFFC13FBD76C185BDB4C15DBD8CC1AABDD9C1A4BE4BC1A8BE1BC1A0" + $"BE8DC1DBBEEFC1B3BEBBC216BEF2C289BED4C253BEEEC2CBBEB5C319BE46C2E8" + $"BE77C347BE18C386BDCEC378BE13C396BD7BC3FEBD27C3C2BD5AC435BCF8C430" + $"BC74C42EBCB5C432BC28C433BB8AC429BBD5C43CBB46C4ABBAE0C47EBB0FC4CD" + $"BABEC512BA6BC505BA9CC519BA4FC513BA10C51332C513B9FBC51131C51AB9D9" + $"C4F8B991C47EB994C48AB9C5C476B976C48BB969C477B97CC4A1B955C478B935" + $"C48BB940C442B915C3F1B8CEC418B902C3CCB89EC391B833C3AEB868C389B826" + $"C36CB7A3C342B796C39AB7B2C3E2B80BC3C4B7E9C419B847C46DB8D2C44AB888" + $"C46EB8DBC496B8F2C48FB8EDC4AFB904C4EAB910C4CAB913C533B90AC55AB888" + $"C555B8C9C562B82FC4E8B817C51DB842C4CAB7FFC49EB7C0C4B6B7DDC48FB7AE" + $"C474B776C466B792C493B761C4BDB785C49FB773C4E0B79AC52CB7B9C505B7AC" + $"C555B7C6C5B4B7D4C592B7BAC5C9B7E4C5E7B820C5D9B80AC5FEB844C627B88E" + $"C614B868C645B8C9C694B907C64DB8F1C667B950C6B6B9EBC693B9A7C6DFBA3C" + $"C6E3BAE4C6E4BA8BC6E2BB36C6D0BBE1C6F5BB94C6A7BC34C69FBD02C69FBCA6" + $"C6A1BCFDC6A5BCF0C6A3BCF5C6A2BCF7C6A1BD28C696BD26C6B2BD2CC6D6BC6A" + $"C6D2BC7DC6F6BBCDC6F7BA8CC700BB2CC6F7BA8C0008C301B640C301B640C2E6" + $"B644C2D4B60CC2E8B616C2B1B5FAC269B620C288B60FC204B657C236B5ABC221" + $"B5E3C239B5A2C285B5ACC27AB5AEC2A7B5A8C2F3B5B7C2D8B599C30CB5D3C33C" + $"B609C31FB5EFC360B62AC301B640C31CB63CC301B6400004BB53C06BBB53C06B" + $"BB45C075BB26C089BB38C085BB55C0B1BBBAC0F9BB87C0D6BB92C0CDBB53C06B" + $"BB84C08FBB53C06B0005C4F4BC96C4F4BC96C4D3BCBFC48CBD0CC4A6BCDEC46E" + $"BD42C47DBDBBC47DBD80C4B6BDA0C4EDBD21C4D0BD54C502BCFBC4F4BC96C531" + $"BCB0C4F4BC960009C213C18FC213C18FC17FC1F8BFF7C1ADC09DC19ABFD0C1B1" + $"BF8EC1D2BFACC1B8BF67C1F4BF20C1EEBF56C1EEBEAFC1EEBDCDC1EEBE3EC1EE" + $"BEC1C233C0C0C222BFC4C245C137C212C221C1CFC1AFC1F6C22AC1CCC262C193" + $"C280C19FC249C18AC213C18FC22AC199C213C18F040A00010012412E2C000000" + $"000000412FC3C85CD737400D01178400040A01010002412E2C00000000000041" + $"2FC3C85CD737400D0A02010102412E2C000000000000412FC3C85CD737400D0A" + $"030A0304050607080A0B020902412E2C000000000000412FC3C85CD737400D" +}; + +#else // HAIKU_TARGET_PLATFORM_HAIKU + +resource large_icon array { + $"FFFFFFFFFFFFFFFFFFFFFFD5DDDE28000002DED57FFFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFDD0000DE7F3E5F3E7EDCDE0000DDFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFDD00023E7436363E7E7E3E363E3E7E0200DDFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFDE003E3E5F5F3E5F7E3E7E363E3636363E7E00DEFFFFFFFFFFFF" + $"FFFFFFFFB528DE36345F5E5EBE5F7E3674363636363638383EDE28B5FFFFFFFF" + $"FFFFFFFFDEDE34745F5E5E5E5E5E3E7434363436367F3E36383EDE28FFFFFFFF" + $"FFFFFF28DD743E5F5E5E5E5E5E5F75343E7E3E343E363E3638363EDE28FFFFFF" + $"FFFFDD003E5F5E5E5E5E5E5E5E5F747436363E7E7E7E3E383638383E02DDFFFF" + $"FFFF005F745E5E5E5E5E5E5E5E5F5534343436363E363E36383E38387F00FFFF" + $"FFD528365E5E5EB25E925E92744E5634343634363636383E363E7F9E3E02DDFF" + $"FFDF5F3E5E5EB25E925E5E5F6E565634343436363636363E7F383EDD9E7E00FF" + $"B5005F5E5EB25E5E925E925F5457343436363436363636387F3E387FDD9E00B5" + $"DDDF5F5F925E92B25E925E5F3434343434363636363638363E7FDDBFDC7F28DD" + $"067E36745F92925E925E9273363634363634363636383638363E7FDCBF9EDD06" + $"DE5F3636745E92929292925E737474743E3E36363636383838367FDCBF247F28" + $"283E363836945E9272927292925E5F925E5F3E3636383836383E7FBFBFDCDC00" + $"005F38363636745F927292925E92925E925F3E363836383836DDBFBFBFDCDC00" + $"DE3E38363836387473927292925E925E5E5E3E38363836383EDC5FBFBFDCDDDE" + $"DD7F3E383638363E93725E92925E925E925E5F3E383838383EDCDCBFBFDE7FDE" + $"D5283E3638363E73925E92925E925E925E5E5F3E383638383EDD7FDCBF7F28D5" + $"B5005F3E3838365F92925E925E925E5E5E5E7E38363938387F7F7FBFDCDC00FF" + $"FF287E7E38363E5F925E925EB25EB25E5E5E5F7E3838383EDCDDDCBFBF2602FF" + $"FFDD027E38383E935EB25E925E5E5E5E5E5E5E7F38383EDCBFBFBFBFBF00DDFF" + $"FFFF007E3E387E5EB25E5E5EB25E5E5E5E5E5E7E3E3EDCBFBF5FBFBFDD00FFFF" + $"FFFFD5005F3E3E5E5EB25E5E5E5E5E5E5E5E5EBFDCBF5FBE5FBFBFDC00D4FFFF" + $"FFFFFFDEDD7F7E5F5E5E5E5E5E5E5E5E5E5EBE5E5F5EBF5FBEBFBF28DEFFFFFF" + $"FFFFFFFF28DE5F7E5E5E5E5E5E5E5E5E5E5F5EBF5EBFBEBFBFBF2828FFFFFFFF" + $"FFFFFFFFFF28DE7E5F5F5E5E5E5E5E5E5EBE5F5EBFBE5FBFDC28DFFFFFFFFFFF" + $"FFFFFFFFFFFFDE00DC7EDC5F5E5EBF5FBF5FBFDCDCDCBFDD00DEFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFD50000DC5FDDDDDC7F9E9E9E7F9EDC0028D5FFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFDD0200DEDD7E7E7E7EDD280000D5FFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFFB5D5DEDE000028D5DEFFFFFFFFFFFFFFFFFFFFFFFF" +}; + +resource mini_icon array { + $"B4B4B4B4DD007F5F7EDE00B4B4B4B4B4" + $"B4B4B4003E5F5F3E3636367EDEB4B4B4" + $"B4B4DE745E5E5E7436367F363E28B4B4" + $"B4005F5E5E5E5F74367E7E38383EDDB4" + $"D5365EB292924E343636363E3E9E02B4" + $"005EB25E5E5F5734363636383E7F9EB5" + $"7E74925E5E733636343638383EDC9E06" + $"3E38949292925E925F3638363EBFDC00" + $"3E36367492925E5E5E383838DCBFDCDE" + $"283636735E9292925E3E3638DDDC7FD5" + $"287E365F5E5E5E5E5E7E383EDDBF26B4" + $"B47E385E5E5E5E5E5E7E3EBF5FBF00B4" + $"B4DE7F5F5E5E5E5E5E5E5E5FBF28B4B4" + $"B4B4287E5F5E5E5EBE5EBEBF28B4B4B4" + $"B4B4B4D5005FDD7F9E7FDC28B4B4B4B4" + $"B4B4B4B4B4B5DE0028DEB4B4B4B4B4B4" +}; + +#endif // HAIKU_TARGET_PLATFORM_HAIKU + +resource app_signature "application/x-vnd.Haiku-Locale"; + +resource app_version { + major = 1, + middle = 0, + minor = 0, + + variety = B_APPV_DEVELOPMENT, + internal = 0, + + short_info = "1.0.0", + long_info = "Locale ?2009 Haiku" +}; + +resource app_flags B_SINGLE_LAUNCH; From axeld at mail.berlios.de Sun May 3 17:28:55 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sun, 3 May 2009 17:28:55 +0200 Subject: [Haiku-commits] r30609 - haiku/trunk/src/bin Message-ID: <200905031528.n43FStsh015874@sheep.berlios.de> Author: axeld Date: 2009-05-03 17:28:54 +0200 (Sun, 03 May 2009) New Revision: 30609 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30609&view=rev Modified: haiku/trunk/src/bin/reindex.cpp Log: * Now also adds directories to the index (before only in non-recursive mode). Modified: haiku/trunk/src/bin/reindex.cpp =================================================================== --- haiku/trunk/src/bin/reindex.cpp 2009-05-03 14:50:42 UTC (rev 30608) +++ haiku/trunk/src/bin/reindex.cpp 2009-05-03 15:28:54 UTC (rev 30609) @@ -175,7 +175,8 @@ BNode innerNode; handleFile(&entryIterator, &innerNode); } - return; + + // also rewrite the attributes of the directory } char name[B_FILE_NAME_LENGTH]; @@ -347,7 +348,7 @@ while (*++argv) { BEntry entry(*argv); - BNode node; + BNode node; if (entry.InitCheck() == B_OK) { if (gFromVolume) From zooey at mail.berlios.de Sun May 3 18:10:29 2009 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Sun, 3 May 2009 18:10:29 +0200 Subject: [Haiku-commits] r30610 - haiku/trunk/build/jam Message-ID: <200905031610.n43GATOB021802@sheep.berlios.de> Author: zooey Date: 2009-05-03 18:10:29 +0200 (Sun, 03 May 2009) New Revision: 30610 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30610&view=rev Modified: haiku/trunk/build/jam/HaikuImage Log: One more thing I missed from PulkoMandys patch: * added deskbar preferences link for Locale Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2009-05-03 15:28:54 UTC (rev 30609) +++ haiku/trunk/build/jam/HaikuImage 2009-05-03 16:10:29 UTC (rev 30610) @@ -293,8 +293,8 @@ # TODO/NOTE: Cannot use $(SYSTEM_PREFERENCES) here since there is # "Tracker"... DESKBAR_PREFERENCES = Appearance Backgrounds CPUFrequency DataTranslations - E-mail FileTypes Fonts Keyboard Keymap Media Menu Mouse Network Printers - Screen ScreenSaver Sounds Time Touchpad Tracker VirtualMemory + E-mail FileTypes Fonts Keyboard Keymap Locale Media Menu Mouse Network + Printers Screen ScreenSaver Sounds Time Touchpad Tracker VirtualMemory ; for linkTarget in $(DESKBAR_PREFERENCES) { AddSymlinkToHaikuImage home config be Preferences From axeld at pinc-software.de Sun May 3 18:48:01 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Sun, 03 May 2009 18:48:01 +0200 CEST Subject: [Haiku-commits] r30511 - in haiku/trunk: build/jam src/bin In-Reply-To: <1e42d8c50904301520t78a67d65v1e16968fdbfd4228@mail.gmail.com> Message-ID: <9163078317-BeMail@zon> Matt Madia wrote: > On Thu, Apr 30, 2009 at 10:17 PM, Axel D?rfler > > wrote: > > Matt Madia wrote: > >> One problem, it's not reindexing directories. > > You mean it's not reindexing the attributes of directories, or does > > not > > traverse directories? I actually only tested it on a single file > > when I > > made the changes. > it isn't reindexing the attributes of directories. > traversing them is working properly. Fixed in r30609, thanks for the note! Bye, Axel. From axeld at pinc-software.de Sun May 3 18:49:51 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Sun, 03 May 2009 18:49:51 +0200 CEST Subject: [Haiku-commits] r30374 - haiku/trunk/src/apps/terminal In-Reply-To: <20090424162638.1377.2@bepc.1240578914.fake> Message-ID: <9273808639-BeMail@zon> Stephan Assmus wrote: > > Log: > > * Applied patch by Olivier to implement more mouse reporting modes, > > and > > thus fixing bug #2854. Thanks! > May I propose to give Oliver commit access? :-) Olivier, do you want some? Bye, Axel. From stippi at mail.berlios.de Sun May 3 19:35:12 2009 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sun, 3 May 2009 19:35:12 +0200 Subject: [Haiku-commits] r30611 - haiku/trunk/src/apps/installer Message-ID: <200905031735.n43HZCV2024057@sheep.berlios.de> Author: stippi Date: 2009-05-03 19:35:09 +0200 (Sun, 03 May 2009) New Revision: 30611 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30611&view=rev Modified: haiku/trunk/src/apps/installer/InstallerWindow.cpp haiku/trunk/src/apps/installer/PartitionMenuItem.cpp haiku/trunk/src/apps/installer/PartitionMenuItem.h haiku/trunk/src/apps/installer/WorkerThread.cpp Log: * Remember in PartitionMenuItem if a partition is a suitable install target. * Show non-BFS partitions again, but show them disabled and show the content type in the menu label. BFS partitions don't get the content type shown, so that it looks more like the reason why they are disabled if the content type is shown. * Small cleanups. Modified: haiku/trunk/src/apps/installer/InstallerWindow.cpp =================================================================== --- haiku/trunk/src/apps/installer/InstallerWindow.cpp 2009-05-03 16:10:29 UTC (rev 30610) +++ haiku/trunk/src/apps/installer/InstallerWindow.cpp 2009-05-03 17:35:09 UTC (rev 30611) @@ -633,18 +633,17 @@ } fSrcMenuField->MenuItem()->SetLabel(label.String()); - if (srcItem) { - // Prevent the user from having picked the same partition as source - // and destination. - for (int32 i = fDestMenu->CountItems() - 1; i >= 0; i--) { - PartitionMenuItem* dstItem - = (PartitionMenuItem*)fDestMenu->ItemAt(i); - if (dstItem->ID() == srcItem->ID()) { - dstItem->SetEnabled(false); - dstItem->SetMarked(false); - } else - dstItem->SetEnabled(true); - } + // Disable any unsuitable target items + for (int32 i = fDestMenu->CountItems() - 1; i >= 0; i--) { + PartitionMenuItem* dstItem + = (PartitionMenuItem*)fDestMenu->ItemAt(i); + if (srcItem != NULL && dstItem->ID() == srcItem->ID()) { + // Prevent the user from having picked the same partition as source + // and destination. + dstItem->SetEnabled(false); + dstItem->SetMarked(false); + } else + dstItem->SetEnabled(dstItem->IsValidTarget()); } PartitionMenuItem* dstItem = (PartitionMenuItem*)fDestMenu->FindMarked(); Modified: haiku/trunk/src/apps/installer/PartitionMenuItem.cpp =================================================================== --- haiku/trunk/src/apps/installer/PartitionMenuItem.cpp 2009-05-03 16:10:29 UTC (rev 30610) +++ haiku/trunk/src/apps/installer/PartitionMenuItem.cpp 2009-05-03 17:35:09 UTC (rev 30611) @@ -12,11 +12,12 @@ PartitionMenuItem::PartitionMenuItem(const char* name, const char* label, const char* menuLabel, BMessage* message, partition_id id) : - BMenuItem(label, message) + BMenuItem(label, message), + fID(id), + fMenuLabel(strdup(menuLabel)), + fName(strdup(name)), + fIsValidTarget(true) { - fID = id; - fMenuLabel = strdup(menuLabel); - fName = strdup(name); } @@ -37,13 +38,27 @@ const char* PartitionMenuItem::MenuLabel() const { - return fMenuLabel ? fMenuLabel : Label(); + return fMenuLabel != NULL ? fMenuLabel : Label(); } const char* PartitionMenuItem::Name() const { - return fName ? fName : Label(); + return fName != NULL ? fName : Label(); } + +void +PartitionMenuItem::SetIsValidTarget(bool isValidTarget) +{ + fIsValidTarget = isValidTarget; +} + + +bool +PartitionMenuItem::IsValidTarget() const +{ + return fIsValidTarget; +} + Modified: haiku/trunk/src/apps/installer/PartitionMenuItem.h =================================================================== --- haiku/trunk/src/apps/installer/PartitionMenuItem.h 2009-05-03 16:10:29 UTC (rev 30610) +++ haiku/trunk/src/apps/installer/PartitionMenuItem.h 2009-05-03 17:35:09 UTC (rev 30611) @@ -24,10 +24,14 @@ const char* MenuLabel() const; const char* Name() const; + void SetIsValidTarget(bool isValidTarget); + bool IsValidTarget() const; + private: partition_id fID; char* fMenuLabel; char* fName; + bool fIsValidTarget; }; #endif // PARTITION_MENU_ITEM_H_ Modified: haiku/trunk/src/apps/installer/WorkerThread.cpp =================================================================== --- haiku/trunk/src/apps/installer/WorkerThread.cpp 2009-05-03 16:10:29 UTC (rev 30610) +++ haiku/trunk/src/apps/installer/WorkerThread.cpp 2009-05-03 17:35:09 UTC (rev 30611) @@ -42,32 +42,34 @@ const char BOOT_PATH[] = "/boot"; -extern void SizeAsString(off_t size, char *string); +extern void SizeAsString(off_t size, char* string); const uint32 MSG_START_INSTALLING = 'eSRT'; -class SourceVisitor : public BDiskDeviceVisitor -{ - public: - SourceVisitor(BMenu *menu); - virtual bool Visit(BDiskDevice *device); - virtual bool Visit(BPartition *partition, int32 level); - private: - BMenu *fMenu; +class SourceVisitor : public BDiskDeviceVisitor { +public: + SourceVisitor(BMenu* menu); + virtual bool Visit(BDiskDevice* device); + virtual bool Visit(BPartition* partition, int32 level); + +private: + BMenu* fMenu; }; -class TargetVisitor : public BDiskDeviceVisitor -{ - public: - TargetVisitor(BMenu *menu); - virtual bool Visit(BDiskDevice *device); - virtual bool Visit(BPartition *partition, int32 level); - private: - void _MakeLabel(BPartition *partition, char *label, char *menuLabel); - BMenu *fMenu; +class TargetVisitor : public BDiskDeviceVisitor { +public: + TargetVisitor(BMenu* menu); + virtual bool Visit(BDiskDevice* device); + virtual bool Visit(BPartition* partition, int32 level); + +private: + void _MakeLabel(BPartition* partition, char* label, char* menuLabel, + bool showContentType); + + BMenu* fMenu; }; @@ -532,13 +534,6 @@ printf("TargetVisitor::Visit(BPartition *) : %s\n", path.Path()); printf("TargetVisitor::Visit(BPartition *) : %s\n", partition->ContentName()); - if (partition->ContentType() == NULL - || strcmp(partition->ContentType(), kPartitionTypeBFS) != 0) { - // Except only valid BFS partitions - printf(" not BFS\n"); - return false; - } - if (partition->ContentSize() < 20 * 1024 * 1024) { // reject partitions which are too small anyways // TODO: Could depend on the source size @@ -556,31 +551,46 @@ // TODO: After running DriveSetup and doing another scan, it would // be great to pick the partition which just appeared! + // Only BFS partitions are valid targets, but we want to display the + // other partitions as well, in order not to irritate the user. + bool isValidTarget = partition->ContentType() != NULL + && strcmp(partition->ContentType(), kPartitionTypeBFS) == 0; + char label[255], menuLabel[255]; - _MakeLabel(partition, label, menuLabel); - fMenu->AddItem(new PartitionMenuItem(partition->ContentName(), label, - menuLabel, new BMessage(TARGET_PARTITION), partition->ID())); + _MakeLabel(partition, label, menuLabel, !isValidTarget); + PartitionMenuItem* item = new PartitionMenuItem(partition->ContentName(), + label, menuLabel, new BMessage(TARGET_PARTITION), partition->ID()); + + item->SetIsValidTarget(isValidTarget); + + + fMenu->AddItem(item); return false; } void -TargetVisitor::_MakeLabel(BPartition *partition, char *label, char *menuLabel) +TargetVisitor::_MakeLabel(BPartition* partition, char* label, char* menuLabel, + bool showContentType) { char size[15]; SizeAsString(partition->ContentSize(), size); + BPath path; partition->GetPath(&path); - // TODO: Reenable the printing of the content type once Haiku supports - // installing to other file systems than BFS. -// sprintf(label, "%s - %s [%s] [%s]", partition->ContentName(), -// size, partition->ContentType(), path.Path()); -// sprintf(menuLabel, "%s - %s [%s]", partition->ContentName(), size, -// partition->ContentType()); + if (showContentType) { + const char* type = partition->ContentType(); + if (type == NULL) + type = "Unknown Type"; + + sprintf(label, "%s - %s [%s] (%s)", partition->ContentName(), size, + path.Path(), type); + } else { + sprintf(label, "%s - %s [%s]", partition->ContentName(), size, + path.Path()); + } - sprintf(label, "%s - %s - %s", partition->ContentName(), size, - path.Path()); sprintf(menuLabel, "%s - %s", partition->ContentName(), size); } From stippi at mail.berlios.de Sun May 3 19:44:39 2009 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sun, 3 May 2009 19:44:39 +0200 Subject: [Haiku-commits] r30612 - haiku/trunk/src/apps/installer Message-ID: <200905031744.n43HidJx008357@sheep.berlios.de> Author: stippi Date: 2009-05-03 19:44:38 +0200 (Sun, 03 May 2009) New Revision: 30612 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30612&view=rev Modified: haiku/trunk/src/apps/installer/InstallerWindow.cpp haiku/trunk/src/apps/installer/InstallerWindow.h Log: If no suitable partitions have been found, encourage the user to use the Setup Partitions button... Modified: haiku/trunk/src/apps/installer/InstallerWindow.cpp =================================================================== --- haiku/trunk/src/apps/installer/InstallerWindow.cpp 2009-05-03 17:35:09 UTC (rev 30611) +++ haiku/trunk/src/apps/installer/InstallerWindow.cpp 2009-05-03 17:44:38 UTC (rev 30612) @@ -208,6 +208,7 @@ : BWindow(BRect(-2000, -2000, -1800, -1800), "Installer", B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS), fNeedsToCenterOnScreen(true), + fEncouragedToSetupPartitions(false), fDriveSetupLaunched(false), fInstallStatus(kReadyForInstall), fWorkerThread(new WorkerThread(this)), @@ -633,7 +634,9 @@ } fSrcMenuField->MenuItem()->SetLabel(label.String()); - // Disable any unsuitable target items + // Disable any unsuitable target items, check if at least one partition + // is suitable. + bool foundOneSuitableTarget = false; for (int32 i = fDestMenu->CountItems() - 1; i >= 0; i--) { PartitionMenuItem* dstItem = (PartitionMenuItem*)fDestMenu->ItemAt(i); @@ -644,6 +647,9 @@ dstItem->SetMarked(false); } else dstItem->SetEnabled(dstItem->IsValidTarget()); + + if (dstItem->IsEnabled()) + foundOneSuitableTarget = true; } PartitionMenuItem* dstItem = (PartitionMenuItem*)fDestMenu->FindMarked(); @@ -683,6 +689,15 @@ label << " to \'" <Name() << '\''; fMakeBootableButton->SetEnabled(dstItem); fMakeBootableButton->SetLabel(label.String()); + + if (!fEncouragedToSetupPartitions && !foundOneSuitableTarget) { + // Focus the users attention on the DriveSetup button + fEncouragedToSetupPartitions = true; + (new BAlert("use drive setup", "No partitions have been found that " + "are suitable for installation. Please setup partitions and " + "initialize at least one partition with the Be File System." , + "Ok"))->Go(); + } } Modified: haiku/trunk/src/apps/installer/InstallerWindow.h =================================================================== --- haiku/trunk/src/apps/installer/InstallerWindow.h 2009-05-03 17:35:09 UTC (rev 30611) +++ haiku/trunk/src/apps/installer/InstallerWindow.h 2009-05-03 17:44:38 UTC (rev 30612) @@ -88,6 +88,7 @@ BButton* fMakeBootableButton; bool fNeedsToCenterOnScreen; + bool fEncouragedToSetupPartitions; bool fDriveSetupLaunched; InstallStatus fInstallStatus; From stippi at mail.berlios.de Sun May 3 19:53:39 2009 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sun, 3 May 2009 19:53:39 +0200 Subject: [Haiku-commits] r30613 - haiku/trunk/src/apps/installer Message-ID: <200905031753.n43HrdLT009660@sheep.berlios.de> Author: stippi Date: 2009-05-03 19:53:37 +0200 (Sun, 03 May 2009) New Revision: 30613 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30613&view=rev Modified: haiku/trunk/src/apps/installer/InstallerWindow.cpp Log: Tweak the "install done" message. If Deskbar is running, chances are quitting the Installer won't restart the computer. Modified: haiku/trunk/src/apps/installer/InstallerWindow.cpp =================================================================== --- haiku/trunk/src/apps/installer/InstallerWindow.cpp 2009-05-03 17:44:38 UTC (rev 30612) +++ haiku/trunk/src/apps/installer/InstallerWindow.cpp 2009-05-03 17:53:37 UTC (rev 30613) @@ -415,13 +415,6 @@ case kInstalling: { _QuitCopyEngine(true); -// if (fWorkerThread->Cancel()) { -// fInstallStatus = kCancelled; -// _SetStatusMessage("Installation cancelled."); -// fProgressLayoutItem->SetVisible(false); -// fPkgSwitchLayoutItem->SetVisible(true); -// _ShowOptionalPackages(); -// } break; } case kFinished: @@ -494,11 +487,18 @@ PartitionMenuItem* dstItem = (PartitionMenuItem*)fDestMenu->FindMarked(); + + const char* quitString; + if (be_roster->IsRunning(kDeskbarSignature)) + quitString = "leave the Installer"; + else + quitString = "restart the computer"; + char status[1024]; snprintf(status, sizeof(status), "Installation completed. " - "Boot sector has been written to '%s'. Press Quit to reboot " + "Boot sector has been written to '%s'. Press Quit to %s " "or chose a new target volume to perform another " - "installation.", dstItem ? dstItem->Name() : "???"); + "installation.", dstItem ? dstItem->Name() : "???", quitString); _SetStatusMessage(status); fInstallStatus = kFinished; _DisableInterface(false); From axeld at mail.berlios.de Sun May 3 19:56:09 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sun, 3 May 2009 19:56:09 +0200 Subject: [Haiku-commits] r30614 - haiku/trunk/src/add-ons/kernel/file_systems/bfs Message-ID: <200905031756.n43Hu9bM009885@sheep.berlios.de> Author: axeld Date: 2009-05-03 19:56:08 +0200 (Sun, 03 May 2009) New Revision: 30614 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30614&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Debug.cpp Log: * Replaced the Print() macro with a direct call to kprintf(). * Before, it would incorrectly resolve to the __out() macro which was defined as dprintf() when compiled for the kernel -- this could deadlock KDL, though. Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Debug.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Debug.cpp 2009-05-03 17:53:37 UTC (rev 30613) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Debug.cpp 2009-05-03 17:56:08 UTC (rev 30614) @@ -12,9 +12,7 @@ #include "Inode.h" #include "Journal.h" -#define Print __out - char* get_tupel(uint32 id) { @@ -37,7 +35,7 @@ void dump_block_run(const char* prefix, const block_run& run) { - Print("%s(%d, %d, %d)\n", prefix, (int)run.allocation_group, run.start, + kprintf("%s(%d, %d, %d)\n", prefix, (int)run.allocation_group, run.start, run.length); } @@ -45,33 +43,33 @@ void dump_super_block(const disk_super_block* superBlock) { - Print("disk_super_block:\n"); - Print(" name = %s\n", superBlock->name); - Print(" magic1 = %#08x (%s) %s\n", (int)superBlock->Magic1(), + kprintf("disk_super_block:\n"); + kprintf(" name = %s\n", superBlock->name); + kprintf(" magic1 = %#08x (%s) %s\n", (int)superBlock->Magic1(), get_tupel(superBlock->magic1), (superBlock->magic1 == SUPER_BLOCK_MAGIC1 ? "valid" : "INVALID")); - Print(" fs_byte_order = %#08x (%s)\n", (int)superBlock->fs_byte_order, + kprintf(" fs_byte_order = %#08x (%s)\n", (int)superBlock->fs_byte_order, get_tupel(superBlock->fs_byte_order)); - Print(" block_size = %u\n", (unsigned)superBlock->BlockSize()); - Print(" block_shift = %u\n", (unsigned)superBlock->BlockShift()); - Print(" num_blocks = %Lu\n", superBlock->NumBlocks()); - Print(" used_blocks = %Lu\n", superBlock->UsedBlocks()); - Print(" inode_size = %u\n", (unsigned)superBlock->InodeSize()); - Print(" magic2 = %#08x (%s) %s\n", (int)superBlock->Magic2(), + kprintf(" block_size = %u\n", (unsigned)superBlock->BlockSize()); + kprintf(" block_shift = %u\n", (unsigned)superBlock->BlockShift()); + kprintf(" num_blocks = %Lu\n", superBlock->NumBlocks()); + kprintf(" used_blocks = %Lu\n", superBlock->UsedBlocks()); + kprintf(" inode_size = %u\n", (unsigned)superBlock->InodeSize()); + kprintf(" magic2 = %#08x (%s) %s\n", (int)superBlock->Magic2(), get_tupel(superBlock->magic2), (superBlock->magic2 == (int)SUPER_BLOCK_MAGIC2 ? "valid" : "INVALID")); - Print(" blocks_per_ag = %u\n", + kprintf(" blocks_per_ag = %u\n", (unsigned)superBlock->BlocksPerAllocationGroup()); - Print(" ag_shift = %u (%ld bytes)\n", + kprintf(" ag_shift = %u (%ld bytes)\n", (unsigned)superBlock->AllocationGroupShift(), 1L << superBlock->AllocationGroupShift()); - Print(" num_ags = %u\n", (unsigned)superBlock->AllocationGroups()); - Print(" flags = %#08x (%s)\n", (int)superBlock->Flags(), + kprintf(" num_ags = %u\n", (unsigned)superBlock->AllocationGroups()); + kprintf(" flags = %#08x (%s)\n", (int)superBlock->Flags(), get_tupel(superBlock->Flags())); dump_block_run(" log_blocks = ", superBlock->log_blocks); - Print(" log_start = %Lu\n", superBlock->LogStart()); - Print(" log_end = %Lu\n", superBlock->LogEnd()); - Print(" magic3 = %#08x (%s) %s\n", (int)superBlock->Magic3(), + kprintf(" log_start = %Lu\n", superBlock->LogStart()); + kprintf(" log_end = %Lu\n", superBlock->LogEnd()); + kprintf(" magic3 = %#08x (%s) %s\n", (int)superBlock->Magic3(), get_tupel(superBlock->magic3), (superBlock->magic3 == SUPER_BLOCK_MAGIC3 ? "valid" : "INVALID")); dump_block_run(" root_dir = ", superBlock->root_dir); @@ -82,76 +80,76 @@ void dump_data_stream(const data_stream* stream) { - Print("data_stream:\n"); + kprintf("data_stream:\n"); for (int i = 0; i < NUM_DIRECT_BLOCKS; i++) { if (!stream->direct[i].IsZero()) { - Print(" direct[%02d] = ", i); + kprintf(" direct[%02d] = ", i); dump_block_run("", stream->direct[i]); } } - Print(" max_direct_range = %Lu\n", stream->MaxDirectRange()); + kprintf(" max_direct_range = %Lu\n", stream->MaxDirectRange()); if (!stream->indirect.IsZero()) dump_block_run(" indirect = ", stream->indirect); - Print(" max_indirect_range = %Lu\n", stream->MaxIndirectRange()); + kprintf(" max_indirect_range = %Lu\n", stream->MaxIndirectRange()); if (!stream->double_indirect.IsZero()) { dump_block_run(" double_indirect = ", stream->double_indirect); } - Print(" max_double_indirect_range = %Lu\n", + kprintf(" max_double_indirect_range = %Lu\n", stream->MaxDoubleIndirectRange()); - Print(" size = %Lu\n", stream->Size()); + kprintf(" size = %Lu\n", stream->Size()); } void dump_inode(const bfs_inode* inode) { - Print("inode:\n"); - Print(" magic1 = %08x (%s) %s\n", (int)inode->Magic1(), + kprintf("inode:\n"); + kprintf(" magic1 = %08x (%s) %s\n", (int)inode->Magic1(), get_tupel(inode->magic1), (inode->magic1 == INODE_MAGIC1 ? "valid" : "INVALID")); dump_block_run( " inode_num = ", inode->inode_num); - Print(" uid = %u\n", (unsigned)inode->UserID()); - Print(" gid = %u\n", (unsigned)inode->GroupID()); - Print(" mode = %08x\n", (int)inode->Mode()); - Print(" flags = %08x\n", (int)inode->Flags()); - Print(" create_time = %Ld (%Ld)\n", inode->CreateTime(), + kprintf(" uid = %u\n", (unsigned)inode->UserID()); + kprintf(" gid = %u\n", (unsigned)inode->GroupID()); + kprintf(" mode = %08x\n", (int)inode->Mode()); + kprintf(" flags = %08x\n", (int)inode->Flags()); + kprintf(" create_time = %Ld (%Ld)\n", inode->CreateTime(), inode->CreateTime() >> INODE_TIME_SHIFT); - Print(" last_modified_time = %Ld (%Ld)\n", inode->LastModifiedTime(), + kprintf(" last_modified_time = %Ld (%Ld)\n", inode->LastModifiedTime(), inode->LastModifiedTime() >> INODE_TIME_SHIFT); dump_block_run( " parent = ", inode->parent); dump_block_run( " attributes = ", inode->attributes); - Print(" type = %u\n", (unsigned)inode->Type()); - Print(" inode_size = %u\n", (unsigned)inode->InodeSize()); - Print(" short_symlink = %s\n", + kprintf(" type = %u\n", (unsigned)inode->Type()); + kprintf(" inode_size = %u\n", (unsigned)inode->InodeSize()); + kprintf(" short_symlink = %s\n", S_ISLNK(inode->Mode()) && (inode->Flags() & INODE_LONG_SYMLINK) == 0 ? inode->short_symlink : "-"); dump_data_stream(&(inode->data)); - Print(" --\n pad[0] = %08x\n", (int)inode->pad[0]); - Print(" pad[1] = %08x\n", (int)inode->pad[1]); - Print(" pad[2] = %08x\n", (int)inode->pad[2]); - Print(" pad[3] = %08x\n", (int)inode->pad[3]); + kprintf(" --\n pad[0] = %08x\n", (int)inode->pad[0]); + kprintf(" pad[1] = %08x\n", (int)inode->pad[1]); + kprintf(" pad[2] = %08x\n", (int)inode->pad[2]); + kprintf(" pad[3] = %08x\n", (int)inode->pad[3]); } void dump_bplustree_header(const bplustree_header* header) { - Print("bplustree_header:\n"); - Print(" magic = %#08x (%s) %s\n", (int)header->Magic(), + kprintf("bplustree_header:\n"); + kprintf(" magic = %#08x (%s) %s\n", (int)header->Magic(), get_tupel(header->magic), (header->magic == BPLUSTREE_MAGIC ? "valid" : "INVALID")); - Print(" node_size = %u\n", (unsigned)header->NodeSize()); - Print(" max_number_of_levels = %u\n", + kprintf(" node_size = %u\n", (unsigned)header->NodeSize()); + kprintf(" max_number_of_levels = %u\n", (unsigned)header->MaxNumberOfLevels()); - Print(" data_type = %u\n", (unsigned)header->DataType()); - Print(" root_node_pointer = %Ld\n", header->RootNode()); - Print(" free_node_pointer = %Ld\n", header->FreeNode()); - Print(" maximum_size = %Lu\n", header->MaximumSize()); + kprintf(" data_type = %u\n", (unsigned)header->DataType()); + kprintf(" root_node_pointer = %Ld\n", header->RootNode()); + kprintf(" free_node_pointer = %Ld\n", header->FreeNode()); + kprintf(" maximum_size = %Lu\n", header->MaximumSize()); } @@ -165,27 +163,27 @@ for (; i < start + DUMPED_BLOCK_SIZE; i++) { if (!(i % 4)) - Print(" "); + kprintf(" "); if (i >= size) - Print(" "); + kprintf(" "); else - Print("%02x", *(unsigned char *)(buffer + i)); + kprintf("%02x", *(unsigned char *)(buffer + i)); } - Print(" "); + kprintf(" "); for (i = start; i < start + DUMPED_BLOCK_SIZE; i++) { if (i < size) { char c = *(buffer + i); if (c < 30) - Print("."); + kprintf("."); else - Print("%c", c); + kprintf("%c", c); } else break; } - Print("\n"); + kprintf("\n"); } } @@ -194,12 +192,12 @@ dump_bplustree_node(const bplustree_node* node, const bplustree_header* header, Volume* volume) { - Print("bplustree_node:\n"); - Print(" left_link = %Ld\n", node->left_link); - Print(" right_link = %Ld\n", node->right_link); - Print(" overflow_link = %Ld\n", node->overflow_link); - Print(" all_key_count = %u\n", node->all_key_count); - Print(" all_key_length = %u\n", node->all_key_length); + kprintf("bplustree_node:\n"); + kprintf(" left_link = %Ld\n", node->left_link); + kprintf(" right_link = %Ld\n", node->right_link); + kprintf(" overflow_link = %Ld\n", node->overflow_link); + kprintf(" all_key_count = %u\n", node->all_key_count); + kprintf(" all_key_length = %u\n", node->all_key_length); if (header == NULL) return; @@ -207,17 +205,17 @@ if (node->all_key_count > node->all_key_length || uint32(node->all_key_count * 10) > (uint32)header->node_size || node->all_key_count == 0) { - Print("\n"); + kprintf("\n"); dump_block((char *)node, header->node_size/*, sizeof(off_t)*/); return; } - Print("\n"); + kprintf("\n"); for (int32 i = 0;i < node->all_key_count;i++) { uint16 length; char buffer[256], *key = (char *)node->KeyAt(i, &length); if (length > 255 || length == 0) { - Print(" %2d. Invalid length (%u)!!\n", (int)i, length); + kprintf(" %2d. Invalid length (%u)!!\n", (int)i, length); dump_block((char *)node, header->node_size/*, sizeof(off_t)*/); break; } @@ -227,37 +225,37 @@ off_t* value = node->Values() + i; if ((addr_t)value < (addr_t)node || (addr_t)value > (addr_t)node + header->node_size) - Print(" %2d. Invalid Offset!!\n", (int)i); + kprintf(" %2d. Invalid Offset!!\n", (int)i); else { - Print(" %2d. ", (int)i); + kprintf(" %2d. ", (int)i); if (header->data_type == BPLUSTREE_STRING_TYPE) - Print("\"%s\"", buffer); + kprintf("\"%s\"", buffer); else if (header->data_type == BPLUSTREE_INT32_TYPE) { - Print("int32 = %d (0x%x)", (int)*(int32 *)&buffer, + kprintf("int32 = %d (0x%x)", (int)*(int32 *)&buffer, (int)*(int32 *)&buffer); } else if (header->data_type == BPLUSTREE_UINT32_TYPE) { - Print("uint32 = %u (0x%x)", (unsigned)*(uint32 *)&buffer, + kprintf("uint32 = %u (0x%x)", (unsigned)*(uint32 *)&buffer, (unsigned)*(uint32 *)&buffer); } else if (header->data_type == BPLUSTREE_INT64_TYPE) { - Print("int64 = %Ld (0x%Lx)", *(int64 *)&buffer, + kprintf("int64 = %Ld (0x%Lx)", *(int64 *)&buffer, *(int64 *)&buffer); } else - Print("???"); + kprintf("???"); off_t offset = *value & 0x3fffffffffffffffLL; - Print(" (%d bytes) -> %Ld", length, offset); + kprintf(" (%d bytes) -> %Ld", length, offset); if (volume != NULL) { block_run run = volume->ToBlockRun(offset); - Print(" (%d, %d)", (int)run.allocation_group, run.start); + kprintf(" (%d, %d)", (int)run.allocation_group, run.start); } if (bplustree_node::LinkType(*value) == BPLUSTREE_DUPLICATE_FRAGMENT) - Print(" (duplicate fragment %Ld)\n", *value & 0x3ff); + kprintf(" (duplicate fragment %Ld)\n", *value & 0x3ff); else if (bplustree_node::LinkType(*value) == BPLUSTREE_DUPLICATE_NODE) - Print(" (duplicate node)\n"); + kprintf(" (duplicate node)\n"); else - Print("\n"); + kprintf("\n"); } } } From kirilla at mail.berlios.de Sun May 3 22:26:33 2009 From: kirilla at mail.berlios.de (kirilla at BerliOS) Date: Sun, 3 May 2009 22:26:33 +0200 Subject: [Haiku-commits] r30615 - haiku/trunk/src/data/beos_mime/audio Message-ID: <200905032026.n43KQXhN024888@sheep.berlios.de> Author: kirilla Date: 2009-05-03 22:26:33 +0200 (Sun, 03 May 2009) New Revision: 30615 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30615&view=rev Modified: haiku/trunk/src/data/beos_mime/audio/ac3 haiku/trunk/src/data/beos_mime/audio/basic haiku/trunk/src/data/beos_mime/audio/mp4 haiku/trunk/src/data/beos_mime/audio/mpeg haiku/trunk/src/data/beos_mime/audio/x-aiff haiku/trunk/src/data/beos_mime/audio/x-ape haiku/trunk/src/data/beos_mime/audio/x-flac haiku/trunk/src/data/beos_mime/audio/x-matroska haiku/trunk/src/data/beos_mime/audio/x-mdx haiku/trunk/src/data/beos_mime/audio/x-musepack haiku/trunk/src/data/beos_mime/audio/x-wav Log: MediaPlayer is set as the Preferred Application of the audio supertype. The subtype inherits the Preferred Application setting of its supertype and need not set a preferred application, unless another application is truly preferred. E.g. the MidiPlayer for midi files. Modified: haiku/trunk/src/data/beos_mime/audio/ac3 =================================================================== --- haiku/trunk/src/data/beos_mime/audio/ac3 2009-05-03 17:56:08 UTC (rev 30614) +++ haiku/trunk/src/data/beos_mime/audio/ac3 2009-05-03 20:26:33 UTC (rev 30615) @@ -5,9 +5,7 @@ resource(2, "META:S:DESC") #'MSDC' "AC3 Sound File"; -resource(3, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-MediaPlayer"; - -resource(4, "META:EXTENS") message(234) { +resource(3, "META:EXTENS") message(234) { "extensions" = "ac3", "type" = "audio/ac3" }; Modified: haiku/trunk/src/data/beos_mime/audio/basic =================================================================== --- haiku/trunk/src/data/beos_mime/audio/basic 2009-05-03 17:56:08 UTC (rev 30614) +++ haiku/trunk/src/data/beos_mime/audio/basic 2009-05-03 20:26:33 UTC (rev 30615) @@ -5,12 +5,10 @@ resource(2, "META:S:DESC") #'MSDC' "Sun Sound File"; -resource(3, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-MediaPlayer"; - -resource(4, "META:EXTENS") message(234) { +resource(3, "META:EXTENS") message(234) { "extensions" = "au", "extensions" = "snd", "type" = "audio/basic" }; -resource(5, "META:SNIFF_RULE") "0.50 (\".snd\")"; +resource(4, "META:SNIFF_RULE") "0.50 (\".snd\")"; Modified: haiku/trunk/src/data/beos_mime/audio/mp4 =================================================================== --- haiku/trunk/src/data/beos_mime/audio/mp4 2009-05-03 17:56:08 UTC (rev 30614) +++ haiku/trunk/src/data/beos_mime/audio/mp4 2009-05-03 20:26:33 UTC (rev 30615) @@ -5,9 +5,7 @@ resource(2, "META:S:DESC") #'MSDC' "MP4 Sound File"; -resource(3, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-MediaPlayer"; - -resource(4, "META:EXTENS") message(234) { +resource(3, "META:EXTENS") message(234) { "extensions" = "m4a", "type" = "audio/mp4" }; Modified: haiku/trunk/src/data/beos_mime/audio/mpeg =================================================================== --- haiku/trunk/src/data/beos_mime/audio/mpeg 2009-05-03 17:56:08 UTC (rev 30614) +++ haiku/trunk/src/data/beos_mime/audio/mpeg 2009-05-03 20:26:33 UTC (rev 30615) @@ -7,9 +7,7 @@ resource(4, "META:S:DESC") #'MSDC' "MPEG audio file"; -resource(5, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-MediaPlayer"; - -resource(6, "META:EXTENS") message(234) { +resource(5, "META:EXTENS") message(234) { "extensions" = "mp2", "extensions" = "MP2", "extensions" = "mp3", Modified: haiku/trunk/src/data/beos_mime/audio/x-aiff =================================================================== --- haiku/trunk/src/data/beos_mime/audio/x-aiff 2009-05-03 17:56:08 UTC (rev 30614) +++ haiku/trunk/src/data/beos_mime/audio/x-aiff 2009-05-03 20:26:33 UTC (rev 30615) @@ -5,9 +5,7 @@ resource(2, "META:S:DESC") #'MSDC' "AIFF Sound File"; -resource(3, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-MediaPlayer"; - -resource(4, "META:EXTENS") message(234) { +resource(3, "META:EXTENS") message(234) { "extensions" = "aif", "extensions" = "aiff", "extensions" = "aifc", Modified: haiku/trunk/src/data/beos_mime/audio/x-ape =================================================================== --- haiku/trunk/src/data/beos_mime/audio/x-ape 2009-05-03 17:56:08 UTC (rev 30614) +++ haiku/trunk/src/data/beos_mime/audio/x-ape 2009-05-03 20:26:33 UTC (rev 30615) @@ -7,9 +7,7 @@ resource(3, "META:L:DESC") #'MLDC' "Lossless Compressed APE (Monkey's Audio) Sound File"; -resource(4, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-MediaPlayer"; - -resource(5, "META:EXTENS") message(234) { +resource(4, "META:EXTENS") message(234) { "extensions" = "ape", "type" = "audio/x-ape" }; Modified: haiku/trunk/src/data/beos_mime/audio/x-flac =================================================================== --- haiku/trunk/src/data/beos_mime/audio/x-flac 2009-05-03 17:56:08 UTC (rev 30614) +++ haiku/trunk/src/data/beos_mime/audio/x-flac 2009-05-03 20:26:33 UTC (rev 30615) @@ -5,9 +5,7 @@ resource(2, "META:S:DESC") #'MSDC' "FLAC Sound File"; -resource(3, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-MediaPlayer"; - -resource(4, "META:EXTENS") message(234) { +resource(3, "META:EXTENS") message(234) { "extensions" = "fla", "extensions" = "flac", "type" = "audio/x-flac" Modified: haiku/trunk/src/data/beos_mime/audio/x-matroska =================================================================== --- haiku/trunk/src/data/beos_mime/audio/x-matroska 2009-05-03 17:56:08 UTC (rev 30614) +++ haiku/trunk/src/data/beos_mime/audio/x-matroska 2009-05-03 20:26:33 UTC (rev 30615) @@ -8,9 +8,7 @@ resource(3, "META:S:DESC") #'MSDC' "Matroska Audio"; -resource(4, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-MediaPlayer"; - -resource(5, "META:EXTENS") message(234) { +resource(4, "META:EXTENS") message(234) { "extensions" = "mka", "type" = "audio/x-matroska" }; Modified: haiku/trunk/src/data/beos_mime/audio/x-mdx =================================================================== --- haiku/trunk/src/data/beos_mime/audio/x-mdx 2009-05-03 17:56:08 UTC (rev 30614) +++ haiku/trunk/src/data/beos_mime/audio/x-mdx 2009-05-03 20:26:33 UTC (rev 30615) @@ -7,9 +7,7 @@ resource(3, "META:L:DESC") #'MLDC' "SHARP X68000 MDX (Music Data for mXdrv) Sound File"; -resource(4, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-MediaPlayer"; - -resource(5, "META:EXTENS") message(234) { +resource(4, "META:EXTENS") message(234) { "extensions" = "mdx", "type" = "audio/x-mdx" }; Modified: haiku/trunk/src/data/beos_mime/audio/x-musepack =================================================================== --- haiku/trunk/src/data/beos_mime/audio/x-musepack 2009-05-03 17:56:08 UTC (rev 30614) +++ haiku/trunk/src/data/beos_mime/audio/x-musepack 2009-05-03 20:26:33 UTC (rev 30615) @@ -5,9 +5,7 @@ resource(2, "META:S:DESC") #'MSDC' "Musepack Sound File"; -resource(3, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-MediaPlayer"; - -resource(4, "META:EXTENS") message(234) { +resource(3, "META:EXTENS") message(234) { "extensions" = "mpc", "extensions" = "mpp", "extensions" = "mp+", Modified: haiku/trunk/src/data/beos_mime/audio/x-wav =================================================================== --- haiku/trunk/src/data/beos_mime/audio/x-wav 2009-05-03 17:56:08 UTC (rev 30614) +++ haiku/trunk/src/data/beos_mime/audio/x-wav 2009-05-03 20:26:33 UTC (rev 30615) @@ -5,9 +5,7 @@ resource(2, "META:S:DESC") #'MSDC' "WAVE Sound File"; -resource(3, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-MediaPlayer"; - -resource(4, "META:EXTENS") message(234) { +resource(3, "META:EXTENS") message(234) { "extensions" = "wav", "type" = "audio/x-wav" }; From axeld at mail.berlios.de Sun May 3 22:29:50 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sun, 3 May 2009 22:29:50 +0200 Subject: [Haiku-commits] r30616 - haiku/trunk/src/add-ons/kernel/file_systems/bfs Message-ID: <200905032029.n43KToUX025093@sheep.berlios.de> Author: axeld Date: 2009-05-03 22:29:50 +0200 (Sun, 03 May 2009) New Revision: 30616 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30616&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp Log: * Fixed two bugs in BPlusTree::Remove(): it could update the tree iterators incorrectly in case of duplicates. And also, more importantly, it did not check if the entry to remove had the same value -- it would happily remove any entry with the same attribute content. This could only happen in the reindex case, though, and was the cause of bug #3854. * Minor cleanup. Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp 2009-05-03 20:26:33 UTC (rev 30615) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp 2009-05-03 20:29:50 UTC (rev 30616) @@ -1,5 +1,5 @@ /* - * Copyright 2001-2008, Axel D?rfler, axeld at pinc-software.de. + * Copyright 2001-2009, Axel D?rfler, axeld at pinc-software.de. * This file may be used under the terms of the MIT License. * * Roughly based on 'btlib' written by Marcus J. Ranum - it shares @@ -899,7 +899,7 @@ bplustree_node* newDuplicate; status = cachedDuplicate.Allocate(transaction, &newDuplicate, &offset); - if (status < B_OK) + if (status != B_OK) RETURN_ERROR(status); // link the two nodes together @@ -921,8 +921,8 @@ if (_FindFreeDuplicateFragment(transaction, node, cachedDuplicate, &offset, &fragment, &fragmentIndex) != B_OK) { // allocate a new duplicate fragment node - if ((status = cachedDuplicate.Allocate(transaction, &fragment, - &offset)) < B_OK) + status = cachedDuplicate.Allocate(transaction, &fragment, &offset); + if (status != B_OK) RETURN_ERROR(status); memset(fragment, 0, fNodeSize); @@ -1692,19 +1692,10 @@ // first round, check for duplicate entries status_t status = _FindKey(node, key, keyLength, &nodeAndKey.keyIndex); - if (status < B_OK) + if (status != B_OK) RETURN_ERROR(status); - // If we will remove the last key, the iterator will be set - // to the next node after the current - if there aren't any - // more nodes, we need a way to prevent the TreeIterators to - // touch the old node again, we use BPLUSTREE_FREE for this - off_t next = node->RightLink() == BPLUSTREE_NULL - ? BPLUSTREE_FREE : node->RightLink(); - _UpdateIterators(nodeAndKey.nodeOffset, node->NumKeys() == 1 - ? next : BPLUSTREE_NULL, nodeAndKey.keyIndex, 0 , -1); - - // is this a duplicate entry? + // Is this a duplicate entry? if (bplustree_node::IsDuplicate(BFS_ENDIAN_TO_HOST_INT64( node->Values()[nodeAndKey.keyIndex]))) { if (fAllowDuplicates) { @@ -1715,6 +1706,18 @@ FATAL(("dupliate node found where no duplicates are " "allowed!\n")); RETURN_ERROR(B_ERROR); + } else { + if (node->Values()[nodeAndKey.keyIndex] != value) + return B_ENTRY_NOT_FOUND; + + // If we will remove the last key, the iterator will be set + // to the next node after the current - if there aren't any + // more nodes, we need a way to prevent the TreeIterators to + // touch the old node again, we use BPLUSTREE_FREE for this + off_t next = node->RightLink() == BPLUSTREE_NULL + ? BPLUSTREE_FREE : node->RightLink(); + _UpdateIterators(nodeAndKey.nodeOffset, node->NumKeys() == 1 + ? next : BPLUSTREE_NULL, nodeAndKey.keyIndex, 0 , -1); } } From kirilla at mail.berlios.de Sun May 3 22:33:53 2009 From: kirilla at mail.berlios.de (kirilla at BerliOS) Date: Sun, 3 May 2009 22:33:53 +0200 Subject: [Haiku-commits] r30617 - haiku/trunk/src/data/beos_mime/video Message-ID: <200905032033.n43KXrJ3025435@sheep.berlios.de> Author: kirilla Date: 2009-05-03 22:33:52 +0200 (Sun, 03 May 2009) New Revision: 30617 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30617&view=rev Modified: haiku/trunk/src/data/beos_mime/video/mp4 haiku/trunk/src/data/beos_mime/video/mpeg haiku/trunk/src/data/beos_mime/video/quicktime haiku/trunk/src/data/beos_mime/video/x-matroska haiku/trunk/src/data/beos_mime/video/x-ms-asf haiku/trunk/src/data/beos_mime/video/x-msvideo Log: Subtypes inherit the Preferred Application setting of their supertype and need not set one unless they want or need a separate one. Modified: haiku/trunk/src/data/beos_mime/video/mp4 =================================================================== --- haiku/trunk/src/data/beos_mime/video/mp4 2009-05-03 20:29:50 UTC (rev 30616) +++ haiku/trunk/src/data/beos_mime/video/mp4 2009-05-03 20:33:52 UTC (rev 30617) @@ -11,4 +11,3 @@ "type" = "video/mp4" }; -resource(4, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-MediaPlayer"; Modified: haiku/trunk/src/data/beos_mime/video/mpeg =================================================================== --- haiku/trunk/src/data/beos_mime/video/mpeg 2009-05-03 20:29:50 UTC (rev 30616) +++ haiku/trunk/src/data/beos_mime/video/mpeg 2009-05-03 20:33:52 UTC (rev 30617) @@ -7,4 +7,3 @@ resource(3, "META:S:DESC") #'MSDC' "MPEG Movie"; -resource(6, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-MediaPlayer"; Modified: haiku/trunk/src/data/beos_mime/video/quicktime =================================================================== --- haiku/trunk/src/data/beos_mime/video/quicktime 2009-05-03 20:29:50 UTC (rev 30616) +++ haiku/trunk/src/data/beos_mime/video/quicktime 2009-05-03 20:33:52 UTC (rev 30617) @@ -13,4 +13,3 @@ "type" = "video/quicktime" }; -resource(5, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-MediaPlayer"; Modified: haiku/trunk/src/data/beos_mime/video/x-matroska =================================================================== --- haiku/trunk/src/data/beos_mime/video/x-matroska 2009-05-03 20:29:50 UTC (rev 30616) +++ haiku/trunk/src/data/beos_mime/video/x-matroska 2009-05-03 20:33:52 UTC (rev 30617) @@ -8,9 +8,7 @@ resource(3, "META:S:DESC") #'MSDC' "Matroska Video"; -resource(4, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-MediaPlayer"; - -resource(5, "META:EXTENS") message(234) { +resource(4, "META:EXTENS") message(234) { "extensions" = "mkv", "type" = "video/x-matroska" }; Modified: haiku/trunk/src/data/beos_mime/video/x-ms-asf =================================================================== --- haiku/trunk/src/data/beos_mime/video/x-ms-asf 2009-05-03 20:29:50 UTC (rev 30616) +++ haiku/trunk/src/data/beos_mime/video/x-ms-asf 2009-05-03 20:33:52 UTC (rev 30617) @@ -12,4 +12,3 @@ "type" = "video/x-ms-asf" }; -resource(5, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-MediaPlayer"; Modified: haiku/trunk/src/data/beos_mime/video/x-msvideo =================================================================== --- haiku/trunk/src/data/beos_mime/video/x-msvideo 2009-05-03 20:29:50 UTC (rev 30616) +++ haiku/trunk/src/data/beos_mime/video/x-msvideo 2009-05-03 20:33:52 UTC (rev 30617) @@ -7,9 +7,7 @@ resource(3, "META:S:DESC") #'MSDC' "AVI Movie"; -resource(4, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-MediaPlayer"; - -resource(5, "META:EXTENS") message(234) { +resource(4, "META:EXTENS") message(234) { "extensions" = "avi", "type" = "video/x-msvideo" }; From kirilla at mail.berlios.de Sun May 3 23:28:39 2009 From: kirilla at mail.berlios.de (kirilla at BerliOS) Date: Sun, 3 May 2009 23:28:39 +0200 Subject: [Haiku-commits] r30618 - haiku/trunk/src/data/beos_mime/application Message-ID: <200905032128.n43LSdu8001887@sheep.berlios.de> Author: kirilla Date: 2009-05-03 23:28:39 +0200 (Sun, 03 May 2009) New Revision: 30618 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30618&view=rev Modified: haiku/trunk/src/data/beos_mime/application/x-vnd.be-bookmark Log: Making urlwrapper the preferred application of NetPositive Bookmarks. They will be with us for some time - many application zip files include them - but NetPositive itself can't make it into Haiku. It's wrong to have a non-present application set as preferred. Sadly, changing this filetype's setting means little in practice, as the preferred application -attribute- is set on every bookmark file. Two solutions exist to make bookmarks work seamlessly/effortlessly: A) urlwrapper adopts NetPositive's app signature, or B) a N+ Bookmark opener binary reusing its app signature is created, existing only to pass on bookmarks to urlwrapper. Modified: haiku/trunk/src/data/beos_mime/application/x-vnd.be-bookmark =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-vnd.be-bookmark 2009-05-03 20:33:52 UTC (rev 30617) +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be-bookmark 2009-05-03 21:28:39 UTC (rev 30618) @@ -7,7 +7,7 @@ resource(3, "META:L:DESC") #'MLDC' "Bookmark for a web page"; -resource(4, "META:PREF_APP") #'MSIG' "application/x-vnd.Be-NPOS"; +resource(4, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-urlwrapper"; resource(5, "META:ICON") #'VICN' array { $"6E63696608010100006B02001602BA6666BB33323B3332BA6666480CCD4BD333" From revol at free.fr Sun May 3 23:58:26 2009 From: revol at free.fr (=?utf-8?q?Fran=C3=A7ois?= Revol) Date: Sun, 03 May 2009 23:58:26 +0200 CEST Subject: [Haiku-commits] r30618 - haiku/trunk/src/data/beos_mime/application In-Reply-To: <200905032128.n43LSdu8001887@sheep.berlios.de> Message-ID: <1069448077-BeMail@laptop> > Author: kirilla > Date: 2009-05-03 23:28:39 +0200 (Sun, 03 May 2009) > New Revision: 30618 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30618&view=rev > > Modified: > haiku/trunk/src/data/beos_mime/application/x-vnd.be-bookmark > Log: > Making urlwrapper the preferred application of NetPositive Bookmarks. > They If the specified preferred app isn't found it should fall back to the preferred app for the type anyway, right ? Fran?ois. From kirilla at mail.berlios.de Mon May 4 00:12:36 2009 From: kirilla at mail.berlios.de (kirilla at BerliOS) Date: Mon, 4 May 2009 00:12:36 +0200 Subject: [Haiku-commits] r30619 - in haiku/trunk/headers/os: arch arch/mipsel kernel Message-ID: <200905032212.n43MCanp004815@sheep.berlios.de> Author: kirilla Date: 2009-05-04 00:12:35 +0200 (Mon, 04 May 2009) New Revision: 30619 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30619&view=rev Added: haiku/trunk/headers/os/arch/mipsel/ haiku/trunk/headers/os/arch/mipsel/arch_debugger.h Modified: haiku/trunk/headers/os/kernel/OS.h haiku/trunk/headers/os/kernel/debugger.h Log: Staking out some mipsel ground. Added: haiku/trunk/headers/os/arch/mipsel/arch_debugger.h =================================================================== --- haiku/trunk/headers/os/arch/mipsel/arch_debugger.h 2009-05-03 21:28:39 UTC (rev 30618) +++ haiku/trunk/headers/os/arch/mipsel/arch_debugger.h 2009-05-03 22:12:35 UTC (rev 30619) @@ -0,0 +1,13 @@ +/* + * Copyright 2009, Haiku Inc. + * Distributed under the terms of the MIT License. + */ +#ifndef _ARCH_MIPSEL_DEBUGGER_H +#define _ARCH_MIPSEL_DEBUGGER_H + +#warning MIPSEL: fixme +struct debug_cpu_state { + uint32 dummy; +} __attribute__((aligned(8))); + +#endif // _ARCH_MIPSEL_DEBUGGER_H Modified: haiku/trunk/headers/os/kernel/OS.h =================================================================== --- haiku/trunk/headers/os/kernel/OS.h 2009-05-03 21:28:39 UTC (rev 30618) +++ haiku/trunk/headers/os/kernel/OS.h 2009-05-03 22:12:35 UTC (rev 30619) @@ -402,6 +402,8 @@ # define B_MAX_CPU_COUNT 1 #elif __ARM__ # define B_MAX_CPU_COUNT 1 +#elif __MIPSEL__ +# define B_MAX_CPU_COUNT 1 #else # warning Unknown cpu # define B_MAX_CPU_COUNT 1 Modified: haiku/trunk/headers/os/kernel/debugger.h =================================================================== --- haiku/trunk/headers/os/kernel/debugger.h 2009-05-03 21:28:39 UTC (rev 30618) +++ haiku/trunk/headers/os/kernel/debugger.h 2009-05-03 22:12:35 UTC (rev 30619) @@ -17,6 +17,8 @@ #include #elif __M68K__ #include +#elif __MIPSEL__ + #include #else #error you need to write a /arch_debugger.h> #endif From jonas at kirilla.com Mon May 4 00:16:56 2009 From: jonas at kirilla.com (Jonas =?iso-8859-1?q?Sundstr=F6m?=) Date: Mon, 04 May 2009 00:16:56 +0200 CEST Subject: [Haiku-commits] r30618 - haiku/trunk/src/data/beos_mime/application In-Reply-To: <1069448077-BeMail@laptop> Message-ID: <1444880021-BeMail@kirilla> "Fran?ois Revol" wrote: > > Author: kirilla > > Date: 2009-05-03 23:28:39 +0200 (Sun, 03 May 2009) > > New Revision: 30618 > > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30618&view=rev > > > > Modified: > > haiku/trunk/src/data/beos_mime/application/x-vnd.be-bookmark > > Log: > > Making urlwrapper the preferred application of NetPositive > > Bookmarks. > > They > > If the specified preferred app isn't found it > should fall back to the preferred app for the > type anyway, right ? I have no idea. That would seem like a good thing. If it doesn?t work that way now, we can make it so. /Jonas. From kirilla at mail.berlios.de Mon May 4 00:26:24 2009 From: kirilla at mail.berlios.de (kirilla at BerliOS) Date: Mon, 4 May 2009 00:26:24 +0200 Subject: [Haiku-commits] r30620 - haiku/trunk/src/system/glue/arch/mipsel Message-ID: <200905032226.n43MQOgl005620@sheep.berlios.de> Author: kirilla Date: 2009-05-04 00:26:23 +0200 (Mon, 04 May 2009) New Revision: 30620 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30620&view=rev Added: haiku/trunk/src/system/glue/arch/mipsel/Jamfile haiku/trunk/src/system/glue/arch/mipsel/crti.S haiku/trunk/src/system/glue/arch/mipsel/crtn.S Log: Staking out some more mipsel ground. Added: haiku/trunk/src/system/glue/arch/mipsel/Jamfile =================================================================== --- haiku/trunk/src/system/glue/arch/mipsel/Jamfile 2009-05-03 22:12:35 UTC (rev 30619) +++ haiku/trunk/src/system/glue/arch/mipsel/Jamfile 2009-05-03 22:26:23 UTC (rev 30620) @@ -0,0 +1,7 @@ +SubDir HAIKU_TOP src system glue arch mipsel ; + +KernelObjects + crti.S + crtn.S + ; + Added: haiku/trunk/src/system/glue/arch/mipsel/crti.S =================================================================== --- haiku/trunk/src/system/glue/arch/mipsel/crti.S 2009-05-03 22:12:35 UTC (rev 30619) +++ haiku/trunk/src/system/glue/arch/mipsel/crti.S 2009-05-03 22:26:23 UTC (rev 30620) @@ -0,0 +1,42 @@ +/* + * Copyright 2009, Axel D?rfler, axeld at pinc-software.de. + * Distributed under the terms of the MIT License. + * + * Authors: + * Axel D?rfler, axeld at pinc-software.de + * Jonas Sundstr?m, jonas at kirilla.se + */ + +/** This file contains the first part of the ".init" and ".fini" sections in + * the ELF executable. + * The functions defined here will be called during initialization/termination + * of the loaded executable/library. The ".init" and ".fini" sections are + * stacked together like this: + * + * crti.S entry point + * call to _init_before/_term_before + * crtbegin.S GCC specific: constructors/destructors are called, ... + * crtend.S + * crtn.S call to _init_after/_term_after + * exit + */ + +#define FUNCTION(x) .global x; .type x, at function; x + +#warning MIPSEL: fixme + +.section .init +FUNCTION(_init): + .set noreorder + jal _init_before + nop + .set reorder + // crtbegin.o stuff comes here + +.section .fini +FUNCTION(_fini): + .set noreorder + jal _term_before + nop + .set reorder + // crtbegin.o stuff comes here Added: haiku/trunk/src/system/glue/arch/mipsel/crtn.S =================================================================== --- haiku/trunk/src/system/glue/arch/mipsel/crtn.S 2009-05-03 22:12:35 UTC (rev 30619) +++ haiku/trunk/src/system/glue/arch/mipsel/crtn.S 2009-05-03 22:26:23 UTC (rev 30620) @@ -0,0 +1,29 @@ +/* + * Copyright 2009, Axel D?rfler, axeld at pinc-software.de. + * Distributed under the terms of the MIT License. + * + * Authors: + * Axel D?rfler, axeld at pinc-software.de + * Jonas Sundstr?m, jonas at kirilla.se + */ + +/** This file contains the final part of the ".init" and ".fini" sections in + * the ELF executable. It is tightly connected to crti.S. + * Have a look at crti.S to find a description of what happens here. + */ + +#warning MIPSEL: fixme + +.section .init + // the image ID and program args are still on the stack + .set noreorder + jal _init_after + nop + .set reorder + +.section .fini + // the image ID and program args are still on the stack + .set noreorder + jal _term_after + nop + .set reorder From korli at users.berlios.de Mon May 4 00:40:37 2009 From: korli at users.berlios.de (=?ISO-8859-1?B?Suly9G1lIER1dmFs?=) Date: Mon, 4 May 2009 00:40:37 +0200 Subject: [Haiku-commits] r30374 - haiku/trunk/src/apps/terminal In-Reply-To: <9273808639-BeMail@zon> References: <20090424162638.1377.2@bepc.1240578914.fake> <9273808639-BeMail@zon> Message-ID: On behalf of Olivier (not present on this list): Hi, J?r?me forward me this discussion. I am not yet on this mailling list (and no time to register right now). May I propose to give Oliver commit access? :-) Olivier, do you want some? Bye, Axel. Thank you for the offer, but i think it is a little too early right now. This is only my first "large" patch (all others were only 3 lines of codes). I am not yet familliar enough with all the coding guidelines. I think it would be safer to wait a few more large patchs. Bye, Olivier From kirilla at mail.berlios.de Mon May 4 00:41:49 2009 From: kirilla at mail.berlios.de (kirilla at BerliOS) Date: Mon, 4 May 2009 00:41:49 +0200 Subject: [Haiku-commits] r30621 - in haiku/trunk/src/system: boot/arch/mipsel libroot/os/arch/mipsel libroot/posix/arch/mipsel Message-ID: <200905032241.n43Mfn2d013467@sheep.berlios.de> Author: kirilla Date: 2009-05-04 00:41:38 +0200 (Mon, 04 May 2009) New Revision: 30621 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30621&view=rev Added: haiku/trunk/src/system/boot/arch/mipsel/Jamfile haiku/trunk/src/system/libroot/os/arch/mipsel/Jamfile haiku/trunk/src/system/libroot/os/arch/mipsel/atomic.S haiku/trunk/src/system/libroot/os/arch/mipsel/byteorder.S haiku/trunk/src/system/libroot/os/arch/mipsel/compatibility.c haiku/trunk/src/system/libroot/os/arch/mipsel/stack_frame.c haiku/trunk/src/system/libroot/os/arch/mipsel/syscalls.inc haiku/trunk/src/system/libroot/os/arch/mipsel/system_time.c haiku/trunk/src/system/libroot/os/arch/mipsel/system_time_asm.S haiku/trunk/src/system/libroot/os/arch/mipsel/thread.c haiku/trunk/src/system/libroot/os/arch/mipsel/time.c haiku/trunk/src/system/libroot/os/arch/mipsel/tls.c haiku/trunk/src/system/libroot/posix/arch/mipsel/Jamfile haiku/trunk/src/system/libroot/posix/arch/mipsel/setjmp_internal.h haiku/trunk/src/system/libroot/posix/arch/mipsel/siglongjmp.S haiku/trunk/src/system/libroot/posix/arch/mipsel/sigsetjmp.S Log: More mipsel Added: haiku/trunk/src/system/boot/arch/mipsel/Jamfile =================================================================== --- haiku/trunk/src/system/boot/arch/mipsel/Jamfile 2009-05-03 22:26:23 UTC (rev 30620) +++ haiku/trunk/src/system/boot/arch/mipsel/Jamfile 2009-05-03 22:41:38 UTC (rev 30621) @@ -0,0 +1,21 @@ +SubDir HAIKU_TOP src system boot arch mipsel ; + +DEFINES += _BOOT_MODE ; + +local kernelLibArchObjects = + byteorder.o + memcpy.o + memset.o +; + +KernelMergeObject boot_arch_$(TARGET_ARCH).o : + arch_elf.cpp + : # additional flags + : + $(kernelArchObjects) + $(kernelLibArchObjects) +; + +SEARCH on [ FGristFiles arch_elf.cpp ] + = [ FDirName $(HAIKU_TOP) src system kernel arch $(TARGET_ARCH) ] ; + Added: haiku/trunk/src/system/libroot/os/arch/mipsel/Jamfile =================================================================== --- haiku/trunk/src/system/libroot/os/arch/mipsel/Jamfile 2009-05-03 22:26:23 UTC (rev 30620) +++ haiku/trunk/src/system/libroot/os/arch/mipsel/Jamfile 2009-05-03 22:41:38 UTC (rev 30621) @@ -0,0 +1,20 @@ +SubDir HAIKU_TOP src system libroot os arch mipsel ; + +UsePrivateKernelHeaders ; + # TODO: Replace by "UsePrivateHeaders libroot" after resolving the TODO in + # time.c! +UsePrivateSystemHeaders ; + +MergeObject os_arch_$(TARGET_ARCH).o : + atomic.S + byteorder.S + compatibility.c # only here until the places where those functions are used + # are fixed + stack_frame.c +# systeminfo.c + system_time.c + system_time_asm.S + thread.c + time.c + tls.c +; Added: haiku/trunk/src/system/libroot/os/arch/mipsel/atomic.S =================================================================== --- haiku/trunk/src/system/libroot/os/arch/mipsel/atomic.S 2009-05-03 22:26:23 UTC (rev 30620) +++ haiku/trunk/src/system/libroot/os/arch/mipsel/atomic.S 2009-05-03 22:41:38 UTC (rev 30621) @@ -0,0 +1,46 @@ +/* + * Copyright 2003-2009, Axel D?rfler, axeld at pinc-software.de. + * Distributed under the terms of the MIT License. + */ + +#define FUNCTION(x) .global x; .type x, at function; x + +#warning MIPSEL: fixme + +.text + +/* int atomic_add(int *value, int increment) + * (r3) r3 r4 + */ +FUNCTION(atomic_add): +lost1: jr $ra + +/* int atomic_and(int *value, int andValue) + * (r3) r3 r4 + */ +FUNCTION(atomic_and): +lost2: jr $ra + +/* int atomic_or(int *value, int orValue) + * (r3) r3 r4 + */ +FUNCTION(atomic_or): +lost3: jr $ra + +/* int atomic_set(int *value, int setTo) + * (r3) r3 r4 + */ +FUNCTION(atomic_set): +lost4: jr $ra + +/* int atomic_test_and_set(int *value, int setTo, int testValue) + * (r3) r3 r4 r5 + */ +FUNCTION(atomic_test_and_set): +lost5: jr $ra + +/* int atomic_get(int *value) + * (r3) r3 + */ +FUNCTION(atomic_get): +lost6: jr $ra Added: haiku/trunk/src/system/libroot/os/arch/mipsel/byteorder.S =================================================================== --- haiku/trunk/src/system/libroot/os/arch/mipsel/byteorder.S 2009-05-03 22:26:23 UTC (rev 30620) +++ haiku/trunk/src/system/libroot/os/arch/mipsel/byteorder.S 2009-05-03 22:41:38 UTC (rev 30621) @@ -0,0 +1,49 @@ +/* + * Copyright 2003, Axel D??rfler, axeld at pinc-software.de. All rights reserved. + * Distributed under the terms of the OpenBeOS License. + */ + +#define FUNCTION(x) .global x; .type x, at function; x + +#warning MIPSEL: fixme + +.text + +/* uint16 __swap_int16(uint16 value) + * r3 + */ +FUNCTION(__swap_int16): + jr $ra + + +/* uint32 __swap_int32(uint32 value) + * r3 + */ +FUNCTION(__swap_int32): + jr $ra + + +/* uint64 __swap_int64(uint64 value) + * r3/r4 + */ +FUNCTION(__swap_int64): + jr $ra + + +/* TODO: The following functions can surely be optimized. A simple optimization + * would be to define macros with the contents of the __swap_int{32,64} + * functions and use those instead of calling the functions. + */ + +/* float __swap_float(float value) + * f1 + */ +FUNCTION(__swap_float): + jr $ra + +/* double __swap_double(double value) + * f1 + */ +FUNCTION(__swap_double): + jr $ra + Added: haiku/trunk/src/system/libroot/os/arch/mipsel/compatibility.c =================================================================== --- haiku/trunk/src/system/libroot/os/arch/mipsel/compatibility.c 2009-05-03 22:26:23 UTC (rev 30620) +++ haiku/trunk/src/system/libroot/os/arch/mipsel/compatibility.c 2009-05-03 22:41:38 UTC (rev 30621) @@ -0,0 +1,44 @@ +/* + * Copyright 2005, Axel D??rfler, axeld at pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ + +// This file includes some known R5 syscalls +// ToDo: maybe they should indeed do something... + +#include + + +int _kset_mon_limit_(int num); +int _kset_fd_limit_(int num); +int _kget_cpu_state_(int cpuNum); +int _kset_cpu_state_(int cpuNum, int state); + + +int +_kset_mon_limit_(int num) +{ + return B_ERROR; +} + + +int +_kset_fd_limit_(int num) +{ + return B_ERROR; +} + + +int +_kget_cpu_state_(int cpuNum) +{ + return 1; +} + + +int +_kset_cpu_state_(int cpuNum, int state) +{ + return state ? B_OK : B_ERROR; +} + Added: haiku/trunk/src/system/libroot/os/arch/mipsel/stack_frame.c =================================================================== --- haiku/trunk/src/system/libroot/os/arch/mipsel/stack_frame.c 2009-05-03 22:26:23 UTC (rev 30620) +++ haiku/trunk/src/system/libroot/os/arch/mipsel/stack_frame.c 2009-05-03 22:41:38 UTC (rev 30621) @@ -0,0 +1,24 @@ +/* + * Copyright 2008, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ + +#include + +#include + + +void* +get_stack_frame(void) +{ + // TODO: Implement! + return NULL; +} + + +void* +__arch_get_caller(void) +{ + // TODO: Implement! + return NULL; +} Added: haiku/trunk/src/system/libroot/os/arch/mipsel/syscalls.inc =================================================================== --- haiku/trunk/src/system/libroot/os/arch/mipsel/syscalls.inc 2009-05-03 22:26:23 UTC (rev 30620) +++ haiku/trunk/src/system/libroot/os/arch/mipsel/syscalls.inc 2009-05-03 22:41:38 UTC (rev 30621) @@ -0,0 +1,88 @@ +/* + * Copyright 2001, Travis Geiselbrecht. All rights reserved. + * Distributed under the terms of the NewOS License. + */ +#define SYSCALL0(name, n) \ +.globl name; \ +.type name, at function; \ +.align 4; \ +name: + +#define SYSCALL1(name, n) \ +.globl name; \ +.type name, at function; \ +.align 4; \ +name: + +#define SYSCALL2(name, n) \ +.globl name; \ +.type name, at function; \ +.align 4; \ +name: + +#define SYSCALL3(name, n) \ +.globl name; \ +.type name, at function; \ +.align 4; \ +name: + +#define SYSCALL4(name, n) \ +.globl name; \ +.type name, at function; \ +.align 4; \ +name: + +#define SYSCALL5(name, n) \ +.globl name; \ +.type name, at function; \ +.align 4; \ +name: + +#define SYSCALL6(name, n) \ +.globl name; \ +.type name, at function; \ +.align 4; \ +name: + +#define SYSCALL7(name, n) \ +.globl name; \ +.type name, at function; \ +.align 4; \ +name: + +#define SYSCALL8(name, n) \ +.globl name; \ +.type name, at function; \ +.align 4; \ +name: + +#define SYSCALL9(name, n) \ +.globl name; \ +.type name, at function; \ +.align 4; \ +name: + +#define SYSCALL10(name, n) \ +.globl name; \ +.type name, at function; \ +.align 4; \ +name: + +#define SYSCALL11(name, n) \ +.globl name; \ +.type name, at function; \ +.align 4; \ +name: + +#define SYSCALL12(name, n) \ +.globl name; \ +.type name, at function; \ +.align 4; \ +name: + +#define SYSCALL13(name, n) \ +.globl name; \ +.type name, at function; \ +.align 4; \ +name: + Added: haiku/trunk/src/system/libroot/os/arch/mipsel/system_time.c =================================================================== --- haiku/trunk/src/system/libroot/os/arch/mipsel/system_time.c 2009-05-03 22:26:23 UTC (rev 30620) +++ haiku/trunk/src/system/libroot/os/arch/mipsel/system_time.c 2009-05-03 22:41:38 UTC (rev 30621) @@ -0,0 +1,29 @@ +/* + * Copyright 2006, Ingo Weinhold . + * All rights reserved. Distributed under the terms of the MIT License. + */ + +#include + +#include +#include +#include + + +static vint32 *sConversionFactor; + +void +__mipsel_setup_system_time(vint32 *cvFactor) +{ + sConversionFactor = cvFactor; +} + + +bigtime_t +system_time(void) +{ + uint64 timeBase = __mipsel_get_time_base(); + + uint32 cv = *sConversionFactor; + return (timeBase >> 32) * cv + (((timeBase & 0xffffffff) * cv) >> 32); +} Added: haiku/trunk/src/system/libroot/os/arch/mipsel/system_time_asm.S =================================================================== --- haiku/trunk/src/system/libroot/os/arch/mipsel/system_time_asm.S 2009-05-03 22:26:23 UTC (rev 30620) +++ haiku/trunk/src/system/libroot/os/arch/mipsel/system_time_asm.S 2009-05-03 22:41:38 UTC (rev 30621) @@ -0,0 +1,18 @@ +/* + * Copyright 2003, Axel D??rfler, axeld at pinc-software.de. All rights reserved. + * Distributed under the terms of the OpenBeOS License. + */ + +#define FUNCTION(x) .global x; .type x, at function; x + +#warning MIPSEL: fixme + +.text + +/* int64 __mipsel_get_time_base(void) + * r3/r4 + */ +FUNCTION(__mipsel_get_time_base): + /* get TB (time base) register */ +carry: jr $ra + Added: haiku/trunk/src/system/libroot/os/arch/mipsel/thread.c =================================================================== --- haiku/trunk/src/system/libroot/os/arch/mipsel/thread.c 2009-05-03 22:26:23 UTC (rev 30620) +++ haiku/trunk/src/system/libroot/os/arch/mipsel/thread.c 2009-05-03 22:41:38 UTC (rev 30621) @@ -0,0 +1,9 @@ +#include +#include "syscalls.h" + + +thread_id +find_thread(const char *name) +{ + return _kern_find_thread(name); +} Added: haiku/trunk/src/system/libroot/os/arch/mipsel/time.c =================================================================== --- haiku/trunk/src/system/libroot/os/arch/mipsel/time.c 2009-05-03 22:26:23 UTC (rev 30620) +++ haiku/trunk/src/system/libroot/os/arch/mipsel/time.c 2009-05-03 22:41:38 UTC (rev 30621) @@ -0,0 +1,42 @@ +/* + * Copyright 2006, Ingo Weinhold . + * Distributed under the terms of the MIT License. + */ + +#include + +#include +#include +#include + + +static struct arch_real_time_data *sRealTimeData; + +void +__arch_init_time(struct real_time_data *data, bool setDefaults) +{ + sRealTimeData = &data->arch_data; + + if (setDefaults) { + sRealTimeData->data[0].system_time_offset = 0; + sRealTimeData->system_time_conversion_factor = 1000000000LL; + sRealTimeData->version = 0; + } + + __mipsel_setup_system_time(&sRealTimeData->system_time_conversion_factor); +} + + +bigtime_t +__arch_get_system_time_offset(struct real_time_data *data) +{ + int32 version; + bigtime_t offset; + do { + version = sRealTimeData->version; + offset = sRealTimeData->data[version % 2].system_time_offset; + } while (version != sRealTimeData->version); + + return offset; +} + Added: haiku/trunk/src/system/libroot/os/arch/mipsel/tls.c =================================================================== --- haiku/trunk/src/system/libroot/os/arch/mipsel/tls.c 2009-05-03 22:26:23 UTC (rev 30620) +++ haiku/trunk/src/system/libroot/os/arch/mipsel/tls.c 2009-05-03 22:41:38 UTC (rev 30621) @@ -0,0 +1,53 @@ +/* +** Copyright 2003, Axel D??rfler, axeld at pinc-software.de. All rights reserved. +** Distributed under the terms of the OpenBeOS License. +*/ + +// ToDo: this is a dummy implementation - I've not yet gained enough knowledge +// to decide how this should be done, so it's just broken now (okay for single +// threaded apps, though). + +// we don't want to have the inline assembly included here +#ifndef _NO_INLINE_ASM +# define _NO_INLINE_ASM 1 +#endif + +#include "support/TLS.h" +#include "tls.h" + + +static int32 gNextSlot = TLS_FIRST_FREE_SLOT; +static void *gSlots[TLS_MAX_KEYS]; + + +int32 +tls_allocate(void) +{ + int32 next = atomic_add(&gNextSlot, 1); + if (next >= TLS_MAX_KEYS) + return B_NO_MEMORY; + + return next; +} + + +void * +tls_get(int32 index) +{ + return gSlots[index]; +} + + +void ** +tls_address(int32 index) +{ + return &gSlots[index]; +} + + +void +tls_set(int32 index, void *value) +{ + gSlots[index] = value; +} + Added: haiku/trunk/src/system/libroot/posix/arch/mipsel/Jamfile =================================================================== --- haiku/trunk/src/system/libroot/posix/arch/mipsel/Jamfile 2009-05-03 22:26:23 UTC (rev 30620) +++ haiku/trunk/src/system/libroot/posix/arch/mipsel/Jamfile 2009-05-03 22:41:38 UTC (rev 30621) @@ -0,0 +1,16 @@ +SubDir HAIKU_TOP src system libroot posix arch mipsel ; + +local genericSources = + setjmp_save_sigs.c + longjmp_return.c +; + +MergeObject posix_arch_$(TARGET_ARCH).o : + sigsetjmp.S + siglongjmp.S + + $(genericSources) +; + +SEARCH on [ FGristFiles $(genericSources) ] + = [ FDirName $(SUBDIR) $(DOTDOT) generic ] ; Added: haiku/trunk/src/system/libroot/posix/arch/mipsel/setjmp_internal.h =================================================================== --- haiku/trunk/src/system/libroot/posix/arch/mipsel/setjmp_internal.h 2009-05-03 22:26:23 UTC (rev 30620) +++ haiku/trunk/src/system/libroot/posix/arch/mipsel/setjmp_internal.h 2009-05-03 22:41:38 UTC (rev 30621) @@ -0,0 +1,49 @@ +/* + * Copyright 2005, Ingo Weinhold . All rights + * reserved. Distributed under the terms of the Haiku License. + */ +#ifndef SETJMP_INTERNAL_H +#define SETJMP_INTERNAL_H + +#error MIPSEL: fixme + +/* PPC function call ABI register use: + r0 - volatile + r1 - stack frame + r2 - reserved + r3-r4 - param passing, return values + r5-r10 - param passing + r11-r12 - volatile + r13 - small data pointer + r14-r30 - local vars + r31 - local vars/environment +*/ + +/* These are the fields of the __jmp_regs structure */ +#define JMP_REGS_R1 0 +#define JMP_REGS_R2 4 +#define JMP_REGS_R13 8 +#define JMP_REGS_R14 12 +#define JMP_REGS_R15 16 +#define JMP_REGS_R16 20 +#define JMP_REGS_R17 24 +#define JMP_REGS_R18 28 +#define JMP_REGS_R19 32 +#define JMP_REGS_R20 36 +#define JMP_REGS_R21 40 +#define JMP_REGS_R22 44 +#define JMP_REGS_R23 48 +#define JMP_REGS_R24 52 +#define JMP_REGS_R25 56 +#define JMP_REGS_R26 60 +#define JMP_REGS_R27 64 +#define JMP_REGS_R28 68 +#define JMP_REGS_R29 72 +#define JMP_REGS_R30 76 +#define JMP_REGS_R31 80 +#define JMP_REGS_LR 84 +#define JMP_REGS_CR 88 + +#define FUNCTION(x) .global x; .type x, at function; x + +#endif /* SETJMP_INTERNAL_H */ Added: haiku/trunk/src/system/libroot/posix/arch/mipsel/siglongjmp.S =================================================================== --- haiku/trunk/src/system/libroot/posix/arch/mipsel/siglongjmp.S 2009-05-03 22:26:23 UTC (rev 30620) +++ haiku/trunk/src/system/libroot/posix/arch/mipsel/siglongjmp.S 2009-05-03 22:41:38 UTC (rev 30621) @@ -0,0 +1,48 @@ +#error XXX +/* + * Copyright 2005, Ingo Weinhold . All rights + * reserved. Distributed under the terms of the Haiku License. + */ + +#include "setjmp_internal.h" + +#error MIPSEL: fixme + +/* int __siglongjmp(jmp_buf buffer, int value) */ +FUNCTION(siglongjmp): +FUNCTION(longjmp): +FUNCTION(_longjmp): + // r3: buffer, r4: saveMask + + // restore non-volatile general purpose registers + lwz %r1, JMP_REGS_R1(3) + lwz %r2, JMP_REGS_R2(3) + lwz %r13, JMP_REGS_R13(3) + lwz %r14, JMP_REGS_R14(3) + lwz %r15, JMP_REGS_R15(3) + lwz %r16, JMP_REGS_R16(3) + lwz %r17, JMP_REGS_R17(3) + lwz %r18, JMP_REGS_R18(3) + lwz %r19, JMP_REGS_R19(3) + lwz %r20, JMP_REGS_R20(3) + lwz %r21, JMP_REGS_R21(3) + lwz %r22, JMP_REGS_R22(3) + lwz %r23, JMP_REGS_R23(3) + lwz %r24, JMP_REGS_R24(3) + lwz %r25, JMP_REGS_R25(3) + lwz %r26, JMP_REGS_R26(3) + lwz %r27, JMP_REGS_R27(3) + lwz %r28, JMP_REGS_R28(3) + lwz %r29, JMP_REGS_R29(3) + lwz %r30, JMP_REGS_R30(3) + lwz %r31, JMP_REGS_R31(3) + + // restore special registers (link, condition) + lwz %r0, JMP_REGS_LR(3) + mtlr %r0 + lwz %r0, JMP_REGS_CR(3) + mtcr %r0 + + b __longjmp_return + +#pragma weak longjmp=siglongjmp Added: haiku/trunk/src/system/libroot/posix/arch/mipsel/sigsetjmp.S =================================================================== --- haiku/trunk/src/system/libroot/posix/arch/mipsel/sigsetjmp.S 2009-05-03 22:26:23 UTC (rev 30620) +++ haiku/trunk/src/system/libroot/posix/arch/mipsel/sigsetjmp.S 2009-05-03 22:41:38 UTC (rev 30621) @@ -0,0 +1,54 @@ +#error XXX +/* + * Copyright 2005, Ingo Weinhold . All rights + * reserved. Distributed under the terms of the Haiku License. + */ + +#include "setjmp_internal.h" + +#error MIPSEL: fixme + +/* int sigsetjmp(jmp_buf buffer, int saveMask) */ +FUNCTION(__sigsetjmp): +FUNCTION(sigsetjmp): + // r3: buffer, r4: saveMask + + // store non-volatile general purpose registers + stw %r1, JMP_REGS_R1(3) + stw %r2, JMP_REGS_R2(3) + stw %r13, JMP_REGS_R13(3) + stw %r14, JMP_REGS_R14(3) + stw %r15, JMP_REGS_R15(3) + stw %r16, JMP_REGS_R16(3) + stw %r17, JMP_REGS_R17(3) + stw %r18, JMP_REGS_R18(3) + stw %r19, JMP_REGS_R19(3) + stw %r20, JMP_REGS_R20(3) + stw %r21, JMP_REGS_R21(3) + stw %r22, JMP_REGS_R22(3) + stw %r23, JMP_REGS_R23(3) + stw %r24, JMP_REGS_R24(3) + stw %r25, JMP_REGS_R25(3) + stw %r26, JMP_REGS_R26(3) + stw %r27, JMP_REGS_R27(3) + stw %r28, JMP_REGS_R28(3) + stw %r29, JMP_REGS_R29(3) + stw %r30, JMP_REGS_R30(3) + stw %r31, JMP_REGS_R31(3) + + // store special registers (link, condition) + mflr %r0 + stw %r0, JMP_REGS_LR(3) + mfcr %r0 + stw %r0, JMP_REGS_CR(3) + + b __setjmp_save_sigs + + +/* int setjmp(jmp_buf buffer) */ +FUNCTION(setjmp): + // call __sigsetjmp with saveMask = 0 + addi %r4, 0, 0 + b __sigsetjmp + +#pragma weak _setjmp=setjmp From jonas at kirilla.com Mon May 4 00:56:28 2009 From: jonas at kirilla.com (Jonas =?iso-8859-1?q?Sundstr=F6m?=) Date: Mon, 04 May 2009 00:56:28 +0200 CEST Subject: [Haiku-commits] =?iso-8859-1?q?r30621_-_in_haiku/trunk/src/system?= =?iso-8859-1?q?=3A_boot/arch/mipsel__libroot/os/arch/mipsel_libroot/posix?= =?iso-8859-1?q?/arch/mipsel?= In-Reply-To: <200905032241.n43Mfn2d013467@sheep.berlios.de> Message-ID: <3816844810-BeMail@kirilla> kirilla at BerliOS wrote: ... > Added: > haiku/trunk/src/system/boot/arch/mipsel/Jamfile > haiku/trunk/src/system/libroot/os/arch/mipsel/Jamfile > haiku/trunk/src/system/libroot/os/arch/mipsel/atomic.S > haiku/trunk/src/system/libroot/os/arch/mipsel/byteorder.S > haiku/trunk/src/system/libroot/os/arch/mipsel/compatibility.c ... Most of my mipsel commits in the near future will be just placeholders, copying relevant parts from the other archs. If anyone objects to being listed as author of code in this halfway and clearly erroneous state, or objects to anything else, please let me know. /Jonas. From axeld at mail.berlios.de Mon May 4 11:03:21 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Mon, 4 May 2009 11:03:21 +0200 Subject: [Haiku-commits] r30622 - haiku/trunk/src/add-ons/accelerants/common Message-ID: <200905040903.n4493LMS026532@sheep.berlios.de> Author: axeld Date: 2009-05-04 11:03:19 +0200 (Mon, 04 May 2009) New Revision: 30622 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30622&view=rev Modified: haiku/trunk/src/add-ons/accelerants/common/dump_edid.c Log: * Applied patch by Fredrik Holmqvist: improved EDID dump output. * This closes ticket #3809. Modified: haiku/trunk/src/add-ons/accelerants/common/dump_edid.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/common/dump_edid.c 2009-05-03 22:41:38 UTC (rev 30621) +++ haiku/trunk/src/add-ons/accelerants/common/dump_edid.c 2009-05-04 09:03:19 UTC (rev 30622) @@ -50,41 +50,41 @@ dprintf("Supported VESA Video Modes:\n"); if (edid->established_timing.res_720x400x70) - dprintf("720x400 at 70\n"); + dprintf("720x400 at 70Hz\n"); if (edid->established_timing.res_720x400x88) - dprintf("720x400 at 88\n"); + dprintf("720x400 at 88Hz\n"); if (edid->established_timing.res_640x480x60) - dprintf("640x480 at 60\n"); + dprintf("640x480 at 60Hz\n"); if (edid->established_timing.res_640x480x67) - dprintf("640x480x67\n"); + dprintf("640x480x67Hz\n"); if (edid->established_timing.res_640x480x72) - dprintf("640x480x72\n"); + dprintf("640x480x72Hz\n"); if (edid->established_timing.res_640x480x75) - dprintf("640x480x75\n"); + dprintf("640x480x75Hz\n"); if (edid->established_timing.res_800x600x56) - dprintf("800x600 at 56\n"); + dprintf("800x600 at 56Hz\n"); if (edid->established_timing.res_800x600x60) - dprintf("800x600 at 60\n"); + dprintf("800x600 at 60Hz\n"); if (edid->established_timing.res_800x600x72) - dprintf("800x600 at 72\n"); + dprintf("800x600 at 72Hz\n"); if (edid->established_timing.res_800x600x75) - dprintf("800x600 at 75\n"); + dprintf("800x600 at 75Hz\n"); if (edid->established_timing.res_832x624x75) - dprintf("832x624 at 75\n"); + dprintf("832x624 at 75Hz\n"); if (edid->established_timing.res_1024x768x87i) - dprintf("1024x768 at 87 interlaced\n"); + dprintf("1024x768 at 87Hz interlaced\n"); if (edid->established_timing.res_1024x768x60) - dprintf("1024x768 at 60\n"); + dprintf("1024x768 at 60Hz\n"); if (edid->established_timing.res_1024x768x70) - dprintf("1024x768 at 70\n"); + dprintf("1024x768 at 70Hz\n"); if (edid->established_timing.res_1024x768x75) - dprintf("1024x768 at 75\n"); + dprintf("1024x768 at 75Hz\n"); if (edid->established_timing.res_1280x1024x75) - dprintf("1280x1024 at 75\n"); + dprintf("1280x1024 at 75Hz\n"); if (edid->established_timing.res_1152x870x75) - dprintf("1152x870 at 75\n"); + dprintf("1152x870 at 75Hz\n"); for (i = 0; i < EDID1_NUM_DETAILED_MONITOR_DESC; ++i) { edid1_detailed_monitor *monitor = &edid->detailed_monitor[i]; @@ -149,8 +149,13 @@ case EDID1_IS_DETAILED_TIMING: { edid1_detailed_timing *timing = &monitor->data.detailed_timing; + dprintf("Additional Video Mode (%dx%d@%dHz):\n", + timing->h_active, timing->v_active, + (timing->pixel_clock * 10000 + / (timing->h_active + timing->h_blank) + / (timing->v_active + timing->v_blank))); + // Refresh rate = pixel clock in MHz / Htotal / Vtotal - dprintf("Additional Video Mode:\n"); dprintf("clock=%f MHz\n", timing->pixel_clock / 100.0); dprintf("h: (%d, %d, %d, %d)\n", timing->h_active, timing->h_active + timing->h_sync_off, From bonefish at mail.berlios.de Mon May 4 12:31:47 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Mon, 4 May 2009 12:31:47 +0200 Subject: [Haiku-commits] r30623 - haiku/trunk/src/kits/app Message-ID: <200905041031.n44AVlbS022641@sheep.berlios.de> Author: bonefish Date: 2009-05-04 12:31:45 +0200 (Mon, 04 May 2009) New Revision: 30623 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30623&view=rev Modified: haiku/trunk/src/kits/app/Roster.cpp Log: * BRoster::_TranslateRef(): Changed error handling style. No functional change. * Automatic white space cleanup. Modified: haiku/trunk/src/kits/app/Roster.cpp =================================================================== --- haiku/trunk/src/kits/app/Roster.cpp 2009-05-04 09:03:19 UTC (rev 30622) +++ haiku/trunk/src/kits/app/Roster.cpp 2009-05-04 10:31:45 UTC (rev 30623) @@ -8,7 +8,7 @@ */ /*! BRoster class lets you launch apps and keeps track of apps - that are running. + that are running. Global be_roster represents the default BRoster. app_info structure provides info for a running app. */ @@ -547,7 +547,7 @@ \return - \c B_OK: Everything went fine. - \c B_BAD_VALUE: \c NULL \a mimeType or \a app. - - \c B_LAUNCH_FAILED_NO_PREFERRED_APP: Neither with the supplied type nor + - \c B_LAUNCH_FAILED_NO_PREFERRED_APP: Neither with the supplied type nor with its supertype (if the supplied isn't a supertype itself) a preferred application is associated. - \c B_LAUNCH_FAILED_APP_NOT_FOUND: The supplied type is not installed or @@ -589,7 +589,7 @@ \return - \c B_OK: Everything went fine. - \c B_BAD_VALUE: \c NULL \a mimeType or \a app. - - \c B_LAUNCH_FAILED_NO_PREFERRED_APP: Neither with the supplied type nor + - \c B_LAUNCH_FAILED_NO_PREFERRED_APP: Neither with the supplied type nor with its supertype (if the supplied isn't a supertype itself) a preferred application is associated. - \c B_LAUNCH_FAILED_APP_NOT_FOUND: The supplied type is not installed or @@ -821,7 +821,7 @@ \return - \c B_OK: Everything went fine. - \c B_BAD_VALUE: \c NULL \a mimeType - - \c B_LAUNCH_FAILED_NO_PREFERRED_APP: Neither with the supplied type nor + - \c B_LAUNCH_FAILED_NO_PREFERRED_APP: Neither with the supplied type nor with its supertype (if the supplied isn't a supertype itself) a preferred application is associated. - \c B_LAUNCH_FAILED_APP_NOT_FOUND: The supplied type is not installed or @@ -868,7 +868,7 @@ \return - \c B_OK: Everything went fine. - \c B_BAD_VALUE: \c NULL \a mimeType - - \c B_LAUNCH_FAILED_NO_PREFERRED_APP: Neither with the supplied type nor + - \c B_LAUNCH_FAILED_NO_PREFERRED_APP: Neither with the supplied type nor with its supertype (if the supplied isn't a supertype itself) a preferred application is associated. - \c B_LAUNCH_FAILED_APP_NOT_FOUND: The supplied type is not installed or @@ -908,7 +908,7 @@ \return - \c B_OK: Everything went fine. - \c B_BAD_VALUE: \c NULL \a mimeType - - \c B_LAUNCH_FAILED_NO_PREFERRED_APP: Neither with the supplied type nor + - \c B_LAUNCH_FAILED_NO_PREFERRED_APP: Neither with the supplied type nor with its supertype (if the supplied isn't a supertype itself) a preferred application is associated. - \c B_LAUNCH_FAILED_APP_NOT_FOUND: The supplied type is not installed or @@ -953,7 +953,7 @@ \return - \c B_OK: Everything went fine. - \c B_BAD_VALUE: \c NULL \a ref - - \c B_LAUNCH_FAILED_NO_PREFERRED_APP: Neither with the supplied type nor + - \c B_LAUNCH_FAILED_NO_PREFERRED_APP: Neither with the supplied type nor with its supertype (if the supplied isn't a supertype itself) a preferred application is associated. - \c B_LAUNCH_FAILED_APP_NOT_FOUND: The supplied type is not installed or @@ -1007,7 +1007,7 @@ \return - \c B_OK: Everything went fine. - \c B_BAD_VALUE: \c NULL \a ref - - \c B_LAUNCH_FAILED_NO_PREFERRED_APP: Neither with the supplied type nor + - \c B_LAUNCH_FAILED_NO_PREFERRED_APP: Neither with the supplied type nor with its supertype (if the supplied isn't a supertype itself) a preferred application is associated. - \c B_LAUNCH_FAILED_APP_NOT_FOUND: The supplied type is not installed or @@ -1057,7 +1057,7 @@ \return - \c B_OK: Everything went fine. - \c B_BAD_VALUE: \c NULL \a ref - - \c B_LAUNCH_FAILED_NO_PREFERRED_APP: Neither with the supplied type nor + - \c B_LAUNCH_FAILED_NO_PREFERRED_APP: Neither with the supplied type nor with its supertype (if the supplied isn't a supertype itself) a preferred application is associated. - \c B_LAUNCH_FAILED_APP_NOT_FOUND: The supplied type is not installed or @@ -1119,13 +1119,13 @@ err = reply.what == B_REG_RESULT ? (status_t)B_OK : (status_t)B_BAD_REPLY; if (!err) err = reply.FindInt32("result", &result); - if (!err) + if (!err) err = result; // Clear the result if an error occured if (err && refList) refList->MakeEmpty(); // No return value, how sad :-( -// return err; +// return err; } // GetRecentDocuments @@ -1160,13 +1160,13 @@ err = reply.what == B_REG_RESULT ? (status_t)B_OK : (status_t)B_BAD_REPLY; if (!err) err = reply.FindInt32("result", &result); - if (!err) + if (!err) err = result; // Clear the result if an error occured if (err && refList) refList->MakeEmpty(); // No return value, how sad :-( -// return err; +// return err; } // GetRecentFolders @@ -1196,13 +1196,13 @@ err = reply.what == B_REG_RESULT ? (status_t)B_OK : (status_t)B_BAD_REPLY; if (!err) err = reply.FindInt32("result", &result); - if (!err) + if (!err) err = result; // Clear the result if an error occured if (err && refList) refList->MakeEmpty(); // No return value, how sad :-( -// return err; +// return err; } // GetRecentApps @@ -1229,13 +1229,13 @@ err = reply.what == B_REG_RESULT ? (status_t)B_OK : (status_t)B_BAD_REPLY; if (!err) err = reply.FindInt32("result", &result); - if (!err) + if (!err) err = result; // Clear the result if an error occured if (err && refList) refList->MakeEmpty(); // No return value, how sad :-( -// return err; +// return err; } // AddToRecentDocuments @@ -1249,18 +1249,18 @@ BMessage reply; status_t result; char *callingAppSig = NULL; - + // If no signature is supplied, look up the signature of // the calling app if (!err && !appSig) { app_info info; err = GetRunningAppInfo(be_app->Team(), &info); if (!err) - callingAppSig = info.signature; + callingAppSig = info.signature; } // Build and send the message, read the reply - if (!err) + if (!err) err = msg.AddRef("ref", doc); if (!err) err = msg.AddString("app sig", (appSig ? appSig : callingAppSig)); @@ -1269,7 +1269,7 @@ err = reply.what == B_REG_RESULT ? (status_t)B_OK : (status_t)B_BAD_REPLY; if (!err) err = reply.FindInt32("result", &result); - if (!err) + if (!err) err = result; if (err) DBG(OUT("WARNING: BRoster::AddToRecentDocuments() failed with error 0x%lx\n", err)); @@ -1286,18 +1286,18 @@ BMessage reply; status_t result; char *callingAppSig = NULL; - + // If no signature is supplied, look up the signature of // the calling app if (!err && !appSig) { app_info info; err = GetRunningAppInfo(be_app->Team(), &info); if (!err) - callingAppSig = info.signature; + callingAppSig = info.signature; } // Build and send the message, read the reply - if (!err) + if (!err) err = msg.AddRef("ref", folder); if (!err) err = msg.AddString("app sig", (appSig ? appSig : callingAppSig)); @@ -1306,7 +1306,7 @@ err = reply.what == B_REG_RESULT ? (status_t)B_OK : (status_t)B_BAD_REPLY; if (!err) err = reply.FindInt32("result", &result); - if (!err) + if (!err) err = result; if (err) DBG(OUT("WARNING: BRoster::AddToRecentDocuments() failed with error 0x%lx\n", err)); @@ -1621,7 +1621,7 @@ error = request.AddInt32("team", team); if (error == B_OK && token > 0) error = request.AddInt32("token", (int32)token); - + // send the request BMessage reply; if (error == B_OK) @@ -1645,7 +1645,7 @@ } else if (reply.FindInt32("error", &error) != B_OK) error = B_ERROR; } - + return error; } @@ -1801,7 +1801,7 @@ \return - \c B_OK: Everything went fine. - \c B_BAD_VALUE: \c NULL \a mimeType and \a ref. - - \c B_LAUNCH_FAILED_NO_PREFERRED_APP: Neither with the supplied type nor + - \c B_LAUNCH_FAILED_NO_PREFERRED_APP: Neither with the supplied type nor with its supertype (if the supplied isn't a supertype itself) a preferred application is associated. - \c B_LAUNCH_FAILED_APP_NOT_FOUND: The supplied type is not installed or @@ -2114,92 +2114,100 @@ // resolve ref, if necessary BEntry entry; status_t error = entry.SetTo(ref, false); - if (error == B_OK && entry.IsSymLink()) { + if (error != B_OK) + return error; + + if (entry.IsSymLink()) { // ref refers to a link - error = entry.SetTo(ref, true); - if (error == B_OK) - error = entry.GetRef(ref); - if (error != B_OK) - error = B_LAUNCH_FAILED_NO_RESOLVE_LINK; + if (entry.SetTo(ref, true) != B_OK || entry.GetRef(ref) != B_OK) + return B_LAUNCH_FAILED_NO_RESOLVE_LINK; } // init node BNode node; - if (error == B_OK) - error = node.SetTo(ref); + error = node.SetTo(ref); + if (error != B_OK) + return error; + // get permissions mode_t permissions; - if (error == B_OK) - error = node.GetPermissions(&permissions); - if (error == B_OK) { - if ((permissions & S_IXUSR) && node.IsFile()) { - // node is executable and a file -- we're done - *appRef = *ref; - error = appFile->SetTo(appRef, B_READ_ONLY); + error = node.GetPermissions(&permissions); + if (error != B_OK) + return error; - // get the app's signature via a BAppFileInfo - BAppFileInfo appFileInfo; - if (error == B_OK) - error = appFileInfo.SetTo(appFile); + if ((permissions & S_IXUSR) && node.IsFile()) { + // node is executable and a file -- we're done + *appRef = *ref; + error = appFile->SetTo(appRef, B_READ_ONLY); + if (error != B_OK) + return error; - char type[B_MIME_TYPE_LENGTH]; - bool isDocument = true; + // get the app's signature via a BAppFileInfo + BAppFileInfo appFileInfo; + error = appFileInfo.SetTo(appFile); + if (error != B_OK) + return error; - if (error == B_OK) { - // don't worry, if the file doesn't have a signature, just - // unset the supplied object - if (appFileInfo.GetSignature(type) == B_OK) - error = appMeta->SetTo(type); - else - appMeta->Unset(); - if (appFileInfo.GetType(type) == B_OK - && !strcasecmp(type, B_APP_MIME_TYPE)) - isDocument = false; - } - if (_wasDocument) - *_wasDocument = isDocument; - } else { - // the node is not exectuable or not a file - // init a node info - BNodeInfo nodeInfo; - if (error == B_OK) - error = nodeInfo.SetTo(&node); - char preferredApp[B_MIME_TYPE_LENGTH]; - if (error == B_OK) { - // if the file has a preferred app, let _TranslateType() find - // it for us - bool foundPreferredApp = false; - if (nodeInfo.GetPreferredApp(preferredApp) == B_OK) { - error = _TranslateType(preferredApp, appMeta, appRef, - appFile); - if (error == B_OK) - foundPreferredApp = true; - } - - if (!foundPreferredApp) { - // no preferred app or existing one was not found -- we - // need to get the file's type + char type[B_MIME_TYPE_LENGTH]; + bool isDocument = true; - error = B_OK; // reset error. + // don't worry, if the file doesn't have a signature, just + // unset the supplied object + if (appFileInfo.GetSignature(type) == B_OK) { + error = appMeta->SetTo(type); + if (error != B_OK) + return error; + } else + appMeta->Unset(); - char fileType[B_MIME_TYPE_LENGTH]; + if (appFileInfo.GetType(type) == B_OK + && !strcasecmp(type, B_APP_MIME_TYPE)) { + isDocument = false; + } - // get the type from the file, or guess a type - if (nodeInfo.GetType(fileType) != B_OK) - error = _SniffFile(ref, &nodeInfo, fileType); + if (_wasDocument) + *_wasDocument = isDocument; - // now let _TranslateType() do the actual work - if (error == B_OK) { - error = _TranslateType(fileType, appMeta, appRef, - appFile); - } - } - } - if (_wasDocument) - *_wasDocument = true; - } + return B_OK; } - return error; + + // the node is not exectuable or not a file + // init a node info + BNodeInfo nodeInfo; + error = nodeInfo.SetTo(&node); + if (error != B_OK) + return error; + + // if the file has a preferred app, let _TranslateType() find + // it for us + char preferredApp[B_MIME_TYPE_LENGTH]; + if (nodeInfo.GetPreferredApp(preferredApp) == B_OK + && _TranslateType(preferredApp, appMeta, appRef, appFile) == B_OK) { + if (_wasDocument) + *_wasDocument = true; + return B_OK; + } + + // no preferred app or existing one was not found -- we + // need to get the file's type + + // get the type from the file, or guess a type + char fileType[B_MIME_TYPE_LENGTH]; + if (nodeInfo.GetType(fileType) != B_OK) { + error = _SniffFile(ref, &nodeInfo, fileType); + if (error != B_OK) + return error; + } + + // now let _TranslateType() do the actual work + error = _TranslateType(fileType, appMeta, appRef, appFile); + if (error != B_OK) + return error; + + if (_wasDocument) + *_wasDocument = true; + + return B_OK; } // _TranslateType @@ -2355,7 +2363,7 @@ If \a messageList is not \c NULL or empty, those messages are sent first, then follow \c B_ARGV_RECEIVED, \c B_REFS_RECEIVED and finally \c B_READ_TO_RUN. - + \c B_ARGV_RECEIVED is sent only, if \a args is not \c NULL and contains more than one element. \c B_REFS_RECEIVED is sent only, if \a ref is not \c NULL. @@ -2406,7 +2414,7 @@ for (int32 i = 0; i < argc; i++) message.AddString("argv", args[i]); messenger.SendMessage(&message); - } else if (ref) { + } else if (ref) { printf("_SendToRunning : B_REFS_RECEIVED\n"); BMessage message(B_REFS_RECEIVED); message.AddRef("refs", ref); @@ -2521,9 +2529,9 @@ // LoadRecentLists /*! \brief Loads the system's recently used document, folder, and application lists from the specified file. - + \note The current lists are cleared before loading the new lists - + \param filename The name of the file to load from */ void @@ -2553,7 +2561,7 @@ // SaveRecentLists /*! \brief Saves the system's recently used document, folder, and application lists to the specified file. - + \param filename The name of the file to save to */ void @@ -2843,6 +2851,6 @@ else if (modificationTime1 > modificationTime2) result = 1; } - return result; + return result; } From bonefish at mail.berlios.de Mon May 4 13:14:37 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Mon, 4 May 2009 13:14:37 +0200 Subject: [Haiku-commits] r30624 - haiku/trunk/src/kits/app Message-ID: <200905041114.n44BEbtb021915@sheep.berlios.de> Author: bonefish Date: 2009-05-04 13:14:33 +0200 (Mon, 04 May 2009) New Revision: 30624 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30624&view=rev Modified: haiku/trunk/src/kits/app/Roster.cpp Log: * Renamed _SniffFile() to _GetFileType() and change its semantics slightly. It does now try to get the file type from the given node info first. * _TranslateRef(): Added special handling for executable files that aren't applications and have a preferred application set. In such a case we return the preferred application instead of the given file. This mimics BeOS behavior. Modified: haiku/trunk/src/kits/app/Roster.cpp =================================================================== --- haiku/trunk/src/kits/app/Roster.cpp 2009-05-04 10:31:45 UTC (rev 30623) +++ haiku/trunk/src/kits/app/Roster.cpp 2009-05-04 11:14:33 UTC (rev 30624) @@ -2136,9 +2136,8 @@ return error; if ((permissions & S_IXUSR) && node.IsFile()) { - // node is executable and a file -- we're done - *appRef = *ref; - error = appFile->SetTo(appRef, B_READ_ONLY); + // node is executable and a file + error = appFile->SetTo(ref, B_READ_ONLY); if (error != B_OK) return error; @@ -2148,11 +2147,9 @@ if (error != B_OK) return error; - char type[B_MIME_TYPE_LENGTH]; - bool isDocument = true; - // don't worry, if the file doesn't have a signature, just // unset the supplied object + char type[B_MIME_TYPE_LENGTH]; if (appFileInfo.GetSignature(type) == B_OK) { error = appMeta->SetTo(type); if (error != B_OK) @@ -2160,15 +2157,28 @@ } else appMeta->Unset(); - if (appFileInfo.GetType(type) == B_OK - && !strcasecmp(type, B_APP_MIME_TYPE)) { + // If the file type indicates that the file is an application, we've + // definitely got what we're looking for. + bool isDocument = true; + if (_GetFileType(ref, &appFileInfo, type) == B_OK + && strcasecmp(type, B_APP_MIME_TYPE) == 0) { isDocument = false; } - if (_wasDocument) - *_wasDocument = isDocument; + // If our file is not an application executable, we probably have a + // script. Check whether the file has a preferred application set. If + // so, we fall through and use the preferred app instead. Otherwise + // we're done. + char preferredApp[B_MIME_TYPE_LENGTH]; + if (!isDocument || appFileInfo.GetPreferredApp(preferredApp) != B_OK) { + *appRef = *ref; + if (_wasDocument) + *_wasDocument = isDocument; + return B_OK; + } - return B_OK; + // Executable file, but not an application, and it has a preferred + // application set. Fall through... } // the node is not exectuable or not a file @@ -2191,13 +2201,11 @@ // no preferred app or existing one was not found -- we // need to get the file's type - // get the type from the file, or guess a type + // get the type from the file char fileType[B_MIME_TYPE_LENGTH]; - if (nodeInfo.GetType(fileType) != B_OK) { - error = _SniffFile(ref, &nodeInfo, fileType); - if (error != B_OK) - return error; - } + error = _GetFileType(ref, &nodeInfo, fileType); + if (error != B_OK) + return error; // now let _TranslateType() do the actual work error = _TranslateType(fileType, appMeta, appRef, appFile); @@ -2318,10 +2326,11 @@ return error; } -// _SniffFile -/*! \brief Sniffs the MIME type for a file. +// _GetFileType +/*! \brief Gets the type of a file either from the node info or by sniffing. - Also updates the file's MIME info, if possible. + The method first tries to get the file type from the supplied node info. If + that didn't work, the given entry ref is sniffed. \param file An entry_ref referring to the file in question. \param nodeInfo A BNodeInfo initialized to the file. @@ -2334,24 +2343,31 @@ - other errors */ status_t -BRoster::_SniffFile(const entry_ref *file, BNodeInfo *nodeInfo, +BRoster::_GetFileType(const entry_ref *file, BNodeInfo *nodeInfo, char *mimeType) const { - status_t error = (file && nodeInfo && mimeType ? B_OK : B_BAD_VALUE); - if (error == B_OK) { - // Try to update the file's MIME info and just read the updated type. - // If that fails, sniff manually. - BPath path; - if (path.SetTo(file) != B_OK - || update_mime_info(path.Path(), false, true, false) != B_OK - || nodeInfo->GetType(mimeType) != B_OK) { - BMimeType type; - error = BMimeType::GuessMimeType(file, &type); - if (error == B_OK && type.IsValid()) - strcpy(mimeType, type.Type()); - } + // first try the node info + if (nodeInfo->GetType(mimeType) == B_OK) + return B_OK; + + // Try to update the file's MIME info and just read the updated type. + // If that fails, sniff manually. + BPath path; + if (path.SetTo(file) != B_OK + || update_mime_info(path.Path(), false, true, false) != B_OK + || nodeInfo->GetType(mimeType) != B_OK) { + BMimeType type; + status_t error = BMimeType::GuessMimeType(file, &type); + if (error != B_OK) + return error; + + if (!type.IsValid()) + return B_BAD_VALUE; + + strcpy(mimeType, type.Type()); } - return error; + + return B_OK; } // _SendToRunning From bga at bug-br.org.br Mon May 4 13:54:22 2009 From: bga at bug-br.org.br (Bruno Albuquerque) Date: Mon, 04 May 2009 08:54:22 -0300 Subject: [Haiku-commits] r30618 - haiku/trunk/src/data/beos_mime/application In-Reply-To: <1069448077-BeMail@laptop> References: <1069448077-BeMail@laptop> Message-ID: <49FED76E.8050709@bug-br.org.br> Fran?ois Revol wrote: >> Making urlwrapper the preferred application of NetPositive Bookmarks. >> They > > If the specified preferred app isn't found it should fall back to the > preferred app for the type anyway, right ? It does after my recent changes to handling missing preferred apps. Before that it would simply fail (The open with panel was also broken in several levels concerning handling inexistent preferred apps. I also fixed that). -Bruno From bga at bug-br.org.br Mon May 4 13:56:23 2009 From: bga at bug-br.org.br (Bruno Albuquerque) Date: Mon, 04 May 2009 08:56:23 -0300 Subject: [Haiku-commits] r30618 - haiku/trunk/src/data/beos_mime/application In-Reply-To: <1444880021-BeMail@kirilla> References: <1444880021-BeMail@kirilla> Message-ID: <49FED7E7.10601@bug-br.org.br> Jonas Sundstr?m wrote: > I have no idea. That would seem like a good thing. > > If it doesn?t work that way now, we can make it so. It does since, like, last week. -Bruno From mattmadia at gmail.com Mon May 4 15:25:42 2009 From: mattmadia at gmail.com (Matt Madia) Date: Mon, 4 May 2009 13:25:42 +0000 Subject: [Haiku-commits] r30624 - haiku/trunk/src/kits/app In-Reply-To: <200905041114.n44BEbtb021915@sheep.berlios.de> References: <200905041114.n44BEbtb021915@sheep.berlios.de> Message-ID: <1e42d8c50905040625p487d2adfr5820dd98c6eb75e4@mail.gmail.com> On Mon, May 4, 2009 at 11:14 AM, wrote: > Author: bonefish > Date: 2009-05-04 13:14:33 +0200 (Mon, 04 May 2009) > New Revision: 30624 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30624&view=rev > > Modified: > haiku/trunk/src/kits/app/Roster.cpp > Log: > * Renamed _SniffFile() to _GetFileType() possibly missed committing a header? src/kits/app/Roster.cpp:2163: implicit declaration of function `int _GetFileType(...)' src/kits/app/Roster.cpp:2348: no `status_t BRoster::_GetFileType(const entry_ref *, BNodeInfo *, char *) const' member function declared in class `BRoster' --mmadia From ingo_weinhold at gmx.de Mon May 4 15:31:45 2009 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Mon, 04 May 2009 15:31:45 +0200 Subject: [Haiku-commits] r30624 - haiku/trunk/src/kits/app In-Reply-To: <1e42d8c50905040625p487d2adfr5820dd98c6eb75e4@mail.gmail.com> References: <200905041114.n44BEbtb021915@sheep.berlios.de> <1e42d8c50905040625p487d2adfr5820dd98c6eb75e4@mail.gmail.com> Message-ID: <20090504133145.327290@gmx.net> -------- Original-Nachricht -------- > Datum: Mon, 4 May 2009 13:25:42 +0000 > Von: Matt Madia > An: SVN commits to the Haiku source repository > Betreff: Re: [Haiku-commits] r30624 - haiku/trunk/src/kits/app > On Mon, May 4, 2009 at 11:14 AM, wrote: > > Author: bonefish > > Date: 2009-05-04 13:14:33 +0200 (Mon, 04 May 2009) > > New Revision: 30624 > > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30624&view=rev > > > > Modified: > > haiku/trunk/src/kits/app/Roster.cpp > > Log: > > * Renamed _SniffFile() to _GetFileType() > > possibly missed committing a header? Definitely. Thanks for the heads up. CU, Ingo From bonefish at mail.berlios.de Mon May 4 15:37:04 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Mon, 4 May 2009 15:37:04 +0200 Subject: [Haiku-commits] r30625 - haiku/trunk/headers/os/app Message-ID: <200905041337.n44Db48Q015028@sheep.berlios.de> Author: bonefish Date: 2009-05-04 15:37:03 +0200 (Mon, 04 May 2009) New Revision: 30625 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30625&view=rev Modified: haiku/trunk/headers/os/app/Roster.h Log: Should have been part of r30624: Renamed _SniffFile() to _GetFileType(). Modified: haiku/trunk/headers/os/app/Roster.h =================================================================== --- haiku/trunk/headers/os/app/Roster.h 2009-05-04 11:14:33 UTC (rev 30624) +++ haiku/trunk/headers/os/app/Roster.h 2009-05-04 13:37:03 UTC (rev 30625) @@ -161,7 +161,7 @@ bool *wasDocument) const; status_t _TranslateType(const char *mimeType, BMimeType *appMeta, entry_ref *appRef, BFile *appFile) const; - status_t _SniffFile(const entry_ref *file, BNodeInfo *nodeInfo, + status_t _GetFileType(const entry_ref *file, BNodeInfo *nodeInfo, char *mimeType) const; status_t _SendToRunning(team_id team, int argc, const char *const *args, const BList *messageList, const entry_ref *ref, From umccullough at gmail.com Mon May 4 16:42:05 2009 From: umccullough at gmail.com (Urias McCullough) Date: Mon, 4 May 2009 07:42:05 -0700 Subject: [Haiku-commits] r30622 - haiku/trunk/src/add-ons/accelerants/common In-Reply-To: <200905040903.n4493LMS026532@sheep.berlios.de> References: <200905040903.n4493LMS026532@sheep.berlios.de> Message-ID: <1e80d8750905040742k78dfc735k31c62e7d6a38f51c@mail.gmail.com> On Mon, May 4, 2009 at 2:03 AM, axeld at BerliOS wrote: > Author: axeld > Date: 2009-05-04 11:03:19 +0200 (Mon, 04 May 2009) > New Revision: 30622 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30622&view=rev > > Modified: > ? haiku/trunk/src/add-ons/accelerants/common/dump_edid.c > Log: > * Applied patch by Fredrik Holmqvist: improved EDID dump output. > * This closes ticket #3809. > ? ? ? ?if (edid->established_timing.res_640x480x60) > - ? ? ? ? ? ? ? dprintf("640x480 at 60\n"); > + ? ? ? ? ? ? ? dprintf("640x480 at 60Hz\n"); > ? ? ? ?if (edid->established_timing.res_640x480x67) > - ? ? ? ? ? ? ? dprintf("640x480x67\n"); > + ? ? ? ? ? ? ? dprintf("640x480x67Hz\n"); > ? ? ? ?if (edid->established_timing.res_640x480x72) > - ? ? ? ? ? ? ? dprintf("640x480x72\n"); > + ? ? ? ? ? ? ? dprintf("640x480x72Hz\n"); > ? ? ? ?if (edid->established_timing.res_640x480x75) > - ? ? ? ? ? ? ? dprintf("640x480x75\n"); > + ? ? ? ? ? ? ? dprintf("640x480x75Hz\n"); > ? ? ? ?if (edid->established_timing.res_800x600x56) > - ? ? ? ? ? ? ? dprintf("800x600 at 56\n"); > + ? ? ? ? ? ? ? dprintf("800x600 at 56Hz\n"); While you're at it - perhaps you can fix the few modes there where they aren't using @ for the refresh rate :) - Urias From axeld at mail.berlios.de Mon May 4 20:46:31 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Mon, 4 May 2009 20:46:31 +0200 Subject: [Haiku-commits] r30626 - haiku/trunk/src/add-ons/accelerants/common Message-ID: <200905041846.n44IkVDp013936@sheep.berlios.de> Author: axeld Date: 2009-05-04 20:46:31 +0200 (Mon, 04 May 2009) New Revision: 30626 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30626&view=rev Modified: haiku/trunk/src/add-ons/accelerants/common/dump_edid.c Log: * Replaced remaining 'x' with '@' before the refresh rate, thanks Urias for reporting. * Minor cleanup. Modified: haiku/trunk/src/add-ons/accelerants/common/dump_edid.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/common/dump_edid.c 2009-05-04 13:37:03 UTC (rev 30625) +++ haiku/trunk/src/add-ons/accelerants/common/dump_edid.c 2009-05-04 18:46:31 UTC (rev 30626) @@ -28,9 +28,11 @@ dprintf("Vendor: %s\n", edid->vendor.manufacturer); dprintf("Product ID: %d\n", (int)edid->vendor.prod_id); dprintf("Serial #: %d\n", (int)edid->vendor.serial); - dprintf("Produced in week/year: %d/%d\n", edid->vendor.week, edid->vendor.year); + dprintf("Produced in week/year: %d/%d\n", edid->vendor.week, + edid->vendor.year); - dprintf("EDID version: %d.%d\n", edid->version.version, edid->version.revision); + dprintf("EDID version: %d.%d\n", edid->version.version, + edid->version.revision); dprintf("Type: %s\n", edid->display.input_type ? "Digital" : "Analog"); dprintf("Size: %d cm x %d cm\n", edid->display.h_size, edid->display.v_size); @@ -43,7 +45,7 @@ if (edid->std_timing[i].h_size <= 256) continue; - dprintf("%dx%d@%dHz (id=%d)\n", + dprintf("%dx%d@%dHz (id=%d)\n", edid->std_timing[i].h_size, edid->std_timing[i].v_size, edid->std_timing[i].refresh, edid->std_timing[i].id); } @@ -56,11 +58,11 @@ if (edid->established_timing.res_640x480x60) dprintf("640x480 at 60Hz\n"); if (edid->established_timing.res_640x480x67) - dprintf("640x480x67Hz\n"); + dprintf("640x480 at 67Hz\n"); if (edid->established_timing.res_640x480x72) - dprintf("640x480x72Hz\n"); + dprintf("640x480 at 72Hz\n"); if (edid->established_timing.res_640x480x75) - dprintf("640x480x75Hz\n"); + dprintf("640x480 at 75Hz\n"); if (edid->established_timing.res_800x600x56) dprintf("800x600 at 56Hz\n"); if (edid->established_timing.res_800x600x60) @@ -106,7 +108,8 @@ monitor_range.min_h, monitor_range.max_h); dprintf("Vertical frequency range = %d..%d Hz\n", monitor_range.min_v, monitor_range.max_v); - dprintf("Maximum pixel clock = %d MHz\n", (uint16)monitor_range.max_clock * 10); + dprintf("Maximum pixel clock = %d MHz\n", + (uint16)monitor_range.max_clock * 10); break; } @@ -122,24 +125,23 @@ if (whitepoint->index == 0) continue; - dprintf("Additional whitepoint: (X,Y)=(%f,%f) gamma=%f index=%i\n", - whitepoint->white_x / 1024.0, - whitepoint->white_y / 1024.0, - (whitepoint->gamma + 100) / 100.0, - whitepoint->index); + dprintf("Additional whitepoint: (X,Y)=(%f,%f) gamma=%f " + "index=%i\n", whitepoint->white_x / 1024.0, + whitepoint->white_y / 1024.0, + (whitepoint->gamma + 100) / 100.0, whitepoint->index); } break; } case EDID1_ADD_STD_TIMING: - { + { for (j = 0; j < EDID1_NUM_EXTRA_STD_TIMING; ++j) { edid1_std_timing *timing = &monitor->data.std_timing[j]; if (timing->h_size <= 256) continue; - dprintf("%dx%d@%dHz (id=%d)\n", + dprintf("%dx%d@%dHz (id=%d)\n", timing->h_size, timing->v_size, timing->refresh, timing->id); } @@ -150,22 +152,22 @@ { edid1_detailed_timing *timing = &monitor->data.detailed_timing; dprintf("Additional Video Mode (%dx%d@%dHz):\n", - timing->h_active, timing->v_active, + timing->h_active, timing->v_active, (timing->pixel_clock * 10000 / (timing->h_active + timing->h_blank) / (timing->v_active + timing->v_blank))); // Refresh rate = pixel clock in MHz / Htotal / Vtotal dprintf("clock=%f MHz\n", timing->pixel_clock / 100.0); - dprintf("h: (%d, %d, %d, %d)\n", + dprintf("h: (%d, %d, %d, %d)\n", timing->h_active, timing->h_active + timing->h_sync_off, timing->h_active + timing->h_sync_off + timing->h_sync_width, timing->h_active + timing->h_blank); - dprintf("v: (%d, %d, %d, %d)\n", + dprintf("v: (%d, %d, %d, %d)\n", timing->v_active, timing->v_active + timing->v_sync_off, timing->v_active + timing->v_sync_off + timing->v_sync_width, timing->v_active + timing->v_blank); - dprintf("size: %.1f cm x %.1f cm\n", + dprintf("size: %.1f cm x %.1f cm\n", timing->h_size / 10.0, timing->v_size / 10.0); dprintf("border: %.1f cm x %.1f cm\n", timing->h_border / 10.0, timing->v_border / 10.0); From rudolfc at mail.berlios.de Mon May 4 20:58:38 2009 From: rudolfc at mail.berlios.de (rudolfc at BerliOS) Date: Mon, 4 May 2009 20:58:38 +0200 Subject: [Haiku-commits] r30627 - haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia Message-ID: <200905041858.n44IwcD5015481@sheep.berlios.de> Author: rudolfc Date: 2009-05-04 20:58:38 +0200 (Mon, 04 May 2009) New Revision: 30627 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30627&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html Log: updated docs: added id 0x01d7 which is confirmed operational by two users, and fixed id 0x1d8 which lacked laptop indication. Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html 2009-05-04 18:46:31 UTC (rev 30626) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html 2009-05-04 18:58:38 UTC (rev 30627) @@ -19,6 +19,7 @@
      • Fixed card/system hanging after trying to log LVDS/TMDS distinction info. This (at least) fixes one NV34 trying to startup after a failed kernel VESA modeswitch without using the driver's coldstart option. Might very well help on other type cards too.
      • HDTV video upto/including 1920x1080p can now be played back using overlay on Geforce cards where overlay is supported. On TNT1/TNT2/TNT2-M64 this can't be done and bitmap output is used.
      • Added partial DDC/EDID support: dumping monitor specs to logfile only for now. +
      • Added confirmed support for laptop card with ID 0x01d7: Quadro NVS 110M/GeForce 7300 Go. Also fixed support for laptop card with ID 0x01d8: GeForce 7400 Go: the 'laptop' definition was missing here.

      nv_driver 0.80 (Rudolf)

        From korli at mail.berlios.de Mon May 4 21:08:27 2009 From: korli at mail.berlios.de (korli at BerliOS) Date: Mon, 4 May 2009 21:08:27 +0200 Subject: [Haiku-commits] r30628 - haiku/trunk/src/bin Message-ID: <200905041908.n44J8RIt017392@sheep.berlios.de> Author: korli Date: 2009-05-04 21:08:27 +0200 (Mon, 04 May 2009) New Revision: 30628 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30628&view=rev Modified: haiku/trunk/src/bin/xres.cpp Log: fixes gcc4 warning Modified: haiku/trunk/src/bin/xres.cpp =================================================================== --- haiku/trunk/src/bin/xres.cpp 2009-05-04 18:58:38 UTC (rev 30627) +++ haiku/trunk/src/bin/xres.cpp 2009-05-04 19:08:27 UTC (rev 30628) @@ -354,7 +354,7 @@ resources.GetResourceInfo(i, &type, &id, &name, &size); i++) { - printf("'%s' %11ld %11lu %s\n", resource_type(type), id, size, + printf("'%s' %11ld %11u %s\n", resource_type(type), id, size, (name && strlen(name) > 0 ? name : "(no name)")); } } @@ -452,8 +452,8 @@ _PrepareOutput(); // filter resource - if (fInclusionPattern && !fInclusionPattern->Matches(id) - || fExclusionPattern && fExclusionPattern->Matches(id)) { + if ((fInclusionPattern && !fInclusionPattern->Matches(id)) + || (fExclusionPattern && fExclusionPattern->Matches(id))) { // not included or explicitly excluded return; } @@ -862,7 +862,7 @@ // don't allow "-l" together with other comands or without at least one // input file - if (list && noList || list && !hasInputFiles) + if ((list && noList) || (list && !hasInputFiles)) print_usage_and_exit(true); // create a state From axeld at mail.berlios.de Mon May 4 21:53:13 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Mon, 4 May 2009 21:53:13 +0200 Subject: [Haiku-commits] r30629 - haiku/trunk/src/apps/charactermap Message-ID: <200905041953.n44JrDFE025408@sheep.berlios.de> Author: axeld Date: 2009-05-04 21:53:12 +0200 (Mon, 04 May 2009) New Revision: 30629 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30629&view=rev Modified: haiku/trunk/src/apps/charactermap/CharacterView.cpp haiku/trunk/src/apps/charactermap/CharacterView.h haiku/trunk/src/apps/charactermap/CharacterWindow.cpp Log: * Reverted r30529 as this was pretty much bogus (sorry stpere, but the size of the window was already set with its constructor). * Fixed the actual cause of bug #3752 instead: the fCharacterHeight and fTitleHeight members were not initialized when MinSize() was called. Modified: haiku/trunk/src/apps/charactermap/CharacterView.cpp =================================================================== --- haiku/trunk/src/apps/charactermap/CharacterView.cpp 2009-05-04 19:08:27 UTC (rev 30628) +++ haiku/trunk/src/apps/charactermap/CharacterView.cpp 2009-05-04 19:53:12 UTC (rev 30629) @@ -33,6 +33,8 @@ { fTitleTops = new int32[kNumUnicodeBlocks]; fCharacterFont.SetSize(fCharacterFont.Size() * 1.5f); + + _UpdateFontSize(); } @@ -479,12 +481,8 @@ void -CharacterView::_UpdateSize() +CharacterView::_UpdateFontSize() { - // Compute data rect - - BRect bounds = Bounds(); - font_height fontHeight; GetFontHeight(&fontHeight); fTitleHeight = (int32)ceilf(fontHeight.ascent + fontHeight.descent @@ -510,7 +508,18 @@ fCharacterHeight += fGap; fTitleGap = fGap * 3; +} + +void +CharacterView::_UpdateSize() +{ + // Compute data rect + + BRect bounds = Bounds(); + + _UpdateFontSize(); + fDataRect.right = bounds.Width(); fDataRect.bottom = 0; @@ -583,7 +592,7 @@ CharacterView::_FrameFor(uint32 character) { // find block containing the character - + // TODO: could use binary search here for (uint32 i = 0; i < kNumUnicodeBlocks; i++) { Modified: haiku/trunk/src/apps/charactermap/CharacterView.h =================================================================== --- haiku/trunk/src/apps/charactermap/CharacterView.h 2009-05-04 19:08:27 UTC (rev 30628) +++ haiku/trunk/src/apps/charactermap/CharacterView.h 2009-05-04 19:53:12 UTC (rev 30629) @@ -59,6 +59,7 @@ int32 _BlockAt(BPoint point); bool _GetCharacterAt(BPoint point, uint32& character, BRect* _frame = NULL); + void _UpdateFontSize(); void _UpdateSize(); bool _GetTopmostCharacter(uint32& character, int32& offset); Modified: haiku/trunk/src/apps/charactermap/CharacterWindow.cpp =================================================================== --- haiku/trunk/src/apps/charactermap/CharacterWindow.cpp 2009-05-04 19:08:27 UTC (rev 30628) +++ haiku/trunk/src/apps/charactermap/CharacterWindow.cpp 2009-05-04 19:53:12 UTC (rev 30629) @@ -52,7 +52,7 @@ { SetModificationMessage(message); } - + protected: const char* UpdateText() const { @@ -126,9 +126,6 @@ if (settings.FindRect("window frame", &frame) == B_OK) { MoveTo(frame.LeftTop()); ResizeTo(frame.Width(), frame.Height()); - } else { - MoveTo(BPoint(100, 100)); - ResizeTo(600, 450); } // create GUI @@ -315,7 +312,7 @@ fSelectedFontItem = item; _SetFont(item->Menu()->Name(), item->Label()); - } + } break; } @@ -339,7 +336,7 @@ if (message->FindPointer("source", (void**)&item) != B_OK || item == NULL) break; - + item->SetMarked(!item->IsMarked()); fCharacterView->ShowPrivateBlocks(item->IsMarked()); @@ -353,7 +350,7 @@ if (message->FindPointer("source", (void**)&item) != B_OK || item == NULL) break; - + item->SetMarked(!item->IsMarked()); fCharacterView->ShowContainedBlocksOnly(item->IsMarked()); @@ -434,11 +431,11 @@ status = settings.AddBool("show contained blocks only", fCharacterView->IsShowingContainedBlocksOnly()); } - + if (status == B_OK) { BFont font = fCharacterView->CharacterFont(); status = settings.AddInt32("font size", font.Size()); - + font_family family; font_style style; if (status == B_OK) From oliver.ruiz.dorantes at gmail.com Mon May 4 22:15:58 2009 From: oliver.ruiz.dorantes at gmail.com (Oliver Ruiz Dorantes) Date: Mon, 4 May 2009 22:15:58 +0200 Subject: [Haiku-commits] r30561 - haiku/trunk/data/artwork/icons In-Reply-To: <200905021120.n42BK0mQ025436@sheep.berlios.de> References: <200905021120.n42BK0mQ025436@sheep.berlios.de> Message-ID: > Log: > This was actually the second version of the Bluetooth server icon... > Hi Stephan, I have the svg icons for that, but Raynald made me the rdef files. I can send you the originals by mail, to upload the correct format to the artwork folder. While I like too this second version of the Icon, I prefer having a hand for the server below, and without hand for the Preference. At least something that identifies that this is a server and that is a Preference(without having different BT styled logos around) Regards -- Oliver, -------------- next part -------------- An HTML attachment was scrubbed... URL: From axeld at pinc-software.de Mon May 4 22:30:48 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Mon, 04 May 2009 22:30:48 +0200 CEST Subject: [Haiku-commits] r30374 - haiku/trunk/src/apps/terminal In-Reply-To: Message-ID: <45632718825-BeMail@zon> J?r?me Duval wrote: > On behalf of Olivier (not present on this list): Thanks J?r?me! Bye, Axel. From bga at mail.berlios.de Tue May 5 03:31:02 2009 From: bga at mail.berlios.de (bga at BerliOS) Date: Tue, 5 May 2009 03:31:02 +0200 Subject: [Haiku-commits] r30630 - haiku/trunk/src/bin/bemail_utils Message-ID: <200905050131.n451V28I032349@sheep.berlios.de> Author: bga Date: 2009-05-05 03:31:01 +0200 (Tue, 05 May 2009) New Revision: 30630 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30630&view=rev Modified: haiku/trunk/src/bin/bemail_utils/spamdbm.cpp Log: - Revert to calling Minimize() on the window constructor as this works as expected now. - Yeah, yeah... Style guidelines. I just followed what is used throughout this file. :) Modified: haiku/trunk/src/bin/bemail_utils/spamdbm.cpp =================================================================== --- haiku/trunk/src/bin/bemail_utils/spamdbm.cpp 2009-05-04 19:53:12 UTC (rev 30629) +++ haiku/trunk/src/bin/bemail_utils/spamdbm.cpp 2009-05-05 01:31:01 UTC (rev 30630) @@ -4904,7 +4904,6 @@ } else { DatabaseWindowPntr->Show (); /* Starts the window's message loop. */ - DatabaseWindowPntr->Minimize (g_ServerMode); } } @@ -7057,6 +7056,12 @@ if (m_WordsViewPntr == NULL) goto ErrorExit; AddChild (m_WordsViewPntr); + + /* Minimize the window if we are starting up in server mode. This is done + before the window is open so it doesn't flash onto the screen, and possibly + steal a keystroke or two. The ControlsView will further update the minimize + mode when it detects changes in the server mode. */ + Minimize (g_ServerMode); return; From axeld at mail.berlios.de Tue May 5 12:05:12 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 5 May 2009 12:05:12 +0200 Subject: [Haiku-commits] r30631 - haiku/trunk/src/system/kernel Message-ID: <200905051005.n45A5CdX003907@sheep.berlios.de> Author: axeld Date: 2009-05-05 12:05:11 +0200 (Tue, 05 May 2009) New Revision: 30631 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30631&view=rev Modified: haiku/trunk/src/system/kernel/heap.cpp Log: * Style cleanup, mostly 80 character limit per line. Modified: haiku/trunk/src/system/kernel/heap.cpp =================================================================== --- haiku/trunk/src/system/kernel/heap.cpp 2009-05-05 01:31:01 UTC (rev 30630) +++ haiku/trunk/src/system/kernel/heap.cpp 2009-05-05 10:05:11 UTC (rev 30631) @@ -8,6 +8,7 @@ * Copyright 2001, Travis Geiselbrecht. All rights reserved. * Distributed under the terms of the NewOS License. */ + #include #include #include @@ -284,9 +285,9 @@ for (addr_t *temp = page->free_list; temp != NULL; temp = (addr_t *)*temp) count++; - dprintf("\t\tpage %p: bin_index: %u; free_count: %u; empty_index: %u; free_list %p (%lu entr%s)\n", - page, page->bin_index, page->free_count, page->empty_index, - page->free_list, count, count == 1 ? "y" : "ies"); + dprintf("\t\tpage %p: bin_index: %u; free_count: %u; empty_index: %u; " + "free_list %p (%lu entr%s)\n", page, page->bin_index, page->free_count, + page->empty_index, page->free_list, count, count == 1 ? "y" : "ies"); } @@ -315,10 +316,10 @@ { heap_area *area = heap->all_areas; while (area) { - dprintf("\tarea %p: area: %ld; base: 0x%08lx; size: %lu; page_count: %lu; free_pages: %p (%lu entr%s)\n", - area, area->area, area->base, area->size, area->page_count, - area->free_pages, area->free_page_count, - area->free_page_count == 1 ? "y" : "ies"); + dprintf("\tarea %p: area: %ld; base: 0x%08lx; size: %lu; page_count: " + "%lu; free_pages: %p (%lu entr%s)\n", area, area->area, area->base, + area->size, area->page_count, area->free_pages, + area->free_page_count, area->free_page_count == 1 ? "y" : "ies"); area = area->all_next; } @@ -329,8 +330,9 @@ static void dump_allocator(heap_allocator *heap, bool areas, bool bins) { - dprintf("allocator %p: name: %s; page_size: %lu; bin_count: %lu; pages: %lu; free_pages: %lu; empty_areas: %lu\n", heap, - heap->name, heap->page_size, heap->bin_count, heap->total_pages, + dprintf("allocator %p: name: %s; page_size: %lu; bin_count: %lu; pages: " + "%lu; free_pages: %lu; empty_areas: %lu\n", heap, heap->name, + heap->page_size, heap->bin_count, heap->total_pages, heap->total_free_pages, heap->empty_areas); if (areas) @@ -410,11 +412,14 @@ if (page->bin_index < heap->bin_count) { // page is used by a small allocation bin uint32 elementCount = page->empty_index; - size_t elementSize = heap->bins[page->bin_index].element_size; - for (uint32 j = 0; j < elementCount; j++, base += elementSize) { + size_t elementSize + = heap->bins[page->bin_index].element_size; + for (uint32 j = 0; j < elementCount; + j++, base += elementSize) { // walk the free list to see if this element is in use bool elementInUse = true; - for (addr_t *temp = page->free_list; temp != NULL; temp = (addr_t *)*temp) { + for (addr_t *temp = page->free_list; temp != NULL; + temp = (addr_t *)*temp) { if ((addr_t)temp == base) { elementInUse = false; break; @@ -447,8 +452,10 @@ uint32 pageCount = 1; while (i + pageCount < area->page_count && area->page_table[i + pageCount].in_use - && area->page_table[i + pageCount].bin_index == heap->bin_count - && area->page_table[i + pageCount].allocation_id == page->allocation_id) + && area->page_table[i + pageCount].bin_index + == heap->bin_count + && area->page_table[i + pageCount].allocation_id + == page->allocation_id) pageCount++; info = (heap_leak_check_info *)(base + pageCount @@ -786,16 +793,18 @@ if ((addr_t)&area->page_table[page->index] != (addr_t)page) panic("used page index does not lead to target page\n"); - if (page->prev != lastPage) - panic("used page entry has invalid prev link (%p vs %p bin %lu)\n", - page->prev, lastPage, i); + if (page->prev != lastPage) { + panic("used page entry has invalid prev link (%p vs %p bin " + "%lu)\n", page->prev, lastPage, i); + } if (!page->in_use) panic("used page marked as not in use\n"); - if (page->bin_index != i) + if (page->bin_index != i) { panic("used page with bin index %u in page list of bin %lu\n", page->bin_index, i); + } if (page->free_count < lastFreeCount) panic("ordering of bin page list broken\n"); @@ -817,9 +826,10 @@ } uint32 slotCount = bin->max_free_count; - if (page->empty_index > slotCount) + if (page->empty_index > slotCount) { panic("empty index beyond slot count (%u with %lu slots)\n", page->empty_index, slotCount); + } freeSlotsCount += (slotCount - page->empty_index); if (freeSlotsCount > slotCount) @@ -919,8 +929,9 @@ mutex_unlock(&heap->lock); - dprintf("heap_add_area: area %ld added to %s heap %p - usable range 0x%08lx - 0x%08lx\n", - area->area, heap->name, heap, area->base, area->base + area->size); + dprintf("heap_add_area: area %ld added to %s heap %p - usable range 0x%08lx " + "- 0x%08lx\n", area->area, heap->name, heap, area->base, + area->base + area->size); } @@ -970,8 +981,9 @@ if (!locked) mutex_unlock(&heap->lock); - dprintf("heap_remove_area: area %ld with range 0x%08lx - 0x%08lx removed from %s heap %p\n", - area->area, area->base, area->base + area->size, heap->name, heap); + dprintf("heap_remove_area: area %ld with range 0x%08lx - 0x%08lx removed " + "from %s heap %p\n", area->area, area->base, area->base + area->size, + heap->name, heap); return B_OK; } @@ -1311,7 +1323,8 @@ void *address = heap_raw_alloc(heap, size, binIndex); - TRACE(("memalign(): asked to allocate %lu bytes, returning pointer %p\n", size, address)); + TRACE(("memalign(): asked to allocate %lu bytes, returning pointer %p\n", + size, address)); #if KERNEL_HEAP_LEAK_CHECK size -= sizeof(heap_leak_check_info); @@ -1375,7 +1388,8 @@ heap_page *page = &area->page_table[((addr_t)address - area->base) / heap->page_size]; - TRACE(("free(): page %p: bin_index %d, free_count %d\n", page, page->bin_index, page->free_count)); + TRACE(("free(): page %p: bin_index %d, free_count %d\n", page, + page->bin_index, page->free_count)); if (page->bin_index > heap->bin_count) { panic("free(): page %p: invalid bin_index %d\n", page, page->bin_index); @@ -1389,7 +1403,8 @@ heap_bin *bin = &heap->bins[page->bin_index]; if (((addr_t)address - area->base - page->index * heap->page_size) % bin->element_size != 0) { - panic("free(): passed invalid pointer %p supposed to be in bin for element size %ld\n", address, bin->element_size); + panic("free(): passed invalid pointer %p supposed to be in bin for " + "element size %ld\n", address, bin->element_size); mutex_unlock(&heap->lock); return B_ERROR; } @@ -1398,9 +1413,11 @@ if (((uint32 *)address)[1] == 0xdeadbeef) { // This block looks like it was freed already, walk the free list // on this page to make sure this address doesn't exist. - for (addr_t *temp = page->free_list; temp != NULL; temp = (addr_t *)*temp) { + for (addr_t *temp = page->free_list; temp != NULL; + temp = (addr_t *)*temp) { if (temp == address) { - panic("free(): address %p already exists in page free list\n", address); + panic("free(): address %p already exists in page free " + "list\n", address); mutex_unlock(&heap->lock); return B_ERROR; } @@ -1409,12 +1426,14 @@ uint32 *dead = (uint32 *)address; if (bin->element_size % 4 != 0) { - panic("free(): didn't expect a bin element size that is not a multiple of 4\n"); + panic("free(): didn't expect a bin element size that is not a " + "multiple of 4\n"); mutex_unlock(&heap->lock); return B_ERROR; } - // the first 4 bytes are overwritten with the next free list pointer later + // the first 4 bytes are overwritten with the next free list pointer + // later for (uint32 i = 1; i < bin->element_size / sizeof(uint32); i++) dead[i] = 0xdeadbeef; #endif @@ -1521,7 +1540,8 @@ heap_page *page = &area->page_table[((addr_t)address - area->base) / heap->page_size]; if (page->bin_index > heap->bin_count) { - panic("realloc(): page %p: invalid bin_index %d\n", page, page->bin_index); + panic("realloc(): page %p: invalid bin_index %d\n", page, + page->bin_index); mutex_unlock(&heap->lock); return B_ERROR; } @@ -1671,7 +1691,7 @@ // one to make some room. TRACE(("heap_grower: grow heaps will run out of memory soon\n")); if (heap_create_new_heap_area(sGrowHeap, "additional grow heap", - HEAP_DEDICATED_GROW_SIZE) != B_OK) + HEAP_DEDICATED_GROW_SIZE) != B_OK) dprintf("heap_grower: failed to create new grow heap area\n"); } @@ -1684,7 +1704,7 @@ // allocation cannot be fulfilled due to lack of contiguous // pages) if (heap_create_new_heap_area(heap, "additional heap", - HEAP_GROW_SIZE) != B_OK) + HEAP_GROW_SIZE) != B_OK) dprintf("heap_grower: failed to create new heap area\n"); sLastHandledGrowRequest[i] = sLastGrowRequest[i]; } @@ -1768,7 +1788,8 @@ B_ANY_KERNEL_BLOCK_ADDRESS, HEAP_DEDICATED_GROW_SIZE, B_FULL_LOCK, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA); if (growHeapArea < B_OK) { - panic("heap_init_post_thread(): couldn't allocate dedicate grow heap area"); + panic("heap_init_post_thread(): couldn't allocate dedicate grow heap " + "area"); return growHeapArea; } @@ -1947,7 +1968,8 @@ && info->size == areaInfo.size && info->base == areaInfo.address && info->allocation_size < areaInfo.size) { delete_area(area); - TRACE(("free(): freed huge allocation by deleting area %ld\n", area)); + TRACE(("free(): freed huge allocation by deleting area %ld\n", + area)); return; } } @@ -2002,8 +2024,8 @@ if (available >= newSize) { // there is enough room available for the newSize - TRACE(("realloc(): new size %ld fits in old area %ld with %ld available\n", - newSize, area, available)); + TRACE(("realloc(): new size %ld fits in old area %ld with %ld " + "available\n", newSize, area, available)); return address; } @@ -2017,13 +2039,14 @@ memcpy(newAddress, address, min_c(newSize, info->allocation_size)); delete_area(area); - TRACE(("realloc(): allocated new block %p for size %ld and deleted old area %ld\n", - newAddress, newSize, area)); + TRACE(("realloc(): allocated new block %p for size %ld and deleted " + "old area %ld\n", newAddress, newSize, area)); return newAddress; } } - panic("realloc(): failed to realloc address %p to size %lu\n", address, newSize); + panic("realloc(): failed to realloc address %p to size %lu\n", address, + newSize); return NULL; } From axeld at mail.berlios.de Tue May 5 12:13:55 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 5 May 2009 12:13:55 +0200 Subject: [Haiku-commits] r30632 - haiku/trunk/src/system/kernel/cache Message-ID: <200905051013.n45ADtQU004893@sheep.berlios.de> Author: axeld Date: 2009-05-05 12:13:55 +0200 (Tue, 05 May 2009) New Revision: 30632 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30632&view=rev Modified: haiku/trunk/src/system/kernel/cache/file_cache.cpp Log: * Since PrecacheIO is used as asynchronous callback object, we must not access it anymore after having called vfs_asynchronous_read_pages(). * Now, Prepare() does all the preparation work, and ReadAsync() does the actual work - this must be called without having the cache locked. This also fixes another bug where the callback would be deleted twice in case the I/O request failed. * This fixes bug #3847. Modified: haiku/trunk/src/system/kernel/cache/file_cache.cpp =================================================================== --- haiku/trunk/src/system/kernel/cache/file_cache.cpp 2009-05-05 10:05:11 UTC (rev 30631) +++ haiku/trunk/src/system/kernel/cache/file_cache.cpp 2009-05-05 10:13:55 UTC (rev 30632) @@ -75,8 +75,8 @@ size_t size); ~PrecacheIO(); - status_t Init(); - status_t Start(); + status_t Prepare(); + void ReadAsync(); virtual void IOFinished(status_t status, bool partialTransfer, @@ -90,6 +90,7 @@ ConditionVariable* fBusyConditions; iovec* fVecs; off_t fOffset; + uint32 fVecCount; size_t fSize; }; @@ -116,6 +117,7 @@ fBusyConditions(NULL), fVecs(NULL), fOffset(offset), + fVecCount(0), fSize(size) { fPageCount = (size + B_PAGE_SIZE - 1) / B_PAGE_SIZE; @@ -133,7 +135,7 @@ status_t -PrecacheIO::Init() +PrecacheIO::Prepare() { if (fPageCount == 0) return B_BAD_VALUE; @@ -150,18 +152,7 @@ if (fVecs == NULL) return B_NO_MEMORY; - return B_OK; -} - - -/*! Cache has to be locked when calling this method, but it will be temporarily - unlocked during execution. -*/ -status_t -PrecacheIO::Start() -{ // allocate pages for the cache and mark them busy - uint32 vecCount = 0; uint32 i = 0; for (size_t pos = 0; pos < fSize; pos += B_PAGE_SIZE) { vm_page* page = vm_page_allocate_page(PAGE_STATE_FREE, true); @@ -171,7 +162,7 @@ fBusyConditions[i].Publish(page, "page"); fCache->InsertPage(page, fOffset + pos); - add_to_iovec(fVecs, vecCount, fPageCount, + add_to_iovec(fVecs, fVecCount, fPageCount, page->physical_page_number * B_PAGE_SIZE, B_PAGE_SIZE); fPages[i++] = page; } @@ -186,14 +177,17 @@ return B_NO_MEMORY; } - fCache->Unlock(); + return B_OK; +} - status_t status = vfs_asynchronous_read_pages(fRef->vnode, NULL, fOffset, - fVecs, vecCount, fSize, B_PHYSICAL_IO_REQUEST, this); - fCache->Lock(); - - return status; +void +PrecacheIO::ReadAsync() +{ + // This object is going to be deleted after the I/O request has been + // fulfilled + vfs_asynchronous_read_pages(fRef->vnode, NULL, fOffset, fVecs, fVecCount, + fSize, B_PHYSICAL_IO_REQUEST, this); } @@ -952,11 +946,16 @@ // read the part before the current page (or the end of the request) PrecacheIO* io = new(std::nothrow) PrecacheIO(ref, lastOffset, bytesToRead); - if (io == NULL || io->Init() != B_OK || io->Start() != B_OK) { + if (io == NULL || io->Prepare() != B_OK) { delete io; break; } + // we must not have the cache locked during I/O + cache->Unlock(); + io->ReadAsync(); + cache->Lock(); + bytesToRead = 0; } From axeld at mail.berlios.de Tue May 5 13:53:47 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 5 May 2009 13:53:47 +0200 Subject: [Haiku-commits] r30633 - haiku/trunk/src/system/kernel/fs Message-ID: <200905051153.n45Brl7c028357@sheep.berlios.de> Author: axeld Date: 2009-05-05 13:53:46 +0200 (Tue, 05 May 2009) New Revision: 30633 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30633&view=rev Modified: haiku/trunk/src/system/kernel/fs/rootfs.cpp Log: * Fixed two bugs in rootfs_rename(): the check of the result of rootfs_find_in_dir() was wrong, leading to never be able to find the fromName in the directory. Furthermore, the parent of the root directory is itself, but the check to see whether or not the target is valid did not take this into account, and therefore ran into an endless loop. This fixes bug #3864. * Rearranged rootfs_rename() to be clearer. * Style cleanup. Modified: haiku/trunk/src/system/kernel/fs/rootfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/rootfs.cpp 2009-05-05 10:13:55 UTC (rev 30632) +++ haiku/trunk/src/system/kernel/fs/rootfs.cpp 2009-05-05 11:53:46 UTC (rev 30633) @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Copyright 2002-2009, Axel D?rfler, axeld at pinc-software.de. * Distributed under the terms of the MIT License. * * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. @@ -45,44 +45,44 @@ struct rootfs_stream { - mode_t type; + mode_t type; struct stream_dir { - struct rootfs_vnode *dir_head; - struct list cookies; + struct rootfs_vnode* dir_head; + struct list cookies; } dir; struct stream_symlink { - char *path; - size_t length; + char* path; + size_t length; } symlink; }; struct rootfs_vnode { - struct rootfs_vnode *all_next; - ino_t id; - char *name; - time_t modification_time; - time_t creation_time; - uid_t uid; - gid_t gid; - struct rootfs_vnode *parent; - struct rootfs_vnode *dir_next; - struct rootfs_stream stream; + struct rootfs_vnode* all_next; + ino_t id; + char* name; + time_t modification_time; + time_t creation_time; + uid_t uid; + gid_t gid; + struct rootfs_vnode* parent; + struct rootfs_vnode* dir_next; + struct rootfs_stream stream; }; struct rootfs { - fs_volume *volume; - dev_t id; - mutex lock; - ino_t next_vnode_id; - hash_table *vnode_list_hash; - struct rootfs_vnode *root_vnode; + fs_volume* volume; + dev_t id; + mutex lock; + ino_t next_vnode_id; + hash_table* vnode_list_hash; + struct rootfs_vnode* root_vnode; }; // dircookie, dirs are only types of streams supported by rootfs struct rootfs_dir_cookie { - struct list_link link; - struct rootfs_vnode *current; - int32 state; // iteration state + struct list_link link; + struct rootfs_vnode* current; + int32 iteration_state; }; // directory iteration states @@ -103,10 +103,10 @@ static uint32 -rootfs_vnode_hash_func(void *_v, const void *_key, uint32 range) +rootfs_vnode_hash_func(void* _v, const void* _key, uint32 range) { - struct rootfs_vnode *vnode = (rootfs_vnode*)_v; - const ino_t *key = (const ino_t*)_key; + struct rootfs_vnode* vnode = (rootfs_vnode*)_v; + const ino_t* key = (const ino_t*)_key; if (vnode != NULL) return vnode->id % range; @@ -116,10 +116,10 @@ static int -rootfs_vnode_compare_func(void *_v, const void *_key) +rootfs_vnode_compare_func(void* _v, const void* _key) { - struct rootfs_vnode *v = (rootfs_vnode*)_v; - const ino_t *key = (const ino_t*)_key; + struct rootfs_vnode* v = (rootfs_vnode*)_v; + const ino_t* key = (const ino_t*)_key; if (v->id == *key) return 0; @@ -128,11 +128,11 @@ } -static struct rootfs_vnode * -rootfs_create_vnode(struct rootfs *fs, struct rootfs_vnode *parent, - const char *name, int type) +static struct rootfs_vnode* +rootfs_create_vnode(struct rootfs* fs, struct rootfs_vnode* parent, + const char* name, int type) { - struct rootfs_vnode *vnode; + struct rootfs_vnode* vnode; vnode = (rootfs_vnode*)malloc(sizeof(struct rootfs_vnode)); if (vnode == NULL) @@ -163,7 +163,7 @@ static status_t -rootfs_delete_vnode(struct rootfs *fs, struct rootfs_vnode *v, bool force_delete) +rootfs_delete_vnode(struct rootfs* fs, struct rootfs_vnode* v, bool force_delete) { // cant delete it if it's in a directory or is a directory // and has children @@ -180,12 +180,11 @@ } -/* makes sure none of the dircookies point to the vnode passed in */ - +/*! Makes sure none of the dircookies point to the vnode passed in. */ static void -update_dir_cookies(struct rootfs_vnode *dir, struct rootfs_vnode *vnode) +update_dir_cookies(struct rootfs_vnode* dir, struct rootfs_vnode* vnode) { - struct rootfs_dir_cookie *cookie = NULL; + struct rootfs_dir_cookie* cookie = NULL; while ((cookie = (rootfs_dir_cookie*)list_get_next_item( &dir->stream.dir.cookies, cookie)) != NULL) { @@ -195,10 +194,10 @@ } -static struct rootfs_vnode * -rootfs_find_in_dir(struct rootfs_vnode *dir, const char *path) +static struct rootfs_vnode* +rootfs_find_in_dir(struct rootfs_vnode* dir, const char* path) { - struct rootfs_vnode *vnode; + struct rootfs_vnode* vnode; if (!strcmp(path, ".")) return dir; @@ -206,7 +205,7 @@ return dir->parent; for (vnode = dir->stream.dir.dir_head; vnode; vnode = vnode->dir_next) { - if (strcmp(vnode->name, path) == 0) + if (!strcmp(vnode->name, path)) return vnode; } return NULL; @@ -214,13 +213,14 @@ static status_t -rootfs_insert_in_dir(struct rootfs *fs, struct rootfs_vnode *dir, - struct rootfs_vnode *vnode) +rootfs_insert_in_dir(struct rootfs* fs, struct rootfs_vnode* dir, + struct rootfs_vnode* vnode) { // make sure the directory stays sorted alphabetically - struct rootfs_vnode *node = dir->stream.dir.dir_head, *last = NULL; - while (node && strcmp(node->name, vnode->name) < 0) { + struct rootfs_vnode* node = dir->stream.dir.dir_head; + struct rootfs_vnode* last = NULL; + while (node != NULL && strcmp(node->name, vnode->name) < 0) { last = node; node = node->dir_next; } @@ -243,22 +243,23 @@ static status_t -rootfs_remove_from_dir(struct rootfs *fs, struct rootfs_vnode *dir, - struct rootfs_vnode *findit) +rootfs_remove_from_dir(struct rootfs* fs, struct rootfs_vnode* dir, + struct rootfs_vnode* removeVnode) { - struct rootfs_vnode *v; - struct rootfs_vnode *last_v; + struct rootfs_vnode* vnode; + struct rootfs_vnode* lastVnode; - for (v = dir->stream.dir.dir_head, last_v = NULL; v; last_v = v, v = v->dir_next) { - if (v == findit) { - /* make sure all dircookies dont point to this vnode */ - update_dir_cookies(dir, v); + for (vnode = dir->stream.dir.dir_head, lastVnode = NULL; vnode != NULL; + lastVnode = vnode, vnode = vnode->dir_next) { + if (vnode == removeVnode) { + // make sure all dircookies dont point to this vnode + update_dir_cookies(dir, vnode); - if (last_v) - last_v->dir_next = v->dir_next; + if (lastVnode) + lastVnode->dir_next = vnode->dir_next; else - dir->stream.dir.dir_head = v->dir_next; - v->dir_next = NULL; + dir->stream.dir.dir_head = vnode->dir_next; + vnode->dir_next = NULL; dir->modification_time = time(NULL); notify_stat_changed(fs->id, dir->id, B_STAT_MODIFICATION_TIME); @@ -270,17 +271,16 @@ static bool -rootfs_is_dir_empty(struct rootfs_vnode *dir) +rootfs_is_dir_empty(struct rootfs_vnode* dir) { return !dir->stream.dir.dir_head; } -/** You must hold the FS lock when calling this function */ - +/*! You must hold the FS lock when calling this function */ static status_t -remove_node(struct rootfs *fs, struct rootfs_vnode *directory, - struct rootfs_vnode *vnode) +remove_node(struct rootfs* fs, struct rootfs_vnode* directory, + struct rootfs_vnode* vnode) { // schedule this vnode to be removed when it's ref goes to zero @@ -303,9 +303,10 @@ static status_t -rootfs_remove(struct rootfs *fs, struct rootfs_vnode *dir, const char *name, bool isDirectory) +rootfs_remove(struct rootfs* fs, struct rootfs_vnode* dir, const char* name, + bool isDirectory) { - struct rootfs_vnode *vnode; + struct rootfs_vnode* vnode; status_t status = B_OK; mutex_lock(&fs->lock); @@ -336,11 +337,11 @@ static status_t -rootfs_mount(fs_volume *volume, const char *device, uint32 flags, - const char *args, ino_t *root_vnid) +rootfs_mount(fs_volume* volume, const char* device, uint32 flags, + const char* args, ino_t* _rootID) { - struct rootfs *fs; - struct rootfs_vnode *vnode; + struct rootfs* fs; + struct rootfs_vnode* vnode; status_t err; TRACE(("rootfs_mount: entry\n")); @@ -357,8 +358,9 @@ mutex_init(&fs->lock, "rootfs_mutex"); - fs->vnode_list_hash = hash_init(ROOTFS_HASH_SIZE, (addr_t)&vnode->all_next - (addr_t)vnode, - &rootfs_vnode_compare_func, &rootfs_vnode_hash_func); + fs->vnode_list_hash = hash_init(ROOTFS_HASH_SIZE, + (addr_t)&vnode->all_next - (addr_t)vnode, &rootfs_vnode_compare_func, + &rootfs_vnode_hash_func); if (fs->vnode_list_hash == NULL) { err = B_NO_MEMORY; goto err2; @@ -376,7 +378,7 @@ hash_insert(fs->vnode_list_hash, vnode); publish_vnode(volume, vnode->id, vnode, &sVnodeOps, vnode->stream.type, 0); - *root_vnid = vnode->id; + *_rootID = vnode->id; return B_OK; @@ -391,11 +393,9 @@ static status_t -rootfs_unmount(fs_volume *_volume) +rootfs_unmount(fs_volume* _volume) { - struct rootfs *fs = (struct rootfs *)_volume->private_volume; - struct rootfs_vnode *v; - struct hash_iterator i; + struct rootfs* fs = (struct rootfs*)_volume->private_volume; TRACE(("rootfs_unmount: entry fs = %p\n", fs)); @@ -403,10 +403,14 @@ put_vnode(fs->volume, fs->root_vnode->id); // delete all of the vnodes + struct hash_iterator i; hash_open(fs->vnode_list_hash, &i); - while ((v = (struct rootfs_vnode *)hash_next(fs->vnode_list_hash, &i)) != NULL) { - rootfs_delete_vnode(fs, v, true); + + while (struct rootfs_vnode* vnode = (struct rootfs_vnode*) + hash_next(fs->vnode_list_hash, &i)) { + rootfs_delete_vnode(fs, vnode, true); } + hash_close(fs->vnode_list_hash, &i, false); hash_uninit(fs->vnode_list_hash); @@ -418,7 +422,7 @@ static status_t -rootfs_sync(fs_volume *_volume) +rootfs_sync(fs_volume* _volume) { TRACE(("rootfs_sync: entry\n")); @@ -427,11 +431,11 @@ static status_t -rootfs_lookup(fs_volume *_volume, fs_vnode *_dir, const char *name, ino_t *_id) +rootfs_lookup(fs_volume* _volume, fs_vnode* _dir, const char* name, ino_t* _id) { - struct rootfs *fs = (struct rootfs *)_volume->private_volume; - struct rootfs_vnode *dir = (struct rootfs_vnode *)_dir->private_node; - struct rootfs_vnode *vnode; + struct rootfs* fs = (struct rootfs*)_volume->private_volume; + struct rootfs_vnode* dir = (struct rootfs_vnode*)_dir->private_node; + struct rootfs_vnode* vnode; status_t status; TRACE(("rootfs_lookup: entry dir %p, name '%s'\n", dir, name)); @@ -461,12 +465,13 @@ static status_t -rootfs_get_vnode_name(fs_volume *_volume, fs_vnode *_vnode, char *buffer, +rootfs_get_vnode_name(fs_volume* _volume, fs_vnode* _vnode, char* buffer, size_t bufferSize) { - struct rootfs_vnode *vnode = (struct rootfs_vnode *)_vnode->private_node; + struct rootfs_vnode* vnode = (struct rootfs_vnode*)_vnode->private_node; - TRACE(("rootfs_get_vnode_name: vnode = %p (name = %s)\n", vnode, vnode->name)); + TRACE(("rootfs_get_vnode_name: vnode = %p (name = %s)\n", vnode, + vnode->name)); strlcpy(buffer, vnode->name, bufferSize); return B_OK; @@ -474,11 +479,11 @@ static status_t -rootfs_get_vnode(fs_volume *_volume, ino_t id, fs_vnode *_vnode, int *_type, - uint32 *_flags, bool reenter) +rootfs_get_vnode(fs_volume* _volume, ino_t id, fs_vnode* _vnode, int* _type, + uint32* _flags, bool reenter) { - struct rootfs *fs = (struct rootfs *)_volume->private_volume; - struct rootfs_vnode *vnode; + struct rootfs* fs = (struct rootfs*)_volume->private_volume; + struct rootfs_vnode* vnode; TRACE(("rootfs_getvnode: asking for vnode %Ld, r %d\n", id, reenter)); @@ -490,7 +495,7 @@ if (!reenter) mutex_unlock(&fs->lock); - TRACE(("rootfs_getnvnode: looked it up at %p\n", *_vnode)); + TRACE(("rootfs_getnvnode: looked it up at %p\n", vnode)); if (vnode == NULL) return B_ENTRY_NOT_FOUND; @@ -505,10 +510,10 @@ static status_t -rootfs_put_vnode(fs_volume *_volume, fs_vnode *_vnode, bool reenter) +rootfs_put_vnode(fs_volume* _volume, fs_vnode* _vnode, bool reenter) { #ifdef TRACE_ROOTFS - struct rootfs_vnode *vnode = (struct rootfs_vnode *)_vnode->private_node; + struct rootfs_vnode* vnode = (struct rootfs_vnode*)_vnode->private_node; TRACE(("rootfs_putvnode: entry on vnode 0x%Lx, r %d\n", vnode->id, reenter)); #endif @@ -517,19 +522,21 @@ static status_t -rootfs_remove_vnode(fs_volume *_volume, fs_vnode *_vnode, bool reenter) +rootfs_remove_vnode(fs_volume* _volume, fs_vnode* _vnode, bool reenter) { - struct rootfs *fs = (struct rootfs *)_volume->private_volume; - struct rootfs_vnode *vnode = (struct rootfs_vnode *)_vnode->private_node; + struct rootfs* fs = (struct rootfs*)_volume->private_volume; + struct rootfs_vnode* vnode = (struct rootfs_vnode*)_vnode->private_node; - TRACE(("rootfs_remove_vnode: remove %p (0x%Lx), r %d\n", vnode, vnode->id, reenter)); + TRACE(("rootfs_remove_vnode: remove %p (0x%Lx), r %d\n", vnode, vnode->id, + reenter)); if (!reenter) mutex_lock(&fs->lock); if (vnode->dir_next) { // can't remove node if it's linked to the dir - panic("rootfs_remove_vnode: vnode %p asked to be removed is present in dir\n", vnode); + panic("rootfs_remove_vnode: vnode %p asked to be removed is present in " + "dir\n", vnode); } rootfs_delete_vnode(fs, vnode, false); @@ -542,15 +549,15 @@ static status_t -rootfs_create(fs_volume *_volume, fs_vnode *_dir, const char *name, int omode, - int perms, void **_cookie, ino_t *_newID) +rootfs_create(fs_volume* _volume, fs_vnode* _dir, const char* name, int omode, + int perms, void** _cookie, ino_t* _newID) { return B_BAD_VALUE; } static status_t -rootfs_open(fs_volume *_volume, fs_vnode *_v, int oflags, void **_cookie) +rootfs_open(fs_volume* _volume, fs_vnode* _v, int oflags, void** _cookie) { // allow to open the file, but it can't be done anything with it @@ -560,58 +567,54 @@ static status_t -rootfs_close(fs_volume *_volume, fs_vnode *_v, void *_cookie) +rootfs_close(fs_volume* _volume, fs_vnode* _vnode, void* _cookie) { -#ifdef TRACE_ROOTFS - struct rootfs_vnode *v = _v->private_node; - struct rootvoid **cookie = _cookie; - - TRACE(("rootfs_close: entry vnode %p, cookie %p\n", v, cookie)); -#endif + TRACE(("rootfs_close: entry vnode %p, cookie %p\n", _vnode->private_node, + _cookie)); return B_OK; } static status_t -rootfs_free_cookie(fs_volume *_volume, fs_vnode *_v, void *_cookie) +rootfs_free_cookie(fs_volume* _volume, fs_vnode* _v, void* _cookie) { return B_OK; } static status_t -rootfs_fsync(fs_volume *_volume, fs_vnode *_v) +rootfs_fsync(fs_volume* _volume, fs_vnode* _v) { return B_OK; } static status_t -rootfs_read(fs_volume *_volume, fs_vnode *_vnode, void *_cookie, - off_t pos, void *buffer, size_t *_length) +rootfs_read(fs_volume* _volume, fs_vnode* _vnode, void* _cookie, + off_t pos, void* buffer, size_t* _length) { return EINVAL; } static status_t -rootfs_write(fs_volume *_volume, fs_vnode *vnode, void *cookie, - off_t pos, const void *buffer, size_t *_length) +rootfs_write(fs_volume* _volume, fs_vnode* vnode, void* cookie, + off_t pos, const void* buffer, size_t* _length) { - TRACE(("rootfs_write: vnode %p, cookie %p, pos 0x%Lx , len 0x%lx\n", - vnode, cookie, pos, *_length)); + TRACE(("rootfs_write: vnode %p, cookie %p, pos 0x%Lx , len %#x\n", + vnode, cookie, pos, (int)*_length)); return EPERM; } static status_t -rootfs_create_dir(fs_volume *_volume, fs_vnode *_dir, const char *name, +rootfs_create_dir(fs_volume* _volume, fs_vnode* _dir, const char* name, int mode) { - struct rootfs *fs = (rootfs*)_volume->private_volume; - struct rootfs_vnode *dir = (rootfs_vnode*)_dir->private_node; - struct rootfs_vnode *vnode; + struct rootfs* fs = (rootfs*)_volume->private_volume; + struct rootfs_vnode* dir = (rootfs_vnode*)_dir->private_node; + struct rootfs_vnode* vnode; status_t status = 0; TRACE(("rootfs_create_dir: dir %p, name = '%s', perms = %d\n", dir, name, @@ -648,23 +651,24 @@ static status_t -rootfs_remove_dir(fs_volume *_volume, fs_vnode *_dir, const char *name) +rootfs_remove_dir(fs_volume* _volume, fs_vnode* _dir, const char* name) { - struct rootfs *fs = (rootfs*)_volume->private_volume; - struct rootfs_vnode *dir = (rootfs_vnode*)_dir->private_node; + struct rootfs* fs = (rootfs*)_volume->private_volume; + struct rootfs_vnode* dir = (rootfs_vnode*)_dir->private_node; - TRACE(("rootfs_remove_dir: dir %p (0x%Lx), name '%s'\n", dir, dir->id, name)); + TRACE(("rootfs_remove_dir: dir %p (0x%Lx), name '%s'\n", dir, dir->id, + name)); return rootfs_remove(fs, dir, name, true); } static status_t -rootfs_open_dir(fs_volume *_volume, fs_vnode *_v, void **_cookie) +rootfs_open_dir(fs_volume* _volume, fs_vnode* _v, void** _cookie) { - struct rootfs *fs = (struct rootfs *)_volume->private_volume; - struct rootfs_vnode *vnode = (struct rootfs_vnode *)_v->private_node; - struct rootfs_dir_cookie *cookie; + struct rootfs* fs = (struct rootfs*)_volume->private_volume; + struct rootfs_vnode* vnode = (struct rootfs_vnode*)_v->private_node; + struct rootfs_dir_cookie* cookie; TRACE(("rootfs_open: vnode %p\n", vnode)); @@ -678,7 +682,7 @@ mutex_lock(&fs->lock); cookie->current = vnode->stream.dir.dir_head; - cookie->state = ITERATION_STATE_BEGIN; + cookie->iteration_state = ITERATION_STATE_BEGIN; list_add_item(&vnode->stream.dir.cookies, cookie); *_cookie = cookie; @@ -690,11 +694,11 @@ static status_t -rootfs_free_dir_cookie(fs_volume *_volume, fs_vnode *_vnode, void *_cookie) +rootfs_free_dir_cookie(fs_volume* _volume, fs_vnode* _vnode, void* _cookie) { - struct rootfs_dir_cookie *cookie = (rootfs_dir_cookie*)_cookie; - struct rootfs_vnode *vnode = (rootfs_vnode*)_vnode->private_node; - struct rootfs *fs = (rootfs*)_volume->private_volume; + struct rootfs_dir_cookie* cookie = (rootfs_dir_cookie*)_cookie; + struct rootfs_vnode* vnode = (rootfs_vnode*)_vnode->private_node; + struct rootfs* fs = (rootfs*)_volume->private_volume; mutex_lock(&fs->lock); list_remove_item(&vnode->stream.dir.cookies, cookie); @@ -706,34 +710,35 @@ static status_t -rootfs_read_dir(fs_volume *_volume, fs_vnode *_vnode, void *_cookie, - struct dirent *dirent, size_t bufferSize, uint32 *_num) +rootfs_read_dir(fs_volume* _volume, fs_vnode* _vnode, void* _cookie, + struct dirent* dirent, size_t bufferSize, uint32* _num) { - struct rootfs_vnode *vnode = (struct rootfs_vnode *)_vnode->private_node; - struct rootfs_dir_cookie *cookie = (rootfs_dir_cookie*)_cookie; - struct rootfs *fs = (rootfs*)_volume->private_volume; + struct rootfs_vnode* vnode = (struct rootfs_vnode*)_vnode->private_node; + struct rootfs_dir_cookie* cookie = (rootfs_dir_cookie*)_cookie; + struct rootfs* fs = (rootfs*)_volume->private_volume; status_t status = B_OK; - struct rootfs_vnode *childNode = NULL; - const char *name = NULL; - struct rootfs_vnode *nextChildNode = NULL; - int nextState = cookie->state; + struct rootfs_vnode* childNode = NULL; + const char* name = NULL; + struct rootfs_vnode* nextChildNode = NULL; + int nextState = cookie->iteration_state; - TRACE(("rootfs_read_dir: vnode %p, cookie %p, buffer = %p, bufferSize = %ld, num = %p\n", _vnode, cookie, dirent, bufferSize,_num)); + TRACE(("rootfs_read_dir: vnode %p, cookie %p, buffer = %p, bufferSize = %d, " + "num = %p\n", _vnode, cookie, dirent, (int)bufferSize, _num)); mutex_lock(&fs->lock); - switch (cookie->state) { + switch (cookie->iteration_state) { case ITERATION_STATE_DOT: childNode = vnode; name = "."; nextChildNode = vnode->stream.dir.dir_head; - nextState = cookie->state + 1; + nextState = cookie->iteration_state + 1; break; case ITERATION_STATE_DOT_DOT: childNode = vnode->parent; name = ".."; nextChildNode = vnode->stream.dir.dir_head; - nextState = cookie->state + 1; + nextState = cookie->iteration_state + 1; break; default: childNode = cookie->current; @@ -765,7 +770,7 @@ goto err; cookie->current = nextChildNode; - cookie->state = nextState; + cookie->iteration_state = nextState; *_num = 1; status = B_OK; @@ -777,16 +782,16 @@ static status_t -rootfs_rewind_dir(fs_volume *_volume, fs_vnode *_vnode, void *_cookie) +rootfs_rewind_dir(fs_volume* _volume, fs_vnode* _vnode, void* _cookie) { - struct rootfs_dir_cookie *cookie = (rootfs_dir_cookie*)_cookie; - struct rootfs_vnode *vnode = (rootfs_vnode*)_vnode->private_node; - struct rootfs *fs = (rootfs*)_volume->private_volume; + struct rootfs_dir_cookie* cookie = (rootfs_dir_cookie*)_cookie; + struct rootfs_vnode* vnode = (rootfs_vnode*)_vnode->private_node; + struct rootfs* fs = (rootfs*)_volume->private_volume; mutex_lock(&fs->lock); cookie->current = vnode->stream.dir.dir_head; - cookie->state = ITERATION_STATE_BEGIN; + cookie->iteration_state = ITERATION_STATE_BEGIN; mutex_unlock(&fs->lock); return B_OK; @@ -794,43 +799,44 @@ static status_t -rootfs_ioctl(fs_volume *_volume, fs_vnode *_v, void *_cookie, ulong op, - void *buf, size_t len) +rootfs_ioctl(fs_volume* _volume, fs_vnode* _v, void* _cookie, ulong op, + void* buffer, size_t length) { - TRACE(("rootfs_ioctl: vnode %p, cookie %p, op %ld, buf %p, len %ld\n", _v, _cookie, op, buf, len)); + TRACE(("rootfs_ioctl: vnode %p, cookie %p, op %d, buf %p, length %d\n", + _volume, _cookie, (int)op, buffer, (int)length)); - return EINVAL; + return B_BAD_VALUE; } static bool -rootfs_can_page(fs_volume *_volume, fs_vnode *_v, void *cookie) +rootfs_can_page(fs_volume* _volume, fs_vnode* _v, void* cookie) { return false; } static status_t -rootfs_read_pages(fs_volume *_volume, fs_vnode *_v, void *cookie, off_t pos, - const iovec *vecs, size_t count, size_t *_numBytes) +rootfs_read_pages(fs_volume* _volume, fs_vnode* _v, void* cookie, off_t pos, + const iovec* vecs, size_t count, size_t* _numBytes) { return B_NOT_ALLOWED; } static status_t -rootfs_write_pages(fs_volume *_volume, fs_vnode *_v, void *cookie, off_t pos, - const iovec *vecs, size_t count, size_t *_numBytes) +rootfs_write_pages(fs_volume* _volume, fs_vnode* _v, void* cookie, off_t pos, + const iovec* vecs, size_t count, size_t* _numBytes) { return B_NOT_ALLOWED; } static status_t -rootfs_read_link(fs_volume *_volume, fs_vnode *_link, char *buffer, - size_t *_bufferSize) +rootfs_read_link(fs_volume* _volume, fs_vnode* _link, char* buffer, + size_t* _bufferSize) { - struct rootfs_vnode *link = (rootfs_vnode*)_link->private_node; + struct rootfs_vnode* link = (rootfs_vnode*)_link->private_node; if (!S_ISLNK(link->stream.type)) return B_BAD_VALUE; @@ -844,12 +850,12 @@ static status_t -rootfs_symlink(fs_volume *_volume, fs_vnode *_dir, const char *name, - const char *path, int mode) +rootfs_symlink(fs_volume* _volume, fs_vnode* _dir, const char* name, + const char* path, int mode) { - struct rootfs *fs = (rootfs*)_volume->private_volume; - struct rootfs_vnode *dir = (rootfs_vnode*)_dir->private_node; - struct rootfs_vnode *vnode; + struct rootfs* fs = (rootfs*)_volume->private_volume; + struct rootfs_vnode* dir = (rootfs_vnode*)_dir->private_node; + struct rootfs_vnode* vnode; status_t status = B_OK; TRACE(("rootfs_symlink: dir %p, name = '%s', path = %s\n", dir, name, path)); @@ -893,10 +899,10 @@ static status_t -rootfs_unlink(fs_volume *_volume, fs_vnode *_dir, const char *name) +rootfs_unlink(fs_volume* _volume, fs_vnode* _dir, const char* name) { - struct rootfs *fs = (rootfs*)_volume->private_volume; - struct rootfs_vnode *dir = (rootfs_vnode*)_dir->private_node; + struct rootfs* fs = (rootfs*)_volume->private_volume; + struct rootfs_vnode* dir = (rootfs_vnode*)_dir->private_node; TRACE(("rootfs_unlink: dir %p (0x%Lx), name '%s'\n", dir, dir->id, name)); @@ -905,66 +911,54 @@ static status_t -rootfs_rename(fs_volume *_volume, fs_vnode *_fromDir, const char *fromName, - fs_vnode *_toDir, const char *toName) +rootfs_rename(fs_volume* _volume, fs_vnode* _fromDir, const char* fromName, + fs_vnode* _toDir, const char* toName) { - struct rootfs *fs = (rootfs*)_volume->private_volume; - struct rootfs_vnode *fromDirectory = (rootfs_vnode*)_fromDir->private_node; - struct rootfs_vnode *toDirectory = (rootfs_vnode*)_toDir->private_node; - struct rootfs_vnode *vnode, *targetVnode, *parent; - status_t status; - char *nameBuffer = NULL; + struct rootfs* fs = (rootfs*)_volume->private_volume; + struct rootfs_vnode* fromDirectory = (rootfs_vnode*)_fromDir->private_node; + struct rootfs_vnode* toDirectory = (rootfs_vnode*)_toDir->private_node; - TRACE(("rootfs_rename: from %p (0x%Lx), fromName '%s', to %p (0x%Lx), toName '%s'\n", - fromDirectory, fromDirectory->id, fromName, toDirectory, toDirectory->id, toName)); + TRACE(("rootfs_rename: from %p (0x%Lx), fromName '%s', to %p (0x%Lx), " + "toName '%s'\n", fromDirectory, fromDirectory->id, fromName, toDirectory, + toDirectory->id, toName)); - mutex_lock(&fs->lock); + MutexLocker _(&fs->lock); - vnode = rootfs_find_in_dir(fromDirectory, fromName); - if (vnode != NULL) { - status = B_ENTRY_NOT_FOUND; - goto err; - } + struct rootfs_vnode* vnode = rootfs_find_in_dir(fromDirectory, fromName); + if (vnode == NULL) + return B_ENTRY_NOT_FOUND; - // make sure the target not a subdirectory of us - parent = toDirectory->parent; - while (parent != NULL) { - if (parent == vnode) { - status = B_BAD_VALUE; - goto err; - } + // make sure the target is not a subdirectory of us + struct rootfs_vnode* parent = toDirectory->parent; + while (parent != NULL && parent != parent->parent) { + if (parent == vnode) + return B_BAD_VALUE; parent = parent->parent; } - // we'll reuse the name buffer if possible - if (strlen(fromName) >= strlen(toName)) { - nameBuffer = strdup(toName); - if (nameBuffer == NULL) { - status = B_NO_MEMORY; - goto err; - } - } - - targetVnode = rootfs_find_in_dir(toDirectory, toName); + struct rootfs_vnode* targetVnode = rootfs_find_in_dir(toDirectory, toName); if (targetVnode != NULL) { // target node exists, let's see if it is an empty directory - if (S_ISDIR(targetVnode->stream.type) && !rootfs_is_dir_empty(targetVnode)) { - status = B_NAME_IN_USE; - goto err; - } + if (S_ISDIR(targetVnode->stream.type) + && !rootfs_is_dir_empty(targetVnode)) + return B_NAME_IN_USE; // so we can cleanly remove it remove_node(fs, toDirectory, targetVnode); } - // change the name on this node - if (nameBuffer == NULL) { - // we can just copy it - strcpy(vnode->name, toName); - } else { + // we try to reuse the existing name buffer if possible + if (strlen(fromName) >= strlen(toName)) { + char* nameBuffer = strdup(toName); + if (nameBuffer == NULL) + return B_NO_MEMORY; + free(vnode->name); vnode->name = nameBuffer; + } else { + // we can just copy it + strcpy(vnode->name, toName); } // remove it from the dir @@ -975,28 +969,24 @@ // so that it keeps sorted correctly. rootfs_insert_in_dir(fs, toDirectory, vnode); - notify_entry_moved(fs->id, fromDirectory->id, fromName, toDirectory->id, toName, vnode->id); - status = B_OK; + notify_entry_moved(fs->id, fromDirectory->id, fromName, toDirectory->id, + toName, vnode->id); -err: - if (status != B_OK) - free(nameBuffer); - - mutex_unlock(&fs->lock); - - return status; + return B_OK; } static status_t -rootfs_read_stat(fs_volume *_volume, fs_vnode *_v, struct stat *stat) +rootfs_read_stat(fs_volume* _volume, fs_vnode* _v, struct stat* stat) { - struct rootfs *fs = (rootfs*)_volume->private_volume; - struct rootfs_vnode *vnode = (rootfs_vnode*)_v->private_node; + struct rootfs* fs = (rootfs*)_volume->private_volume; + struct rootfs_vnode* vnode = (rootfs_vnode*)_v->private_node; - TRACE(("rootfs_read_stat: vnode %p (0x%Lx), stat %p\n", vnode, vnode->id, stat)); + TRACE(("rootfs_read_stat: vnode %p (0x%Lx), stat %p\n", vnode, vnode->id, + stat)); - // stream exists, but we know to return size 0, since we can only hold directories + // stream exists, but we know to return size 0, since we can only hold + // directories stat->st_dev = fs->id; stat->st_ino = vnode->id; if (S_ISLNK(vnode->stream.type)) @@ -1021,13 +1011,14 @@ static status_t -rootfs_write_stat(fs_volume *_volume, fs_vnode *_vnode, const struct stat *stat, +rootfs_write_stat(fs_volume* _volume, fs_vnode* _vnode, const struct stat* stat, uint32 statMask) { - struct rootfs *fs = (rootfs*)_volume->private_volume; - struct rootfs_vnode *vnode = (rootfs_vnode*)_vnode->private_node; + struct rootfs* fs = (rootfs*)_volume->private_volume; + struct rootfs_vnode* vnode = (rootfs_vnode*)_vnode->private_node; - TRACE(("rootfs_write_stat: vnode %p (0x%Lx), stat %p\n", vnode, vnode->id, stat)); + TRACE(("rootfs_write_stat: vnode %p (0x%Lx), stat %p\n", vnode, vnode->id, + stat)); // we cannot change the size of anything if (statMask & B_STAT_SIZE) @@ -1035,17 +1026,19 @@ mutex_lock(&fs->lock); - if (statMask & B_STAT_MODE) - vnode->stream.type = (vnode->stream.type & ~S_IUMSK) | (stat->st_mode & S_IUMSK); + if ((statMask & B_STAT_MODE) != 0) { + vnode->stream.type = (vnode->stream.type & ~S_IUMSK) + | (stat->st_mode & S_IUMSK); + } - if (statMask & B_STAT_UID) + if ((statMask & B_STAT_UID) != 0) vnode->uid = stat->st_uid; - if (statMask & B_STAT_GID) + if ((statMask & B_STAT_GID) != 0) vnode->gid = stat->st_gid; - if (statMask & B_STAT_MODIFICATION_TIME) + if ((statMask & B_STAT_MODIFICATION_TIME) != 0) vnode->modification_time = stat->st_mtime; - if (statMask & B_STAT_CREATION_TIME) + if ((statMask & B_STAT_CREATION_TIME) != 0) vnode->creation_time = stat->st_crtime; mutex_unlock(&fs->lock); @@ -1056,13 +1049,13 @@ static status_t -rootfs_create_special_node(fs_volume *_volume, fs_vnode *_dir, const char *name, - fs_vnode *subVnode, mode_t mode, uint32 flags, fs_vnode *_superVnode, - ino_t *_nodeID) +rootfs_create_special_node(fs_volume* _volume, fs_vnode* _dir, const char* name, + fs_vnode* subVnode, mode_t mode, uint32 flags, fs_vnode* _superVnode, + ino_t* _nodeID) { - struct rootfs *fs = (rootfs*)_volume->private_volume; - struct rootfs_vnode *dir = (rootfs_vnode*)_dir->private_node; - struct rootfs_vnode *vnode; + struct rootfs* fs = (rootfs*)_volume->private_volume; + struct rootfs_vnode* dir = (rootfs_vnode*)_dir->private_node; + struct rootfs_vnode* vnode; MutexLocker _(fs->lock); From zooey at mail.berlios.de Tue May 5 16:50:51 2009 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Tue, 5 May 2009 16:50:51 +0200 Subject: [Haiku-commits] r30634 - haiku/trunk/src/preferences/locale Message-ID: <200905051450.n45EopHc005704@sheep.berlios.de> Author: zooey Date: 2009-05-05 16:50:50 +0200 (Tue, 05 May 2009) New Revision: 30634 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30634&view=rev Modified: haiku/trunk/src/preferences/locale/LocaleWindow.cpp Log: * applied unchanged patch by PulkoMandy that converts the Locale prefs to use layout management Modified: haiku/trunk/src/preferences/locale/LocaleWindow.cpp =================================================================== --- haiku/trunk/src/preferences/locale/LocaleWindow.cpp 2009-05-05 11:53:46 UTC (rev 30633) +++ haiku/trunk/src/preferences/locale/LocaleWindow.cpp 2009-05-05 14:50:50 UTC (rev 30634) @@ -8,11 +8,13 @@ #include "LocaleWindow.h" #include +#include +#include +#include +#include #include +#include #include -#include -#include -#include const static uint32 kMsgSelectLanguage = 'slng'; @@ -24,59 +26,47 @@ : BWindow(rect, "Locale", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS) { - rect = Bounds(); - BView *view = new BView(rect, "view", B_FOLLOW_ALL, 0); - view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - AddChild(view); + // Buttons at the bottom - BButton *button = new BButton(rect, "defaults", "Defaults", - new BMessage(kMsgDefaults), B_FOLLOW_NONE); - button->ResizeToPreferred(); - button->MoveTo(10, rect.bottom - 10 - button->Bounds().Height()); - view->AddChild(button); + BButton *button = new BButton("Defaults", new BMessage(kMsgDefaults)); - fRevertButton = new BButton(rect, "revert", "Revert", - new BMessage(kMsgRevert), B_FOLLOW_NONE); - fRevertButton->ResizeToPreferred(); - fRevertButton->MoveTo(20 + button->Bounds().Width(), button->Frame().top); + fRevertButton = new BButton("Revert", new BMessage(kMsgRevert)); fRevertButton->SetEnabled(false); - view->AddChild(fRevertButton); - rect.InsetBy(10, 10); - rect.bottom -= 10 + button->Bounds().Height(); - BTabView *tabView = new BTabView(rect, "tabview"); + // Tabs + BTabView *tabView = new BTabView("tabview"); - rect = tabView->ContainerView()->Bounds(); - rect.InsetBy(2, 2); - BView *tab = new BView(rect, "Language", B_FOLLOW_NONE, B_WILL_DRAW); + // Language tab + + BView *tab = new BView("Language", B_WILL_DRAW); tab->SetViewColor(tabView->ViewColor()); + tab->SetLayout(new BGroupLayout(B_VERTICAL,10)); tabView->AddTab(tab); { - BRect frame = rect; - frame.InsetBy(12, 12); - frame.right = 100 + B_V_SCROLL_BAR_WIDTH; - frame.bottom = 150; - - BListView *listView = new BListView(frame, "preferred", B_SINGLE_SELECTION_LIST, - B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP); + BListView *listView = new BListView("preferred", B_SINGLE_SELECTION_LIST); listView->SetSelectionMessage(new BMessage(kMsgSelectLanguage)); BScrollView *scrollView = new BScrollView("scroller", listView, - B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP, 0, false, true, B_FANCY_BORDER); - tab->AddChild(scrollView); + 0, false, true, B_FANCY_BORDER); + tab->AddChild(BGroupLayoutBuilder(B_HORIZONTAL,10) + .Add(scrollView) + .AddGlue() + ); } - tab = new BView(rect, "Country", B_FOLLOW_NONE, B_WILL_DRAW); + // Country tab + + tab = new BView("Country", B_WILL_DRAW); tab->SetViewColor(tabView->ViewColor()); tabView->AddTab(tab); - tab = new BView(rect, "Keyboard", B_FOLLOW_NONE, B_WILL_DRAW); + // Keyboard tab + + tab = new BView("Keyboard", B_WILL_DRAW); tab->SetViewColor(tabView->ViewColor()); tabView->AddTab(tab); - view->AddChild(tabView); - // check if the window is on screen rect = BScreen().Frame(); @@ -90,6 +80,20 @@ position.y = (rect.Height() - Bounds().Height()) / 2; } MoveTo(position); + + // Layout management + + SetLayout(new BGroupLayout(B_HORIZONTAL)); + + AddChild(BGroupLayoutBuilder(B_VERTICAL,10) + .Add(tabView) + .Add(BGroupLayoutBuilder(B_HORIZONTAL,10) + .Add(button) + .Add(fRevertButton) + .AddGlue() + ) + .SetInsets(5,5,5,5) + ); } From bga at bug-br.org.br Tue May 5 17:09:24 2009 From: bga at bug-br.org.br (Bruno Albuquerque) Date: Tue, 05 May 2009 12:09:24 -0300 Subject: [Haiku-commits] r30634 - haiku/trunk/src/preferences/locale In-Reply-To: <200905051450.n45EopHc005704@sheep.berlios.de> References: <200905051450.n45EopHc005704@sheep.berlios.de> Message-ID: <4A0056A4.4050207@bug-br.org.br> zooey at BerliOS wrote: > Author: zooey > Date: 2009-05-05 16:50:50 +0200 (Tue, 05 May 2009) > New Revision: 30634 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30634&view=rev > > Modified: > haiku/trunk/src/preferences/locale/LocaleWindow.cpp > Log: > * applied unchanged patch by PulkoMandy that converts the Locale prefs to > use layout management BTW, is it expected that the Locale preferences app shows only an empty listbox and some tabs without any content whatsoever (this was before this change)? -Bruno From axeld at pinc-software.de Tue May 5 18:59:10 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Tue, 05 May 2009 18:59:10 +0200 CEST Subject: [Haiku-commits] r30634 - haiku/trunk/src/preferences/locale In-Reply-To: <4A0056A4.4050207@bug-br.org.br> Message-ID: <31901094349-BeMail@zon> Bruno Albuquerque wrote: > BTW, is it expected that the Locale preferences app shows only an > empty > listbox and some tabs without any content whatsoever (this was before > this change)? Yep, it was just left in its early stages. Bye, Axel. From superstippi at gmx.de Tue May 5 19:00:22 2009 From: superstippi at gmx.de (=?ISO-8859-1?Q?Stephan_A=DFmus?=) Date: Tue, 05 May 2009 19:00:22 +0200 Subject: [Haiku-commits] r30634 - haiku/trunk/src/preferences/locale In-Reply-To: <200905051450.n45EopHc005704@sheep.berlios.de> References: <200905051450.n45EopHc005704@sheep.berlios.de> Message-ID: <4A0070A6.8030904@gmx.de> zooey at BerliOS schrieb: > Author: zooey > Date: 2009-05-05 16:50:50 +0200 (Tue, 05 May 2009) > New Revision: 30634 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30634&view=rev > > Modified: > haiku/trunk/src/preferences/locale/LocaleWindow.cpp > Log: > * applied unchanged patch by PulkoMandy that converts the Locale prefs to > use layout management [...] > + tab->SetLayout(new BGroupLayout(B_VERTICAL,10)); [...] > + AddChild(BGroupLayoutBuilder(B_VERTICAL,10) > + .Add(tabView) > + .Add(BGroupLayoutBuilder(B_HORIZONTAL,10) > + .Add(button) > + .Add(fRevertButton) > + .AddGlue() > + ) > + .SetInsets(5,5,5,5) > + ); > } The coding style police is raising an eyebrow: There are supposed to be spaces after commas! Nice change otherwise! Best regards, -Stephan From axeld at mail.berlios.de Tue May 5 19:36:58 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 5 May 2009 19:36:58 +0200 Subject: [Haiku-commits] r30635 - haiku/trunk/src/tools Message-ID: <200905051736.n45HawD7019084@sheep.berlios.de> Author: axeld Date: 2009-05-05 19:36:57 +0200 (Tue, 05 May 2009) New Revision: 30635 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30635&view=rev Removed: haiku/trunk/src/tools/copy_to_bfs_image/ Modified: haiku/trunk/src/tools/Jamfile Log: * copy_to_bfs_image is no longer needed (and doesn't compile anymore, either). Modified: haiku/trunk/src/tools/Jamfile =================================================================== --- haiku/trunk/src/tools/Jamfile 2009-05-05 14:50:50 UTC (rev 30634) +++ haiku/trunk/src/tools/Jamfile 2009-05-05 17:36:57 UTC (rev 30635) @@ -104,7 +104,6 @@ SubInclude HAIKU_TOP src tools addattr ; SubInclude HAIKU_TOP src tools bfs_shell ; -SubInclude HAIKU_TOP src tools copy_to_bfs_image ; SubInclude HAIKU_TOP src tools cppunit ; SubInclude HAIKU_TOP src tools docbook ; SubInclude HAIKU_TOP src tools elfsymbolpatcher ; From zooey at mail.berlios.de Tue May 5 20:17:16 2009 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Tue, 5 May 2009 20:17:16 +0200 Subject: [Haiku-commits] r30636 - haiku/trunk/src/preferences/locale Message-ID: <200905051817.n45IHGVs010187@sheep.berlios.de> Author: zooey Date: 2009-05-05 20:17:16 +0200 (Tue, 05 May 2009) New Revision: 30636 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30636&view=rev Modified: haiku/trunk/src/preferences/locale/LocaleWindow.cpp Log: * applying patch by PulkoMandy that fix a couple of styleguide issues (missing spaces after commas) that were pointed out by Stephan Modified: haiku/trunk/src/preferences/locale/LocaleWindow.cpp =================================================================== --- haiku/trunk/src/preferences/locale/LocaleWindow.cpp 2009-05-05 17:36:57 UTC (rev 30635) +++ haiku/trunk/src/preferences/locale/LocaleWindow.cpp 2009-05-05 18:17:16 UTC (rev 30636) @@ -40,7 +40,7 @@ BView *tab = new BView("Language", B_WILL_DRAW); tab->SetViewColor(tabView->ViewColor()); - tab->SetLayout(new BGroupLayout(B_VERTICAL,10)); + tab->SetLayout(new BGroupLayout(B_VERTICAL, 10)); tabView->AddTab(tab); { @@ -49,7 +49,7 @@ BScrollView *scrollView = new BScrollView("scroller", listView, 0, false, true, B_FANCY_BORDER); - tab->AddChild(BGroupLayoutBuilder(B_HORIZONTAL,10) + tab->AddChild(BGroupLayoutBuilder(B_HORIZONTAL, 10) .Add(scrollView) .AddGlue() ); @@ -85,14 +85,14 @@ SetLayout(new BGroupLayout(B_HORIZONTAL)); - AddChild(BGroupLayoutBuilder(B_VERTICAL,10) + AddChild(BGroupLayoutBuilder(B_VERTICAL, 10) .Add(tabView) - .Add(BGroupLayoutBuilder(B_HORIZONTAL,10) + .Add(BGroupLayoutBuilder(B_HORIZONTAL, 10) .Add(button) .Add(fRevertButton) .AddGlue() ) - .SetInsets(5,5,5,5) + .SetInsets(5, 5, 5, 5) ); } From czeidler at mail.berlios.de Tue May 5 20:30:52 2009 From: czeidler at mail.berlios.de (czeidler at mail.berlios.de) Date: Tue, 5 May 2009 20:30:52 +0200 Subject: [Haiku-commits] r30637 - haiku/trunk/src/apps/mail Message-ID: <200905051830.n45IUq97011561@sheep.berlios.de> Author: czeidler Date: 2009-05-05 20:30:50 +0200 (Tue, 05 May 2009) New Revision: 30637 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30637&view=rev Modified: haiku/trunk/src/apps/mail/Prefs.cpp Log: Fix some spelling mistakes. Thanks to Jonas. Modified: haiku/trunk/src/apps/mail/Prefs.cpp =================================================================== --- haiku/trunk/src/apps/mail/Prefs.cpp 2009-05-05 18:17:16 UTC (rev 30636) +++ haiku/trunk/src/apps/mail/Prefs.cpp 2009-05-05 18:30:50 UTC (rev 30637) @@ -82,7 +82,7 @@ #define ENCODING_TEXT MDR_DIALECT_CHOICE ("Encoding:", "???????:") #define WARN_UNENCODABLE_TEXT MDR_DIALECT_CHOICE ("Warn Unencodable:", "??: ??????????") #define SPELL_CHECK_START_ON_TEXT MDR_DIALECT_CHOICE ("Initial Spell Check Mode:", "??????????:") -#define AUTO_MARK_READED_TEXT MDR_DIALECT_CHOICE ("Automaticly mark mail as readed:", "Automaticly mark mail as readed:") +#define AUTO_MARK_READED_TEXT MDR_DIALECT_CHOICE ("Automatically mark mail as read:", "Automatically mark mail as read:") #define BUTTONBAR_TEXT MDR_DIALECT_CHOICE ("Button Bar:", "?????:") From axeld at mail.berlios.de Tue May 5 22:06:50 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 5 May 2009 22:06:50 +0200 Subject: [Haiku-commits] r30638 - haiku/trunk/src/tests/add-ons/kernel/file_systems/iso9660 Message-ID: <200905052006.n45K6o62027901@sheep.berlios.de> Author: axeld Date: 2009-05-05 22:06:50 +0200 (Tue, 05 May 2009) New Revision: 30638 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30638&view=rev Removed: haiku/trunk/src/tests/add-ons/kernel/file_systems/iso9660/r5/ Log: * Removed old BeOS ISO9660 file system. From axeld at mail.berlios.de Tue May 5 22:07:24 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 5 May 2009 22:07:24 +0200 Subject: [Haiku-commits] r30639 - in haiku/trunk/src: add-ons/kernel/file_systems/iso9660 tests/add-ons/kernel/file_systems tests/add-ons/kernel/file_systems/iso9660 tests/add-ons/kernel/file_systems/iso9660/iso9660_shell Message-ID: <200905052007.n45K7OYG028067@sheep.berlios.de> Author: axeld Date: 2009-05-05 22:07:24 +0200 (Tue, 05 May 2009) New Revision: 30639 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30639&view=rev Removed: haiku/trunk/src/tests/add-ons/kernel/file_systems/iso9660/iso9660_shell/additional_commands.c haiku/trunk/src/tests/add-ons/kernel/file_systems/iso9660/iso9660_shell/additional_commands.h Modified: haiku/trunk/src/add-ons/kernel/file_systems/iso9660/iso9660.cpp haiku/trunk/src/add-ons/kernel/file_systems/iso9660/iso9660.h haiku/trunk/src/add-ons/kernel/file_systems/iso9660/iso9660_identify.cpp haiku/trunk/src/add-ons/kernel/file_systems/iso9660/iso9660_identify.h haiku/trunk/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp haiku/trunk/src/add-ons/kernel/file_systems/iso9660/rock_ridge.h haiku/trunk/src/tests/add-ons/kernel/file_systems/Jamfile haiku/trunk/src/tests/add-ons/kernel/file_systems/iso9660/Jamfile haiku/trunk/src/tests/add-ons/kernel/file_systems/iso9660/iso9660_shell/Jamfile Log: * Made the iso9660 file system buildable within the fs_shell (iso9660_shell). Modified: haiku/trunk/src/add-ons/kernel/file_systems/iso9660/iso9660.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/iso9660/iso9660.cpp 2009-05-05 20:06:50 UTC (rev 30638) +++ haiku/trunk/src/add-ons/kernel/file_systems/iso9660/iso9660.cpp 2009-05-05 20:07:24 UTC (rev 30639) @@ -9,19 +9,22 @@ #include "iso9660.h" #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#ifndef FS_SHELL +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +#endif + #include "rock_ridge.h" //#define TRACE_ISO9660 1 @@ -98,8 +101,8 @@ for (srcCount = 0; srcCount < srcLimit; srcCount += 2) { uint16 *UNICODE = (uint16 *)&src[srcCount]; - uchar utf8[4]; - uchar *UTF8 = utf8; + uint8 utf8[4]; + uint8 *UTF8 = utf8; int32 utf8Len; int32 j; Modified: haiku/trunk/src/add-ons/kernel/file_systems/iso9660/iso9660.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/iso9660/iso9660.h 2009-05-05 20:06:50 UTC (rev 30638) +++ haiku/trunk/src/add-ons/kernel/file_systems/iso9660/iso9660.h 2009-05-05 20:07:24 UTC (rev 30639) @@ -8,15 +8,19 @@ #define ISO_9660_H -#include "lock.h" +#if FS_SHELL +# include "fssh_api_wrapper.h" +#else +# include +# include +# include +# include -#include -#include +# include +# include -#include -#include -#include -#include +# include +#endif // Size of primary volume descriptor for ISO9660 Modified: haiku/trunk/src/add-ons/kernel/file_systems/iso9660/iso9660_identify.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/iso9660/iso9660_identify.cpp 2009-05-05 20:06:50 UTC (rev 30638) +++ haiku/trunk/src/add-ons/kernel/file_systems/iso9660/iso9660_identify.cpp 2009-05-05 20:07:24 UTC (rev 30639) @@ -1,5 +1,5 @@ /* - * Copyright 2007, Axel D?rfler, axeld at pinc-software.de. + * Copyright 2007-2009, Axel D?rfler, axeld at pinc-software.de. * Copyright 2002, Tyler Dauwalder. * * This file may be used under the terms of the MIT License. @@ -33,27 +33,29 @@ - 0x003A == ':' - 0x003B == ';' - 0x003F == '?' - - 0x005C == '\' + - 0x005C == '\' */ #include "iso9660_identify.h" -#include -#include -#include -#include -#include +#ifndef FS_SHELL +# include +# include +# include +# include +# include -#include -#include -#include +# include +# include +# include +#endif #include "iso9660.h" //#define TRACE(x) ; #define TRACE(x) dprintf x -// misc constants + static const char *kISO9660Signature = "CD001"; static const uint32 kVolumeDescriptorLength = 2048; #define ISO9660_VOLUME_IDENTIFIER_LENGTH 32 @@ -72,18 +74,18 @@ descriptor types. */ typedef struct iso9660_common_descriptor { - uchar type; + uint8 type; char standard_identifier[5]; // should be 'CD001' - uchar version; + uint8 version; // Remaining bytes are unused } __attribute__((packed)) iso9660_common_volume_descriptor; typedef struct iso9660_volume_descriptor { iso9660_common_descriptor common; - uchar flags; + uint8 flags; char system_identifier[32]; char identifier[ISO9660_VOLUME_IDENTIFIER_LENGTH]; - uchar _reserved0[8]; + uint8 _reserved0[8]; uint32 size; uint32 size_big_endian; char escape_sequences[ISO9660_ESCAPE_SEQUENCE_LENGTH]; @@ -97,7 +99,7 @@ uint32 path_table_size; uint32 path_table_size_big_endian; uint32 _reserved1[4]; - uchar root_directory_record[34]; + uint8 root_directory_record[34]; char set_identifier[28]; // Remaining bytes are disinteresting to us } __attribute__((packed)) iso9660_volume_descriptor; @@ -108,7 +110,7 @@ uint32 location; uint32 location_big_endian; uint32 data_length; - uchar _reserved[14]; + uint8 _reserved[14]; uint16 volume_space; } __attribute__((packed)) iso9660_directory_record; @@ -199,10 +201,10 @@ if (string == NULL) return; - TRACE(("iso9660_info::set_string(%p ('%s'), '%s', %ld)\n", string, - *string, newString, newLength)); + TRACE(("iso9660_info::set_string(%p ('%s'), '%s', %u)\n", string, + *string, newString, (unsigned)newLength)); - char *&oldString = *string; + char *&oldString = *string; free(oldString); if (newString) { @@ -213,7 +215,7 @@ } } else oldString = NULL; -} +} // #pragma mark - C functions @@ -293,16 +295,16 @@ dump_common_descriptor(&primary->common, indent, false); TRACE(("%s identifier: '%.32s'\n", indent, primary->identifier)); - TRACE(("%s size: %ld\n", indent, - B_LENDIAN_TO_HOST_INT32(primary->size))); - TRACE(("%s set size: %ld\n", indent, - B_LENDIAN_TO_HOST_INT32(primary->set_size))); - TRACE(("%s sequence number: %ld\n", indent, - B_LENDIAN_TO_HOST_INT32(primary->sequence_number))); - TRACE(("%s logical block size: %ld\n", indent, - B_LENDIAN_TO_HOST_INT32(primary->logical_block_size))); - TRACE(("%s path table size: %ld\n", indent, - B_LENDIAN_TO_HOST_INT32(primary->path_table_size))); + TRACE(("%s size: %d\n", indent, + (int)B_LENDIAN_TO_HOST_INT32(primary->size))); + TRACE(("%s set size: %d\n", indent, + (int)B_LENDIAN_TO_HOST_INT32(primary->set_size))); + TRACE(("%s sequence number: %d\n", indent, + (int)B_LENDIAN_TO_HOST_INT32(primary->sequence_number))); + TRACE(("%s logical block size: %d\n", indent, + (int)B_LENDIAN_TO_HOST_INT32(primary->logical_block_size))); + TRACE(("%s path table size: %d\n", indent, + (int)B_LENDIAN_TO_HOST_INT32(primary->path_table_size))); TRACE(("%s set identifier: %.28s\n", indent, primary->set_identifier)); dump_directory_record((iso9660_directory_record*) @@ -333,10 +335,10 @@ { TRACE(("%s root directory record:\n", indent)); TRACE(("%s length: %d\n", indent, record->length)); - TRACE(("%s location: %ld\n", indent, - B_LENDIAN_TO_HOST_INT32(record->location))); - TRACE(("%s data length: %ld\n", indent, - B_LENDIAN_TO_HOST_INT32(record->data_length))); + TRACE(("%s location: %d\n", indent, + (int)B_LENDIAN_TO_HOST_INT32(record->location))); + TRACE(("%s data length: %d\n", indent, + (int)B_LENDIAN_TO_HOST_INT32(record->data_length))); TRACE(("%s volume space: %d\n", indent, B_LENDIAN_TO_HOST_INT16(record->volume_space))); } @@ -360,7 +362,7 @@ /*! \brief Returns true if the given partition is a valid iso9660 partition. See fs_identify_hook() for more information. - + \todo Fill in partitionInfo->mounted_at with something useful. */ status_t @@ -480,7 +482,7 @@ name, info->joliet_name)); } - info->SetJolietName(name, pos - name); + info->SetJolietName(name, pos - name); } break; } @@ -495,7 +497,7 @@ default: break; } - } + } return found ? B_OK : error; } Modified: haiku/trunk/src/add-ons/kernel/file_systems/iso9660/iso9660_identify.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/iso9660/iso9660_identify.h 2009-05-05 20:06:50 UTC (rev 30638) +++ haiku/trunk/src/add-ons/kernel/file_systems/iso9660/iso9660_identify.h 2009-05-05 20:07:24 UTC (rev 30639) @@ -1,4 +1,4 @@ -/* +/* * Copyright 2007, Axel D?rfler, axeld at pinc-software.de. * Copyright 2002, Tyler Dauwalder. * @@ -8,7 +8,11 @@ #define ISO9660_IDENTIFY_H -#include +#if FS_SHELL +# include "fssh_api_wrapper.h" +#else +# include +#endif /*! \brief Contains all the info of interest pertaining to an Modified: haiku/trunk/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp 2009-05-05 20:06:50 UTC (rev 30638) +++ haiku/trunk/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp 2009-05-05 20:07:24 UTC (rev 30639) @@ -9,29 +9,32 @@ #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#ifndef FS_SHELL +# include +# include +# include +# include +# include +# include +# include +# include +# include -#include -#include -#include -#include -#include +# include +# include +# include +# include -#include +# include +# include +# include +# include +# include +# include +#endif + #include "iso9660.h" #include "iso9660_identify.h" @@ -285,7 +288,7 @@ } else { result = initResult; if (bytesRead == 0) - done = TRUE; + done = true; } blockData += bytesRead; blockBytesRead += bytesRead; @@ -302,7 +305,7 @@ block_cache_put(ns->fBlockCache, cachedBlock); } else - done = TRUE; + done = true; } TRACE(("fs_walk - EXIT, result is %s, vnid is %Lu\n", Modified: haiku/trunk/src/add-ons/kernel/file_systems/iso9660/rock_ridge.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/iso9660/rock_ridge.h 2009-05-05 20:06:50 UTC (rev 30638) +++ haiku/trunk/src/add-ons/kernel/file_systems/iso9660/rock_ridge.h 2009-05-05 20:07:24 UTC (rev 30639) @@ -2,26 +2,31 @@ Copyright 1999, Be Incorporated. All Rights Reserved. This file may be used under the terms of the Be Sample Code License. */ +#ifndef ROCK_RIDGE_H +#define ROCK_RIDGE_H + // Altername name field flags. -enum { +enum NMFLAGS { NM_CONTINUE = 1, NM_CURRENT = 2, NM_PARENT = 4, NM_HOST = 32 -} NMFLAGS; +}; // Symbolic link field flags -enum { +enum SLFLAGS { SL_CONTINUE = 1 -} SLFLAGS; +}; // Symbolic link field component flags -enum { +enum SLCPFLAGS { SLCP_CONTINUE = 1, - SLCP_CURRENT = 2, - SLCP_PARENT = 4, + SLCP_CURRENT = 2, + SLCP_PARENT = 4, SLCP_ROOT = 8, - SLCP_VOLROOT = 16, + SLCP_VOLROOT = 16, SLCP_HOST = 32 -} SLCPFLAGS; +}; + +#endif // ROCK_RIDGE_H Modified: haiku/trunk/src/tests/add-ons/kernel/file_systems/Jamfile =================================================================== --- haiku/trunk/src/tests/add-ons/kernel/file_systems/Jamfile 2009-05-05 20:06:50 UTC (rev 30638) +++ haiku/trunk/src/tests/add-ons/kernel/file_systems/Jamfile 2009-05-05 20:07:24 UTC (rev 30639) @@ -1,12 +1,12 @@ SubDir HAIKU_TOP src tests add-ons kernel file_systems ; -SubInclude HAIKU_TOP src tests add-ons kernel file_systems bfs ; -SubInclude HAIKU_TOP src tests add-ons kernel file_systems cdda ; -SubInclude HAIKU_TOP src tests add-ons kernel file_systems consistency_check ; -SubInclude HAIKU_TOP src tests add-ons kernel file_systems fs_shell ; -SubInclude HAIKU_TOP src tests add-ons kernel file_systems fragmenter ; -#SubInclude HAIKU_TOP src tests add-ons kernel file_systems iso9660 ; -SubInclude HAIKU_TOP src tests add-ons kernel file_systems random_file_actions ; -SubInclude HAIKU_TOP src tests add-ons kernel file_systems random_read ; -SubInclude HAIKU_TOP src tests add-ons kernel file_systems udf ; -SubInclude HAIKU_TOP src tests add-ons kernel file_systems userlandfs ; +HaikuSubInclude bfs ; +HaikuSubInclude cdda ; +HaikuSubInclude consistency_check ; +HaikuSubInclude fs_shell ; +HaikuSubInclude fragmenter ; +HaikuSubInclude iso9660 ; +HaikuSubInclude random_file_actions ; +HaikuSubInclude random_read ; +HaikuSubInclude udf ; +HaikuSubInclude userlandfs ; Modified: haiku/trunk/src/tests/add-ons/kernel/file_systems/iso9660/Jamfile =================================================================== --- haiku/trunk/src/tests/add-ons/kernel/file_systems/iso9660/Jamfile 2009-05-05 20:06:50 UTC (rev 30638) +++ haiku/trunk/src/tests/add-ons/kernel/file_systems/iso9660/Jamfile 2009-05-05 20:07:24 UTC (rev 30639) @@ -1,3 +1,3 @@ SubDir HAIKU_TOP src tests add-ons kernel file_systems iso9660 ; -SubInclude HAIKU_TOP src tests add-ons kernel file_systems iso9660 iso9660_shell ; +HaikuSubInclude iso9660_shell ; Modified: haiku/trunk/src/tests/add-ons/kernel/file_systems/iso9660/iso9660_shell/Jamfile =================================================================== --- haiku/trunk/src/tests/add-ons/kernel/file_systems/iso9660/iso9660_shell/Jamfile 2009-05-05 20:06:50 UTC (rev 30638) +++ haiku/trunk/src/tests/add-ons/kernel/file_systems/iso9660/iso9660_shell/Jamfile 2009-05-05 20:07:24 UTC (rev 30639) @@ -1,31 +1,34 @@ SubDir HAIKU_TOP src tests add-ons kernel file_systems iso9660 iso9660_shell ; -SubDirHdrs $(HAIKU_TOP) src add-ons kernel file_systems iso9660 ; -SubDirHdrs $(HAIKU_TOP) src tests add-ons kernel file_systems fs_shell ; +UsePrivateHeaders fs_shell ; +SEARCH_SOURCE + += [ FDirName $(HAIKU_TOP) src add-ons kernel file_systems iso9660 ] ; + +# set some additional defines { - local defines = [ FDefines USER DEBUG ] ; # _NO_INLINE_ASM - SubDirCcFlags $(defines) -fno-exceptions -fno-rtti ; #-fcheck-memory-usage + local defines = [ FDefines FS_SHELL USER DEBUG ] ; + SubDirCcFlags $(defines) -Wall -Wno-multichar ; + SubDirC++Flags $(defines) -Wall -Wno-multichar -fno-exceptions ; } -local fsShellSources = - fsh.c rootfs.c initfs.c kernel.c cache.c external_commands.cpp sl.c - stub.c tracker.cpp sysdep.c hexdump.c argv.c -; +local libHaikuCompat ; +if $(HOST_PLATFORM_BEOS_COMPATIBLE) && ! $(HOST_PLATFORM_HAIKU_COMPATIBLE) { + libHaikuCompat = libhaikucompat_build.a ; +} -SimpleTest iso9660_shell - : - $(fsShellSources) +# platform specific libraries +local fsShellCommandLibs ; +if ! $(HOST_PLATFORM_BEOS_COMPATIBLE) { + fsShellCommandLibs = $(HOST_NETWORK_LIBS) ; +} - iso.c kernel_interface.c +BuildPlatformMain iso9660_shell : - ; + iso9660.cpp + iso9660_identify.cpp + kernel_interface.cpp -# Tell Jam where to find these sources -SEARCH on [ FGristFiles - iso.c kernel_interface.c - ] = [ FDirName $(HAIKU_TOP) src add-ons kernel file_systems iso9660 ] ; - -SEARCH on [ FGristFiles - $(fsShellSources) - ] = [ FDirName $(HAIKU_TOP) src tests add-ons kernel file_systems fs_shell ] ; + : fs_shell.a $(libHaikuCompat) $(HOST_LIBSUPC++) $(HOST_LIBSTDC++) + $(HOST_LIBROOT) $(fsShellCommandLibs) +; Deleted: haiku/trunk/src/tests/add-ons/kernel/file_systems/iso9660/iso9660_shell/additional_commands.c Deleted: haiku/trunk/src/tests/add-ons/kernel/file_systems/iso9660/iso9660_shell/additional_commands.h From fekdahl at gmail.com Tue May 5 22:13:16 2009 From: fekdahl at gmail.com (Fredrik Ekdahl) Date: Tue, 05 May 2009 22:13:16 +0200 Subject: [Haiku-commits] r30637 - haiku/trunk/src/apps/mail In-Reply-To: <200905051830.n45IUq97011561@sheep.berlios.de> References: <200905051830.n45IUq97011561@sheep.berlios.de> Message-ID: <4A009DDC.5050206@gmail.com> czeidler at mail.berlios.de skrev: > Author: czeidler > Date: 2009-05-05 20:30:50 +0200 (Tue, 05 May 2009) > New Revision: 30637 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30637&view=rev > > Modified: > haiku/trunk/src/apps/mail/Prefs.cpp > Log: > Fix some spelling mistakes. Thanks to Jonas. > > > Modified: haiku/trunk/src/apps/mail/Prefs.cpp > =================================================================== > --- haiku/trunk/src/apps/mail/Prefs.cpp 2009-05-05 18:17:16 UTC (rev 30636) > +++ haiku/trunk/src/apps/mail/Prefs.cpp 2009-05-05 18:30:50 UTC (rev 30637) > @@ -82,7 +82,7 @@ > #define ENCODING_TEXT MDR_DIALECT_CHOICE ("Encoding:", "???????:") > #define WARN_UNENCODABLE_TEXT MDR_DIALECT_CHOICE ("Warn Unencodable:", "??: ??????????") > #define SPELL_CHECK_START_ON_TEXT MDR_DIALECT_CHOICE ("Initial Spell Check Mode:", "??????????:") > -#define AUTO_MARK_READED_TEXT MDR_DIALECT_CHOICE ("Automaticly mark mail as readed:", "Automaticly mark mail as readed:") > +#define AUTO_MARK_READED_TEXT MDR_DIALECT_CHOICE ("Automatically mark mail as read:", "Automatically mark mail as read:") > What about the define? AUTO_MARK_READED_TEXT :) -- /Fredrik Ekdahl From axeld at mail.berlios.de Tue May 5 22:55:47 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 5 May 2009 22:55:47 +0200 Subject: [Haiku-commits] r30640 - haiku/trunk/src/add-ons/kernel/file_systems/iso9660 Message-ID: <200905052055.n45KtlRT002655@sheep.berlios.de> Author: axeld Date: 2009-05-05 22:55:47 +0200 (Tue, 05 May 2009) New Revision: 30640 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30640&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/iso9660/iso9660.cpp haiku/trunk/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp Log: Fixed two crashing bugs, one of them mentioned in ticket #3861: * ISOReadDirEnt() did happily read after the 2048 byte block. Now we check after having processed an entry if the position is on the 2048 block boundary, and skip to the next block directly. * fs_walk() assumed a 2 block set (and accessed memory therein), but only has access to a single block. I haven't looked at the specs, so I'm not really sure what the old code tried to achieve. In any case, it doesn't crash anymore. Modified: haiku/trunk/src/add-ons/kernel/file_systems/iso9660/iso9660.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/iso9660/iso9660.cpp 2009-05-05 20:07:24 UTC (rev 30639) +++ haiku/trunk/src/add-ons/kernel/file_systems/iso9660/iso9660.cpp 2009-05-05 20:55:47 UTC (rev 30640) @@ -738,6 +738,11 @@ } cookie->pos += bytesRead; } + + if (cookie->pos == volume->logicalBlkSize[FS_DATA_FORMAT]) { + cookie->pos = 0; + cookie->block++; + } } else { if (totalRead >= cookie->totalSize) result = B_ENTRY_NOT_FOUND; Modified: haiku/trunk/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp 2009-05-05 20:07:24 UTC (rev 30639) +++ haiku/trunk/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp 2009-05-05 20:55:47 UTC (rev 30640) @@ -246,66 +246,66 @@ while (totalRead < dataLength && !done) { off_t cachedBlock = block; char* blockData = (char*)block_cache_get(ns->fBlockCache, block); - if (blockData != NULL) { - size_t bytesRead = 0; - off_t blockBytesRead = 0; - iso9660_inode node; - int initResult; + if (blockData == NULL) + break; - TRACE(("fs_walk - read buffer from disk at LBN %Ld into buffer " - "%p.\n", block, blockData)); + size_t bytesRead = 0; + off_t blockBytesRead = 0; + iso9660_inode node; + int initResult; - // Move to the next 2-block set if necessary - // Don't go over end of buffer, if dir record sits on boundary. + TRACE(("fs_walk - read buffer from disk at LBN %Ld into buffer " + "%p.\n", block, blockData)); - while (blockBytesRead < 2 * ns->logicalBlkSize[FS_DATA_FORMAT] - && totalRead + blockBytesRead < dataLength - && blockData[0] != 0 - && !done) { - initResult = InitNode(&node, blockData, &bytesRead, - ns->joliet_level); - TRACE(("fs_walk - InitNode returned %s, filename %s, %lu bytes " - "read\n", strerror(initResult), node.name, - bytesRead)); + // Move to the next block if necessary + // Don't go over end of buffer, if dir record sits on boundary. - if (initResult == B_OK) { - if (!strcmp(node.name, file)) { - TRACE(("fs_walk - success, found vnode at block %Ld, pos %Ld\n", block, blockBytesRead)); - *_vnodeID = (block << 30) - + (blockBytesRead & 0xffffffff); - TRACE(("fs_walk - New vnode id is %Ld\n", *_vnodeID)); + while (blockBytesRead < ns->logicalBlkSize[FS_DATA_FORMAT] + && totalRead + blockBytesRead < dataLength + && blockData[0] != 0 + && !done) { + initResult = InitNode(&node, blockData, &bytesRead, + ns->joliet_level); + TRACE(("fs_walk - InitNode returned %s, filename %s, %lu bytes " + "read\n", strerror(initResult), node.name, + bytesRead)); - result = get_vnode(_vol, *_vnodeID, - (void **)&newNode); - if (result == B_OK) { - newNode->parID = baseNode->id; - done = true; - } - } else { - free(node.name); - free(node.attr.slName); + if (initResult == B_OK) { + if (!strcmp(node.name, file)) { + TRACE(("fs_walk - success, found vnode at block %Ld, pos " + "%Ld\n", block, blockBytesRead)); + + *_vnodeID = (block << 30) + (blockBytesRead & 0xffffffff); + TRACE(("fs_walk - New vnode id is %Ld\n", *_vnodeID)); + + result = get_vnode(_vol, *_vnodeID, + (void **)&newNode); + if (result == B_OK) { + newNode->parID = baseNode->id; + done = true; } } else { - result = initResult; - if (bytesRead == 0) - done = true; + free(node.name); + free(node.attr.slName); } - blockData += bytesRead; - blockBytesRead += bytesRead; - - TRACE(("fs_walk - Adding %lu bytes to blockBytes read (total " - "%Ld/%lu).\n", bytesRead, blockBytesRead, - baseNode->dataLen[FS_DATA_FORMAT])); + } else { + result = initResult; + if (bytesRead == 0) + done = true; } - totalRead += ns->logicalBlkSize[FS_DATA_FORMAT]; - block++; + blockData += bytesRead; + blockBytesRead += bytesRead; - TRACE(("fs_walk - moving to next block %Ld, total read %lu\n", - block, totalRead)); - block_cache_put(ns->fBlockCache, cachedBlock); + TRACE(("fs_walk - Adding %lu bytes to blockBytes read (total " + "%Ld/%lu).\n", bytesRead, blockBytesRead, + baseNode->dataLen[FS_DATA_FORMAT])); + } + totalRead += ns->logicalBlkSize[FS_DATA_FORMAT]; + block++; - } else - done = true; + TRACE(("fs_walk - moving to next block %Ld, total read %lu\n", + block, totalRead)); + block_cache_put(ns->fBlockCache, cachedBlock); } TRACE(("fs_walk - EXIT, result is %s, vnid is %Lu\n", From mmlr at mail.berlios.de Wed May 6 04:03:27 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Wed, 6 May 2009 04:03:27 +0200 Subject: [Haiku-commits] r30641 - haiku/trunk/src/add-ons/kernel/bus_managers/usb Message-ID: <200905060203.n4623RMv022353@sheep.berlios.de> Author: mmlr Date: 2009-05-06 04:03:25 +0200 (Wed, 06 May 2009) New Revision: 30641 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30641&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/usb/Hub.cpp Log: When doing removal notifications for USB devices, report the hub after the children. Otherwise a driver that builds up a device hierarchy could run into trouble when the parent hub is removed before its child devices. Not that there were any drivers that do so, but it just seems more correct. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/usb/Hub.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/usb/Hub.cpp 2009-05-05 20:55:47 UTC (rev 30640) +++ haiku/trunk/src/add-ons/kernel/bus_managers/usb/Hub.cpp 2009-05-06 02:03:25 UTC (rev 30641) @@ -349,16 +349,16 @@ uint32 supportDescriptorCount, const usb_notify_hooks *hooks, usb_driver_cookie **cookies, bool added, bool recursive) { - TRACE("reporting hub\n"); + status_t result = B_UNSUPPORTED; - // Report ourselfs first - status_t result = Device::ReportDevice(supportDescriptors, - supportDescriptorCount, hooks, cookies, added, recursive); + if (added) { + // Report hub before children when adding devices + TRACE("reporting hub before children\n"); + result = Device::ReportDevice(supportDescriptors, + supportDescriptorCount, hooks, cookies, added, recursive); + } - if (!recursive) - return result; - - for (int32 i = 0; i < fHubDescriptor.num_ports; i++) { + for (int32 i = 0; recursive && i < fHubDescriptor.num_ports; i++) { if (!fChildren[i]) continue; @@ -367,6 +367,14 @@ result = B_OK; } + if (!added) { + // Report hub after children when removing devices + TRACE("reporting hub after children\n"); + if (Device::ReportDevice(supportDescriptors, supportDescriptorCount, + hooks, cookies, added, recursive) == B_OK) + result = B_OK; + } + return result; } From mmlr at mail.berlios.de Wed May 6 13:47:49 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Wed, 6 May 2009 13:47:49 +0200 Subject: [Haiku-commits] r30642 - haiku/trunk/src/add-ons/kernel/bus_managers/ata Message-ID: <200905061147.n46Blnrc021760@sheep.berlios.de> Author: mmlr Date: 2009-05-06 13:47:48 +0200 (Wed, 06 May 2009) New Revision: 30642 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30642&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ATAChannel.cpp Log: Add three more error checks for paranoias sake. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ATAChannel.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ATAChannel.cpp 2009-05-06 02:03:25 UTC (rev 30641) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ATAChannel.cpp 2009-05-06 11:47:48 UTC (rev 30642) @@ -264,7 +264,13 @@ taskFile.lba.mode = ATA_MODE_LBA; taskFile.lba.device = device; - _WriteRegs(&taskFile, ATA_MASK_DEVICE_HEAD); + status_t result = _WriteRegs(&taskFile, ATA_MASK_DEVICE_HEAD); + if (result != B_OK) { + TRACE_ERROR("writing register failed when trying to select device %d\n", + device); + return result; + } + _FlushAndWait(1); #if 0 @@ -285,7 +291,11 @@ ATAChannel::SelectedDevice() { ata_task_file taskFile; - _ReadRegs(&taskFile, ATA_MASK_DEVICE_HEAD); + if (_ReadRegs(&taskFile, ATA_MASK_DEVICE_HEAD) != B_OK) { + TRACE_ERROR("reading register failed when detecting selected device\n"); + return 2; + } + return taskFile.lba.device; } @@ -321,9 +331,7 @@ uint8 deviceCount = fDeviceCount; for (uint8 i = 0; i < deviceCount; i++) { - SelectDevice(i); - - if (SelectedDevice() != i) { + if (SelectDevice(i) != B_OK || SelectedDevice() != i) { TRACE_ALWAYS("cannot select device %d, assuming not present\n", i); continue; } From superstippi at gmx.de Wed May 6 13:50:20 2009 From: superstippi at gmx.de (=?ISO-8859-1?Q?Stephan_A=DFmus?=) Date: Wed, 06 May 2009 13:50:20 +0200 Subject: [Haiku-commits] r30642 - haiku/trunk/src/add-ons/kernel/bus_managers/ata In-Reply-To: <200905061147.n46Blnrc021760@sheep.berlios.de> References: <200905061147.n46Blnrc021760@sheep.berlios.de> Message-ID: <4A01797C.10602@gmx.de> Hi, mmlr at mail.berlios.de schrieb: > Author: mmlr > Date: 2009-05-06 13:47:48 +0200 (Wed, 06 May 2009) > New Revision: 30642 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30642&view=rev > > Modified: > haiku/trunk/src/add-ons/kernel/bus_managers/ata/ATAChannel.cpp > Log: > Add three more error checks for paranoias sake. [...] > @@ -285,7 +291,11 @@ > ATAChannel::SelectedDevice() > { > ata_task_file taskFile; > - _ReadRegs(&taskFile, ATA_MASK_DEVICE_HEAD); > + if (_ReadRegs(&taskFile, ATA_MASK_DEVICE_HEAD) != B_OK) { > + TRACE_ERROR("reading register failed when detecting selected device\n"); > + return 2; > + } return 2; ? Best regards, -Stephan From mmlr at mail.berlios.de Wed May 6 13:55:20 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Wed, 6 May 2009 13:55:20 +0200 Subject: [Haiku-commits] r30643 - haiku/trunk/src/system/boot/platform/bios_ia32 Message-ID: <200905061155.n46BtKRF022173@sheep.berlios.de> Author: mmlr Date: 2009-05-06 13:55:19 +0200 (Wed, 06 May 2009) New Revision: 30643 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30643&view=rev Modified: haiku/trunk/src/system/boot/platform/bios_ia32/devices.cpp Log: * Check for disk extensions before using them (mostly for good practice reasons) * A CHS read error would previously be hidden by a successful disk system reset. Not that it matters much because it'd have resulted in a non-booting system anyway. * Add some more debug output, minor cleanup. Modified: haiku/trunk/src/system/boot/platform/bios_ia32/devices.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/bios_ia32/devices.cpp 2009-05-06 11:47:48 UTC (rev 30642) +++ haiku/trunk/src/system/boot/platform/bios_ia32/devices.cpp 2009-05-06 11:55:19 UTC (rev 30643) @@ -198,6 +198,22 @@ } +static bool +are_extensions_available(uint8 drive) +{ + struct bios_regs regs; + regs.eax = BIOS_IS_EXT_PRESENT; + regs.ebx = 0x55aa; + regs.edx = drive; + call_bios(0x13, ®s); + + TRACE(("checking extensions: carry: %u; ebx: 0x%08lx; ecx: 0x%08lx\n", + regs.flags & CARRY_FLAG, regs.ebx, regs.ecx)); + return (regs.flags & CARRY_FLAG) == 0 && regs.ebx == 0xaa55 + && (regs.ecx & 0x01 /* supports device access using packet */) != 0; +} + + static status_t get_ext_drive_parameters(uint8 drive, drive_parameters *targetParameters) { @@ -528,7 +544,7 @@ { TRACE(("drive ID %u\n", driveID)); - if (driveID < 0x80 + if (driveID < 0x80 || !are_extensions_available(driveID) || get_ext_drive_parameters(driveID, &fParameters) != B_OK) { // old style CHS support @@ -627,12 +643,16 @@ uint32 cylinder = head / fParameters.heads; head %= fParameters.heads; - if (cylinder >= fParameters.cylinders) + if (cylinder >= fParameters.cylinders) { + TRACE(("cylinder value %lu bigger than available %lu\n", + cylinder, fParameters.cylinders)); return B_BAD_VALUE; + } // try to read from the device more than once, just to make sure it'll work struct bios_regs regs; int32 tries = 3; + bool readWorked = false; while (tries-- > 0) { regs.eax = BIOS_READ | blocksRead; @@ -642,21 +662,26 @@ regs.ebx = kExtraSegmentScratch; call_bios(0x13, ®s); - if ((regs.flags & CARRY_FLAG) == 0) + if ((regs.flags & CARRY_FLAG) == 0) { + readWorked = true; break; + } + TRACE(("read failed\n")); + if (tries < 2) { // reset disk system + TRACE(("reset disk system\n")); regs.eax = BIOS_RESET_DISK_SYSTEM; regs.edx = fDriveID; call_bios(0x13, ®s); } - + // wait a bit between the retries (1/20 sec) spin(50000); } - if (regs.flags & CARRY_FLAG) { + if (!readWorked) { dprintf("reading %ld bytes from drive %u failed at %Ld\n", blocksRead, fDriveID, pos); return B_ERROR; From mmlr at mlotz.ch Wed May 6 13:59:04 2009 From: mmlr at mlotz.ch (Michael Lotz) Date: Wed, 06 May 2009 13:59:04 Subject: [Haiku-commits] =?windows-1252?q?r30642_-_haiku/trunk/src/add-ons?= =?windows-1252?q?/kernel/bus=5Fmanagers/ata?= In-Reply-To: <4A01797C.10602@gmx.de> Message-ID: <3363839233-BeMail@haiku> > > @@ -285,7 +291,11 @@ > > ATAChannel::SelectedDevice() > > { > > ata_task_file taskFile; > > - _ReadRegs(&taskFile, ATA_MASK_DEVICE_HEAD); > > + if (_ReadRegs(&taskFile, ATA_MASK_DEVICE_HEAD) != B_OK) { > > + TRACE_ERROR("reading register failed when detecting > > selected device\n"); > > + return 2; > > + } > > return 2; ? Yeah, it's an illegal value as there can only be devices 0 and 1 causing the check SelectedDevice() == i (0 or 1) to fail. Regards Michael From bga at bug-br.org.br Wed May 6 14:07:42 2009 From: bga at bug-br.org.br (Bruno Albuquerque) Date: Wed, 06 May 2009 09:07:42 -0300 Subject: [Haiku-commits] r30642 - haiku/trunk/src/add-ons/kernel/bus_managers/ata In-Reply-To: <3363839233-BeMail@haiku> References: <3363839233-BeMail@haiku> Message-ID: <4A017D8E.40604@bug-br.org.br> Michael Lotz wrote: >>> @@ -285,7 +291,11 @@ >>> ATAChannel::SelectedDevice() >>> { >>> ata_task_file taskFile; >>> - _ReadRegs(&taskFile, ATA_MASK_DEVICE_HEAD); >>> + if (_ReadRegs(&taskFile, ATA_MASK_DEVICE_HEAD) != B_OK) { >>> + TRACE_ERROR("reading register failed when detecting >>> selected device\n"); >>> + return 2; >>> + } >> return 2; ? > > Yeah, it's an illegal value as there can only be devices 0 and 1 causing > the check SelectedDevice() == i (0 or 1) to fail. Maybe using a define here (or an enum, if there are other values that could be added there) would be better. As it is, this is a bit more cryptic than it needs to be. :) -Bruno From superstippi at gmx.de Wed May 6 14:11:58 2009 From: superstippi at gmx.de (=?ISO-8859-1?Q?Stephan_A=DFmus?=) Date: Wed, 06 May 2009 14:11:58 +0200 Subject: [Haiku-commits] r30642 - haiku/trunk/src/add-ons/kernel/bus_managers/ata In-Reply-To: <3363839233-BeMail@haiku> References: <3363839233-BeMail@haiku> Message-ID: <4A017E8E.2070405@gmx.de> Michael Lotz schrieb: >>> @@ -285,7 +291,11 @@ >>> ATAChannel::SelectedDevice() >>> { >>> ata_task_file taskFile; >>> - _ReadRegs(&taskFile, ATA_MASK_DEVICE_HEAD); >>> + if (_ReadRegs(&taskFile, ATA_MASK_DEVICE_HEAD) != B_OK) { >>> + TRACE_ERROR("reading register failed when detecting >>> selected device\n"); >>> + return 2; >>> + } >> return 2; ? > > Yeah, it's an illegal value as there can only be devices 0 and 1 causing > the check SelectedDevice() == i (0 or 1) to fail. I wondered because somewhere else, you seem to have an fDeviceCount member. Best regards, -Stephan From mmlr at mlotz.ch Wed May 6 14:52:49 2009 From: mmlr at mlotz.ch (Michael Lotz) Date: Wed, 06 May 2009 14:52:49 Subject: [Haiku-commits] =?windows-1252?q?r30642_-_haiku/trunk/src/add-ons?= =?windows-1252?q?/kernel/bus=5Fmanagers/ata?= In-Reply-To: <4A017D8E.40604@bug-br.org.br> Message-ID: <6589748906-BeMail@haiku> > Michael Lotz wrote: > >>> @@ -285,7 +291,11 @@ > >>> ATAChannel::SelectedDevice() > >>> { > >>> ata_task_file taskFile; > >>> - _ReadRegs(&taskFile, ATA_MASK_DEVICE_HEAD); > >>> + if (_ReadRegs(&taskFile, ATA_MASK_DEVICE_HEAD) != B_OK) { > >>> + TRACE_ERROR("reading register failed when detecting > >>> selected device\n"); > >>> + return 2; > >>> + } > >> return 2; ? > > > > Yeah, it's an illegal value as there can only be devices 0 and 1 > > causing > > the check SelectedDevice() == i (0 or 1) to fail. > > Maybe using a define here (or an enum, if there are other values that > could be added there) would be better. As it is, this is a bit more > cryptic than it needs to be. :) There can't be any other values. The device selection bit is only 1 bit in the bitmap. Therefore if it ever gets a value more than 1 we need a little more than just a defines... Also we are checking SelectedDevice() == expected device and not SelectedDevice() == 2, so it's not like the actual value did matter in more than one spot, making a define reasonable. Regards Michael From bga at bug-br.org.br Wed May 6 15:00:31 2009 From: bga at bug-br.org.br (Bruno Albuquerque) Date: Wed, 06 May 2009 10:00:31 -0300 Subject: [Haiku-commits] r30642 - haiku/trunk/src/add-ons/kernel/bus_managers/ata In-Reply-To: <6589748906-BeMail@haiku> References: <6589748906-BeMail@haiku> Message-ID: <4A0189EF.7040703@bug-br.org.br> Michael Lotz wrote: >> Maybe using a define here (or an enum, if there are other values that >> could be added there) would be better. As it is, this is a bit more >> cryptic than it needs to be. :) > > There can't be any other values. The device selection bit is only 1 bit > in the bitmap. Therefore if it ever gets a value more than 1 we need a > little more than just a defines... Also we are checking > SelectedDevice() == expected device and not SelectedDevice() == 2, so > it's not like the actual value did matter in more than one spot, making > a define reasonable. Yes, but these are things you know because you wrote the code. Other developers looking at it would had a way better chance of understanding what is happening (at least in an easier way) if they saw: return INVALID_DEVICE instead of return 2 2 means nothing to anyone that does not know the code while INVALID_DEVICE (or any other descriptive name) is pretty obvious even if you are only looking at that section of the code. Anyway, this was just a suggestion. -Bruno From mmlr at mail.berlios.de Wed May 6 15:09:02 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Wed, 6 May 2009 15:09:02 +0200 Subject: [Haiku-commits] r30644 - haiku/trunk/src/add-ons/kernel/bus_managers/ata Message-ID: <200905061309.n46D92Rk028966@sheep.berlios.de> Author: mmlr Date: 2009-05-06 15:09:01 +0200 (Wed, 06 May 2009) New Revision: 30644 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30644&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ATAChannel.cpp Log: By popular request: Change the invalid device number and add a comment explaining the reasons behind it. Oh well, at least the commit count raises... Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ATAChannel.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ATAChannel.cpp 2009-05-06 11:55:19 UTC (rev 30643) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ATAChannel.cpp 2009-05-06 13:09:01 UTC (rev 30644) @@ -293,7 +293,11 @@ ata_task_file taskFile; if (_ReadRegs(&taskFile, ATA_MASK_DEVICE_HEAD) != B_OK) { TRACE_ERROR("reading register failed when detecting selected device\n"); - return 2; + // Return an invalid device number so that the + // SelectedDevice() == "expected device" check fails. + // Due to the device number being a bit, we can't really get values + // other than 0 and 1, so anything >= 2 can be regarded as invalid. + return 234; } return taskFile.lba.device; From mmlr at mlotz.ch Wed May 6 15:12:10 2009 From: mmlr at mlotz.ch (Michael Lotz) Date: Wed, 06 May 2009 15:12:10 Subject: [Haiku-commits] =?windows-1252?q?r30642_-_haiku/trunk/src/add-ons?= =?windows-1252?q?/kernel/bus=5Fmanagers/ata?= In-Reply-To: <4A0189EF.7040703@bug-br.org.br> Message-ID: <7750205763-BeMail@haiku> > Michael Lotz wrote: > > >> Maybe using a define here (or an enum, if there are other values > > > that > >> could be added there) would be better. As it is, this is a bit > > > more > >> cryptic than it needs to be. :) > > > > There can't be any other values. The device selection bit is only 1 > > bit > > in the bitmap. Therefore if it ever gets a value more than 1 we > > need a > > little more than just a defines... Also we are checking > > SelectedDevice() == expected device and not SelectedDevice() == 2, > > so > > it's not like the actual value did matter in more than one spot, > > making > > a define reasonable. > > Yes, but these are things you know because you wrote the code. Other > developers looking at it would had a way better chance of > understanding > what is happening (at least in an easier way) if they saw: > > return INVALID_DEVICE > > instead of > > return 2 > > 2 means nothing to anyone that does not know the code while > INVALID_DEVICE (or any other descriptive name) is pretty obvious even > if > you are only looking at that section of the code. Anyone knowing a bit of ATA (which is a prerequisite to understand the code at all) knows that a device number other than 0 and 1 is invalid. It's not like I hardcoded 2 as some mysterious error code somewhere that was checked for specifically or that it was only an invalid index in our own ATA stack. It's simply the first invalid device number, so I picked it. Anyway, fixed in r30644. Regards Michael From zooey at mail.berlios.de Wed May 6 15:14:06 2009 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Wed, 6 May 2009 15:14:06 +0200 Subject: [Haiku-commits] r30645 - in haiku/trunk: build/jam src/kits/locale Message-ID: <200905061314.n46DE6sb029593@sheep.berlios.de> Author: zooey Date: 2009-05-06 15:14:06 +0200 (Wed, 06 May 2009) New Revision: 30645 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30645&view=rev Modified: haiku/trunk/build/jam/HaikuImage haiku/trunk/src/kits/locale/Language.cpp Log: * moved locale language files from B_BEOS_ETC_DIRECTORY to B_SYSTEM_DATA_DIRECTORY, as that seems more appropriate Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2009-05-06 13:09:01 UTC (rev 30644) +++ haiku/trunk/build/jam/HaikuImage 2009-05-06 13:14:06 UTC (rev 30645) @@ -351,7 +351,7 @@ # Locale kit language files local languageDir = [ FDirName $(HAIKU_TOP) src data etc locale languages ] ; local languages = [ Glob $(languageDir) : *.language ] ; -AddFilesToHaikuImage system etc locale languages : $(languages) ; +AddFilesToHaikuImage system data locale languages : $(languages) ; local etcFiles = bash_completion inputrc profile teapot.data ; etcFiles = $(etcFiles:G=etc) ; Modified: haiku/trunk/src/kits/locale/Language.cpp =================================================================== --- haiku/trunk/src/kits/locale/Language.cpp 2009-05-06 13:09:01 UTC (rev 30644) +++ haiku/trunk/src/kits/locale/Language.cpp 2009-05-06 13:14:06 UTC (rev 30645) @@ -109,7 +109,7 @@ sprintf(name, "locale/languages/%s.language", language); BPath path; - if (find_directory(B_BEOS_ETC_DIRECTORY, &path) < B_OK) { + if (find_directory(B_SYSTEM_DATA_DIRECTORY, &path) < B_OK) { Default(); return; } From marcusoverhagen at arcor.de Wed May 6 15:26:38 2009 From: marcusoverhagen at arcor.de (Marcus Overhagen) Date: Wed, 6 May 2009 15:26:38 +0200 (CEST) Subject: [Haiku-commits] r30644 - haiku/trunk/src/add-ons/kernel/bus_managers/ata In-Reply-To: <200905061309.n46D92Rk028966@sheep.berlios.de> References: <200905061309.n46D92Rk028966@sheep.berlios.de> Message-ID: <25007794.1241616398056.JavaMail.ngmail@webmail13.arcor-online.net> mmlr at mail.berlios.de wrote: > + // Return an invalid device number so that the > + // SelectedDevice() == "expected device" check fails. > + // Due to the device number being a bit, we can't really get values > + // other than 0 and 1, so anything >= 2 can be regarded as invalid. > + return 234; aktually I liked the 2 here. Or a -1. but thats just ugly... regards Marcus Arcor.de Gaming Area - kostenfrei daddeln bis der Arzt kommt! Jetzt checken und aus ?ber 80 Spielen w?hlen! http://www.arcor.de/footer-gaming/ From mmlr at mlotz.ch Wed May 6 15:41:32 2009 From: mmlr at mlotz.ch (Michael Lotz) Date: Wed, 6 May 2009 15:41:32 +0200 Subject: [Haiku-commits] r30642 - haiku/trunk/src/add-ons/kernel/bus_managers/ata In-Reply-To: <7750205763-BeMail@haiku> References: <4A0189EF.7040703@bug-br.org.br> <7750205763-BeMail@haiku> Message-ID: <20090506133128.M82036@mlotz.ch> On Wed, 06 May 2009 15:12:10, Michael Lotz wrote > > Michael Lotz wrote: > > Yes, but these are things you know because you wrote the code. Other > > developers looking at it would had a way better chance of > > understanding > > what is happening (at least in an easier way) if they saw: > > > > return INVALID_DEVICE > > > > instead of > > > > return 2 > > > > 2 means nothing to anyone that does not know the code while > > INVALID_DEVICE (or any other descriptive name) is pretty obvious even > > if > > you are only looking at that section of the code. > > Anyone knowing a bit of ATA (which is a prerequisite to understand > the code at all) knows that a device number other than 0 and 1 is > invalid. It's not like I hardcoded 2 as some mysterious error code > somewhere that was checked for specifically or that it was only an > invalid index in our own ATA stack. It's simply the first invalid > device number, so I picked it. Anyway, fixed in r30644. By the way: Don't get me wrong, I understand and support the stance to make things obvious and I do pay attention to do so in code I write and correct it in existing code when I rework it. It's just that in this case it's silly to even talk about it, seeing that it's reasonably understandable for anyone looking into ATA and the amount of time spent on discussing/adjusting it could be so much better spent on most anything else. This is opposed to magic error codes that mean something specific, where a certain error code is set and checked in specific places and it is not immediately obvious that they are linked together. Those are cases that only the developer of said code would know. Regards Michael From mmlr at mlotz.ch Wed May 6 15:46:48 2009 From: mmlr at mlotz.ch (Michael Lotz) Date: Wed, 6 May 2009 15:46:48 +0200 Subject: [Haiku-commits] r30644 - haiku/trunk/src/add-ons/kernel/bus_managers/ata In-Reply-To: <25007794.1241616398056.JavaMail.ngmail@webmail13.arcor-online.net> References: <200905061309.n46D92Rk028966@sheep.berlios.de> <25007794.1241616398056.JavaMail.ngmail@webmail13.arcor-online.net> Message-ID: <20090506134229.M59880@mlotz.ch> On Wed, 6 May 2009 15:26:38 +0200 (CEST), Marcus Overhagen wrote > mmlr at mail.berlios.de wrote: > > > + // Return an invalid device number so that the > > + // SelectedDevice() == "expected device" check fails. > > + // Due to the device number being a bit, we can't really get values > > + // other than 0 and 1, so anything >= 2 can be regarded as invalid. > > + return 234; > aktually I liked the 2 here. Or a -1. but thats just ugly... You are kidding me, right? I'm very much inclined to just remove that check completely now. It's a very unlikely error case in the first place. It is about the register read failing, not the device selection or anything. It's really only checked out of paranoia as if register reads/writes do not work that'd be noticed much earlier in the codepaths leading to that place. But we can of course discuss it if this is seriously disturbing anyone. Regards Michael From superstippi at gmx.de Wed May 6 16:06:28 2009 From: superstippi at gmx.de (=?ISO-8859-1?Q?Stephan_A=DFmus?=) Date: Wed, 06 May 2009 16:06:28 +0200 Subject: [Haiku-commits] r30642 - haiku/trunk/src/add-ons/kernel/bus_managers/ata In-Reply-To: <20090506133128.M82036@mlotz.ch> References: <4A0189EF.7040703@bug-br.org.br> <7750205763-BeMail@haiku> <20090506133128.M82036@mlotz.ch> Message-ID: <4A019964.7080505@gmx.de> Michael Lotz schrieb: > On Wed, 06 May 2009 15:12:10, Michael Lotz wrote >> Anyone knowing a bit of ATA (which is a prerequisite to understand >> the code at all) knows that a device number other than 0 and 1 is >> invalid. It's not like I hardcoded 2 as some mysterious error code >> somewhere that was checked for specifically or that it was only an >> invalid index in our own ATA stack. It's simply the first invalid >> device number, so I picked it. Anyway, fixed in r30644. > > By the way: Don't get me wrong, I understand and support the stance to make > things obvious and I do pay attention to do so in code I write and correct it > in existing code when I rework it. It's just that in this case it's silly to > even talk about it, seeing that it's reasonably understandable for anyone > looking into ATA and the amount of time spent on discussing/adjusting it could > be so much better spent on most anything else. This is opposed to magic error > codes that mean something specific, where a certain error code is set and > checked in specific places and it is not immediately obvious that they are > linked together. Those are cases that only the developer of said code would know. It's really no big deal, Michael, I am sorry it has blown so much out of proportion. I am simply sometimes proof-reading commits and for a lot of code, it means I am proof-reading something that I don't know much about. I don't see the context either, only what shows up in the commit notification. In this case, I saw an "fDeviceCount" at one place and then later this non-obvious (to me) "return 2;" for a device number. It looked like it could be an error and if in doubt, I rather speak up, it has sometimes turned up real errors. I think your current solution with the comment above that line works very well, the define is probably not justified if it would be used in only that place. Best regards, -Stephan From bga at bug-br.org.br Wed May 6 16:09:27 2009 From: bga at bug-br.org.br (Bruno Albuquerque) Date: Wed, 06 May 2009 11:09:27 -0300 Subject: [Haiku-commits] r30642 - haiku/trunk/src/add-ons/kernel/bus_managers/ata In-Reply-To: <7750205763-BeMail@haiku> References: <7750205763-BeMail@haiku> Message-ID: <4A019A17.40606@bug-br.org.br> Michael Lotz wrote: >> 2 means nothing to anyone that does not know the code while >> INVALID_DEVICE (or any other descriptive name) is pretty obvious even >> if you are only looking at that section of the code. > > Anyone knowing a bit of ATA (which is a prerequisite to understand the > code at all) knows that a device number other than 0 and 1 is invalid. > It's not like I hardcoded 2 as some mysterious error code somewhere > that was checked for specifically or that it was only an invalid index > in our own ATA stack. It's simply the first invalid device number, so I > picked it. Anyway, fixed in r30644. The problem with this reasoning is just that it can be applied to virtually any code. Saying that knowing the ATA protocol is a prerequisite to understanding the code (which is true) is not really an excuse to make the code less readable. You could as well say that understanding Haiku is a pre-requisite to write a Haiku application (and there are probably as much people in the world that knows the ATA protocol as there are people that know the Haiku/BeOS API). I can't help but notice you seem to be taking this as a personal offense or something, it is not. I am just being pragmatic. It is good engineering practice to make the code as readable as possible. I would say it is specially more so in the case of open-source projects where you may be working on it today but eventually get fed up and leave the project. Someone would have to take over your code even if that meant having to learn the ATA protocol. And if your code is more legible, a lot can be learned from looking at it and even the protocol couldbe inferred. -Bruno From bga at bug-br.org.br Wed May 6 16:11:41 2009 From: bga at bug-br.org.br (Bruno Albuquerque) Date: Wed, 06 May 2009 11:11:41 -0300 Subject: [Haiku-commits] r30642 - haiku/trunk/src/add-ons/kernel/bus_managers/ata In-Reply-To: <20090506133128.M82036@mlotz.ch> References: <4A0189EF.7040703@bug-br.org.br> <7750205763-BeMail@haiku> <20090506133128.M82036@mlotz.ch> Message-ID: <4A019A9D.8020408@bug-br.org.br> Michael Lotz wrote: > By the way: Don't get me wrong, I understand and support the stance to make > things obvious and I do pay attention to do so in code I write and correct it > in existing code when I rework it. It's just that in this case it's silly to > even talk about it, seeing that it's reasonably understandable for anyone > looking into ATA and the amount of time spent on discussing/adjusting it could > be so much better spent on most anything else. This is opposed to magic error > codes that mean something specific, where a certain error code is set and > checked in specific places and it is not immediately obvious that they are > linked together. Those are cases that only the developer of said code would know. Too late! I already did. ;) I replied to your previous email before reading this. Obviously I stand for what I said there but I take back what I said about it looking like you were taking this personally. This messages clarifies this point. -Bruno From bonefish at mail.berlios.de Wed May 6 17:26:33 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Wed, 6 May 2009 17:26:33 +0200 Subject: [Haiku-commits] r30646 - haiku/trunk/src/kits/support Message-ID: <200905061526.n46FQX79012426@sheep.berlios.de> Author: bonefish Date: 2009-05-06 17:26:30 +0200 (Wed, 06 May 2009) New Revision: 30646 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30646&view=rev Modified: haiku/trunk/src/kits/support/String.cpp Log: Simplification. Modified: haiku/trunk/src/kits/support/String.cpp =================================================================== --- haiku/trunk/src/kits/support/String.cpp 2009-05-06 13:14:06 UTC (rev 30645) +++ haiku/trunk/src/kits/support/String.cpp 2009-05-06 15:26:30 UTC (rev 30646) @@ -1419,7 +1419,7 @@ { int32 length = Length(); if (maxLength > length) - length += maxLength - length; + length = maxLength; if (_DetachWith(fPrivateData, length) == B_OK) { _ReferenceCount() = -1; From bonefish at mail.berlios.de Wed May 6 17:27:06 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Wed, 6 May 2009 17:27:06 +0200 Subject: [Haiku-commits] r30647 - haiku/trunk/src/apps/debuganalyzer/gui/chart Message-ID: <200905061527.n46FR63Y012672@sheep.berlios.de> Author: bonefish Date: 2009-05-06 17:27:05 +0200 (Wed, 06 May 2009) New Revision: 30647 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30647&view=rev Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/ChartDataRange.h Log: Added some handy methods. Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/ChartDataRange.h =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/chart/ChartDataRange.h 2009-05-06 15:26:30 UTC (rev 30646) +++ haiku/trunk/src/apps/debuganalyzer/gui/chart/ChartDataRange.h 2009-05-06 15:27:05 UTC (rev 30647) @@ -34,6 +34,17 @@ { } + bool IsValid() const + { + + return min < max; + } + + double Size() const + { + return max - min; + } + ChartDataRange& Extend(const ChartDataRange& other) { min = std::min(min, other.min); @@ -41,6 +52,20 @@ return *this; } + ChartDataRange& OffsetBy(double offset) + { + min += offset; + max += offset; + return *this; + } + + ChartDataRange& OffsetTo(double newMin) + { + max += newMin - min; + min = newMin; + return *this; + } + ChartDataRange& operator=(const ChartDataRange& other) { min = other.min; From bonefish at mail.berlios.de Wed May 6 17:31:45 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Wed, 6 May 2009 17:31:45 +0200 Subject: [Haiku-commits] r30648 - haiku/trunk/src/apps/debuganalyzer/gui/chart Message-ID: <200905061531.n46FVjjx013556@sheep.berlios.de> Author: bonefish Date: 2009-05-06 17:31:44 +0200 (Wed, 06 May 2009) New Revision: 30648 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30648&view=rev Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.cpp haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.h Log: * Made the displayed domain and range settable. * Added support for scrolling. * Automatic white space cleanup. Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.cpp =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.cpp 2009-05-06 15:27:05 UTC (rev 30647) +++ haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.cpp 2009-05-06 15:31:44 UTC (rev 30648) @@ -11,6 +11,7 @@ #include #include +#include #include "chart/ChartAxis.h" #include "chart/ChartDataSource.h" @@ -58,7 +59,11 @@ Chart::Chart(ChartRenderer* renderer, const char* name) : BView(name, B_FRAME_EVENTS | B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE), - fRenderer(renderer) + fRenderer(renderer), + fHScrollSize(0), + fVScrollSize(0), + fHScrollValue(0), + fVScrollValue(0) { SetViewColor(B_TRANSPARENT_32_BIT); @@ -129,7 +134,7 @@ fRenderer->RemoveDataSource(dataSource); _UpdateDomainAndRange(); - + return dataSource; } @@ -178,37 +183,91 @@ } -#if 0 -ChartDataRange -Chart::Domain() const +void +Chart::SetDisplayDomain(ChartDataRange domain) { - return fDataSource != NULL ? fDataSource->Domain() : ChartDataRange(); + // sanitize the supplied range + if (domain.IsValid() && domain.Size() < fDomain.Size()) { + if (domain.min < fDomain.min) + domain.OffsetBy(fDomain.min - domain.min); + else if (domain.max > fDomain.max) + domain.OffsetBy(fDomain.max - domain.max); + } else + domain = fDomain; + + if (domain == fDisplayDomain) + return; + + fDisplayDomain = domain; + + fRenderer->SetDomain(fDisplayDomain); + fTopAxis.SetRange(fDisplayDomain); + fBottomAxis.SetRange(fDisplayDomain); + + _UpdateScrollBar(true); + + InvalidateLayout(); + Invalidate(); } void -Chart::SetDisplayDomain(const ChartDataRange& domain) +Chart::SetDisplayRange(ChartDataRange range) { - fRenderer->SetDomain(domain); + // sanitize the supplied range + if (range.IsValid() && range.Size() < fRange.Size()) { + if (range.min < fRange.min) + range.OffsetBy(fRange.min - range.min); + else if (range.max > fRange.max) + range.OffsetBy(fRange.max - range.max); + } else + range = fRange; + + if (range == fDisplayRange) + return; + + fDisplayRange = range; + + fRenderer->SetRange(fDisplayRange); + fLeftAxis.SetRange(fDisplayRange); + fRightAxis.SetRange(fDisplayRange); + + _UpdateScrollBar(false); + + InvalidateLayout(); Invalidate(); } void -Chart::SetDisplayDomain(const ChartDataRange& range) +Chart::DomainChanged() { - fRenderer->SetRange(range); - Invalidate(); + if (ScrollBar(B_HORIZONTAL) != NULL && fDisplayDomain.IsValid()) + SetDisplayDomain(fDisplayDomain); + else + SetDisplayDomain(fDomain); } -#endif void +Chart::RangeChanged() +{ + if (ScrollBar(B_VERTICAL) != NULL && fDisplayRange.IsValid()) + SetDisplayRange(fDisplayRange); + else + SetDisplayRange(fRange); +} + + +void Chart::FrameResized(float newWidth, float newHeight) { //printf("Chart::FrameResized(%f, %f)\n", newWidth, newHeight); // fRenderer->SetFrame(Bounds()); + _UpdateScrollBar(true); + _UpdateScrollBar(false); + Invalidate(); } @@ -252,24 +311,36 @@ } -#if 0 +void +Chart::ScrollTo(BPoint where) +{ + _ScrollTo(where.x, true); + _ScrollTo(where.y, false); +} + + BSize Chart::MinSize() { + // TODO: Implement for real! + return BSize(100, 100); } BSize Chart::MaxSize() { + // TODO: Implement for real! + return BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED); } BSize Chart::PreferredSize() { + // TODO: Implement for real! + return MinSize(); } -#endif void @@ -316,15 +387,17 @@ void Chart::_UpdateDomainAndRange() { + ChartDataRange oldDomain = fDomain; + ChartDataRange oldRange = fRange; + if (fDataSources.IsEmpty()) { fDomain = ChartDataRange(); fRange = ChartDataRange(); - return; } else { ChartDataSource* firstSource = fDataSources.ItemAt(0); fDomain = firstSource->Domain(); fRange = firstSource->Range(); - + for (int32 i = 1; ChartDataSource* source = fDataSources.ItemAt(i); i++) { fDomain.Extend(source->Domain()); @@ -332,11 +405,65 @@ } } - fRenderer->SetDomain(fDomain); - fRenderer->SetRange(fRange); + if (fDomain != oldDomain) + DomainChanged(); + if (fRange != oldRange) + RangeChanged(); +} - fLeftAxis.SetRange(fRange); - fTopAxis.SetRange(fDomain); - fRightAxis.SetRange(fRange); - fBottomAxis.SetRange(fDomain); + +void +Chart::_UpdateScrollBar(bool horizontal) +{ + const ChartDataRange& range = horizontal ? fDomain : fRange; + const ChartDataRange& displayRange = horizontal + ? fDisplayDomain : fDisplayRange; + float chartSize = horizontal ? fChartFrame.Width() : fChartFrame.Height(); + chartSize += 3; // +1 for pixel size, +2 for border + float& scrollSize = horizontal ? fHScrollSize : fVScrollSize; + float& scrollValue = horizontal ? fHScrollValue : fVScrollValue; + BScrollBar* scrollBar = ScrollBar(horizontal ? B_HORIZONTAL : B_VERTICAL); + + float proportion; + + if (range.IsValid() && displayRange.IsValid()) { + scrollSize = (range.Size() / displayRange.Size() - 1) * chartSize; + scrollValue = (displayRange.min - range.min) / displayRange.Size() + * chartSize; + proportion = displayRange.Size() / range.Size(); + } else { + scrollSize = 0; + scrollValue = 0; + proportion = 1; + } + + if (scrollBar != NULL) { + scrollBar->SetRange(0, scrollSize); +// TODO: If the scroll range changes, we might need to reset the scroll value. + scrollBar->SetValue(scrollValue); + scrollBar->SetProportion(proportion); + } } + + +void +Chart::_ScrollTo(float value, bool horizontal) +{ + float& scrollValue = horizontal ? fHScrollValue : fVScrollValue; + if (value == scrollValue) + return; + + const ChartDataRange& range = horizontal ? fDomain : fRange; + ChartDataRange displayRange = horizontal ? fDisplayDomain : fDisplayRange; + float chartSize = horizontal ? fChartFrame.Width() : fChartFrame.Height(); + chartSize += 3; // +1 for pixel size, +2 for border + const float& scrollSize = horizontal ? fHScrollSize : fVScrollSize; + + scrollValue = value; + displayRange.OffsetTo(value / scrollSize + * (range.Size() - displayRange.Size())); + if (horizontal) + SetDisplayDomain(displayRange); + else + SetDisplayRange(displayRange); +} Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.h =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.h 2009-05-06 15:27:05 UTC (rev 30647) +++ haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.h 2009-05-06 15:31:44 UTC (rev 30648) @@ -40,21 +40,25 @@ void SetAxis(ChartAxisLocation location, ChartAxis* axis); -#if 0 - ChartDataRange Domain() const; + inline ChartDataRange Domain() const; + inline ChartDataRange Range() const; - void SetDisplayDomain(const ChartDataRange& domain); - void SetDisplayRange(const ChartDataRange& range); -#endif + inline ChartDataRange DisplayDomain() const; + inline ChartDataRange DisplayRange() const; + void SetDisplayDomain(ChartDataRange domain); + void SetDisplayRange(ChartDataRange range); + + virtual void DomainChanged(); + virtual void RangeChanged(); + virtual void FrameResized(float newWidth, float newHeight); virtual void Draw(BRect updateRect); + virtual void ScrollTo(BPoint where); -#if 0 virtual BSize MinSize(); virtual BSize MaxSize(); virtual BSize PreferredSize(); -#endif virtual void DoLayout(); @@ -74,6 +78,8 @@ private: void _UpdateDomainAndRange(); + void _UpdateScrollBar(bool horizontal); + void _ScrollTo(float value, bool horizontal); private: ChartRenderer* fRenderer; @@ -84,12 +90,42 @@ AxisInfo fBottomAxis; ChartDataRange fDomain; ChartDataRange fRange; -#if 0 ChartDataRange fDisplayDomain; ChartDataRange fDisplayRange; -#endif BRect fChartFrame; + float fHScrollSize; + float fVScrollSize; + float fHScrollValue; + float fVScrollValue; }; +ChartDataRange +Chart::Domain() const +{ + return fDomain; +} + + +ChartDataRange +Chart::Range() const +{ + return fRange; +} + + +ChartDataRange +Chart::DisplayDomain() const +{ + return fDisplayDomain; +} + + +ChartDataRange +Chart::DisplayRange() const +{ + return fDisplayRange; +} + + #endif // CHART_H From bonefish at mail.berlios.de Wed May 6 17:33:52 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Wed, 6 May 2009 17:33:52 +0200 Subject: [Haiku-commits] r30649 - haiku/trunk/src/apps/debuganalyzer/gui/thread_window Message-ID: <200905061533.n46FXqlW013777@sheep.berlios.de> Author: bonefish Date: 2009-05-06 17:33:51 +0200 (Wed, 06 May 2009) New Revision: 30649 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30649&view=rev Modified: haiku/trunk/src/apps/debuganalyzer/gui/thread_window/ActivityPage.cpp Log: * Added scroll view around the activity chart. * Set the displayed domain to 0.5 s for debugging purposes. Modified: haiku/trunk/src/apps/debuganalyzer/gui/thread_window/ActivityPage.cpp =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/thread_window/ActivityPage.cpp 2009-05-06 15:31:44 UTC (rev 30648) +++ haiku/trunk/src/apps/debuganalyzer/gui/thread_window/ActivityPage.cpp 2009-05-06 15:33:51 UTC (rev 30649) @@ -8,6 +8,7 @@ #include #include +#include #include @@ -96,7 +97,7 @@ previousEventTime = event->time; break; } - + case B_SYSTEM_PROFILER_THREAD_ENQUEUED_IN_RUN_QUEUE: { system_profiler_thread_enqueued_in_run_queue* event @@ -106,7 +107,7 @@ previousEventTime = event->time; break; } - + case B_SYSTEM_PROFILER_THREAD_REMOVED_FROM_RUN_QUEUE: { system_profiler_thread_removed_from_run_queue* event @@ -134,7 +135,7 @@ system_profiler_thread_scheduled* event = (system_profiler_thread_scheduled*)(header + 1); eventTime = double(event->time - baseTime); - + if (event->thread == threadID) { // thread scheduled if (state == READY) { @@ -145,7 +146,7 @@ // before timeType = PREEMPTION_TIME; } - + if (state == STILL_RUNNING) { // Thread was running and continues to run. state = RUNNING; @@ -166,17 +167,17 @@ timeType = RUN_TIME; } } - + break; } - + case B_SYSTEM_PROFILER_THREAD_ENQUEUED_IN_RUN_QUEUE: { system_profiler_thread_enqueued_in_run_queue* event = (system_profiler_thread_enqueued_in_run_queue*) (header + 1); eventTime = double(event->time - baseTime); - + if (state == RUNNING || state == STILL_RUNNING) { // Thread was running and is reentered into the run // queue. This is done by the scheduler, if the @@ -193,20 +194,20 @@ state = READY; timeType = WAIT_TIME; } - + break; } - + case B_SYSTEM_PROFILER_THREAD_REMOVED_FROM_RUN_QUEUE: { system_profiler_thread_removed_from_run_queue* event = (system_profiler_thread_removed_from_run_queue*) (header + 1); eventTime = double(event->time - baseTime); - + // This really only happens when the thread priority is // changed while the thread is ready. - + if (state == RUNNING) { // This should never happen. state = READY; @@ -219,7 +220,7 @@ timeType = PREEMPTION_TIME; } else state = READY; - + break; } } @@ -315,7 +316,7 @@ fActivityChart = new Chart(fActivityChartRenderer); BGroupLayoutBuilder(this) - .Add(fActivityChart) + .Add(new BScrollView("activity scroll", fActivityChart, 0, true, false)) .AddStrut(20) ; @@ -327,15 +328,15 @@ fActivityChart->SetAxis(CHART_AXIS_BOTTOM, axis); axis = new LegendChartAxis( - new BigtimeChartAxisLegendSource, new StringChartLegendRenderer); + new BigtimeChartAxisLegendSource, new StringChartLegendRenderer); fActivityChart->SetAxis(CHART_AXIS_TOP, axis); axis = new LegendChartAxis( - new DefaultChartAxisLegendSource, new StringChartLegendRenderer); + new DefaultChartAxisLegendSource, new StringChartLegendRenderer); fActivityChart->SetAxis(CHART_AXIS_LEFT, axis); axis = new LegendChartAxis( - new DefaultChartAxisLegendSource, new StringChartLegendRenderer); + new DefaultChartAxisLegendSource, new StringChartLegendRenderer); fActivityChart->SetAxis(CHART_AXIS_RIGHT, axis); } @@ -402,5 +403,6 @@ fPreemptionTimeData = new(std::nothrow) ThreadActivityData(fThreadModel, LATENCY_TIME); fActivityChart->AddDataSource(fPreemptionTimeData, &latencyConfig); +fActivityChart->SetDisplayDomain(ChartDataRange(0, 500000)); } } From czeidler at mail.berlios.de Wed May 6 17:47:52 2009 From: czeidler at mail.berlios.de (czeidler at mail.berlios.de) Date: Wed, 6 May 2009 17:47:52 +0200 Subject: [Haiku-commits] r30650 - haiku/trunk/src/apps/mail Message-ID: <200905061547.n46FlqWU014881@sheep.berlios.de> Author: czeidler Date: 2009-05-06 17:47:50 +0200 (Wed, 06 May 2009) New Revision: 30650 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30650&view=rev Modified: haiku/trunk/src/apps/mail/Prefs.cpp Log: Some more spelling. Modified: haiku/trunk/src/apps/mail/Prefs.cpp =================================================================== --- haiku/trunk/src/apps/mail/Prefs.cpp 2009-05-06 15:33:51 UTC (rev 30649) +++ haiku/trunk/src/apps/mail/Prefs.cpp 2009-05-06 15:47:50 UTC (rev 30650) @@ -82,7 +82,7 @@ #define ENCODING_TEXT MDR_DIALECT_CHOICE ("Encoding:", "???????:") #define WARN_UNENCODABLE_TEXT MDR_DIALECT_CHOICE ("Warn Unencodable:", "??: ??????????") #define SPELL_CHECK_START_ON_TEXT MDR_DIALECT_CHOICE ("Initial Spell Check Mode:", "??????????:") -#define AUTO_MARK_READED_TEXT MDR_DIALECT_CHOICE ("Automatically mark mail as read:", "Automatically mark mail as read:") +#define AUTO_MARK_READ_TEXT MDR_DIALECT_CHOICE ("Automatically mark mail as read:", "Automatically mark mail as read:") #define BUTTONBAR_TEXT MDR_DIALECT_CHOICE ("Button Bar:", "?????:") @@ -247,7 +247,7 @@ add_menu_to_layout(menu, interfaceLayout, layoutRow); fAutoMarkReadedMenu = _BuildAutoMarkReadedMenu(fAutoMarkReaded); - menu = new BMenuField("autoMarkReaded", AUTO_MARK_READED_TEXT, + menu = new BMenuField("autoMarkReaded", AUTO_MARK_READ_TEXT, fAutoMarkReadedMenu, NULL); add_menu_to_layout(menu, interfaceLayout, layoutRow); // Mail Accounts @@ -415,7 +415,7 @@ r.OffsetBy(0, height + ITEM_SPACE); fAutoMarkReadedMenu = _BuildAutoMarkReadedMenu(fAutoMarkReaded); - menu = new BMenuField("autoMarkReaded", AUTO_MARK_READED_TEXT, + menu = new BMenuField("autoMarkReaded", AUTO_MARK_READ_TEXT, fAutoMarkReadedMenu, NULL); menu->SetDivider(labelWidth); menu->SetAlignment(B_ALIGN_RIGHT); From clemens.zeidler at rwth-aachen.de Wed May 6 17:48:37 2009 From: clemens.zeidler at rwth-aachen.de (Clemens zeidler) Date: Wed, 06 May 2009 17:48:37 +0200 Subject: [Haiku-commits] r30637 - haiku/trunk/src/apps/mail In-Reply-To: <4A009DDC.5050206@gmail.com> References: <200905051830.n45IUq97011561@sheep.berlios.de> <4A009DDC.5050206@gmail.com> Message-ID: On Tue, 05 May 2009 22:13:16 +0200, Fredrik Ekdahl wrote: > > What about the define? AUTO_MARK_READED_TEXT Argh, ok done. Clemens From axeld at pinc-software.de Wed May 6 18:51:34 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Wed, 06 May 2009 18:51:34 +0200 CEST Subject: [Haiku-commits] r30650 - haiku/trunk/src/apps/mail In-Reply-To: <200905061547.n46FlqWU014881@sheep.berlios.de> Message-ID: <37089941245-BeMail@zon> czeidler at mail.berlios.de wrote: > - menu = new BMenuField("autoMarkReaded", AUTO_MARK_READED_TEXT, > + menu = new BMenuField("autoMarkReaded", AUTO_MARK_READ_TEXT, autoMarkReaded? Hehe, so close :-) Bye, Axel. From czeidler at mail.berlios.de Wed May 6 19:08:08 2009 From: czeidler at mail.berlios.de (czeidler at mail.berlios.de) Date: Wed, 6 May 2009 19:08:08 +0200 Subject: [Haiku-commits] r30651 - haiku/trunk/src/apps/mail Message-ID: <200905061708.n46H88XW018939@sheep.berlios.de> Author: czeidler Date: 2009-05-06 19:07:57 +0200 (Wed, 06 May 2009) New Revision: 30651 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30651&view=rev Modified: haiku/trunk/src/apps/mail/MailApp.cpp haiku/trunk/src/apps/mail/MailApp.h haiku/trunk/src/apps/mail/MailWindow.cpp haiku/trunk/src/apps/mail/MailWindow.h haiku/trunk/src/apps/mail/Messages.h haiku/trunk/src/apps/mail/Prefs.cpp haiku/trunk/src/apps/mail/Prefs.h Log: Hopefully this are all remaining read erros. Modified: haiku/trunk/src/apps/mail/MailApp.cpp =================================================================== --- haiku/trunk/src/apps/mail/MailApp.cpp 2009-05-06 15:47:50 UTC (rev 30650) +++ haiku/trunk/src/apps/mail/MailApp.cpp 2009-05-06 17:07:57 UTC (rev 30651) @@ -130,7 +130,7 @@ { // set default values fContentFont.SetSize(12.0); - fAutoMarkReaded = true; + fAutoMarkRead = true; fSignature = (char *)malloc(strlen(SIG_NONE) + 1); strcpy(fSignature, SIG_NONE); fReplyPreamble = (char *)malloc(1); @@ -349,7 +349,7 @@ &fColoredQuotes, &fDefaultChain, &fUseAccountFrom, &fReplyPreamble, &fSignature, &fMailCharacterSet, &fWarnAboutUnencodableCharacters, - &fStartWithSpellCheckOn, &fAutoMarkReaded, + &fStartWithSpellCheckOn, &fAutoMarkRead, &fShowButtonBar); fPrefsWindow->Show(); } @@ -912,7 +912,7 @@ settings.AddRect("SignatureWindowSize", fSignatureWindowFrame); settings.AddBool("WordWrapMode", fWrapMode); settings.AddPoint("PreferencesWindowLocation", fPrefsWindowPos); - settings.AddBool("AutoMarkReaded", fAutoMarkReaded); + settings.AddBool("AutoMarkRead", fAutoMarkRead); settings.AddString("SignatureText", fSignature); settings.AddInt32("CharacterSet", fMailCharacterSet); settings.AddString("FindString", FindWindow::GetFindString()); @@ -1001,8 +1001,8 @@ if (settings.FindPoint("PreferencesWindowLocation", &point) == B_OK) fPrefsWindowPos = point; - if (settings.FindBool("AutoMarkReaded", &boolValue) == B_OK) - fAutoMarkReaded = boolValue; + if (settings.FindBool("AutoMarkRead", &boolValue) == B_OK) + fAutoMarkRead = boolValue; const char *string; if (settings.FindString("SignatureText", &string) == B_OK) { @@ -1142,10 +1142,10 @@ bool -TMailApp::AutoMarkReaded() +TMailApp::AutoMarkRead() { BAutolock _(this); - return fAutoMarkReaded; + return fAutoMarkRead; } Modified: haiku/trunk/src/apps/mail/MailApp.h =================================================================== --- haiku/trunk/src/apps/mail/MailApp.h 2009-05-06 15:47:50 UTC (rev 30650) +++ haiku/trunk/src/apps/mail/MailApp.h 2009-05-06 17:07:57 UTC (rev 30651) @@ -73,7 +73,7 @@ void SetLastWindowFrame(BRect frame); // TODO: move these into a MailSettings class - bool AutoMarkReaded(); + bool AutoMarkRead(); BString Signature(); BString ReplyPreamble(); bool WrapMode(); @@ -114,7 +114,7 @@ bool fPrintHelpAndExit; // TODO: these should go into a settings class - bool fAutoMarkReaded; + bool fAutoMarkRead; char* fSignature; char* fReplyPreamble; bool fWrapMode; Modified: haiku/trunk/src/apps/mail/MailWindow.cpp =================================================================== --- haiku/trunk/src/apps/mail/MailWindow.cpp 2009-05-06 15:47:50 UTC (rev 30650) +++ haiku/trunk/src/apps/mail/MailWindow.cpp 2009-05-06 17:07:57 UTC (rev 30651) @@ -167,7 +167,7 @@ fChanged(false), fStartingText(NULL), fOriginatingWindow(NULL), - fReadedButton(NULL), + fReadButton(NULL), fNextButton(NULL) { if (messenger != NULL) @@ -194,7 +194,7 @@ fIncoming = false; } - fAutoMarkReaded = fApp->AutoMarkReaded(); + fAutoMarkRead = fApp->AutoMarkRead(); BRect r(0, 0, RIGHT_BOUNDARY, 15); fMenuBar = new BMenuBar(r, ""); @@ -634,8 +634,8 @@ new BMessage(M_NEXTMSG)); bbar->AddButton(MDR_DIALECT_CHOICE ("Previous","??"), 20, new BMessage(M_PREVMSG)); - if (!fAutoMarkReaded) { - _AddReadedButton(); + if (!fAutoMarkRead) { + _AddReadButton(); } } bbar->AddButton(MDR_DIALECT_CHOICE ("Inbox","???"), 36, @@ -696,7 +696,7 @@ void TMailWindow::UpdatePreferences() { - fAutoMarkReaded = fApp->AutoMarkReaded(); + fAutoMarkRead = fApp->AutoMarkRead(); _UpdateReadButton(); } @@ -817,17 +817,17 @@ void -TMailWindow::SetCurrentMessageRead(bool readed) +TMailWindow::SetCurrentMessageRead(bool read) { BNode node(fRef); if (node.InitCheck() == B_NO_ERROR) { BString status; if (ReadAttrString(&node, B_MAIL_ATTR_STATUS, &status) == B_NO_ERROR) { - if (readed && !status.ICompare("New")) { + if (read && !status.ICompare("New")) { node.RemoveAttr(B_MAIL_ATTR_STATUS); WriteAttrString(&node, B_MAIL_ATTR_STATUS, "Read"); } - if (!readed && !status.ICompare("Read")) { + if (!read && !status.ICompare("Read")) { node.RemoveAttr(B_MAIL_ATTR_STATUS); WriteAttrString(&node, B_MAIL_ATTR_STATUS, "New"); } @@ -1116,7 +1116,7 @@ foundRef = GetTrackerWindowFile(&nextRef, msg->what == M_DELETE_NEXT); } - if (fIncoming && fAutoMarkReaded) + if (fIncoming && fAutoMarkRead) SetCurrentMessageRead(); if (!fTrackerMessenger.IsValid() || !fIncoming) { @@ -1441,7 +1441,7 @@ SetCurrentMessageRead(false); _UpdateReadButton(); break; - case M_READED: + case M_READ: SetCurrentMessageRead(); msg->what = M_NEXTMSG; case M_PREVMSG: @@ -1452,7 +1452,7 @@ if (GetTrackerWindowFile(&nextRef, (msg->what == M_NEXTMSG))) { TMailWindow *window = static_cast(be_app)->FindWindow(nextRef); if (window == NULL) { - if (fAutoMarkReaded) + if (fAutoMarkRead) SetCurrentMessageRead(); OpenMessage(&nextRef, fHeaderView->fCharacterSetUserSees); } else { @@ -1707,7 +1707,7 @@ } } else if (fRef && !sKeepStatusOnQuit) { // ...Otherwise just set the message read - if (fAutoMarkReaded) + if (fAutoMarkRead) SetCurrentMessageRead(); } @@ -3133,7 +3133,7 @@ void -TMailWindow::_AddReadedButton() +TMailWindow::_AddReadButton() { bool newMail = false; BNode node(fRef); @@ -3147,11 +3147,11 @@ int32 buttonIndex = fButtonBar->IndexOf(fNextButton); if (newMail) - fReadedButton = fButtonBar->AddButton( + fReadButton = fButtonBar->AddButton( MDR_DIALECT_CHOICE (" Read ", " Read "), 24, - new BMessage(M_READED), buttonIndex); + new BMessage(M_READ), buttonIndex); else - fReadedButton = fButtonBar->AddButton( + fReadButton = fButtonBar->AddButton( MDR_DIALECT_CHOICE ("Unread", "Unread"), 28, new BMessage(M_UNREAD), buttonIndex); } @@ -3161,10 +3161,10 @@ TMailWindow::_UpdateReadButton() { if (fApp->ShowButtonBar()) { - fButtonBar->RemoveButton(fReadedButton); - fReadedButton = NULL; - if (!fAutoMarkReaded && !fReadedButton) { - _AddReadedButton(); + fButtonBar->RemoveButton(fReadButton); + fReadButton = NULL; + if (!fAutoMarkRead && !fReadButton) { + _AddReadButton(); } } UpdateViews(); Modified: haiku/trunk/src/apps/mail/MailWindow.h =================================================================== --- haiku/trunk/src/apps/mail/MailWindow.h 2009-05-06 15:47:50 UTC (rev 30650) +++ haiku/trunk/src/apps/mail/MailWindow.h 2009-05-06 17:07:57 UTC (rev 30651) @@ -107,7 +107,7 @@ void SaveTrackerPosition(entry_ref*); void SetOriginatingWindow(BWindow* window); - void SetCurrentMessageRead(bool readed = true); + void SetCurrentMessageRead(bool read = true); void SetTrackerSelectionToCurrent(); TMailWindow* FrontmostWindow(); void UpdateViews(); @@ -126,7 +126,7 @@ void _RebuildQueryMenu(bool firstTime = false); char* _BuildQueryString(BEntry* entry) const; - void _AddReadedButton(); + void _AddReadButton(); void _UpdateReadButton(); TMailApp* fApp; @@ -198,8 +198,8 @@ entry_ref fRepliedMail; BMessenger* fOriginatingWindow; - bool fAutoMarkReaded : 1; - BmapButton* fReadedButton; + bool fAutoMarkRead : 1; + BmapButton* fReadButton; BmapButton* fNextButton; }; Modified: haiku/trunk/src/apps/mail/Messages.h =================================================================== --- haiku/trunk/src/apps/mail/Messages.h 2009-05-06 15:47:50 UTC (rev 30650) +++ haiku/trunk/src/apps/mail/Messages.h 2009-05-06 17:07:57 UTC (rev 30651) @@ -113,7 +113,7 @@ M_COPY, // nav - M_READED, + M_READ, M_UNREAD, M_NEXTMSG, M_PREVMSG, Modified: haiku/trunk/src/apps/mail/Prefs.cpp =================================================================== --- haiku/trunk/src/apps/mail/Prefs.cpp 2009-05-06 15:47:50 UTC (rev 30650) +++ haiku/trunk/src/apps/mail/Prefs.cpp 2009-05-06 17:07:57 UTC (rev 30651) @@ -100,7 +100,7 @@ P_SIG, P_ENC, P_WARN_UNENCODABLE, P_SPELL_CHECK_START_ON, P_BUTTON_BAR, P_ACCOUNT, P_REPLYTO, P_REPLY_PREAMBLE, - P_COLORED_QUOTES, P_MARK_READED}; + P_COLORED_QUOTES, P_MARK_READ}; #define ICON_LABEL_TEXT MDR_DIALECT_CHOICE ("Show Icons & Labels", "????????") #define ICON_TEXT MDR_DIALECT_CHOICE ("Show Icons Only", "??????") @@ -137,7 +137,7 @@ TPrefsWindow::TPrefsWindow(BRect rect, BFont* font, int32* level, bool* wrap, bool* attachAttributes, bool* cquotes, uint32* account, int32* replyTo, char** preamble, char** sig, uint32* encoding, bool* warnUnencodable, - bool* spellCheckStartOn, bool* autoMarkReaded, uint8* buttonBar) + bool* spellCheckStartOn, bool* autoMarkRead, uint8* buttonBar) : #if USE_LAYOUT_MANAGEMENT BWindow(rect, MDR_DIALECT_CHOICE ("Mail Preferences", "Mail???"), @@ -183,8 +183,8 @@ fNewSpellCheckStartOn(spellCheckStartOn), fSpellCheckStartOn(*fNewSpellCheckStartOn), - fNewAutoMarkReaded(autoMarkReaded), - fAutoMarkReaded(*fNewAutoMarkReaded) + fNewAutoMarkRead(autoMarkRead), + fAutoMarkRead(*fNewAutoMarkRead) { strcpy(fSignature, *fNewSignature); @@ -246,9 +246,9 @@ fSpellCheckStartOnMenu, NULL); add_menu_to_layout(menu, interfaceLayout, layoutRow); - fAutoMarkReadedMenu = _BuildAutoMarkReadedMenu(fAutoMarkReaded); - menu = new BMenuField("autoMarkReaded", AUTO_MARK_READ_TEXT, - fAutoMarkReadedMenu, NULL); + fAutoMarkReadMenu = _BuildAutoMarkReadMenu(fAutoMarkRead); + menu = new BMenuField("autoMarkRead", AUTO_MARK_READ_TEXT, + fAutoMarkReadMenu, NULL); add_menu_to_layout(menu, interfaceLayout, layoutRow); // Mail Accounts @@ -414,9 +414,9 @@ interfaceBox->AddChild(menu); r.OffsetBy(0, height + ITEM_SPACE); - fAutoMarkReadedMenu = _BuildAutoMarkReadedMenu(fAutoMarkReaded); - menu = new BMenuField("autoMarkReaded", AUTO_MARK_READ_TEXT, - fAutoMarkReadedMenu, NULL); + fAutoMarkReadMenu = _BuildAutoMarkReadMenu(fAutoMarkRead); + menu = new BMenuField("autoMarkRead", AUTO_MARK_READ_TEXT, + fAutoMarkReadMenu, NULL); menu->SetDivider(labelWidth); menu->SetAlignment(B_ALIGN_RIGHT); interfaceBox->AddChild(menu); @@ -593,7 +593,7 @@ *fNewEncoding = fEncoding; *fNewWarnUnencodable = fWarnUnencodable; *fNewSpellCheckStartOn = fSpellCheckStartOn; - *fNewAutoMarkReaded = fAutoMarkReaded; + *fNewAutoMarkRead = fAutoMarkRead; *fNewButtonBar = fButtonBar; be_app->PostMessage(PREFS_CHANGED); @@ -734,8 +734,8 @@ case P_SPELL_CHECK_START_ON: msg->FindBool("spellCheckStartOn", fNewSpellCheckStartOn); break; - case P_MARK_READED: - msg->FindBool("autoMarkReaded", fNewAutoMarkReaded); + case P_MARK_READ: + msg->FindBool("autoMarkRead", fNewAutoMarkRead); be_app->PostMessage(PREFS_CHANGED); break; case P_BUTTON_BAR: @@ -764,7 +764,7 @@ || fEncoding != *fNewEncoding || fWarnUnencodable != *fNewWarnUnencodable || fSpellCheckStartOn != *fNewSpellCheckStartOn - || fAutoMarkReaded != *fNewAutoMarkReaded + || fAutoMarkRead != *fNewAutoMarkRead || fButtonBar != *fNewButtonBar; fRevert->SetEnabled(changed); } @@ -1124,10 +1124,10 @@ BPopUpMenu* -TPrefsWindow::_BuildAutoMarkReadedMenu(bool autoMarkReaded) +TPrefsWindow::_BuildAutoMarkReadMenu(bool autoMarkRead) { - return _BuildBoolMenu(P_MARK_READED, "autoMarkReaded", - autoMarkReaded); + return _BuildBoolMenu(P_MARK_READ, "autoMarkRead", + autoMarkRead); } Modified: haiku/trunk/src/apps/mail/Prefs.h =================================================================== --- haiku/trunk/src/apps/mail/Prefs.h 2009-05-06 15:47:50 UTC (rev 30650) +++ haiku/trunk/src/apps/mail/Prefs.h 2009-05-06 17:07:57 UTC (rev 30651) @@ -70,7 +70,7 @@ char** preamble, char** sig, uint32* encoding, bool* warnUnencodable, bool* spellCheckStartOn, - bool* autoMarkReaded, uint8* buttonBar); + bool* autoMarkRead, uint8* buttonBar); virtual ~TPrefsWindow(); virtual void MessageReceived(BMessage* message); @@ -91,8 +91,8 @@ bool warnUnencodable); BPopUpMenu* _BuildSpellCheckStartOnMenu( bool spellCheckStartOn); - BPopUpMenu* _BuildAutoMarkReadedMenu( - bool autoMarkReaded); + BPopUpMenu* _BuildAutoMarkReadMenu( + bool autoMarkRead); BPopUpMenu* _BuildButtonBarMenu(uint8 show); BPopUpMenu* _BuildBoolMenu(uint32 msg, @@ -123,8 +123,8 @@ bool fWarnUnencodable; bool* fNewSpellCheckStartOn; bool fSpellCheckStartOn; - bool* fNewAutoMarkReaded; - bool fAutoMarkReaded; + bool* fNewAutoMarkRead; + bool fAutoMarkRead; BButton* fRevert; @@ -142,7 +142,7 @@ BPopUpMenu* fWarnUnencodableMenu; BPopUpMenu* fSpellCheckStartOnMenu; BPopUpMenu* fButtonBarMenu; - BPopUpMenu* fAutoMarkReadedMenu; + BPopUpMenu* fAutoMarkReadMenu; }; #endif /* _PREFS_H */ From clemens.zeidler at rwth-aachen.de Wed May 6 19:10:22 2009 From: clemens.zeidler at rwth-aachen.de (Clemens zeidler) Date: Wed, 06 May 2009 19:10:22 +0200 Subject: [Haiku-commits] r30650 - haiku/trunk/src/apps/mail In-Reply-To: <37089941245-BeMail@zon> References: <37089941245-BeMail@zon> Message-ID: Ok I grep for "readed" and hopefully get them all, these nasty beast! Clemens > autoMarkReaded? Hehe, so close :-) > > Bye, > Axel. > > _______________________________________________ > Haiku-commits mailing list > Haiku-commits at lists.berlios.de > https://lists.berlios.de/mailman/listinfo/haiku-commits From korli at mail.berlios.de Wed May 6 22:34:19 2009 From: korli at mail.berlios.de (korli at BerliOS) Date: Wed, 6 May 2009 22:34:19 +0200 Subject: [Haiku-commits] r30652 - in buildtools/trunk/gcc/gcc: . config/arm Message-ID: <200905062034.n46KYJsY026007@sheep.berlios.de> Author: korli Date: 2009-05-06 22:34:18 +0200 (Wed, 06 May 2009) New Revision: 30652 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30652&view=rev Modified: buildtools/trunk/gcc/gcc/config.gcc buildtools/trunk/gcc/gcc/config/arm/haiku.h Log: Applied patch for arm haiku target from Johannes Wischert (bug #3633) The cross tools build still needs the arm specific headers in Haiku to complete (bug #3763) Modified: buildtools/trunk/gcc/gcc/config/arm/haiku.h =================================================================== --- buildtools/trunk/gcc/gcc/config/arm/haiku.h 2009-05-06 17:07:57 UTC (rev 30651) +++ buildtools/trunk/gcc/gcc/config/arm/haiku.h 2009-05-06 20:34:18 UTC (rev 30652) @@ -21,7 +21,8 @@ #undef TARGET_VERSION #define TARGET_VERSION fprintf (stderr, " (ARM Haiku/ELF)"); - +#undef ASM_COMMENT_START +#define ASM_COMMENT_START "@" /* Unsigned chars produces much better code than signed. */ #define DEFAULT_SIGNED_CHAR 0 Modified: buildtools/trunk/gcc/gcc/config.gcc =================================================================== --- buildtools/trunk/gcc/gcc/config.gcc 2009-05-06 17:07:57 UTC (rev 30651) +++ buildtools/trunk/gcc/gcc/config.gcc 2009-05-06 20:34:18 UTC (rev 30652) @@ -737,7 +737,6 @@ tmake_file="${tmake_file} t-haiku arm/t-arm arm/t-arm-elf" tm_file="dbxelf.h elfos.h haiku.h arm/elf.h arm/aout.h arm/haiku.h arm/arm.h" tm_defines="USE_GAS" - use_fixproto=yes ;; arm*-*-linux*) # ARM GNU/Linux with ELF tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h" From zooey at mail.berlios.de Wed May 6 22:34:29 2009 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Wed, 6 May 2009 22:34:29 +0200 Subject: [Haiku-commits] r30653 - haiku/trunk/src/bin/zip Message-ID: <200905062034.n46KYTYb026049@sheep.berlios.de> Author: zooey Date: 2009-05-06 22:34:28 +0200 (Wed, 06 May 2009) New Revision: 30653 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30653&view=rev Modified: haiku/trunk/src/bin/zip/beos.c Log: Closing #3874: * fixed a couple of memory leaks in the BeOS-specific (attribute related) code of zip Modified: haiku/trunk/src/bin/zip/beos.c =================================================================== --- haiku/trunk/src/bin/zip/beos.c 2009-05-06 20:34:18 UTC (rev 30652) +++ haiku/trunk/src/bin/zip/beos.c 2009-05-06 20:34:28 UTC (rev 30653) @@ -746,6 +746,8 @@ compbuff = attrbuff; flags = EB_BE_FL_NATURAL; + } else { + free( attrbuff ); } /* Check to see if we really have enough room in the EF for the data. */ @@ -761,6 +763,7 @@ z->ext = 0; } if( l_ef == NULL ) { + free( compbuff ); return ZE_MEM; } z->extra = l_ef; @@ -773,6 +776,7 @@ z->cext = 0; } if( c_ef == NULL ) { + free( compbuff ); return ZE_MEM; } z->cextra = c_ef; @@ -805,6 +809,8 @@ z->cext += EB_C_BE_SIZE; + free( compbuff ); + return ZE_OK; } From axeld at mail.berlios.de Thu May 7 09:20:57 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 7 May 2009 09:20:57 +0200 Subject: [Haiku-commits] r30654 - haiku/trunk/src/tools/fs_shell Message-ID: <200905070720.n477KvLl007069@sheep.berlios.de> Author: axeld Date: 2009-05-07 09:20:57 +0200 (Thu, 07 May 2009) New Revision: 30654 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30654&view=rev Modified: haiku/trunk/src/tools/fs_shell/command_cp.cpp Log: * Don't let GuestNode::Init() fail if the attribute directory could not be opened; not all file systems support this. Modified: haiku/trunk/src/tools/fs_shell/command_cp.cpp =================================================================== --- haiku/trunk/src/tools/fs_shell/command_cp.cpp 2009-05-06 20:34:28 UTC (rev 30653) +++ haiku/trunk/src/tools/fs_shell/command_cp.cpp 2009-05-07 07:20:57 UTC (rev 30654) @@ -123,7 +123,7 @@ virtual ~FSDomain() {} virtual fssh_status_t Open(const char *path, int openMode, Node *&node) = 0; - + virtual fssh_status_t CreateFile(const char *path, const struct fssh_stat &st, File *&file) = 0; virtual fssh_status_t CreateDirectory(const char *path, @@ -173,7 +173,7 @@ { if (!fAttrDir) return 0; - + fssh_set_errno(FSSH_B_OK); struct dirent *entry = fs_read_attr_dir(fAttrDir); if (!entry) @@ -394,7 +394,7 @@ _node = node; return FSSH_B_OK; } - + virtual fssh_status_t CreateFile(const char *path, const struct fssh_stat &st, File *&_file) { @@ -529,8 +529,9 @@ // open the attribute directory fAttrDir = _kern_open_attr_dir(fd, NULL); - if (fAttrDir < 0) - return fAttrDir; + if (fAttrDir < 0) { + // TODO: check if the file system supports attributes, and fail + } return FSSH_B_OK; } @@ -539,7 +540,7 @@ { if (fAttrDir < 0) return 0; - + char buffer[sizeof(fssh_dirent) + B_ATTR_NAME_LENGTH]; struct fssh_dirent *entry = (fssh_dirent *)buffer; int numRead = _kern_read_dir(fAttrDir, entry, sizeof(buffer), 1); @@ -758,7 +759,7 @@ _node = node; return FSSH_B_OK; } - + virtual fssh_status_t CreateFile(const char *path, const struct fssh_stat &st, File *&_file) { @@ -1183,7 +1184,7 @@ fssh_strerror(bytesRead)); } linkTo[bytesRead] = '\0'; // always NULL-terminate - + // create the target link SymLink *link; error = targetDomain->CreateSymLink(target, linkTo, From axeld at mail.berlios.de Thu May 7 10:00:17 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 7 May 2009 10:00:17 +0200 Subject: [Haiku-commits] r30655 - haiku/trunk/src/add-ons/kernel/file_systems/iso9660 Message-ID: <200905070800.n4780HOV013603@sheep.berlios.de> Author: axeld Date: 2009-05-07 10:00:10 +0200 (Thu, 07 May 2009) New Revision: 30655 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30655&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/iso9660/iso9660.cpp haiku/trunk/src/add-ons/kernel/file_systems/iso9660/iso9660.h haiku/trunk/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp Log: * We now ignore associated files. This makes the double entries of bug #3861 disappear. * When parsing rock ridge attributes, we no longer stop when we encounter an unknown one. Instead, we just parse through until the end. The ISO image as part of #3861 also made this visible. * Minor cleanup. Modified: haiku/trunk/src/add-ons/kernel/file_systems/iso9660/iso9660.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/iso9660/iso9660.cpp 2009-05-07 07:20:57 UTC (rev 30654) +++ haiku/trunk/src/add-ons/kernel/file_systems/iso9660/iso9660.cpp 2009-05-07 08:00:10 UTC (rev 30655) @@ -303,6 +303,8 @@ length = *(uint8*)(buffer + 2); if (buffer + length > end) break; + if (length == 0) + break; switch (((int)buffer[0] << 8) + buffer[1]) { // Stat structure stuff @@ -496,7 +498,7 @@ // Deep directory record masquerading as a file. case 'CL': TRACE(("RR: found CL, length %u\n", length)); - node->flags |= ISO_ISDIR; + node->flags |= ISO_IS_DIR; node->startLBN[LSB_DATA] = *(uint32*)(buffer+4); node->startLBN[MSB_DATA] = *(uint32*)(buffer+8); break; @@ -508,7 +510,8 @@ case 'RE': // Relocated directory, we should skip. TRACE(("RR: found RE, length %u\n", length)); - return B_BAD_VALUE; + // TODO: support relocated directories + return B_NOT_SUPPORTED; case 'TF': TRACE(("RR: found TF, length %u\n", length)); @@ -518,10 +521,17 @@ TRACE(("RR: found RR, length %u\n", length)); break; + case 'SF': + TRACE(("RR: found SF, sparse files not supported!\n")); + // TODO: support sparse files + return B_NOT_SUPPORTED; + default: - TRACE(("RR: %x, %x, end of extensions.\n", - buffer[0], buffer[1])); - done = true; + if (buffer[0] == '\0') { + TRACE(("RR: end of extensions\n")); + done = true; + } else + TRACE(("RR: Unknown tag %c%c\n", buffer[0], buffer[1])); break; } } @@ -712,36 +722,45 @@ cacheBlock = cookie->block; if (blockData != NULL && totalRead < cookie->totalSize) { - iso9660_inode node; - result = InitNode(&node, blockData + cookie->pos, &bytesRead, - volume->joliet_level); - if (result == B_OK) { - size_t nameBufferSize = bufferSize - sizeof(struct dirent); + bool done = false; + while (!done) { + iso9660_inode node; + result = InitNode(&node, blockData + cookie->pos, &bytesRead, + volume->joliet_level); + if (result != B_OK) + break; - dirent->d_dev = volume->id; - dirent->d_ino = ((ino_t)cookie->block << 30) - + (cookie->pos & 0x3fffffff); - dirent->d_reclen = sizeof(struct dirent) + node.name_length + 1; + if ((node.flags & ISO_IS_ASSOCIATED_FILE) == 0) { + size_t nameBufferSize = bufferSize - sizeof(struct dirent); - if (node.name_length <= nameBufferSize) { - // need to do some size checking here. - strlcpy(dirent->d_name, node.name, node.name_length + 1); - TRACE(("ISOReadDirEnt - success, name is %s, block %Ld, pos " - "%Ld, inode id %Ld\n", dirent->d_name, cookie->block, - cookie->pos, dirent->d_ino)); - } else { - // TODO: this can be just normal if we support reading more - // than one entry. - TRACE(("ISOReadDirEnt - ERROR, name %s does not fit in buffer " - "of size %lu\n", node.name, nameBufferSize)); - result = B_BAD_VALUE; + dirent->d_dev = volume->id; + dirent->d_ino = ((ino_t)cookie->block << 30) + + (cookie->pos & 0x3fffffff); + dirent->d_reclen = sizeof(struct dirent) + node.name_length + 1; + + if (node.name_length <= nameBufferSize) { + // need to do some size checking here. + strlcpy(dirent->d_name, node.name, node.name_length + 1); + TRACE(("ISOReadDirEnt - success, name is %s, block %Ld, pos " + "%Ld, inode id %Ld\n", dirent->d_name, cookie->block, + cookie->pos, dirent->d_ino)); + } else { + // TODO: this can be just normal if we support reading more + // than one entry. + TRACE(("ISOReadDirEnt - ERROR, name %s does not fit in buffer " + "of size %lu\n", node.name, nameBufferSize)); + result = B_BAD_VALUE; + } + + done = true; } + cookie->pos += bytesRead; - } - if (cookie->pos == volume->logicalBlkSize[FS_DATA_FORMAT]) { - cookie->pos = 0; - cookie->block++; + if (cookie->pos == volume->logicalBlkSize[FS_DATA_FORMAT]) { + cookie->pos = 0; + cookie->block++; + } } } else { if (totalRead >= cookie->totalSize) @@ -782,6 +801,7 @@ memset(node->attr.stat, 0, sizeof(node->attr.stat)); node->extAttrRecLen = *(uint8*)buffer++; + TRACE(("InitNode - ext attr length is %ld\n", node->extAttrRecLen)); node->startLBN[LSB_DATA] = *(uint32*)buffer; buffer += 4; @@ -819,7 +839,7 @@ TRACE(("InitNode - file id length is %lu\n", node->name_length)); // Set defaults, in case there is no RockRidge stuff. - node->attr.stat[FS_DATA_FORMAT].st_mode |= (node->flags & ISO_ISDIR) != 0 + node->attr.stat[FS_DATA_FORMAT].st_mode |= (node->flags & ISO_IS_DIR) != 0 ? S_IFDIR | S_IXUSR | S_IRUSR | S_IXGRP | S_IRGRP | S_IXOTH | S_IROTH : S_IFREG | S_IRUSR | S_IRGRP | S_IROTH; Modified: haiku/trunk/src/add-ons/kernel/file_systems/iso9660/iso9660.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/iso9660/iso9660.h 2009-05-07 07:20:57 UTC (rev 30654) +++ haiku/trunk/src/add-ons/kernel/file_systems/iso9660/iso9660.h 2009-05-07 08:00:10 UTC (rev 30655) @@ -116,12 +116,12 @@ // These go with the flags member of the iso9660_volume struct. enum { - ISO_ISHIDDEN = 0, - ISO_ISDIR = 2, - ISO_ISASSOCFILE = 4, - ISO_EXTATTR = 8, - ISO_EXTPERM = 16, - ISO_MOREDIRS = 128 + ISO_IS_HIDDEN = 0x01, + ISO_IS_DIR = 0x02, + ISO_IS_ASSOCIATED_FILE = 0x04, + ISO_EXTENDED_ATTRIBUTE = 0x08, + ISO_EXTENDED_PERMISSIONS = 0x10, + ISO_MORE_DIRS = 0x80 }; Modified: haiku/trunk/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp 2009-05-07 07:20:57 UTC (rev 30654) +++ haiku/trunk/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp 2009-05-07 08:00:10 UTC (rev 30655) @@ -355,7 +355,7 @@ *_type = newNode->attr.stat[FS_DATA_FORMAT].st_mode & ~(S_IWUSR | S_IWGRP | S_IWOTH); *_flags = 0; - if ((newNode->flags & ISO_ISDIR) == 0) { + if ((newNode->flags & ISO_IS_DIR) == 0) { newNode->cache = file_cache_create(ns->id, vnodeID, newNode->dataLen[FS_DATA_FORMAT]); } @@ -471,7 +471,7 @@ { iso9660_inode *node = (iso9660_inode *)_node->private_node; - if (node->flags & ISO_ISDIR) + if ((node->flags & ISO_IS_DIR) != 0) return EISDIR; uint32 fileSize = node->dataLen[FS_DATA_FORMAT]; @@ -548,7 +548,7 @@ TRACE(("fs_open_dir - node is %p\n", node)); - if (!(node->flags & ISO_ISDIR)) + if ((node->flags & ISO_IS_DIR) == 0) return B_NOT_A_DIRECTORY; dircookie* dirCookie = (dircookie*)malloc(sizeof(dircookie)); From bga at mail.berlios.de Thu May 7 15:00:08 2009 From: bga at mail.berlios.de (bga at BerliOS) Date: Thu, 7 May 2009 15:00:08 +0200 Subject: [Haiku-commits] r30656 - haiku/trunk/src/servers/net Message-ID: <200905071300.n47D08Dc026160@sheep.berlios.de> Author: bga Date: 2009-05-07 15:00:08 +0200 (Thu, 07 May 2009) New Revision: 30656 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30656&view=rev Modified: haiku/trunk/src/servers/net/DHCPClient.cpp Log: - Fix DHCP client when multiple interfaces are present in the system. Modified: haiku/trunk/src/servers/net/DHCPClient.cpp =================================================================== --- haiku/trunk/src/servers/net/DHCPClient.cpp 2009-05-07 08:00:10 UTC (rev 30655) +++ haiku/trunk/src/servers/net/DHCPClient.cpp 2009-05-07 13:00:08 UTC (rev 30656) @@ -397,6 +397,13 @@ local.sin_port = htons(DHCP_CLIENT_PORT); local.sin_addr.s_addr = INADDR_ANY; + // Enable reusing the port . This is needed in case there is more + // than 1 interface that needs to be configured. Note that the only reason + // this works is because there is code below to bind to a specific + // interface. + int option = 1; + setsockopt(socket, SOL_SOCKET, SO_REUSEPORT, &option, sizeof(option)); + if (bind(socket, (struct sockaddr *)&local, sizeof(local)) < 0) { close(socket); return errno; @@ -409,7 +416,7 @@ broadcast.sin_port = htons(DHCP_SERVER_PORT); broadcast.sin_addr.s_addr = INADDR_BROADCAST; - int option = 1; + option = 1; setsockopt(socket, SOL_SOCKET, SO_BROADCAST, &option, sizeof(option)); if (state == INIT) { @@ -857,4 +864,3 @@ break; } } - From bonefish at mail.berlios.de Thu May 7 17:50:57 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Thu, 7 May 2009 17:50:57 +0200 Subject: [Haiku-commits] r30657 - haiku/trunk/src/apps/debuganalyzer/model Message-ID: <200905071550.n47FovFX012726@sheep.berlios.de> Author: bonefish Date: 2009-05-07 17:50:55 +0200 (Thu, 07 May 2009) New Revision: 30657 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30657&view=rev Modified: haiku/trunk/src/apps/debuganalyzer/model/ThreadModel.cpp Log: Fixed cause of potential crash. The binary search could have found the count as final index and accessed the non-existing item. Modified: haiku/trunk/src/apps/debuganalyzer/model/ThreadModel.cpp =================================================================== --- haiku/trunk/src/apps/debuganalyzer/model/ThreadModel.cpp 2009-05-07 13:00:08 UTC (rev 30656) +++ haiku/trunk/src/apps/debuganalyzer/model/ThreadModel.cpp 2009-05-07 15:50:55 UTC (rev 30657) @@ -101,7 +101,7 @@ time += fModel->BaseTime(); int32 lower = 0; - int32 upper = CountSchedulingEvents(); + int32 upper = CountSchedulingEvents() - 1; while (lower < upper) { int32 mid = (lower + upper) / 2; From bonefish at mail.berlios.de Thu May 7 17:53:20 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Thu, 7 May 2009 17:53:20 +0200 Subject: [Haiku-commits] r30658 - haiku/trunk/src/apps/debuganalyzer/gui/chart Message-ID: <200905071553.n47FrKdu012880@sheep.berlios.de> Author: bonefish Date: 2009-05-07 17:53:18 +0200 (Thu, 07 May 2009) New Revision: 30658 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30658&view=rev Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.cpp haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.h Log: * Implemented zooming the domain of the chart (via Shift + Wheel). * The scrolling related computations used a slightly off chart width/height. Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.cpp =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.cpp 2009-05-07 15:50:55 UTC (rev 30657) +++ haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.cpp 2009-05-07 15:53:18 UTC (rev 30658) @@ -63,7 +63,9 @@ fHScrollSize(0), fVScrollSize(0), fHScrollValue(0), - fVScrollValue(0) + fVScrollValue(0), + fDomainZoomLimit(0), + fLastMousePos(-1, -1) { SetViewColor(B_TRANSPARENT_32_BIT); @@ -239,7 +241,21 @@ } +double +Chart::DomainZoomLimit() const +{ + return fDomainZoomLimit; +} + + void +Chart::SetDomainZoomLimit(double limit) +{ + fDomainZoomLimit = limit; +} + + +void Chart::DomainChanged() { if (ScrollBar(B_HORIZONTAL) != NULL && fDisplayDomain.IsValid()) @@ -260,6 +276,31 @@ void +Chart::MessageReceived(BMessage* message) +{ + switch (message->what) { + case B_MOUSE_WHEEL_CHANGED: + { + // We're only interested in Shift + vertical wheel, if the mouse + // is in the chart frame. + float deltaY; + if ((modifiers() & B_SHIFT_KEY) == 0 + || message->FindFloat("be:wheel_delta_y", &deltaY) != B_OK + || !fChartFrame.InsetByCopy(1, 1).Contains(fLastMousePos)) { + break; + } + + _Zoom(fLastMousePos.x, deltaY); + + return; + } + } + + BView::MessageReceived(message); +} + + +void Chart::FrameResized(float newWidth, float newHeight) { //printf("Chart::FrameResized(%f, %f)\n", newWidth, newHeight); @@ -273,6 +314,13 @@ void +Chart::MouseMoved(BPoint where, uint32 code, const BMessage* dragMessage) +{ + fLastMousePos = where; +} + + +void Chart::Draw(BRect updateRect) { printf("Chart::Draw((%f, %f) - (%f, %f))\n", updateRect.left, updateRect.top, updateRect.right, updateRect.bottom); @@ -419,7 +467,7 @@ const ChartDataRange& displayRange = horizontal ? fDisplayDomain : fDisplayRange; float chartSize = horizontal ? fChartFrame.Width() : fChartFrame.Height(); - chartSize += 3; // +1 for pixel size, +2 for border + chartSize--; // +1 for pixel size, -2 for border float& scrollSize = horizontal ? fHScrollSize : fVScrollSize; float& scrollValue = horizontal ? fHScrollValue : fVScrollValue; BScrollBar* scrollBar = ScrollBar(horizontal ? B_HORIZONTAL : B_VERTICAL); @@ -456,7 +504,7 @@ const ChartDataRange& range = horizontal ? fDomain : fRange; ChartDataRange displayRange = horizontal ? fDisplayDomain : fDisplayRange; float chartSize = horizontal ? fChartFrame.Width() : fChartFrame.Height(); - chartSize += 3; // +1 for pixel size, +2 for border + chartSize--; // +1 for pixel size, -2 for border const float& scrollSize = horizontal ? fHScrollSize : fVScrollSize; scrollValue = value; @@ -467,3 +515,46 @@ else SetDisplayRange(displayRange); } + + +void +Chart::_Zoom(float x, float steps) +{ + double displayDomainSize = fDisplayDomain.Size(); + if (fDomainZoomLimit <= 0 || !fDomain.IsValid() || !fDisplayDomain.IsValid() + || steps == 0) { + return; + } + + // compute the domain point where to zoom in + float chartSize = fChartFrame.Width() - 1; + x -= fChartFrame.left + 1; + double domainPos = (fHScrollValue + x) / (fHScrollSize + chartSize) + * fDomain.Size(); + + double factor = 2; + if (steps < 0) { + steps = -steps; + factor = 1.0 / factor; + } + + for (; steps > 0; steps--) + displayDomainSize *= factor; + + if (displayDomainSize < fDomainZoomLimit) + displayDomainSize = fDomainZoomLimit; + if (displayDomainSize > fDomain.Size()) + displayDomainSize = fDomain.Size(); + + if (displayDomainSize == fDisplayDomain.Size()) + return; + + domainPos -= displayDomainSize * x / chartSize; + ChartDataRange displayDomain(domainPos, domainPos + displayDomainSize); + if (displayDomain.min < fDomain.min) + displayDomain.OffsetTo(fDomain.min); + if (displayDomain.max > fDomain.max) + displayDomain.OffsetTo(fDomain.max - displayDomainSize); + + SetDisplayDomain(displayDomain); +} Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.h =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.h 2009-05-07 15:50:55 UTC (rev 30657) +++ haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.h 2009-05-07 15:53:18 UTC (rev 30658) @@ -49,9 +49,16 @@ void SetDisplayDomain(ChartDataRange domain); void SetDisplayRange(ChartDataRange range); + double DomainZoomLimit() const; + void SetDomainZoomLimit(double limit); + virtual void DomainChanged(); virtual void RangeChanged(); + virtual void MessageReceived(BMessage* message); + + virtual void MouseMoved(BPoint where, uint32 code, + const BMessage* dragMessage); virtual void FrameResized(float newWidth, float newHeight); virtual void Draw(BRect updateRect); virtual void ScrollTo(BPoint where); @@ -80,6 +87,7 @@ void _UpdateDomainAndRange(); void _UpdateScrollBar(bool horizontal); void _ScrollTo(float value, bool horizontal); + void _Zoom(float x, float steps); private: ChartRenderer* fRenderer; @@ -97,6 +105,8 @@ float fVScrollSize; float fHScrollValue; float fVScrollValue; + double fDomainZoomLimit; + BPoint fLastMousePos; }; From bonefish at mail.berlios.de Thu May 7 17:54:17 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Thu, 7 May 2009 17:54:17 +0200 Subject: [Haiku-commits] r30659 - haiku/trunk/src/apps/debuganalyzer/gui/thread_window Message-ID: <200905071554.n47FsHb0012979@sheep.berlios.de> Author: bonefish Date: 2009-05-07 17:54:16 +0200 (Thu, 07 May 2009) New Revision: 30659 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30659&view=rev Modified: haiku/trunk/src/apps/debuganalyzer/gui/thread_window/ActivityPage.cpp Log: Enabled zooming the chart. Modified: haiku/trunk/src/apps/debuganalyzer/gui/thread_window/ActivityPage.cpp =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/thread_window/ActivityPage.cpp 2009-05-07 15:53:18 UTC (rev 30658) +++ haiku/trunk/src/apps/debuganalyzer/gui/thread_window/ActivityPage.cpp 2009-05-07 15:54:16 UTC (rev 30659) @@ -314,6 +314,8 @@ ObjectDeleter rendererDeleter(fActivityChartRenderer); fActivityChart = new Chart(fActivityChartRenderer); + fActivityChart->SetDomainZoomLimit(1000); + // maximal zoom: 1 ms for the whole displayed domain BGroupLayoutBuilder(this) .Add(new BScrollView("activity scroll", fActivityChart, 0, true, false)) @@ -403,6 +405,5 @@ fPreemptionTimeData = new(std::nothrow) ThreadActivityData(fThreadModel, LATENCY_TIME); fActivityChart->AddDataSource(fPreemptionTimeData, &latencyConfig); -fActivityChart->SetDisplayDomain(ChartDataRange(0, 500000)); } } From bonefish at mail.berlios.de Thu May 7 18:19:09 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Thu, 7 May 2009 18:19:09 +0200 Subject: [Haiku-commits] r30660 - haiku/trunk/src/apps/debuganalyzer/gui/chart Message-ID: <200905071619.n47GJ9Us015186@sheep.berlios.de> Author: bonefish Date: 2009-05-07 18:19:08 +0200 (Thu, 07 May 2009) New Revision: 30660 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30660&view=rev Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.cpp haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.h Log: * Added support for panning with the mouse. * Some simplifications. Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.cpp =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.cpp 2009-05-07 15:54:16 UTC (rev 30659) +++ haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.cpp 2009-05-07 16:19:08 UTC (rev 30660) @@ -12,6 +12,7 @@ #include #include #include +#include #include "chart/ChartAxis.h" #include "chart/ChartDataSource.h" @@ -65,7 +66,8 @@ fHScrollValue(0), fVScrollValue(0), fDomainZoomLimit(0), - fLastMousePos(-1, -1) + fLastMousePos(-1, -1), + fDraggingStartPos(-1, -1) { SetViewColor(B_TRANSPARENT_32_BIT); @@ -191,7 +193,7 @@ // sanitize the supplied range if (domain.IsValid() && domain.Size() < fDomain.Size()) { if (domain.min < fDomain.min) - domain.OffsetBy(fDomain.min - domain.min); + domain.OffsetTo(fDomain.min); else if (domain.max > fDomain.max) domain.OffsetBy(fDomain.max - domain.max); } else @@ -219,7 +221,7 @@ // sanitize the supplied range if (range.IsValid() && range.Size() < fRange.Size()) { if (range.min < fRange.min) - range.OffsetBy(fRange.min - range.min); + range.OffsetTo(fRange.min); else if (range.max > fRange.max) range.OffsetBy(fRange.max - range.max); } else @@ -314,9 +316,52 @@ void +Chart::MouseDown(BPoint where) +{ + // ignore, if already dragging or if there's no scrollbar + if (fDraggingStartPos.x >= 0 || ScrollBar(B_HORIZONTAL) == NULL) + return; + + // the first button must be pressed + int32 buttons; + if (Window()->CurrentMessage()->FindInt32("buttons", &buttons) != B_OK + || (buttons & B_PRIMARY_MOUSE_BUTTON) == 0) { + return; + } + + fDraggingStartPos = where; + fDraggingStartScrollValue = fHScrollValue; + + SetMouseEventMask(B_POINTER_EVENTS); +} + + +void +Chart::MouseUp(BPoint where) +{ + // ignore if not dragging, or if the first mouse button is still pressed + int32 buttons; + if (fDraggingStartPos.x < 0 + || Window()->CurrentMessage()->FindInt32("buttons", &buttons) != B_OK + || (buttons & B_PRIMARY_MOUSE_BUTTON) != 0) { + return; + } + + // stop dragging + fDraggingStartPos.x = -1; +} + + +void Chart::MouseMoved(BPoint where, uint32 code, const BMessage* dragMessage) { fLastMousePos = where; + + if (fDraggingStartPos.x < 0) + return; + + ScrollBar(B_HORIZONTAL)->SetValue(fDraggingStartScrollValue + + fDraggingStartPos.x - where.x); } @@ -550,11 +595,6 @@ return; domainPos -= displayDomainSize * x / chartSize; - ChartDataRange displayDomain(domainPos, domainPos + displayDomainSize); - if (displayDomain.min < fDomain.min) - displayDomain.OffsetTo(fDomain.min); - if (displayDomain.max > fDomain.max) - displayDomain.OffsetTo(fDomain.max - displayDomainSize); - - SetDisplayDomain(displayDomain); + SetDisplayDomain(ChartDataRange(domainPos, domainPos + displayDomainSize)); + // will adjust the supplied display domain to fit the domain } Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.h =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.h 2009-05-07 15:54:16 UTC (rev 30659) +++ haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.h 2009-05-07 16:19:08 UTC (rev 30660) @@ -57,6 +57,8 @@ virtual void MessageReceived(BMessage* message); + virtual void MouseDown(BPoint where); + virtual void MouseUp(BPoint where); virtual void MouseMoved(BPoint where, uint32 code, const BMessage* dragMessage); virtual void FrameResized(float newWidth, float newHeight); @@ -107,6 +109,8 @@ float fVScrollValue; double fDomainZoomLimit; BPoint fLastMousePos; + BPoint fDraggingStartPos; + float fDraggingStartScrollValue; }; From jackburton at mail.berlios.de Thu May 7 21:45:47 2009 From: jackburton at mail.berlios.de (jackburton at mail.berlios.de) Date: Thu, 7 May 2009 21:45:47 +0200 Subject: [Haiku-commits] r30661 - haiku/trunk/src/kits/interface Message-ID: <200905071945.n47Jjlnq014474@sheep.berlios.de> Author: jackburton Date: 2009-05-07 21:45:42 +0200 (Thu, 07 May 2009) New Revision: 30661 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30661&view=rev Modified: haiku/trunk/src/kits/interface/Menu.cpp haiku/trunk/src/kits/interface/MenuItem.cpp Log: BMenuItem didn't draw the modifier indicator for B_OPTION_KEY. Fixes ticket #3887 Modified: haiku/trunk/src/kits/interface/Menu.cpp =================================================================== --- haiku/trunk/src/kits/interface/Menu.cpp 2009-05-07 16:19:08 UTC (rev 30660) +++ haiku/trunk/src/kits/interface/Menu.cpp 2009-05-07 19:45:42 UTC (rev 30661) @@ -2025,7 +2025,7 @@ bool command = false; bool control = false; bool shift = false; - + bool option = false; if (index > 0) frame = ItemAt(index - 1)->Frame(); else @@ -2045,6 +2045,8 @@ control = true; if (item->fModifiers & B_SHIFT_KEY) shift = true; + if (item->fModifiers & B_OPTION_KEY) + option = true; } item->fBounds.left = 0.0f; @@ -2063,6 +2065,8 @@ frame.right += 17; if (control) frame.right += 17; + if (option) + frame.right += 17; if (shift) frame.right += 22; Modified: haiku/trunk/src/kits/interface/MenuItem.cpp =================================================================== --- haiku/trunk/src/kits/interface/MenuItem.cpp 2009-05-07 16:19:08 UTC (rev 30660) +++ haiku/trunk/src/kits/interface/MenuItem.cpp 2009-05-07 19:45:42 UTC (rev 30661) @@ -56,6 +56,21 @@ }; +const unsigned char kOptBits[] = { + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x14, + 0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14, + 0x1d,0x1a,0x1a,0x13,0x04,0x04,0x13,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14, + 0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x1a,0x04,0x04,0x04,0x1a,0x17,0x14, + 0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x17,0x14, + 0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14, + 0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14, + 0x1d,0x1a,0x1a,0x13,0x04,0x04,0x13,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14, + 0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14, + 0x1d,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14 +}; + + const unsigned char kShiftBits[] = { 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x14, 0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14, @@ -158,7 +173,6 @@ if (data->HasMessage("_msg")) { BMessage *msg = new BMessage; - data->FindMessage("_msg", msg); SetMessage(msg); } @@ -213,7 +227,6 @@ if (ret == B_OK && deep && fSubmenu) { BMessage submenu; - if (fSubmenu->Archive(&submenu, true) == B_OK) ret = data->AddMessage("_submenu", &submenu); } @@ -803,6 +816,14 @@ fSuper->DrawBitmap(&control, where); } + if (fModifiers & B_OPTION_KEY) { + BRect rect(0,0,16,10); + BBitmap option(rect, B_CMAP8); + option.ImportBits(kOptBits, sizeof(kOptBits), 17, 0, B_CMAP8); + where.x -= rect.Width() + 1; + fSuper->DrawBitmap(&option, where); + } + if (fModifiers & B_SHIFT_KEY) { BRect rect(0,0,21,10); BBitmap shift(rect, B_CMAP8); From jackburton at mail.berlios.de Thu May 7 23:13:25 2009 From: jackburton at mail.berlios.de (jackburton at mail.berlios.de) Date: Thu, 7 May 2009 23:13:25 +0200 Subject: [Haiku-commits] r30662 - haiku/trunk/src/kits/interface Message-ID: <200905072113.n47LDPZ9024671@sheep.berlios.de> Author: jackburton Date: 2009-05-07 23:13:24 +0200 (Thu, 07 May 2009) New Revision: 30662 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30662&view=rev Modified: haiku/trunk/src/kits/interface/Menu.cpp Log: Lock the root menu before calling BMenuItem::Invoke(). This fixes #3842, although in some circumstances could introduce a deadlock (if someone does strange things in Invoke(), for example). Modified: haiku/trunk/src/kits/interface/Menu.cpp =================================================================== --- haiku/trunk/src/kits/interface/Menu.cpp 2009-05-07 19:45:42 UTC (rev 30661) +++ haiku/trunk/src/kits/interface/Menu.cpp 2009-05-07 21:13:24 UTC (rev 30662) @@ -2279,7 +2279,18 @@ UnlockLooper(); } - item->Invoke(); + // Lock the root menu window before calling BMenuItem::Invoke() + BMenu *parent = this; + BMenu *rootMenu = NULL; + do { + rootMenu = parent; + parent = rootMenu->Supermenu(); + } while (parent != NULL); + + if (rootMenu->LockLooper()) { + item->Invoke(); + rootMenu->UnlockLooper(); + } } From axeld at mail.berlios.de Thu May 7 23:38:57 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 7 May 2009 23:38:57 +0200 Subject: [Haiku-commits] r30663 - haiku/trunk/src/add-ons/kernel/file_systems/iso9660 Message-ID: <200905072138.n47LcvHT027688@sheep.berlios.de> Author: axeld Date: 2009-05-07 23:38:56 +0200 (Thu, 07 May 2009) New Revision: 30663 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30663&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/iso9660/iso9660.cpp haiku/trunk/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp Log: * The code in fs_walk() duplicates the one in ISOReadDir() mostly, and suffered from the same "associated file" problem as the latter. This now finally fixes bug #3861. This badly needs some cleanup. * Fixed a possible problem I introduced in ISOReadDir() (did not read the next block even if it should have). * Fixed warnings with debug output turned on. Modified: haiku/trunk/src/add-ons/kernel/file_systems/iso9660/iso9660.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/iso9660/iso9660.cpp 2009-05-07 21:13:24 UTC (rev 30662) +++ haiku/trunk/src/add-ons/kernel/file_systems/iso9660/iso9660.cpp 2009-05-07 21:38:56 UTC (rev 30663) @@ -694,37 +694,40 @@ ISOReadDirEnt(iso9660_volume *volume, dircookie *cookie, struct dirent *dirent, size_t bufferSize) { - off_t totalRead = cookie->pos + (cookie->block - cookie->startBlock) - * volume->logicalBlkSize[FS_DATA_FORMAT]; - off_t cacheBlock; - char *blockData; int result = B_NO_ERROR; - size_t bytesRead = 0; + bool done = false; TRACE(("ISOReadDirEnt - ENTER\n")); - // If we're at the end of the data in a block, move to the next block. - while (true) { - blockData = (char*)block_cache_get(volume->fBlockCache, cookie->block); - if (blockData != NULL && *(blockData + cookie->pos) == 0) { - // NULL data, move to next block. - block_cache_put(volume->fBlockCache, cookie->block); - blockData = NULL; - totalRead += volume->logicalBlkSize[FS_DATA_FORMAT] - cookie->pos; - cookie->pos = 0; - cookie->block++; - } else - break; + while (!done) { + off_t totalRead = cookie->pos + (cookie->block - cookie->startBlock) + * volume->logicalBlkSize[FS_DATA_FORMAT]; - if (totalRead >= cookie->totalSize) - break; - } + // If we're at the end of the data in a block, move to the next block. + char *blockData; + while (true) { + blockData + = (char*)block_cache_get(volume->fBlockCache, cookie->block); + if (blockData != NULL && *(blockData + cookie->pos) == 0) { + // NULL data, move to next block. + block_cache_put(volume->fBlockCache, cookie->block); + blockData = NULL; + totalRead + += volume->logicalBlkSize[FS_DATA_FORMAT] - cookie->pos; + cookie->pos = 0; + cookie->block++; + } else + break; - cacheBlock = cookie->block; - if (blockData != NULL && totalRead < cookie->totalSize) { - bool done = false; - while (!done) { + if (totalRead >= cookie->totalSize) + break; + } + + off_t cacheBlock = cookie->block; + + if (blockData != NULL && totalRead < cookie->totalSize) { iso9660_inode node; + size_t bytesRead = 0; result = InitNode(&node, blockData + cookie->pos, &bytesRead, volume->joliet_level); if (result != B_OK) @@ -741,14 +744,14 @@ if (node.name_length <= nameBufferSize) { // need to do some size checking here. strlcpy(dirent->d_name, node.name, node.name_length + 1); - TRACE(("ISOReadDirEnt - success, name is %s, block %Ld, pos " - "%Ld, inode id %Ld\n", dirent->d_name, cookie->block, + TRACE(("ISOReadDirEnt - success, name is %s, block %Ld, " + "pos %Ld, inode id %Ld\n", dirent->d_name, cookie->block, cookie->pos, dirent->d_ino)); } else { // TODO: this can be just normal if we support reading more // than one entry. - TRACE(("ISOReadDirEnt - ERROR, name %s does not fit in buffer " - "of size %lu\n", node.name, nameBufferSize)); + TRACE(("ISOReadDirEnt - ERROR, name %s does not fit in " + "buffer of size %d\n", node.name, (int)nameBufferSize)); result = B_BAD_VALUE; } @@ -761,19 +764,21 @@ cookie->pos = 0; cookie->block++; } + } else { + if (totalRead >= cookie->totalSize) + result = B_ENTRY_NOT_FOUND; + else + result = B_NO_MEMORY; + done = true; } - } else { - if (totalRead >= cookie->totalSize) - result = B_ENTRY_NOT_FOUND; - else - result = B_NO_MEMORY; + + if (blockData != NULL) + block_cache_put(volume->fBlockCache, cacheBlock); } - if (blockData != NULL) - block_cache_put(volume->fBlockCache, cacheBlock); - TRACE(("ISOReadDirEnt - EXIT, result is %s, vnid is %Lu\n", strerror(result), dirent->d_ino)); + return result; } @@ -801,19 +806,21 @@ memset(node->attr.stat, 0, sizeof(node->attr.stat)); node->extAttrRecLen = *(uint8*)buffer++; - TRACE(("InitNode - ext attr length is %ld\n", node->extAttrRecLen)); + TRACE(("InitNode - ext attr length is %d\n", (int)node->extAttrRecLen)); node->startLBN[LSB_DATA] = *(uint32*)buffer; buffer += 4; node->startLBN[MSB_DATA] = *(uint32*)buffer; buffer += 4; - TRACE(("InitNode - data start LBN is %ld\n", node->startLBN[FS_DATA_FORMAT])); + TRACE(("InitNode - data start LBN is %d\n", + (int)node->startLBN[FS_DATA_FORMAT])); node->dataLen[LSB_DATA] = *(uint32*)buffer; buffer += 4; node->dataLen[MSB_DATA] = *(uint32*)buffer; buffer += 4; - TRACE(("InitNode - data length is %ld\n", node->dataLen[FS_DATA_FORMAT])); + TRACE(("InitNode - data length is %d\n", + (int)node->dataLen[FS_DATA_FORMAT])); init_node_date(&node->recordDate, buffer); buffer += 7; @@ -832,11 +839,11 @@ node->volSeqNum = *(uint32*)buffer; buffer += 4; - TRACE(("InitNode - volume seq num is %ld\n", node->volSeqNum)); + TRACE(("InitNode - volume seq num is %d\n", (int)node->volSeqNum)); node->name_length = *(uint8*)buffer; buffer++; - TRACE(("InitNode - file id length is %lu\n", node->name_length)); + TRACE(("InitNode - file id length is %u\n", node->name_length)); // Set defaults, in case there is no RockRidge stuff. node->attr.stat[FS_DATA_FORMAT].st_mode |= (node->flags & ISO_IS_DIR) != 0 Modified: haiku/trunk/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp 2009-05-07 21:13:24 UTC (rev 30662) +++ haiku/trunk/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp 2009-05-07 21:38:56 UTC (rev 30663) @@ -221,8 +221,8 @@ iso9660_inode *baseNode = (iso9660_inode*)_base->private_node; iso9660_inode *newNode = NULL; - TRACE(("fs_walk - looking for %s in dir file of length %ld\n", file, - baseNode->dataLen[FS_DATA_FORMAT])); + TRACE(("fs_walk - looking for %s in dir file of length %d\n", file, + (int)baseNode->dataLen[FS_DATA_FORMAT])); if (strcmp(file, ".") == 0) { // base directory @@ -266,12 +266,12 @@ && !done) { initResult = InitNode(&node, blockData, &bytesRead, ns->joliet_level); - TRACE(("fs_walk - InitNode returned %s, filename %s, %lu bytes " - "read\n", strerror(initResult), node.name, - bytesRead)); + TRACE(("fs_walk - InitNode returned %s, filename %s, %u bytes " + "read\n", strerror(initResult), node.name, (unsigned)bytesRead)); if (initResult == B_OK) { - if (!strcmp(node.name, file)) { + if ((node.flags & ISO_IS_ASSOCIATED_FILE) == 0 + && !strcmp(node.name, file)) { TRACE(("fs_walk - success, found vnode at block %Ld, pos " "%Ld\n", block, blockBytesRead)); @@ -296,15 +296,15 @@ blockData += bytesRead; blockBytesRead += bytesRead; - TRACE(("fs_walk - Adding %lu bytes to blockBytes read (total " - "%Ld/%lu).\n", bytesRead, blockBytesRead, - baseNode->dataLen[FS_DATA_FORMAT])); + TRACE(("fs_walk - Adding %u bytes to blockBytes read (total " + "%Ld/%u).\n", (unsigned)bytesRead, blockBytesRead, + (unsigned)baseNode->dataLen[FS_DATA_FORMAT])); } totalRead += ns->logicalBlkSize[FS_DATA_FORMAT]; block++; - TRACE(("fs_walk - moving to next block %Ld, total read %lu\n", - block, totalRead)); + TRACE(("fs_walk - moving to next block %Ld, total read %u\n", + block, (unsigned)totalRead)); block_cache_put(ns->fBlockCache, cachedBlock); } @@ -327,8 +327,8 @@ uint32 pos = vnodeID & 0x3fffffff; uint32 block = vnodeID >> 30; - TRACE(("fs_read_vnode - block = %ld, pos = %ld, raw = %Lu node %p\n", - block, pos, vnodeID, newNode)); + TRACE(("fs_read_vnode - block = %u, pos = %u, raw = %Lu node %p\n", + (unsigned)block, (unsigned) pos, vnodeID, newNode)); if (pos > ns->logicalBlkSize[FS_DATA_FORMAT]) { free(newNode); @@ -352,7 +352,8 @@ newNode->id = vnodeID; _node->private_node = newNode; _node->ops = &gISO9660VnodeOps; - *_type = newNode->attr.stat[FS_DATA_FORMAT].st_mode & ~(S_IWUSR | S_IWGRP | S_IWOTH); + *_type = newNode->attr.stat[FS_DATA_FORMAT].st_mode + & ~(S_IWUSR | S_IWGRP | S_IWOTH); *_flags = 0; if ((newNode->flags & ISO_IS_DIR) == 0) { From mmlr at mail.berlios.de Fri May 8 00:16:54 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Fri, 8 May 2009 00:16:54 +0200 Subject: [Haiku-commits] r30664 - haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid Message-ID: <200905072216.n47MGsag000110@sheep.berlios.de> Author: mmlr Date: 2009-05-08 00:16:50 +0200 (Fri, 08 May 2009) New Revision: 30664 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30664&view=rev Added: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDCollection.cpp haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDCollection.h haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDDataTypes.h haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDParser.cpp haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDParser.h haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDReport.cpp haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDReport.h haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDReportItem.cpp haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDReportItem.h Log: Adding a complete HID parser and report handling facility. This is generic code, so should be reusable for bluethooth HID as well (which is the same). The only missing part so far is the logical collections that would allow nicer enumeration of the report structure but is otherwise not useful. It should support all of the HID specs except for usage aliases (even long items that aren't actually defined should just work if they ever are). Not integrated into the USB specific device framework and there are no actual drivers making use of provided functionallity. The parsing was tested and works for all of the 3 devices I had available, but actual interpretation of data is not tested as the driver side is missing. Will close that gap as a next step and then port the mouse and keyboard drivers to that framework. Eventually a generic driver that makes unknown fields available to userland apps in some way should be fairly easy to implement with that. Added: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDCollection.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDCollection.cpp 2009-05-07 21:38:56 UTC (rev 30663) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDCollection.cpp 2009-05-07 22:16:50 UTC (rev 30664) @@ -0,0 +1,74 @@ +#include "Driver.h" +#include "HIDCollection.h" + +#include +#include + + +HIDCollection::HIDCollection(HIDCollection *parent, uint8 type, + global_item_state &globalState, local_item_state &localState) + : fParent(parent), + fType(type), + fStringID(localState.string_index), + fPhysicalID(localState.designator_index), + fChildCount(0), + fChildren(NULL) +{ + usage_value usageValue; + usageValue.u.s.usage_page = globalState.usage_page; + if (localState.usage_stack != NULL && localState.usage_stack_used > 0) { + if (localState.usage_stack[0].is_extended) + usageValue.u.extended = localState.usage_stack[0].u.extended; + else + usageValue.u.s.usage_id = localState.usage_stack[0].u.s.usage_id; + } else if (localState.usage_minimum_set) { + if (localState.usage_minimum.is_extended) + usageValue.u.extended = localState.usage_minimum.u.extended; + else + usageValue.u.s.usage_id = localState.usage_minimum.u.s.usage_id; + } + + fUsage = usageValue.u.extended; +} + + +HIDCollection::~HIDCollection() +{ + for (uint32 i = 0; i < fChildCount; i++) + delete fChildren[i]; + free(fChildren); +} + + +status_t +HIDCollection::AddChild(HIDCollection *child) +{ + HIDCollection **newChildren = (HIDCollection **)realloc(fChildren, + (fChildCount + 1) * sizeof(HIDCollection *)); + if (newChildren == NULL) { + TRACE_ALWAYS("no memory when trying to resize collection child list\n"); + return B_NO_MEMORY; + } + + fChildren = newChildren; + fChildren[fChildCount++] = child; + return B_OK; +} + + +HIDCollection * +HIDCollection::ChildAt(uint32 index) +{ + if (index >= fChildCount) + return NULL; + + return fChildren[index]; +} + + +void +HIDCollection::AddMainItem(global_item_state &globalState, + local_item_state &localState, main_item_data &mainData) +{ + // TODO: implement +} Added: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDCollection.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDCollection.h 2009-05-07 21:38:56 UTC (rev 30663) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDCollection.h 2009-05-07 22:16:50 UTC (rev 30664) @@ -0,0 +1,35 @@ +#ifndef HID_COLLECTION_H +#define HID_COLLECTION_H + +#include "HIDParser.h" + +class HIDCollection { +public: + HIDCollection(HIDCollection *parent, + uint8 type, global_item_state &globalState, + local_item_state &localState); + ~HIDCollection(); + + HIDCollection * Parent() { return fParent; }; + + status_t AddChild(HIDCollection *child); + uint32 CountChildren() { return fChildCount; }; + HIDCollection * ChildAt(uint32 index); + + void AddMainItem(global_item_state &globalState, + local_item_state &localState, + main_item_data &mainData); + +private: + HIDCollection * fParent; + + uint8 fType; + uint32 fUsage; + uint8 fStringID; + uint8 fPhysicalID; + + uint32 fChildCount; + HIDCollection ** fChildren; +}; + +#endif // HID_COLLECTION_H Added: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDDataTypes.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDDataTypes.h 2009-05-07 21:38:56 UTC (rev 30663) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDDataTypes.h 2009-05-07 22:16:50 UTC (rev 30664) @@ -0,0 +1,158 @@ +#ifndef HID_DATA_TYPES_H +#define HID_DATA_TYPES_H + +#include + +#define ITEM_TYPE_MAIN 0x0 +#define ITEM_TYPE_GLOBAL 0x1 +#define ITEM_TYPE_LOCAL 0x2 +#define ITEM_TYPE_LONG 0x3 + +#define ITEM_TAG_MAIN_INPUT 0x8 +#define ITEM_TAG_MAIN_OUTPUT 0x9 +#define ITEM_TAG_MAIN_FEATURE 0xb +#define ITEM_TAG_MAIN_COLLECTION 0xa +#define ITEM_TAG_MAIN_END_COLLECTION 0xc + +#define ITEM_TAG_GLOBAL_USAGE_PAGE 0x0 +#define ITEM_TAG_GLOBAL_LOGICAL_MINIMUM 0x1 +#define ITEM_TAG_GLOBAL_LOGICAL_MAXIMUM 0x2 +#define ITEM_TAG_GLOBAL_PHYSICAL_MINIMUM 0x3 +#define ITEM_TAG_GLOBAL_PHYSICAL_MAXIMUM 0x4 +#define ITEM_TAG_GLOBAL_UNIT_EXPONENT 0x5 +#define ITEM_TAG_GLOBAL_UNIT 0x6 +#define ITEM_TAG_GLOBAL_REPORT_SIZE 0x7 +#define ITEM_TAG_GLOBAL_REPORT_ID 0x8 +#define ITEM_TAG_GLOBAL_REPORT_COUNT 0x9 +#define ITEM_TAG_GLOBAL_PUSH 0xa +#define ITEM_TAG_GLOBAL_POP 0xb + +#define ITEM_TAG_LOCAL_USAGE 0x0 +#define ITEM_TAG_LOCAL_USAGE_MINIMUM 0x1 +#define ITEM_TAG_LOCAL_USAGE_MAXIMUM 0x2 +#define ITEM_TAG_LOCAL_DESIGNATOR_INDEX 0x3 +#define ITEM_TAG_LOCAL_DESIGNATOR_MINIMUM 0x4 +#define ITEM_TAG_LOCAL_DESIGNATOR_MAXIMUM 0x5 +#define ITEM_TAG_LOCAL_STRING_INDEX 0x7 +#define ITEM_TAG_LOCAL_STRING_MINIMUM 0x8 +#define ITEM_TAG_LOCAL_STRING_MAXIMUM 0x9 +#define ITEM_TAG_LOCAL_DELIMITER 0xa + +#define ITEM_TAG_LONG 0xf + +#define COLLECTION_PHYSICAL 0x00 +#define COLLECTION_APPLICATION 0x01 +#define COLLECTION_LOGICAL 0x02 +#define COLLECTION_REPORT 0x03 +#define COLLECTION_NAMED_ARRAY 0x04 +#define COLLECTION_USAGE_SWITCH 0x05 +#define COLLECTION_USAGE_MODIFIER 0x06 + +#define UNIT_SYSTEM 0x0 +#define UNIT_LENGTH 0x1 +#define UNIT_MASS 0x2 +#define UNIT_TIME 0x3 +#define UNIT_TEMPERATURE 0x4 +#define UNIT_CURRENT 0x5 +#define UNIT_LUMINOUS_INTENSITY 0x6 + +#define USAGE_PAGE_SHIFT 16 +#define USAGE_PAGE_MASK 0xffff +#define USAGE_ID_SHIFT 0 +#define USAGE_ID_MASK 0xffff + + +typedef struct item_prefix { + LBITFIELD8_3( + size : 2, + type : 2, + tag : 4 + ); +} _PACKED item_prefix; + + +typedef struct short_item { + item_prefix prefix; + + union { + uint8 as_uint8[4]; + int8 as_int8[4]; + uint16 as_uint16[2]; + int16 as_int16[2]; + uint32 as_uint32; + int32 as_int32; + } data; +} _PACKED short_item; + + +typedef struct long_item { + item_prefix prefix; + uint8 data_size; + uint8 long_item_tag; + uint8 data[0]; +} _PACKED long_item; + + +typedef struct main_item_data { + LBITFIELD9( + data_constant : 1, + array_variable : 1, + relative : 1, + wrap : 1, + non_linear : 1, + no_preferred : 1, + null_state : 1, + is_volatile : 1, + bits_bytes : 1 + ); + + //uint8 reserved[2]; +} _PACKED main_item_data; + + +typedef struct usage_value { + union { + struct { + uint16 usage_id; + uint16 usage_page; + } _PACKED s; + uint32 extended; + } u; + + bool is_extended; +} usage_value; + + +typedef struct global_item_state { + uint16 usage_page; + uint32 logical_minimum; + uint32 logical_maximum; + uint32 physical_minimum; + uint32 physical_maximum; + uint8 unit_exponent; + uint8 unit; + uint32 report_size; + uint32 report_count; + uint8 report_id; + global_item_state *link; +} global_item_state; + + +typedef struct local_item_state { + usage_value * usage_stack; + uint32 usage_stack_used; + usage_value usage_minimum; + usage_value usage_maximum; + bool usage_minimum_set; + bool usage_maximum_set; + uint32 designator_index; + bool designator_index_set; + uint32 designator_minimum; + uint32 designator_maximum; + uint8 string_index; + bool string_index_set; + uint8 string_minimum; + uint8 string_maximum; +} local_item_state; + +#endif // HID_DATA_TYPES_H Added: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDParser.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDParser.cpp 2009-05-07 21:38:56 UTC (rev 30663) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDParser.cpp 2009-05-07 22:16:50 UTC (rev 30664) @@ -0,0 +1,514 @@ +#include "Driver.h" +#include "HIDCollection.h" +#include "HIDParser.h" +#include "HIDReport.h" + +#include +#include +#include + + +static uint8 sItemSize[4] = { 0, 1, 2, 4 }; +static int8 sUnitExponent[16] = { + // really just a 4 bit signed value + 0, 1, 2, 3, 4, 5, 6, 7, -8, -7, -6, -5, -4, -3, -2, -1 +}; + + +HIDParser::HIDParser() + : fReportCount(0), + fReports(NULL), + fRootCollection(NULL) +{ +} + + +HIDParser::~HIDParser() +{ + _Reset(); +} + + +status_t +HIDParser::ParseReportDescriptor(uint8 *reportDescriptor, + size_t descriptorLength) +{ + _Reset(); + + global_item_state globalState; + memset(&globalState, 0, sizeof(global_item_state)); + + local_item_state localState; + memset(&localState, 0, sizeof(local_item_state)); + + uint32 usageStackUsed = 0; + uint32 usageStackSize = 10; + usage_value *usageStack = (usage_value *)malloc(usageStackSize + * sizeof(usage_value)); + if (usageStack == NULL) { + TRACE_ALWAYS("no memory to allocate usage stack\n"); + return B_NO_MEMORY; + } + + HIDCollection *collection = NULL; + uint8 *pointer = reportDescriptor; + uint8 *end = pointer + descriptorLength; + + while (pointer < end) { + item_prefix *item = (item_prefix *)pointer; + size_t itemSize = sItemSize[item->size]; + uint32 data = 0; + + if (item->type == ITEM_TYPE_LONG) { + long_item *longItem = (long_item *)item; + itemSize += longItem->data_size; + } else { + short_item *shortItem = (short_item *)item; + switch (itemSize) { + case 1: + data = shortItem->data.as_uint8[0]; + break; + + case 2: + data = shortItem->data.as_uint16[0]; + break; + + case 4: + data = shortItem->data.as_uint32; + break; + + default: + break; + } + } + + TRACE("got item: type: %s; size: %lu; tag: %u; data: %lu\n", + item->type == ITEM_TYPE_MAIN ? "main" + : item->type == ITEM_TYPE_GLOBAL ? "global" + : item->type == ITEM_TYPE_LOCAL ? "local" : "long", + itemSize, item->tag, data); + + switch (item->type) { + case ITEM_TYPE_MAIN: + { + main_item_data *mainData = (main_item_data *)&data; + if (item->tag == ITEM_TAG_MAIN_COLLECTION) { + HIDCollection *newCollection + = new(std::nothrow) HIDCollection(collection, + (uint8)data, globalState, localState); + if (newCollection == NULL) { + TRACE_ALWAYS("no memory to allocate new collection\n"); + break; + } + + if (collection == NULL) + fRootCollection = newCollection; + else + collection->AddChild(newCollection); + + collection = newCollection; + } else if (item->tag == ITEM_TAG_MAIN_END_COLLECTION) { + if (collection == NULL) { + TRACE_ALWAYS("end collection with no open one\n"); + break; + } + + collection = collection->Parent(); + } else { + uint8 reportType = HID_REPORT_TYPE_ANY; + switch (item->tag) { + case ITEM_TAG_MAIN_INPUT: + reportType = HID_REPORT_TYPE_INPUT; + break; + + case ITEM_TAG_MAIN_OUTPUT: + reportType = HID_REPORT_TYPE_OUTPUT; + break; + + case ITEM_TAG_MAIN_FEATURE: + reportType = HID_REPORT_TYPE_FEATURE; + break; + + default: + TRACE_ALWAYS("unknown main item tag: 0x%02x\n", + item->tag); + break; + } + + if (reportType == HID_REPORT_TYPE_ANY) + break; + + HIDReport *target = _FindOrCreateReport(reportType, + globalState.report_id); + if (target == NULL) + break; + + // make all usages extended for easier later processing + for (uint32 i = 0; i < usageStackUsed; i++) { + if (usageStack[i].is_extended) + continue; + usageStack[i].u.s.usage_page = globalState.usage_page; + usageStack[i].is_extended = true; + } + + if (!localState.usage_minimum.is_extended) { + // the specs say if one of them is extended they must + // both be extended, so if the minimum isn't, the + // maximum mustn't either. + localState.usage_minimum.u.s.usage_page + = localState.usage_maximum.u.s.usage_page + = globalState.usage_page; + localState.usage_minimum.is_extended + = localState.usage_maximum.is_extended = true; + } + + localState.usage_stack = usageStack; + localState.usage_stack_used = usageStackUsed; + + // fill in a sensible default if the index isn't set + if (!localState.designator_index_set) { + localState.designator_index + = localState.designator_minimum; + } + + if (!localState.string_index_set) + localState.string_index = localState.string_minimum; + + target->AddMainItem(globalState, localState, *mainData); + if (collection != NULL) { + collection->AddMainItem(globalState, localState, + *mainData); + } else + TRACE_ALWAYS("main item not part of a collection\n"); + } + + // reset the local item state + memset(&localState, 0, sizeof(local_item_state)); + usageStackUsed = 0; + break; + } + + case ITEM_TYPE_GLOBAL: + { + switch (item->tag) { + case ITEM_TAG_GLOBAL_USAGE_PAGE: + globalState.usage_page = data; + break; + + case ITEM_TAG_GLOBAL_LOGICAL_MINIMUM: + globalState.logical_minimum = data; + break; + + case ITEM_TAG_GLOBAL_LOGICAL_MAXIMUM: + globalState.logical_maximum = data; + break; + + case ITEM_TAG_GLOBAL_PHYSICAL_MINIMUM: + globalState.physical_minimum = data; + break; + + case ITEM_TAG_GLOBAL_PHYSICAL_MAXIMUM: + globalState.physical_maximum = data; + break; + + case ITEM_TAG_GLOBAL_UNIT_EXPONENT: + globalState.unit_exponent = data; + break; + + case ITEM_TAG_GLOBAL_UNIT: + globalState.unit = data; + break; + + case ITEM_TAG_GLOBAL_REPORT_SIZE: + globalState.report_size = data; + break; + + case ITEM_TAG_GLOBAL_REPORT_ID: + globalState.report_id = data; + fUsesReportIDs = true; + break; + + case ITEM_TAG_GLOBAL_REPORT_COUNT: + globalState.report_count = data; + break; + + case ITEM_TAG_GLOBAL_PUSH: + { + global_item_state *copy = (global_item_state *)malloc( + sizeof(global_item_state)); + if (copy == NULL) { + TRACE_ALWAYS("out of memory for global push\n"); + break; + } + + memcpy(copy, &globalState, sizeof(global_item_state)); + globalState.link = copy; + break; + } + + case ITEM_TAG_GLOBAL_POP: + { + if (globalState.link == NULL) { + TRACE_ALWAYS("global pop without item on stack\n"); + break; + } + + global_item_state *link = globalState.link; + memcpy(&globalState, link, sizeof(global_item_state)); + free(link); + break; + } + + default: + TRACE_ALWAYS("unknown global item tag: 0x%02x\n", + item->tag); + break; + } + + break; + } + + case ITEM_TYPE_LOCAL: + { + switch (item->tag) { + case ITEM_TAG_LOCAL_USAGE: + { + if (usageStackUsed >= usageStackSize) { + usageStackSize += 10; + usage_value *newUsageStack + = (usage_value *)realloc(usageStack, + usageStackSize * sizeof(usage_value)); + if (newUsageStack == NULL) { + TRACE_ALWAYS("no memory when growing usages\n"); + usageStackSize -= 10; + break; + } + + usageStack = newUsageStack; + } + + usage_value *value = &usageStack[usageStackUsed]; + value->is_extended = itemSize == sizeof(uint32); + value->u.extended = data; + usageStackUsed++; + break; + } + + case ITEM_TAG_LOCAL_USAGE_MINIMUM: + localState.usage_minimum.u.extended = data; + localState.usage_minimum.is_extended + = itemSize == sizeof(uint32); + localState.usage_minimum_set = true; + break; + + case ITEM_TAG_LOCAL_USAGE_MAXIMUM: + localState.usage_maximum.u.extended = data; + localState.usage_maximum.is_extended + = itemSize == sizeof(uint32); + localState.usage_maximum_set = true; + break; + + case ITEM_TAG_LOCAL_DESIGNATOR_INDEX: + localState.designator_index = data; + localState.designator_index_set = true; + break; + + case ITEM_TAG_LOCAL_DESIGNATOR_MINIMUM: + localState.designator_minimum = data; + break; + + case ITEM_TAG_LOCAL_DESIGNATOR_MAXIMUM: + localState.designator_maximum = data; + break; + + case ITEM_TAG_LOCAL_STRING_INDEX: + localState.string_index = data; + localState.string_index_set = true; + break; + + case ITEM_TAG_LOCAL_STRING_MINIMUM: + localState.string_minimum = data; + break; + + case ITEM_TAG_LOCAL_STRING_MAXIMUM: + localState.string_maximum = data; + break; + + default: + TRACE_ALWAYS("unknown local item tag: 0x%02x\n", + item->tag); + break; + } + + break; + } + + case ITEM_TAG_LONG: + { + long_item *longItem = (long_item *)item; + + // no long items are defined yet + switch (longItem->long_item_tag) { + default: + TRACE_ALWAYS("unknown long item tag: 0x%02x\n", + longItem->long_item_tag); + break; + } + + break; + } + } + + pointer += itemSize + sizeof(item_prefix); + } + + global_item_state *state = globalState.link; + while (state != NULL) { + global_item_state *next = state->link; + free(state); + state = next; + } + + free(usageStack); + return B_OK; +} + + +HIDReport * +HIDParser::FindReport(uint8 type, uint8 id) +{ + for (uint8 i = 0; i < fReportCount; i++) { + HIDReport *report = fReports[i]; + if (report == NULL) + continue; + + if ((report->Type() & type) != 0 && report->ID() == id) + return report; + } + + return NULL; +} + + +uint8 +HIDParser::CountReports(uint8 type) +{ + uint8 count = 0; + for (uint8 i = 0; i < fReportCount; i++) { + HIDReport *report = fReports[i]; + if (report == NULL) + continue; + + if (report->Type() & type) + count++; + } + + return count; +} + + +HIDReport * +HIDParser::ReportAt(uint8 type, uint8 index) +{ + for (uint8 i = 0; i < fReportCount; i++) { + HIDReport *report = fReports[i]; + if (report == NULL || (report->Type() & type) == 0) + continue; + + if (index-- == 0) + return report; + } + + return NULL; +} + + +status_t +HIDParser::SetReport(uint8 *report, size_t length) +{ + HIDReport *target = fReports[0]; + if (fUsesReportIDs) { + target = FindReport(HID_REPORT_TYPE_INPUT, report[0]); + report++; + length--; + } + + if (target == NULL) { + TRACE_ALWAYS("got report buffer but found no report to handle it\n"); + return B_ENTRY_NOT_FOUND; + } + + return target->SetReport(report, length); +} + + +HIDReport * +HIDParser::_FindOrCreateReport(uint8 type, uint8 id) +{ + HIDReport *report = FindReport(type, id); + if (report != NULL) + return report; + + report = new(std::nothrow) HIDReport(this, type, id); + if (report == NULL) { + TRACE_ALWAYS("no memory when allocating report\n"); + return NULL; + } + + HIDReport **newReports = (HIDReport **)realloc(fReports, + (fReportCount + 1) * sizeof(HIDReport *)); + if (newReports == NULL) { + TRACE_ALWAYS("no memory when growing report list\n"); + delete report; + return NULL; + } + + fReports = newReports; + fReports[fReportCount++] = report; + return report; +} + + +float +HIDParser::_CalculateResolution(global_item_state *state) +{ + int64 physicalMinimum = state->physical_minimum; + int64 physicalMaximum = state->physical_maximum; + if (physicalMinimum == 0 && physicalMaximum == 0) { + physicalMinimum = state->logical_minimum; + physicalMaximum = state->logical_maximum; + } + + int8 unitExponent = sUnitExponent[state->unit_exponent]; + + float power = 1; + if (unitExponent < 0) { + while (unitExponent++ < 0) + power /= 10; + } else { + while (unitExponent-- > 0) + power *= 10; + } + + float divisor = (physicalMaximum - physicalMinimum) * power; + if (divisor == 0.0) + return 0.0; + + return (state->logical_maximum - state->logical_minimum) / divisor; +} + + +void +HIDParser::_Reset() +{ + for (uint8 i = 0; i < fReportCount; i++) + delete fReports[i]; + + delete fRootCollection; + free(fReports); + + fUsesReportIDs = false; + fReportCount = 0; + fReports = NULL; + fRootCollection = NULL; +} Added: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDParser.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDParser.h 2009-05-07 21:38:56 UTC (rev 30663) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDParser.h 2009-05-07 22:16:50 UTC (rev 30664) @@ -0,0 +1,38 @@ +#ifndef HID_PARSER_H +#define HID_PARSER_H + +#include "HIDDataTypes.h" + +class HIDReport; +class HIDCollection; + +class HIDParser { +public: + HIDParser(); + ~HIDParser(); + + status_t ParseReportDescriptor(uint8 *reportDescriptor, + size_t descriptorLength); + + bool UsesReportIDs() { return fUsesReportIDs; }; + + HIDReport * FindReport(uint8 type, uint8 id); + uint8 CountReports(uint8 type); + HIDReport * ReportAt(uint8 type, uint8 index); + + HIDCollection * RootCollection() { return fRootCollection; }; + + status_t SetReport(uint8 *report, size_t length); + +private: + HIDReport * _FindOrCreateReport(uint8 type, uint8 id); + float _CalculateResolution(global_item_state *state); + void _Reset(); + + bool fUsesReportIDs; + uint8 fReportCount; + HIDReport ** fReports; + HIDCollection * fRootCollection; +}; + +#endif // HID_PARSER_H Added: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDReport.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDReport.cpp 2009-05-07 21:38:56 UTC (rev 30663) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDReport.cpp 2009-05-07 22:16:50 UTC (rev 30664) @@ -0,0 +1,201 @@ +#include "Driver.h" +#include "HIDReport.h" +#include "HIDReportItem.h" + +#include +#include + + +HIDReport::HIDReport(HIDParser *parser, uint8 type, uint8 id) + : fParser(parser), + fType(type), + fReportID(id), + fReportSize(0), + fItemsUsed(0), + fItemsAllocated(0), + fItems(NULL), + fCurrentReport(NULL), + fBusyCount(0) +{ + fConditionVariable.Init(this, "hid report"); +} + + +HIDReport::~HIDReport() +{ + free(fItems); +} + + +void +HIDReport::AddMainItem(global_item_state &globalState, + local_item_state &localState, main_item_data &mainData) +{ + TRACE("adding main item to report of type 0x%02x with id 0x%02x\n", + fType, fReportID); + TRACE("\tmain data:\n"); + TRACE("\t\t%s\n", mainData.data_constant ? "constant" : "data"); + TRACE("\t\t%s\n", mainData.array_variable ? "variable" : "array"); + TRACE("\t\t%s\n", mainData.relative ? "relative" : "absolute"); + TRACE("\t\t%swrap\n", mainData.wrap ? "" : "no-"); + TRACE("\t\t%slinear\n", mainData.non_linear ? "non-" : ""); + TRACE("\t\t%spreferred state\n", mainData.no_preferred ? "no " : ""); + TRACE("\t\t%s null\n", mainData.null_state ? "has" : "no"); + TRACE("\t\t%svolatile\n", mainData.is_volatile ? "" : "non-"); + TRACE("\t\t%s\n", mainData.bits_bytes ? "bit array" : "buffered bytes"); + + uint32 logicalMinimum = globalState.logical_minimum; + uint32 logicalMaximum = globalState.logical_maximum; + if (logicalMinimum > logicalMaximum) + _SignExtend(logicalMinimum, logicalMaximum); + + uint32 physicalMinimum = globalState.physical_minimum; + uint32 physicalMaximum = globalState.physical_maximum; + if (physicalMinimum > logicalMaximum) + _SignExtend(physicalMinimum, physicalMaximum); + + TRACE("\tglobal state:\n"); + TRACE("\t\tusage_page: 0x%x\n", globalState.usage_page); + TRACE("\t\tlogical_minimum: %ld\n", logicalMinimum); + TRACE("\t\tlogical_maximum: %ld\n", logicalMaximum); + TRACE("\t\tphysical_minimum: %ld\n", physicalMinimum); + TRACE("\t\tphysical_maximum: %ld\n", physicalMaximum); + TRACE("\t\tunit_exponent: %d\n", globalState.unit_exponent); + TRACE("\t\tunit: %d\n", globalState.unit); + TRACE("\t\treport_size: %lu\n", globalState.report_size); + TRACE("\t\treport_count: %lu\n", globalState.report_count); + TRACE("\t\treport_id: %u\n", globalState.report_id); + + TRACE("\tlocal state:\n"); + TRACE("\t\tusage stack (%lu)\n", localState.usage_stack_used); + for (uint32 i = 0; i < localState.usage_stack_used; i++) { + TRACE("\t\t\t0x%08lx\n", localState.usage_stack[i].u.extended); + } + + TRACE("\t\tusage_minimum: 0x%08lx\n", localState.usage_minimum.u.extended); + TRACE("\t\tusage_maximum: 0x%08lx\n", localState.usage_maximum.u.extended); + TRACE("\t\tdesignator_index: %lu\n", localState.designator_index); + TRACE("\t\tdesignator_minimum: %lu\n", localState.designator_minimum); + TRACE("\t\tdesignator_maximum: %lu\n", localState.designator_maximum); + TRACE("\t\tstring_index: %u\n", localState.string_index); + TRACE("\t\tstring_minimum: %u\n", localState.string_minimum); + TRACE("\t\tstring_maximum: %u\n", localState.string_maximum); + + uint32 usageMinimum = 0, usageMaximum = 0; + if (mainData.array_variable == 0) { + usageMinimum = localState.usage_minimum.u.extended; + usageMaximum = localState.usage_maximum.u.extended; + } + + uint32 usageRangeIndex = 0; + for (uint32 i = 0; i < globalState.report_count; i++) { + if (fItemsUsed >= fItemsAllocated) { + fItemsAllocated += 10; + HIDReportItem **newItems = (HIDReportItem **)realloc(fItems, + sizeof(HIDReportItem **) * fItemsAllocated); + if (newItems == NULL) { + TRACE_ALWAYS("no memory when growing report item list\n"); + fItemsAllocated -= 10; + return; + } + + fItems = newItems; + } + + if (mainData.array_variable == 1) { + usage_value usage; + if (i < localState.usage_stack_used) + usage = localState.usage_stack[i]; + else { + usage = localState.usage_minimum; + usage.u.extended += usageRangeIndex++; + if (usage.u.extended > localState.usage_maximum.u.extended) + usage.u.extended = localState.usage_maximum.u.extended; + } + + usageMinimum = usageMaximum = usage.u.extended; + } + + fItems[fItemsUsed++] = new(std::nothrow) HIDReportItem(this, + fReportSize, globalState.report_size, mainData.data_constant == 0, + mainData.array_variable == 0, mainData.relative != 0, + logicalMinimum, logicalMaximum, usageMinimum, usageMaximum); + } +} + + +status_t +HIDReport::SetReport(uint8 *report, size_t length) +{ + if (report == NULL) { + fCurrentReport = NULL; + return B_OK; + } + + if (length * 8 < fReportSize) { + TRACE_ALWAYS("report of %lu bits too small, expected %lu bits\n", + length * 8, fReportSize); + return B_ERROR; + } + + fConditionVariable.NotifyAll(); + fCurrentReport = report; + return B_OK; +} + + [... truncated: 225 lines follow ...] From mmlr at mail.berlios.de Fri May 8 00:23:17 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Fri, 8 May 2009 00:23:17 +0200 Subject: [Haiku-commits] r30665 - haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid Message-ID: <200905072223.n47MNHsF000747@sheep.berlios.de> Author: mmlr Date: 2009-05-08 00:23:14 +0200 (Fri, 08 May 2009) New Revision: 30665 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30665&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDCollection.cpp haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDCollection.h haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDDataTypes.h haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDParser.cpp haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDParser.h haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDReport.cpp haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDReport.h haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDReportItem.cpp haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDReportItem.h Log: Adding missing license headers. Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDCollection.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDCollection.cpp 2009-05-07 22:16:50 UTC (rev 30664) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDCollection.cpp 2009-05-07 22:23:14 UTC (rev 30665) @@ -1,3 +1,8 @@ +/* + * Copyright 2009, Michael Lotz, mmlr at mlotz.ch. + * Distributed under the terms of the MIT License. + */ + #include "Driver.h" #include "HIDCollection.h" Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDCollection.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDCollection.h 2009-05-07 22:16:50 UTC (rev 30664) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDCollection.h 2009-05-07 22:23:14 UTC (rev 30665) @@ -1,3 +1,7 @@ +/* + * Copyright 2009, Michael Lotz, mmlr at mlotz.ch. + * Distributed under the terms of the MIT License. + */ #ifndef HID_COLLECTION_H #define HID_COLLECTION_H Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDDataTypes.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDDataTypes.h 2009-05-07 22:16:50 UTC (rev 30664) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDDataTypes.h 2009-05-07 22:23:14 UTC (rev 30665) @@ -1,3 +1,7 @@ +/* + * Copyright 2009, Michael Lotz, mmlr at mlotz.ch. + * Distributed under the terms of the MIT License. + */ #ifndef HID_DATA_TYPES_H #define HID_DATA_TYPES_H Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDParser.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDParser.cpp 2009-05-07 22:16:50 UTC (rev 30664) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDParser.cpp 2009-05-07 22:23:14 UTC (rev 30665) @@ -1,3 +1,8 @@ +/* + * Copyright 2009, Michael Lotz, mmlr at mlotz.ch. + * Distributed under the terms of the MIT License. + */ + #include "Driver.h" #include "HIDCollection.h" #include "HIDParser.h" Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDParser.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDParser.h 2009-05-07 22:16:50 UTC (rev 30664) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDParser.h 2009-05-07 22:23:14 UTC (rev 30665) @@ -1,3 +1,7 @@ +/* + * Copyright 2009, Michael Lotz, mmlr at mlotz.ch. + * Distributed under the terms of the MIT License. + */ #ifndef HID_PARSER_H #define HID_PARSER_H Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDReport.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDReport.cpp 2009-05-07 22:16:50 UTC (rev 30664) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDReport.cpp 2009-05-07 22:23:14 UTC (rev 30665) @@ -1,3 +1,8 @@ +/* + * Copyright 2009, Michael Lotz, mmlr at mlotz.ch. + * Distributed under the terms of the MIT License. + */ + #include "Driver.h" #include "HIDReport.h" #include "HIDReportItem.h" Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDReport.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDReport.h 2009-05-07 22:16:50 UTC (rev 30664) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDReport.h 2009-05-07 22:23:14 UTC (rev 30665) @@ -1,3 +1,7 @@ +/* + * Copyright 2009, Michael Lotz, mmlr at mlotz.ch. + * Distributed under the terms of the MIT License. + */ #ifndef HID_REPORT_H #define HID_REPORT_H Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDReportItem.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDReportItem.cpp 2009-05-07 22:16:50 UTC (rev 30664) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDReportItem.cpp 2009-05-07 22:23:14 UTC (rev 30665) @@ -1,3 +1,8 @@ +/* + * Copyright 2009, Michael Lotz, mmlr at mlotz.ch. + * Distributed under the terms of the MIT License. + */ + #include "HIDReportItem.h" #include "HIDReport.h" Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDReportItem.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDReportItem.h 2009-05-07 22:16:50 UTC (rev 30664) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDReportItem.h 2009-05-07 22:23:14 UTC (rev 30665) @@ -1,3 +1,7 @@ +/* + * Copyright 2009, Michael Lotz, mmlr at mlotz.ch. + * Distributed under the terms of the MIT License. + */ #ifndef HID_REPORT_ITEM_H #define HID_REPORT_ITEM_H From bonefish at mail.berlios.de Fri May 8 03:23:00 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Fri, 8 May 2009 03:23:00 +0200 Subject: [Haiku-commits] r30666 - haiku/trunk/src/apps/debuganalyzer/gui/chart Message-ID: <200905080123.n481N0T2007957@sheep.berlios.de> Author: bonefish Date: 2009-05-08 03:22:58 +0200 (Fri, 08 May 2009) New Revision: 30666 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30666&view=rev Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.cpp haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.h Log: Squashed TODO in Chart::_UpdateScrollBar(): We set both scroll bar range and value -- make sure to ignore feedback when setting the range (happens when the old value doesn't fit the range anymore). Fixes unexpected jumps when zooming out. Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.cpp =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.cpp 2009-05-07 22:23:14 UTC (rev 30665) +++ haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.cpp 2009-05-08 01:22:58 UTC (rev 30666) @@ -65,6 +65,7 @@ fVScrollSize(0), fHScrollValue(0), fVScrollValue(0), + fIgnoreScrollEvent(0), fDomainZoomLimit(0), fLastMousePos(-1, -1), fDraggingStartPos(-1, -1) @@ -407,6 +408,9 @@ void Chart::ScrollTo(BPoint where) { + if (fIgnoreScrollEvent > 0) + return; + _ScrollTo(where.x, true); _ScrollTo(where.y, false); } @@ -531,8 +535,9 @@ } if (scrollBar != NULL) { + fIgnoreScrollEvent++; scrollBar->SetRange(0, scrollSize); -// TODO: If the scroll range changes, we might need to reset the scroll value. + fIgnoreScrollEvent--; scrollBar->SetValue(scrollValue); scrollBar->SetProportion(proportion); } Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.h =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.h 2009-05-07 22:23:14 UTC (rev 30665) +++ haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.h 2009-05-08 01:22:58 UTC (rev 30666) @@ -107,6 +107,7 @@ float fVScrollSize; float fHScrollValue; float fVScrollValue; + int32 fIgnoreScrollEvent; double fDomainZoomLimit; BPoint fLastMousePos; BPoint fDraggingStartPos; From bonefish at mail.berlios.de Fri May 8 04:10:41 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Fri, 8 May 2009 04:10:41 +0200 Subject: [Haiku-commits] r30667 - haiku/trunk/src/apps/debuganalyzer/gui/chart Message-ID: <200905080210.n482Af26012710@sheep.berlios.de> Author: bonefish Date: 2009-05-08 04:10:39 +0200 (Fri, 08 May 2009) New Revision: 30667 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30667&view=rev Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.cpp Log: Invalidate() when removing a data source. Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.cpp =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.cpp 2009-05-08 01:22:58 UTC (rev 30666) +++ haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.cpp 2009-05-08 02:10:39 UTC (rev 30667) @@ -140,6 +140,8 @@ _UpdateDomainAndRange(); + Invalidate(); + return dataSource; } From bonefish at mail.berlios.de Fri May 8 04:12:10 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Fri, 8 May 2009 04:12:10 +0200 Subject: [Haiku-commits] r30668 - haiku/trunk/src/apps/debuganalyzer/gui Message-ID: <200905080212.n482CALs012885@sheep.berlios.de> Author: bonefish Date: 2009-05-08 04:12:07 +0200 (Fri, 08 May 2009) New Revision: 30668 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30668&view=rev Added: haiku/trunk/src/apps/debuganalyzer/gui/ColorCheckBox.cpp haiku/trunk/src/apps/debuganalyzer/gui/ColorCheckBox.h Modified: haiku/trunk/src/apps/debuganalyzer/gui/Jamfile Log: A check box with a small color indicator. Added: haiku/trunk/src/apps/debuganalyzer/gui/ColorCheckBox.cpp =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/ColorCheckBox.cpp 2009-05-08 02:10:39 UTC (rev 30667) +++ haiku/trunk/src/apps/debuganalyzer/gui/ColorCheckBox.cpp 2009-05-08 02:12:07 UTC (rev 30668) @@ -0,0 +1,53 @@ +/* + * Copyright 2009, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ + +#include "ColorCheckBox.h" + +#include + + +ColorCheckBox::ColorCheckBox(const char* label, const rgb_color& color, + BMessage* message) + : + BGroupView(B_HORIZONTAL), + fColor(color) +{ + SetFlags(Flags() | B_WILL_DRAW); + + fCheckBox = new BCheckBox(label, message); + GroupLayout()->AddView(fCheckBox, 0); + AddChild(BSpaceLayoutItem::CreateHorizontalStrut(15)); + AddChild(BSpaceLayoutItem::CreateGlue()); +} + + +BCheckBox* +ColorCheckBox::CheckBox() const +{ + return fCheckBox; +} + + +void +ColorCheckBox::SetTarget(const BMessenger& target) +{ + fCheckBox->SetTarget(target); +} + + +void +ColorCheckBox::Draw(BRect updateRect) +{ + BGroupView::Draw(updateRect); + + BRect rect(Bounds()); + rect.left += fCheckBox->Frame().right + 5; + rect.right = rect.left + 9; + rect.top = floorf((rect.top + rect.bottom) / 2); + rect.bottom = rect.top + 1; + + SetHighColor(fColor); + FillRect(rect); +} Added: haiku/trunk/src/apps/debuganalyzer/gui/ColorCheckBox.h =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/ColorCheckBox.h 2009-05-08 02:10:39 UTC (rev 30667) +++ haiku/trunk/src/apps/debuganalyzer/gui/ColorCheckBox.h 2009-05-08 02:12:07 UTC (rev 30668) @@ -0,0 +1,35 @@ +/* + * Copyright 2009, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ +#ifndef COLOR_CHECK_BOX_H +#define COLOR_CHECK_BOX_H + +#include +#include + + +class BCheckBox; + + +#include + +class ColorCheckBox : public BGroupView { +public: + ColorCheckBox(const char* label, + const rgb_color& color, + BMessage* message = NULL); + + BCheckBox* CheckBox() const; + + void SetTarget(const BMessenger& target); + + virtual void Draw(BRect updateRect); + +private: + BCheckBox* fCheckBox; + rgb_color fColor; +}; + + +#endif // COLOR_CHECK_BOX_H Modified: haiku/trunk/src/apps/debuganalyzer/gui/Jamfile =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/Jamfile 2009-05-08 02:10:39 UTC (rev 30667) +++ haiku/trunk/src/apps/debuganalyzer/gui/Jamfile 2009-05-08 02:12:07 UTC (rev 30668) @@ -9,6 +9,7 @@ MergeObject DebugAnalyzer_gui.o : AbstractGeneralPage.cpp + ColorCheckBox.cpp SubWindow.cpp SubWindowManager.cpp : From bonefish at mail.berlios.de Fri May 8 04:13:50 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Fri, 8 May 2009 04:13:50 +0200 Subject: [Haiku-commits] r30669 - in haiku/trunk/src/apps/debuganalyzer: . gui/thread_window Message-ID: <200905080213.n482Donf013240@sheep.berlios.de> Author: bonefish Date: 2009-05-08 04:13:48 +0200 (Fri, 08 May 2009) New Revision: 30669 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30669&view=rev Modified: haiku/trunk/src/apps/debuganalyzer/MessageCodes.h haiku/trunk/src/apps/debuganalyzer/gui/thread_window/ActivityPage.cpp haiku/trunk/src/apps/debuganalyzer/gui/thread_window/ActivityPage.h Log: Added checkboxen for toggling the displayed data. Modified: haiku/trunk/src/apps/debuganalyzer/MessageCodes.h =================================================================== --- haiku/trunk/src/apps/debuganalyzer/MessageCodes.h 2009-05-08 02:12:07 UTC (rev 30668) +++ haiku/trunk/src/apps/debuganalyzer/MessageCodes.h 2009-05-08 02:13:48 UTC (rev 30669) @@ -11,7 +11,12 @@ MSG_MODEL_LOADED_FAILED = 'mlfl', MSG_MODEL_LOADED_ABORTED = 'mlab', - MSG_WINDOW_QUIT = 'wiqt' + MSG_WINDOW_QUIT = 'wiqt', + + MSG_CHECK_BOX_RUN_TIME = 'chkr', + MSG_CHECK_BOX_WAIT_TIME = 'chkw', + MSG_CHECK_BOX_PREEMPTION_TIME = 'chkp', + MSG_CHECK_BOX_LATENCY_TIME = 'chkl' }; Modified: haiku/trunk/src/apps/debuganalyzer/gui/thread_window/ActivityPage.cpp =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/thread_window/ActivityPage.cpp 2009-05-08 02:12:07 UTC (rev 30668) +++ haiku/trunk/src/apps/debuganalyzer/gui/thread_window/ActivityPage.cpp 2009-05-08 02:13:48 UTC (rev 30669) @@ -7,11 +7,15 @@ #include +#include #include +#include #include #include +#include "ColorCheckBox.h" +#include "MessageCodes.h" #include "ThreadModel.h" #include "chart/BigtimeChartAxisLegendSource.h" @@ -32,7 +36,12 @@ TIME_TYPE_COUNT = 5 }; +static const rgb_color kRunTimeColor = {0, 0, 0, 255}; +static const rgb_color kWaitTimeColor = {0, 255, 0, 255}; +static const rgb_color kPreemptionTimeColor = {0, 0, 255, 255}; +static const rgb_color kLatencyTimeColor = {255, 0, 0, 255}; + class ThreadWindow::ActivityPage::ThreadActivityData : public ChartDataSource { public: @@ -303,8 +312,8 @@ fActivityChartRenderer(NULL), fRunTimeData(NULL), fWaitTimeData(NULL), - fLatencyTimeData(NULL), - fPreemptionTimeData(NULL) + fPreemptionTimeData(NULL), + fLatencyTimeData(NULL) { SetName("Activity"); @@ -320,10 +329,29 @@ BGroupLayoutBuilder(this) .Add(new BScrollView("activity scroll", fActivityChart, 0, true, false)) .AddStrut(20) + .Add(BGridLayoutBuilder() + .Add(fRunTimeCheckBox = new ColorCheckBox("Run Time", kRunTimeColor, + new BMessage(MSG_CHECK_BOX_RUN_TIME)), + 0, 0) + .Add(fWaitTimeCheckBox = new ColorCheckBox("Wait Time", + kWaitTimeColor, new BMessage(MSG_CHECK_BOX_WAIT_TIME)), + 1, 0) + .Add(fPreemptionTimeCheckBox = new ColorCheckBox("Latency Time", + kPreemptionTimeColor, + new BMessage(MSG_CHECK_BOX_PREEMPTION_TIME)), + 0, 1) + .Add(fLatencyTimeCheckBox = new ColorCheckBox("Preemption Time", + kLatencyTimeColor, + new BMessage(MSG_CHECK_BOX_LATENCY_TIME)), + 1, 1) + ) ; rendererDeleter.Detach(); + // enable the run time chart data + fRunTimeCheckBox->CheckBox()->SetValue(B_CONTROL_ON); + // TODO: Allocation management... LegendChartAxis* axis = new LegendChartAxis( new BigtimeChartAxisLegendSource, new StringChartLegendRenderer); @@ -374,36 +402,95 @@ fThreadModel = model; if (fThreadModel != NULL) { - // run time - LineChartRendererDataSourceConfig runConfig( - rgb_color().set_to(0, 0, 0, 255)); + _UpdateChartDataEnabled(RUN_TIME); + _UpdateChartDataEnabled(WAIT_TIME); + _UpdateChartDataEnabled(PREEMPTION_TIME); + _UpdateChartDataEnabled(LATENCY_TIME); + } +} - fRunTimeData = new(std::nothrow) ThreadActivityData(fThreadModel, - RUN_TIME); - fActivityChart->AddDataSource(fRunTimeData, &runConfig); - // wait time - LineChartRendererDataSourceConfig waitConfig( - rgb_color().set_to(0, 255, 0, 255)); +void +ThreadWindow::ActivityPage::MessageReceived(BMessage* message) +{ + switch (message->what) { + case MSG_CHECK_BOX_RUN_TIME: + _UpdateChartDataEnabled(RUN_TIME); + break; + case MSG_CHECK_BOX_WAIT_TIME: + _UpdateChartDataEnabled(WAIT_TIME); + break; + case MSG_CHECK_BOX_PREEMPTION_TIME: + _UpdateChartDataEnabled(PREEMPTION_TIME); + break; + case MSG_CHECK_BOX_LATENCY_TIME: + _UpdateChartDataEnabled(LATENCY_TIME); + break; + default: + BGroupView::MessageReceived(message); + break; + } +} - fWaitTimeData = new(std::nothrow) ThreadActivityData(fThreadModel, - WAIT_TIME); - fActivityChart->AddDataSource(fWaitTimeData, &waitConfig); - // preemption time - LineChartRendererDataSourceConfig preemptionConfig( - rgb_color().set_to(0, 0, 255, 255)); +void +ThreadWindow::ActivityPage::AttachedToWindow() +{ + fRunTimeCheckBox->SetTarget(this); + fWaitTimeCheckBox->SetTarget(this); + fPreemptionTimeCheckBox->SetTarget(this); + fLatencyTimeCheckBox->SetTarget(this); +} - fLatencyTimeData = new(std::nothrow) ThreadActivityData(fThreadModel, - PREEMPTION_TIME); - fActivityChart->AddDataSource(fLatencyTimeData, &preemptionConfig); - // latency time - LineChartRendererDataSourceConfig latencyConfig( - rgb_color().set_to(255, 0, 0, 255)); +void +ThreadWindow::ActivityPage::_UpdateChartDataEnabled(int timeType) +{ + ThreadActivityData** data; + ColorCheckBox* checkBox; + rgb_color color; - fPreemptionTimeData = new(std::nothrow) ThreadActivityData(fThreadModel, - LATENCY_TIME); - fActivityChart->AddDataSource(fPreemptionTimeData, &latencyConfig); + switch (timeType) { + case RUN_TIME: + data = &fRunTimeData; + checkBox = fRunTimeCheckBox; + color = kRunTimeColor; + break; + case WAIT_TIME: + data = &fWaitTimeData; + checkBox = fWaitTimeCheckBox; + color = kWaitTimeColor; + break; + case PREEMPTION_TIME: + data = &fPreemptionTimeData; + checkBox = fPreemptionTimeCheckBox; + color = kPreemptionTimeColor; + break; + case LATENCY_TIME: + data = &fLatencyTimeData; + checkBox = fLatencyTimeCheckBox; + color = kLatencyTimeColor; + break; + default: + return; } + + bool enabled = checkBox->CheckBox()->Value() == B_CONTROL_ON; + + if ((*data != NULL) == enabled) + return; + + if (enabled) { + LineChartRendererDataSourceConfig config(color); + + *data = new(std::nothrow) ThreadActivityData(fThreadModel, timeType); + if (*data == NULL) + return; + + fActivityChart->AddDataSource(*data, &config); + } else { + fActivityChart->RemoveDataSource(*data); + delete *data; + *data = NULL; + } } Modified: haiku/trunk/src/apps/debuganalyzer/gui/thread_window/ActivityPage.h =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/thread_window/ActivityPage.h 2009-05-08 02:12:07 UTC (rev 30668) +++ haiku/trunk/src/apps/debuganalyzer/gui/thread_window/ActivityPage.h 2009-05-08 02:13:48 UTC (rev 30669) @@ -12,6 +12,7 @@ class Chart; class ChartRenderer; +class ColorCheckBox; class ThreadWindow::ActivityPage : public BGroupView { @@ -21,19 +22,28 @@ void SetModel(ThreadModel* model); + virtual void MessageReceived(BMessage* message); + virtual void AttachedToWindow(); + private: class ThreadActivityData; private: + void _UpdateChartDataEnabled(int timeType); + +private: ThreadModel* fThreadModel; Chart* fActivityChart; ChartRenderer* fActivityChartRenderer; ThreadActivityData* fRunTimeData; ThreadActivityData* fWaitTimeData; + ThreadActivityData* fPreemptionTimeData; ThreadActivityData* fLatencyTimeData; - ThreadActivityData* fPreemptionTimeData; + ColorCheckBox* fRunTimeCheckBox; + ColorCheckBox* fWaitTimeCheckBox; + ColorCheckBox* fPreemptionTimeCheckBox; + ColorCheckBox* fLatencyTimeCheckBox; }; - #endif // THREAD_ACTIVITY_PAGE_H From axeld at pinc-software.de Fri May 8 08:44:26 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Fri, 08 May 2009 08:44:26 +0200 CEST Subject: [Haiku-commits] =?utf-8?q?r30664_-_haiku/trunk/src/add-ons/kernel?= =?utf-8?q?/drivers/input/usb=5Fhid?= In-Reply-To: <200905072216.n47MGsag000110@sheep.berlios.de> Message-ID: <1796169469-BeMail@zon> mmlr at mail.berlios.de wrote: > Log: > Adding a complete HID parser and report handling facility. Nice one! :-) Bye, Axel. From axeld at mail.berlios.de Fri May 8 09:14:18 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 8 May 2009 09:14:18 +0200 Subject: [Haiku-commits] r30670 - haiku/trunk/src/apps/terminal Message-ID: <200905080714.n487EISA005122@sheep.berlios.de> Author: axeld Date: 2009-05-08 09:14:18 +0200 (Fri, 08 May 2009) New Revision: 30670 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30670&view=rev Modified: haiku/trunk/src/apps/terminal/AppearPrefView.cpp Log: * Messed up IsFontUsable(), this closed bug #3895 if I understand diver correctly. Modified: haiku/trunk/src/apps/terminal/AppearPrefView.cpp =================================================================== --- haiku/trunk/src/apps/terminal/AppearPrefView.cpp 2009-05-08 02:13:48 UTC (rev 30669) +++ haiku/trunk/src/apps/terminal/AppearPrefView.cpp 2009-05-08 07:14:18 UTC (rev 30670) @@ -37,7 +37,7 @@ int lastWidth = 0; char buffer[2] = {0, 0}; for (int c = 0x20 ; c <= 0x7e; c++){ - buffer[1] = c; + buffer[0] = c; int width = (int)ceilf(font.StringWidth(buffer)); if (c > 0x20 && width != lastWidth) From stippi at mail.berlios.de Fri May 8 11:53:21 2009 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Fri, 8 May 2009 11:53:21 +0200 Subject: [Haiku-commits] r30671 - in haiku/trunk: build/jam src/add-ons/kernel/busses Message-ID: <200905080953.n489rLdY016933@sheep.berlios.de> Author: stippi Date: 2009-05-08 11:53:21 +0200 (Fri, 08 May 2009) New Revision: 30671 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30671&view=rev Modified: haiku/trunk/build/jam/HaikuImage haiku/trunk/src/add-ons/kernel/busses/Jamfile Log: * Currently, it's always supposed to be busses/ide. All the drivers there publish themselves in busses/ide, so you cannot just move them to busses/ata without changing that in the source as well. The object files are still built in the separate busses/ata under generated. * src/system/kernel/device_manager/device_manager.cpp also hardcodes busses/ide in two places. I tried changing all of this to add busses/ata, but my system remains unbootable with the new ATA stack. I do have another system, and because of the previous mixup in HaikuImage, there it installed the drivers in busses/ide when building for the new ATA stack (by mistake), but those drivers actually publish themselves in busses/ide, so this system actually boots with the new ATA stack, because of the mixup. Therefore My change here to install into busses/ide for either stack should be correct for now and should actually fix building the *old* stack. Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2009-05-08 07:14:18 UTC (rev 30670) +++ haiku/trunk/build/jam/HaikuImage 2009-05-08 09:53:21 UTC (rev 30671) @@ -40,7 +40,7 @@ id ident ideinfo idestatus ifconfig install installsound iroster isvolume join - keymap kill less lessecho lesskey link linkcatkeys listarea listattr + keymap kill less lessecho lesskey link linkcatkeys listarea listattr listimage listdev listport listres listsem listusb ln locate logger login logname ls lsindex makebootable md5sum merge mimeset mkdos mkdir mkfifo mkfs mkindex @@ -70,7 +70,7 @@ StyledEdit Terminal TextSearch TV Workspaces ; SYSTEM_PREFERENCES = Appearance Backgrounds CPUFrequency DataTranslations E-mail - FileTypes Fonts Keyboard Keymap Locale Media Menu Mouse Network Printers + FileTypes Fonts Keyboard Keymap Locale Media Menu Mouse Network Printers Screen ScreenSaver Sounds Time Touchpad Tracker VirtualMemory ; SYSTEM_DEMOS = BSnow Chart Clock Cortex FontDemo @@ -165,13 +165,8 @@ : $(SYSTEM_ADD_ONS_BUS_MANAGERS) ; AddFilesToHaikuImage system add-ons kernel busses agp_gart : $(X86_ONLY)intel ; -if $(HAIKU_ATA_STACK) = 1 { AddFilesToHaikuImage system add-ons kernel busses ide : generic_ide_pci it8211 legacy_sata silicon_image_3112 $(X86_ONLY)ide_isa ; -} else { -AddFilesToHaikuImage system add-ons kernel busses ata - : generic_ide_pci it8211 legacy_sata silicon_image_3112 $(X86_ONLY)ide_isa ; -} AddFilesToHaikuImage system add-ons kernel busses scsi : ahci ; AddFilesToHaikuImage system add-ons kernel busses usb @@ -293,7 +288,7 @@ # TODO/NOTE: Cannot use $(SYSTEM_PREFERENCES) here since there is # "Tracker"... DESKBAR_PREFERENCES = Appearance Backgrounds CPUFrequency DataTranslations - E-mail FileTypes Fonts Keyboard Keymap Locale Media Menu Mouse Network + E-mail FileTypes Fonts Keyboard Keymap Locale Media Menu Mouse Network Printers Screen ScreenSaver Sounds Time Touchpad Tracker VirtualMemory ; for linkTarget in $(DESKBAR_PREFERENCES) { Modified: haiku/trunk/src/add-ons/kernel/busses/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/Jamfile 2009-05-08 07:14:18 UTC (rev 30670) +++ haiku/trunk/src/add-ons/kernel/busses/Jamfile 2009-05-08 09:53:21 UTC (rev 30671) @@ -1,7 +1,7 @@ -SubDir HAIKU_TOP src add-ons kernel busses ; +SubDir HAIKU_TOP src add-ons kernel busses ; # HACK: remove this when the old ide code is removed! -if $(HAIKU_ATA_STACK) { +if $(HAIKU_ATA_STACK) = 1 { SubInclude HAIKU_TOP src add-ons kernel busses ata ; } else { SubInclude HAIKU_TOP src add-ons kernel busses ide ; From axeld at mail.berlios.de Fri May 8 12:14:26 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 8 May 2009 12:14:26 +0200 Subject: [Haiku-commits] r30672 - haiku/trunk/src/apps/terminal Message-ID: <200905081014.n48AEQEb019251@sheep.berlios.de> Author: axeld Date: 2009-05-08 12:14:25 +0200 (Fri, 08 May 2009) New Revision: 30672 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30672&view=rev Modified: haiku/trunk/src/apps/terminal/TermView.cpp Log: * Fixed a typo that prevented the right context menu copy action to work on directories. See ticket #3575. Modified: haiku/trunk/src/apps/terminal/TermView.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermView.cpp 2009-05-08 09:53:21 UTC (rev 30671) +++ haiku/trunk/src/apps/terminal/TermView.cpp 2009-05-08 10:14:25 UTC (rev 30672) @@ -1785,7 +1785,7 @@ } if (listContainsDirectory && action == kCopyFiles) - outString += " -R"; + outString += "-R "; outString += itemString; From dlmcpaul at mail.berlios.de Fri May 8 15:04:28 2009 From: dlmcpaul at mail.berlios.de (dlmcpaul at BerliOS) Date: Fri, 8 May 2009 15:04:28 +0200 Subject: [Haiku-commits] r30673 - haiku/trunk/src/add-ons/media/plugins/asf_reader Message-ID: <200905081304.n48D4S67013483@sheep.berlios.de> Author: dlmcpaul Date: 2009-05-08 15:04:27 +0200 (Fri, 08 May 2009) New Revision: 30673 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30673&view=rev Modified: haiku/trunk/src/add-ons/media/plugins/asf_reader/ASFFileReader.cpp haiku/trunk/src/add-ons/media/plugins/asf_reader/ASFIndex.cpp haiku/trunk/src/add-ons/media/plugins/asf_reader/asf_reader.cpp Log: They seek him here, they seek him there. Modified: haiku/trunk/src/add-ons/media/plugins/asf_reader/ASFFileReader.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/asf_reader/ASFFileReader.cpp 2009-05-08 10:14:25 UTC (rev 30672) +++ haiku/trunk/src/add-ons/media/plugins/asf_reader/ASFFileReader.cpp 2009-05-08 13:04:27 UTC (rev 30673) @@ -299,7 +299,7 @@ while (asf_get_packet(asfFile, packet) > 0) { for (int i=0;ipayload_count;i++) { payload = (asf_payload_t *)(&packet->payloads[i]); - // printf("Payload %d Stream %d Keyframe %d send time %Ld pts %Ld id %d size %d\n",i+1,payload->stream_number,payload->key_frame, 1000L * bigtime_t(packet->send_time), 1000L * bigtime_t(payload->pts), payload->media_object_number, payload->datalen); +// printf("Payload %d Stream %d Keyframe %d send time %Ld pts %Ld id %d size %d\n",i+1,payload->stream_number,payload->key_frame, 1000L * bigtime_t(packet->send_time), 1000L * bigtime_t(payload->pts), payload->media_object_number, payload->datalen); if (payload->stream_number < streams.size()) { streams[payload->stream_number].AddPayload(payload->media_object_number, payload->key_frame, 1000L * payload->pts, payload->datalen, false); } @@ -329,6 +329,7 @@ if (indexEntry.noPayloads == 0) { // No index entry + printf("No Index entry for frame %ld\n",pFrameNo); return false; } Modified: haiku/trunk/src/add-ons/media/plugins/asf_reader/ASFIndex.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/asf_reader/ASFIndex.cpp 2009-05-08 10:14:25 UTC (rev 30672) +++ haiku/trunk/src/add-ons/media/plugins/asf_reader/ASFIndex.cpp 2009-05-08 13:04:27 UTC (rev 30673) @@ -73,7 +73,6 @@ for (std::vector::iterator itr = index.begin(); itr != index.end(); ++itr) { if (itr->frameNo == frameNo) { indexEntry = *itr; - index.erase(itr); break; } } @@ -84,12 +83,10 @@ StreamEntry::HasIndex(uint32 frameNo) { if (!index.empty()) { - for (std::vector::iterator itr = index.begin(); - itr != index.end(); - ++itr) { - if (itr->frameNo == frameNo) { - return true; - } + for (std::vector::iterator itr = index.begin(); itr != index.end(); ++itr) { + if (itr->frameNo == frameNo) { + return true; + } } } @@ -104,7 +101,6 @@ for (std::vector::iterator itr = index.begin(); itr != index.end(); ++itr) { if (pts <= itr->pts) { indexEntry = *itr; - index.erase(itr); break; } } @@ -115,12 +111,10 @@ StreamEntry::HasIndex(bigtime_t pts) { if (!index.empty()) { - for (std::vector::iterator itr = index.begin(); - itr != index.end(); - ++itr) { - if (pts <= itr->pts) { - return true; - } + for (std::vector::iterator itr = index.begin(); itr != index.end(); ++itr) { + if (pts <= itr->pts) { + return true; + } } } Modified: haiku/trunk/src/add-ons/media/plugins/asf_reader/asf_reader.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/asf_reader/asf_reader.cpp 2009-05-08 10:14:25 UTC (rev 30672) +++ haiku/trunk/src/add-ons/media/plugins/asf_reader/asf_reader.cpp 2009-05-08 13:04:27 UTC (rev 30673) @@ -190,7 +190,7 @@ TRACE("frame_count %Ld\n", cookie->frame_count); TRACE("duration %.6f (%Ld)\n", cookie->duration / 1E6, cookie->duration); - TRACE("calculated fps=%ld\n", cookie->frame_count * 1000000LL / cookie->duration); + TRACE("calculated fps=%Ld\n", cookie->frame_count * 1000000LL / cookie->duration); // asf does not have a frame rate! The extended descriptor defines an average time per frame which is generally useless. if (videoFormat.FrameScale && videoFormat.FrameRate) { @@ -469,7 +469,7 @@ // Find the nearest keyframe to the given time or frame. asf_cookie *asfCookie = (asf_cookie *)cookie; - bool keyframe = false; + IndexEntry indexEntry; if (flags & B_MEDIA_SEEK_TO_TIME) { // convert time to frame as we seek by frame @@ -477,12 +477,6 @@ *frame = ((*time * asfCookie->frames_per_sec_rate) / (int64)asfCookie->frames_per_sec_scale) / 1000000LL; } - if (flags & B_MEDIA_SEEK_TO_FRAME) { - // convert frame to time as we seek by frame - // frame = (time * rate) / fps / 1000000LL - *time = *frame * 1000000LL * (int64)asfCookie->frames_per_sec_scale / asfCookie->frames_per_sec_rate; - } - TRACE("asfReader::FindKeyFrame: seekTo%s%s%s%s, time %Ld, frame %Ld\n", (flags & B_MEDIA_SEEK_TO_TIME) ? " B_MEDIA_SEEK_TO_TIME" : "", (flags & B_MEDIA_SEEK_TO_FRAME) ? " B_MEDIA_SEEK_TO_FRAME" : "", @@ -490,6 +484,28 @@ (flags & B_MEDIA_SEEK_CLOSEST_BACKWARD) ? " B_MEDIA_SEEK_CLOSEST_BACKWARD" : "", *time, *frame); + if (asfCookie->audio == false) { + // Only video has keyframes + if (flags & B_MEDIA_SEEK_CLOSEST_FORWARD || flags & B_MEDIA_SEEK_CLOSEST_BACKWARD) { + indexEntry = theFileReader->GetIndex(asfCookie->stream,*frame); + + while (indexEntry.noPayloads > 0 && indexEntry.keyFrame == false && *frame > 0) { + if (flags & B_MEDIA_SEEK_CLOSEST_BACKWARD) { + (*frame)--; + } else { + (*frame)++; + } + indexEntry = theFileReader->GetIndex(asfCookie->stream,*frame); + } + + if (indexEntry.noPayloads == 0) { + return B_ERROR; + } + } + } + + *time = *frame * 1000000LL * (int64)asfCookie->frames_per_sec_scale / asfCookie->frames_per_sec_rate; + return B_OK; } From ingo_weinhold at gmx.de Fri May 8 15:04:36 2009 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Fri, 08 May 2009 15:04:36 +0200 Subject: [Haiku-commits] r30673 - haiku/trunk/src/add-ons/media/plugins/asf_reader In-Reply-To: <200905081304.n48D4S67013483@sheep.berlios.de> References: <200905081304.n48D4S67013483@sheep.berlios.de> Message-ID: <20090508150436.656.2@knochen-vm.localdomain> On 2009-05-08 at 15:04:28 [+0200], dlmcpaul at BerliOS wrote: > Author: dlmcpaul > Date: 2009-05-08 15:04:27 +0200 (Fri, 08 May 2009) > New Revision: 30673 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30673&view=rev > > Modified: > haiku/trunk/src/add-ons/media/plugins/asf_reader/ASFFileReader.cpp > haiku/trunk/src/add-ons/media/plugins/asf_reader/ASFIndex.cpp > haiku/trunk/src/add-ons/media/plugins/asf_reader/asf_reader.cpp > Log: > They seek him here, they seek him there. [...] > @@ -84,12 +83,10 @@ > StreamEntry::HasIndex(uint32 frameNo) > { > if (!index.empty()) { > - for (std::vector::iterator itr = index.begin(); > - itr != index.end(); > - ++itr) { > - if (itr->frameNo == frameNo) { > - return true; > - } > + for (std::vector::iterator itr = index.begin(); itr > != index.end(); ++itr) { > + if (itr->frameNo == frameNo) { > + return true; > + } > } > } ... and they want him to respect the coding guidelines. :-) CU, Ingo From axeld at mail.berlios.de Fri May 8 16:29:29 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 8 May 2009 16:29:29 +0200 Subject: [Haiku-commits] r30674 - in haiku/trunk/data: etc system/boot Message-ID: <200905081429.n48ETTpK024686@sheep.berlios.de> Author: axeld Date: 2009-05-08 16:29:29 +0200 (Fri, 08 May 2009) New Revision: 30674 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30674&view=rev Modified: haiku/trunk/data/etc/profile haiku/trunk/data/system/boot/Bootscript haiku/trunk/data/system/boot/Bootscript.cd Log: * Removed the "cd" to home in /etc/profile, made sure that Tracker/Deskbar are started from /boot/home. This closes ticket #3090. Modified: haiku/trunk/data/etc/profile =================================================================== --- haiku/trunk/data/etc/profile 2009-05-08 13:04:27 UTC (rev 30673) +++ haiku/trunk/data/etc/profile 2009-05-08 14:29:29 UTC (rev 30674) @@ -5,9 +5,6 @@ echo -e "\nWelcome to the Haiku shell.\n" -# switch to $HOME -cd - export PS1="\w> " export HISTFILESIZE=50 Modified: haiku/trunk/data/system/boot/Bootscript =================================================================== --- haiku/trunk/data/system/boot/Bootscript 2009-05-08 13:04:27 UTC (rev 30673) +++ haiku/trunk/data/system/boot/Bootscript 2009-05-08 14:29:29 UTC (rev 30674) @@ -90,7 +90,7 @@ # Init Network if [ "$SAFEMODE" != "yes" ]; then - launch $SERVERS/net_server # launch net_server + launch $SERVERS/net_server # launch net_server fi if [ "$SAFEMODE" != "yes" ]; then @@ -120,6 +120,7 @@ launch system/Login # nothing more else + cd /boot/home launch system/Tracker launch system/Deskbar Modified: haiku/trunk/data/system/boot/Bootscript.cd =================================================================== --- haiku/trunk/data/system/boot/Bootscript.cd 2009-05-08 13:04:27 UTC (rev 30673) +++ haiku/trunk/data/system/boot/Bootscript.cd 2009-05-08 14:29:29 UTC (rev 30674) @@ -47,6 +47,7 @@ # Launch Terminal or consoled depending on $SAFEMODE if [ "$SAFEMODE" != "yes" ]; then + cd /boot/home if [ -x /boot/system/apps/Installer ]; then /boot/system/apps/Installer #/boot/system/apps/Terminal -x /boot/system/apps/Installer From axeld at mail.berlios.de Fri May 8 16:48:53 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 8 May 2009 16:48:53 +0200 Subject: [Haiku-commits] r30675 - haiku/trunk/src/add-ons/kernel/file_systems/bfs Message-ID: <200905081448.n48EmrP9028163@sheep.berlios.de> Author: axeld Date: 2009-05-08 16:48:51 +0200 (Fri, 08 May 2009) New Revision: 30675 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30675&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp Log: * Removed the work-around that allowed to open directories read/write. See ticket #3875. Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp 2009-05-08 14:29:29 UTC (rev 30674) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp 2009-05-08 14:48:51 UTC (rev 30675) @@ -1168,18 +1168,14 @@ Volume* volume = (Volume*)_volume->private_volume; Inode* inode = (Inode*)_node->private_node; - // opening a directory read-only is allowed, although you can't read + // Opening a directory read-only is allowed, although you can't read // any data from it. - if (inode->IsDirectory() && (openMode & O_RWMASK) != 0) { - openMode = openMode & ~O_RWMASK; - // TODO: for compatibility reasons, we don't return an error here... - // e.g. "copyattr" tries to do that - //return B_IS_A_DIRECTORY; - } + if (inode->IsDirectory() && (openMode & O_RWMASK) != O_RDONLY) + return B_IS_A_DIRECTORY; status_t status = inode->CheckPermissions(open_mode_to_access(openMode) | (openMode & O_TRUNC ? W_OK : 0)); - if (status < B_OK) + if (status != B_OK) RETURN_ERROR(status); file_cookie* cookie = new(std::nothrow) file_cookie; @@ -1205,10 +1201,6 @@ if ((openMode & O_TRUNC) != 0) { if ((openMode & O_RWMASK) == O_RDONLY) return B_NOT_ALLOWED; - // TODO: this check is only necessary as long as we allow directories - // to be opened r/w, see above. - if (inode->IsDirectory()) - return B_IS_A_DIRECTORY; Transaction transaction(volume, inode->BlockNumber()); inode->WriteLockInTransaction(transaction); From stippi at mail.berlios.de Fri May 8 22:20:26 2009 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Fri, 8 May 2009 22:20:26 +0200 Subject: [Haiku-commits] r30676 - haiku/trunk/src/apps/debuganalyzer/gui/chart Message-ID: <200905082020.n48KKQHx004822@sheep.berlios.de> Author: stippi Date: 2009-05-08 22:20:21 +0200 (Fri, 08 May 2009) New Revision: 30676 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30676&view=rev Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/LineChartRenderer.cpp Log: Use a BShape do draw the chart lines: -> Significant speed up, since there is much less app_server communication. -> Much improved looks, since the line is now drawn as one connected line. The StrokeLine(BPoint to) version cannot do this. Hope I am not interfering, Ingo! Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/LineChartRenderer.cpp =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/chart/LineChartRenderer.cpp 2009-05-08 14:48:51 UTC (rev 30675) +++ haiku/trunk/src/apps/debuganalyzer/gui/chart/LineChartRenderer.cpp 2009-05-08 20:20:21 UTC (rev 30676) @@ -7,6 +7,7 @@ #include +#include #include #include "chart/ChartDataSource.h" @@ -189,19 +190,23 @@ double scale = (double)fFrame.IntegerHeight() / sampleRange; // draw + view->SetLineMode(B_ROUND_CAP, B_ROUND_JOIN); for (int32 i = 0; DataSourceInfo* info = fDataSources.ItemAt(i); i++) { printf("LineChartRenderer::Render(): %p\n", info); - view->SetHighColor(info->config.Color()); float bottom = fFrame.bottom; - view->MovePenTo(left + first, - bottom - ((info->samples[first] - minRange) * scale)); + BShape shape; + shape.MoveTo(BPoint(left + first, + bottom - ((info->samples[first] - minRange) * scale))); for (int32 i = first; i <= last; i++) { - view->StrokeLine(BPoint(float(left + i), + shape.LineTo(BPoint(float(left + i), float(bottom - ((info->samples[i] - minRange) * scale)))); //printf(" %f: %f (%f)\n", info->samples[i] - minRange, float(bottom - ((info->samples[i] - minRange) * scale)), bottom); } + view->SetHighColor(info->config.Color()); + view->MovePenTo(B_ORIGIN); + view->StrokeShape(&shape); } } From ingo_weinhold at gmx.de Fri May 8 23:40:21 2009 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Fri, 08 May 2009 23:40:21 +0200 Subject: [Haiku-commits] r30676 - haiku/trunk/src/apps/debuganalyzer/gui/chart In-Reply-To: <200905082020.n48KKQHx004822@sheep.berlios.de> References: <200905082020.n48KKQHx004822@sheep.berlios.de> Message-ID: <20090508234021.475.1@knochen-vm.localdomain> On 2009-05-08 at 22:20:26 [+0200], stippi at mail.berlios.de wrote: > Author: stippi > Date: 2009-05-08 22:20:21 +0200 (Fri, 08 May 2009) > New Revision: 30676 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30676&view=rev > > Modified: > haiku/trunk/src/apps/debuganalyzer/gui/chart/LineChartRenderer.cpp > Log: > Use a BShape do draw the chart lines: > -> Significant speed up, since there is much less app_server communication. > -> Much improved looks, since the line is now drawn as one connected line. > The StrokeLine(BPoint to) version cannot do this. > Hope I am not interfering, Ingo! No, not at all. Thanks! In fact I wanted to bother you anyway, since spikes in the chart looked just wrong -- they were wider at the point than below. CU, Ingo From ingo_weinhold at gmx.de Sat May 9 01:04:51 2009 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Sat, 09 May 2009 01:04:51 +0200 Subject: [Haiku-commits] r30676 - haiku/trunk/src/apps/debuganalyzer/gui/chart In-Reply-To: <20090508234021.475.1@knochen-vm.localdomain> References: <200905082020.n48KKQHx004822@sheep.berlios.de> <20090508234021.475.1@knochen-vm.localdomain> Message-ID: <20090508230451.48960@gmx.net> -------- Original-Nachricht -------- > Datum: Fri, 08 May 2009 23:40:21 +0200 > Von: Ingo Weinhold > On 2009-05-08 at 22:20:26 [+0200], stippi at mail.berlios.de wrote: > > Author: stippi > > Date: 2009-05-08 22:20:21 +0200 (Fri, 08 May 2009) > > New Revision: 30676 > > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30676&view=rev > > > > Modified: > > haiku/trunk/src/apps/debuganalyzer/gui/chart/LineChartRenderer.cpp > > Log: > > Use a BShape do draw the chart lines: > > -> Significant speed up, since there is much less app_server > communication. > > -> Much improved looks, since the line is now drawn as one connected > line. > > The StrokeLine(BPoint to) version cannot do this. > > Hope I am not interfering, Ingo! > > No, not at all. Thanks! In fact I wanted to bother you anyway, since > spikes > in the chart looked just wrong -- they were wider at the point than below. Just tested it for the first time and wow, the speedup is impressive! It's totally snappy. And I actually thought computing the samples was the part that needed most of the time. The spikes look fine now, too. Thanks a lot! CU, Ingo From stpere at gmail.com Sat May 9 01:58:23 2009 From: stpere at gmail.com (Philippe Saint-Pierre) Date: Fri, 8 May 2009 19:58:23 -0400 Subject: [Haiku-commits] r30675 - haiku/trunk/src/add-ons/kernel/file_systems/bfs In-Reply-To: <200905081448.n48EmrP9028163@sheep.berlios.de> References: <200905081448.n48EmrP9028163@sheep.berlios.de> Message-ID: 2009/5/8 axeld at BerliOS > Author: axeld > Date: 2009-05-08 16:48:51 +0200 (Fri, 08 May 2009) > New Revision: 30675 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30675&view=rev > > Modified: > haiku/trunk/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp > Log: > * Removed the work-around that allowed to open directories read/write. > See ticket #3875. > > > Modified: > haiku/trunk/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp > =================================================================== > --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp > 2009-05-08 14:29:29 UTC (rev 30674) > +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp > 2009-05-08 14:48:51 UTC (rev 30675) > @@ -1168,18 +1168,14 @@ > Volume* volume = (Volume*)_volume->private_volume; > Inode* inode = (Inode*)_node->private_node; > > - // opening a directory read-only is allowed, although you can't > read > + // Opening a directory read-only is allowed, although you can't > read > // any data from it. > - if (inode->IsDirectory() && (openMode & O_RWMASK) != 0) { > - openMode = openMode & ~O_RWMASK; > - // TODO: for compatibility reasons, we don't return an > error here... > - // e.g. "copyattr" tries to do that > - //return B_IS_A_DIRECTORY; > - } > + if (inode->IsDirectory() && (openMode & O_RWMASK) != O_RDONLY) > + return B_IS_A_DIRECTORY; > > status_t status = > inode->CheckPermissions(open_mode_to_access(openMode) > | (openMode & O_TRUNC ? W_OK : 0)); > - if (status < B_OK) > + if (status != B_OK) > RETURN_ERROR(status); > > file_cookie* cookie = new(std::nothrow) file_cookie; > @@ -1205,10 +1201,6 @@ > if ((openMode & O_TRUNC) != 0) { > if ((openMode & O_RWMASK) == O_RDONLY) > return B_NOT_ALLOWED; > - // TODO: this check is only necessary as long as we allow > directories > - // to be opened r/w, see above. > - if (inode->IsDirectory()) > - return B_IS_A_DIRECTORY; > > Transaction transaction(volume, inode->BlockNumber()); > inode->WriteLockInTransaction(transaction); > > Hi Axel, Just a note to point out it seems the build process was expecting to be allowed to open directories read/write.. I tell this because after this commit, there are messages like : ====== Error: Failed to open target `/myfs/home/config/settings/printers/Preview' for writing: `Is a directory' Error: Command failed: Is a directory Error: Command was: cp -a :generated/objects/haiku/x86/common/haiku.image-make-dirs-attributes-home-config-settings-printers-Preview /myfs/home/config/settings/printers/Preview Error: Failed to open target `/myfs/home/config/settings/printers/Save as PDF' for writing: `Is a directory' Error: Command failed: Is a directory Error: Command was: cp -a :generated/objects/haiku/x86/common/haiku.image-make-dirs-attributes-home-config-settings-printers-Save\ as\ PDF /myfs/home/config/settings/printers/Save\ as\ PDF ====== That said, opening a directory as read/write doesn't make sense, so, in no way I intend to suggest to revert this commit or anything like that.. Philippe -------------- next part -------------- An HTML attachment was scrubbed... URL: From bga at bug-br.org.br Fri May 8 21:18:30 2009 From: bga at bug-br.org.br (Bruno Albuquerque) Date: Fri, 08 May 2009 21:18:30 Subject: [Haiku-commits] =?utf-8?q?r30675_-_haiku/trunk/src/add-ons/kernel?= =?utf-8?q?/file=5Fsystems/bfs?= In-Reply-To: Message-ID: <526468093-BeMail@Gaspode> On Fri, 8 May 2009 19:58:23 -0400, Philippe Saint-Pierre said: > That said, opening a directory as read/write doesn't make sense, so, > in no > way I intend to suggest to revert this commit or anything like that.. I guess it is trying to werite attributes to the directory. That being said, I am not sure this is the way to go. I would think writting attributes to a file should be similar to renaming a file (which is basically changing an attribute, the name). Rename does not require the file/directory to be open for writing, does it? That said, the problem that I reported and resulted in Axel removing the hack that was in place is something different. Copyattr was trying to write to the *SOURCE* file/directory it seems, as it was failing because the source volume was read only. Why it wanted to write to the source files is beyond me. :) -Bruno From superstippi at gmx.de Sat May 9 09:01:12 2009 From: superstippi at gmx.de (Stephan Assmus) Date: Sat, 09 May 2009 09:01:12 +0200 Subject: [Haiku-commits] r30676 - haiku/trunk/src/apps/debuganalyzer/gui/chart In-Reply-To: <20090508230451.48960@gmx.net> References: <200905082020.n48KKQHx004822@sheep.berlios.de> <20090508234021.475.1@knochen-vm.localdomain> <20090508230451.48960@gmx.net> Message-ID: <20090509090112.11606.1@bepc.1241851473.fake> On 2009-05-09 at 00:04:51 [+0200], Ingo Weinhold wrote: > > -------- Original-Nachricht -------- > > Datum: Fri, 08 May 2009 23:40:21 +0200 > > Von: Ingo Weinhold > > On 2009-05-08 at 22:20:26 [+0200], stippi at mail.berlios.de wrote: > > > Author: stippi > > > Date: 2009-05-08 22:20:21 +0200 (Fri, 08 May 2009) New Revision: 30676 > > > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30676&view=rev > > > > > > Modified: > > > haiku/trunk/src/apps/debuganalyzer/gui/chart/LineChartRenderer.cpp > > > Log: > > > Use a BShape do draw the chart lines: > > > -> Significant speed up, since there is much less app_server > > communication. > > > -> Much improved looks, since the line is now drawn as one connected > > line. > > > The StrokeLine(BPoint to) version cannot do this. > > > Hope I am not interfering, Ingo! > > > > No, not at all. Thanks! In fact I wanted to bother you anyway, since > > spikes > > in the chart looked just wrong -- they were wider at the point than > > below. > > Just tested it for the first time and wow, the speedup is impressive! > It's totally snappy. And I actually thought computing the samples was the > part that needed most of the time. The spikes look fine now, too. Thanks > a lot! I'm glad you like it! Maybe it can be even better using a BPolygon instead of BShape... that requires no "parsing" at the app_server side. The problem with the lines you saw befor... it's something I had trouble with implementing in app_server. It's the old problem of having to snap coordinates because AGG is subpixel precise. I am snapping lines according to their direction when they are not straight lines, and there may some side effects when the line changes direction like in this particular case, where points then snap to the other side of the true line. Best regards, -Stephan From ingo_weinhold at gmx.de Sat May 9 12:48:56 2009 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Sat, 09 May 2009 12:48:56 +0200 Subject: [Haiku-commits] r30675 - haiku/trunk/src/add-ons/kernel/file_systems/bfs In-Reply-To: <526468093-BeMail@Gaspode> References: <526468093-BeMail@Gaspode> Message-ID: <20090509124856.359.1@knochen-vm.localdomain> On 2009-05-08 at 21:18:30 [+0200], Bruno Albuquerque wrote: > On Fri, 8 May 2009 19:58:23 -0400, Philippe Saint-Pierre said: > > > That said, opening a directory as read/write doesn't make sense, so, > > in no > > way I intend to suggest to revert this commit or anything like that.. > > I guess it is trying to werite attributes to the directory. That being > said, I am not sure this is the way to go. I would think writting > attributes to a file should be similar to renaming a file (which is > basically changing an attribute, the name). Rename does not require the > file/directory to be open for writing, does it? The analogy doesn't really work. Neither is the file name a property of the node (at least in general -- in BFS's implementation it is), nor does one need to open the directory at all to rename an entry. Anyway, I agree that the open mode of the node should not affect what can be done with the attributes, since the FD is used merely as a handle to identify the node. CU, Ingo From bga at bug-br.org.br Sat May 9 09:06:22 2009 From: bga at bug-br.org.br (Bruno Albuquerque) Date: Sat, 09 May 2009 09:06:22 Subject: [Haiku-commits] r30675 - haiku/trunk/src/add-ons/kernel/file_systems/bfs In-Reply-To: <20090509124856.359.1@knochen-vm.localdomain> Message-ID: <1347445657-BeMail@Gaspode> On Sat, 09 May 2009 12:48:56 +0200, Ingo Weinhold said: > > > That said, opening a directory as read/write doesn't make sense, > > > so, > > > in no > > > way I intend to suggest to revert this commit or anything like > > > that.. > > > > I guess it is trying to werite attributes to the directory. That > > being > > said, I am not sure this is the way to go. I would think writting > > attributes to a file should be similar to renaming a file (which is > > basically changing an attribute, the name). Rename does not require > > the > > file/directory to be open for writing, does it? > > The analogy doesn't really work. Neither is the file name a property > of the > node (at least in general -- in BFS's implementation it is), nor does > one > need to open the directory at all to rename an entry. Wait. I guess you are being a bit biased by technicalities. Forget what a file is and think of it as a thing. The name of this thing is an attribute of it (doesn' t matter how it is implemented) just as an attribute (obviously is). I did not mean to say that an attrobute is the same thing as the file name but that for the purposes of my explanation they work the same. > Anyway, I agree that the open mode of the node should not affect what > can > be done with the attributes, since the FD is used merely as a handle > to > identify the node. Yep. That was my point. But then, a different question arrises: Should we have permissions for the attribute directory and attributes? -Bruno From axeld at pinc-software.de Sat May 9 14:17:27 2009 From: axeld at pinc-software.de (=?ISO-8859-1?Q?Axel_D=F6rfler?=) Date: Sat, 09 May 2009 14:17:27 +0200 Subject: [Haiku-commits] r30675 - haiku/trunk/src/add-ons/kernel/file_systems/bfs In-Reply-To: <20090509124856.359.1@knochen-vm.localdomain> References: <526468093-BeMail@Gaspode> <20090509124856.359.1@knochen-vm.localdomain> Message-ID: <4A057457.2050601@pinc-software.de> Ingo Weinhold wrote: > Anyway, I agree that the open mode of the node should not affect what can > be done with the attributes, since the FD is used merely as a handle to > identify the node. Same here. Could someone fix that build bug? At least I probably won't find the time to do that before monday. I did not do a full build when I updated BFS (only the files I worked with), and did not see a problem. In any case, since the change was a change is the right direction, the consequences should be fixed :-) Bye, Axel. From ingo_weinhold at gmx.de Sat May 9 14:11:08 2009 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Sat, 09 May 2009 14:11:08 +0200 Subject: [Haiku-commits] r30675 - haiku/trunk/src/add-ons/kernel/file_systems/bfs In-Reply-To: <1347445657-BeMail@Gaspode> References: <1347445657-BeMail@Gaspode> Message-ID: <20090509141108.388.1@knochen-vm.localdomain> On 2009-05-09 at 09:06:22 [+0200], Bruno Albuquerque wrote: > > Anyway, I agree that the open mode of the node should not affect what > > can > > be done with the attributes, since the FD is used merely as a handle > > to > > identify the node. > > Yep. That was my point. But then, a different question arrises: Should > we have permissions for the attribute directory and attributes? To not further complicate things I'd simply use the node permissions. Attributes hold additional data associated with the file, so using the permissions that apply for the "main" data does make sense (just think of people files). At some point we want to introduces special system attributes (e.g. for reparse points) which would have limited access, but I would consider that a general privilege/capability, not one that needs to be stored for every attribute. CU, Ingo From bonefish at mail.berlios.de Sat May 9 14:39:34 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Sat, 9 May 2009 14:39:34 +0200 Subject: [Haiku-commits] r30677 - haiku/trunk/src/tools/fs_shell Message-ID: <200905091239.n49CdYHG024222@sheep.berlios.de> Author: bonefish Date: 2009-05-09 14:39:33 +0200 (Sat, 09 May 2009) New Revision: 30677 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30677&view=rev Modified: haiku/trunk/src/tools/fs_shell/command_cp.cpp Log: When copying attributes only, it suffices to open the target read-only. Fixes the image build. Modified: haiku/trunk/src/tools/fs_shell/command_cp.cpp =================================================================== --- haiku/trunk/src/tools/fs_shell/command_cp.cpp 2009-05-08 20:20:21 UTC (rev 30676) +++ haiku/trunk/src/tools/fs_shell/command_cp.cpp 2009-05-09 12:39:33 UTC (rev 30677) @@ -1356,7 +1356,7 @@ // open the target node for attributes only mode NodeDeleter targetDeleter; if (options.attributesOnly) { - error = targetDomain->Open(target, FSSH_O_WRONLY, targetNode); + error = targetDomain->Open(target, FSSH_O_RDONLY, targetNode); if (error != FSSH_B_OK) { fprintf(stderr, "Error: Failed to open target `%s' for writing: " "`%s'\n", target, fssh_strerror(error)); From bonefish at mail.berlios.de Sat May 9 17:17:10 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Sat, 9 May 2009 17:17:10 +0200 Subject: [Haiku-commits] r30678 - haiku/trunk/src/apps/debuganalyzer/gui/chart Message-ID: <200905091517.n49FHAMi018105@sheep.berlios.de> Author: bonefish Date: 2009-05-09 17:17:06 +0200 (Sat, 09 May 2009) New Revision: 30678 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30678&view=rev Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/BigtimeChartAxisLegendSource.cpp haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.cpp haiku/trunk/src/apps/debuganalyzer/gui/chart/LegendChartAxis.cpp haiku/trunk/src/apps/debuganalyzer/gui/chart/LineChartRenderer.cpp Log: Removed/commented out debug output. Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/BigtimeChartAxisLegendSource.cpp =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/chart/BigtimeChartAxisLegendSource.cpp 2009-05-09 12:39:33 UTC (rev 30677) +++ haiku/trunk/src/apps/debuganalyzer/gui/chart/BigtimeChartAxisLegendSource.cpp 2009-05-09 15:17:06 UTC (rev 30678) @@ -43,7 +43,6 @@ // interpret range as time range bigtime_t startTime = (bigtime_t)range.min; bigtime_t endTime = (bigtime_t)range.max; -printf("BigtimeChartAxisLegendSource::GetAxisLegends(): range: %lld - %lld\n", startTime, endTime); // TODO: Handle sub-microsecs ranges! if (startTime >= endTime) return 0; Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.cpp =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.cpp 2009-05-09 12:39:33 UTC (rev 30677) +++ haiku/trunk/src/apps/debuganalyzer/gui/chart/Chart.cpp 2009-05-09 15:17:06 UTC (rev 30678) @@ -85,7 +85,6 @@ Chart::AddDataSource(ChartDataSource* dataSource, int32 index, ChartRendererDataSourceConfig* config) { -printf("Chart::AddDataSource(%p)\n", dataSource); if (dataSource == NULL) return false; @@ -130,7 +129,6 @@ ChartDataSource* Chart::RemoveDataSource(int32 index) { -printf("Chart::RemoveDataSource(%ld)\n", index); if (index < 0 || index >= fDataSources.CountItems()) return NULL; @@ -149,7 +147,6 @@ void Chart::RemoveAllDataSources() { -printf("Chart::RemoveAllDataSources()\n"); int32 count = fDataSources.CountItems(); for (int32 i = count - 1; i >= 0; i--) fRenderer->RemoveDataSource(fDataSources.ItemAt(i)); @@ -371,7 +368,7 @@ void Chart::Draw(BRect updateRect) { -printf("Chart::Draw((%f, %f) - (%f, %f))\n", updateRect.left, updateRect.top, updateRect.right, updateRect.bottom); +//printf("Chart::Draw((%f, %f) - (%f, %f))\n", updateRect.left, updateRect.top, updateRect.right, updateRect.bottom); rgb_color background = ui_color(B_PANEL_BACKGROUND_COLOR); rgb_color color; @@ -447,7 +444,7 @@ { // get size in pixels BSize size = Bounds().Size(); -printf("Chart::DoLayout(%f, %f)\n", size.width, size.height); +//printf("Chart::DoLayout(%f, %f)\n", size.width, size.height); int32 width = size.IntegerWidth() + 1; int32 height = size.IntegerHeight() + 1; @@ -470,7 +467,7 @@ fChartFrame = BRect(left, top, width - right - 1, height - bottom - 1); fRenderer->SetFrame(fChartFrame.InsetByCopy(1, 1)); -printf(" fChartFrame: (%f, %f) - (%f, %f)\n", fChartFrame.left, fChartFrame.top, fChartFrame.right, fChartFrame.bottom); +//printf(" fChartFrame: (%f, %f) - (%f, %f)\n", fChartFrame.left, fChartFrame.top, fChartFrame.right, fChartFrame.bottom); fLeftAxis.SetFrame(0, fChartFrame.top + 1, fChartFrame.left - 1, fChartFrame.bottom - 1); Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/LegendChartAxis.cpp =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/chart/LegendChartAxis.cpp 2009-05-09 12:39:33 UTC (rev 30677) +++ haiku/trunk/src/apps/debuganalyzer/gui/chart/LegendChartAxis.cpp 2009-05-09 15:17:06 UTC (rev 30678) @@ -64,7 +64,6 @@ LegendChartAxis::_FilterLegends(int32 totalSize, int32 spacing, float BSize::* sizeField) { -printf("LegendChartAxis::_FilterLegends(%ld, %ld)\n", totalSize, spacing); // compute the min/max legend levels int32 legendCount = fLegends.CountItems(); int32 minLevel = INT_MAX; @@ -91,7 +90,6 @@ // preceeding same-level legends. We iterate backwards from the lower to // the higher levels for (int32 level = std::max(minLevel, 0L); level <= maxLevel;) { -printf(" level: %ld\n", level); legendCount = fLegends.CountItems(); // get the first legend position/end @@ -101,12 +99,10 @@ int32 previousEnd = (int32)ceilf(position + info->size.*sizeField); int32 previousLevel = info->legend->Level(); -printf(" first legend: pos: %f, size: %f\n", position, info->size.*sizeField); for (int32 i = 1; (info = fLegends.ItemAt(i)) != NULL; i++) { float position = _LegendPosition(info->value, info->size.*sizeField, (float)totalSize, scale);; -printf(" legend %ld: pos: %f, size: %f\n", i, position, info->size.*sizeField); if (position - spacing < previousEnd && (previousLevel <= level @@ -183,7 +179,6 @@ void LegendChartAxis::SetFrame(BRect frame) { -printf("LegendChartAxis::SetFrame((%f, %f) - (%f, %f))\n", frame.left, frame.top, frame.right, frame.bottom); if (frame != fFrame) { fFrame = frame; _InvalidateLayout(); @@ -245,7 +240,6 @@ void LegendChartAxis::Render(BView* view, BRect updateRect) { -printf("LegendChartAxis::Render()\n"); if (!_ValidateLayout(view)) return; @@ -279,7 +273,6 @@ return; } -printf(" rendering...\n"); float totalSize = floorf(fFrame.Size().*sizeField) + 1; double rangeSize = fRange.max - fRange.min; if (rangeSize == 0) @@ -293,7 +286,6 @@ : fFrame.RightBottom().*otherPointField - kChartRulerDistance; float rulerEnd = fFrame.RightTop().*pointField; float rulerChartDistant = rulerChartClosest + rulerDirection * kRulerSize; -printf(" ruler: (%f, %f) - (%f, %f)\n", rulerStart, rulerChartClosest, rulerEnd, rulerChartDistant); rgb_color black = { 0, 0, 0, 255 }; view->BeginLineArray(3 + fLegends.CountItems()); @@ -319,7 +311,6 @@ second.*pointField = position; second.*otherPointField = rulerChartDistant + rulerDirection * kRulerMarkSize; -printf(" drawing mark at (%f, %f)\n", first.x, first.y); view->AddLine(first, second, black); } view->EndLineArray(); @@ -338,7 +329,6 @@ first.*otherPointField = rulerDirection == 1 ? legendRulerClosest : legendRulerClosest - info->size.*otherSizeField; -printf(" legend %ld: position: (%f, %f), size: (%f, %f)\n", i, first.x, first.y, info->size.width, info->size.height); fLegendRenderer->RenderLegend(info->legend, view, first); } @@ -357,24 +347,18 @@ { if (fLayoutValid) return true; -printf("LegendChartAxis::_ValidateLayout()\n"); fLegends.MakeEmpty(); int32 width = fFrame.IntegerWidth() + 1; int32 height = fFrame.IntegerHeight() + 1; -printf(" width: %ld, height: %ld\n", width, height); // estimate the maximum legend count we might need int32 maxLegends = _EstimateMaxLegendCount(view, fFrame.Size(), &fHorizontalSpacing, &fVerticalSpacing); -printf(" max %ld legends\n", maxLegends); if (maxLegends == 0) -{ -printf(" too small for any legends!\n"); return false; -} // get the legends ChartLegend* legends[maxLegends]; @@ -382,27 +366,20 @@ int32 legendCount = fLegendSource->GetAxisLegends(fRange, legends, values, maxLegends); -printf(" got %ld legends\n", legendCount); if (legendCount == 0) -{ -printf(" got no legends from source!\n"); return false; -} -printf(" range: %f - %f\n", fRange.min, fRange.max); // create legend infos for (int32 i = 0; i < legendCount; i++) { ChartLegend* legend = legends[i]; BSize size = fLegendRenderer->LegendSize(legend, view); LegendInfo* info = new(std::nothrow) LegendInfo(legend, values[i], size); -printf(" legend %ld: size: (%f, %f), value: %f\n", i, size.width, size.height, info->value); if (info == NULL || !fLegends.AddItem(info)) { // TODO: Report error! delete info; for (int32 k = i; k < legendCount; k++) delete legends[k]; -printf(" failed to create legend info!\n"); return false; } } Modified: haiku/trunk/src/apps/debuganalyzer/gui/chart/LineChartRenderer.cpp =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/chart/LineChartRenderer.cpp 2009-05-09 12:39:33 UTC (rev 30677) +++ haiku/trunk/src/apps/debuganalyzer/gui/chart/LineChartRenderer.cpp 2009-05-09 15:17:06 UTC (rev 30678) @@ -192,17 +192,15 @@ // draw view->SetLineMode(B_ROUND_CAP, B_ROUND_JOIN); for (int32 i = 0; DataSourceInfo* info = fDataSources.ItemAt(i); i++) { -printf("LineChartRenderer::Render(): %p\n", info); - + float bottom = fFrame.bottom; BShape shape; shape.MoveTo(BPoint(left + first, bottom - ((info->samples[first] - minRange) * scale))); - + for (int32 i = first; i <= last; i++) { shape.LineTo(BPoint(float(left + i), float(bottom - ((info->samples[i] - minRange) * scale)))); -//printf(" %f: %f (%f)\n", info->samples[i] - minRange, float(bottom - ((info->samples[i] - minRange) * scale)), bottom); } view->SetHighColor(info->config.Color()); view->MovePenTo(B_ORIGIN); From stpere at mail.berlios.de Sat May 9 17:23:04 2009 From: stpere at mail.berlios.de (stpere at mail.berlios.de) Date: Sat, 9 May 2009 17:23:04 +0200 Subject: [Haiku-commits] r30679 - haiku/trunk/src/apps/deskcalc Message-ID: <200905091523.n49FN4FB018618@sheep.berlios.de> Author: stpere Date: 2009-05-09 17:22:52 +0200 (Sat, 09 May 2009) New Revision: 30679 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30679&view=rev Modified: haiku/trunk/src/apps/deskcalc/CalcWindow.cpp Log: Fixed the initial size of the DeskCalc window. For some reason, it was resizing the window to the size of the dragger frame :-) (the frame variable was reused to a different purpose) Fixes ticket #3896 Modified: haiku/trunk/src/apps/deskcalc/CalcWindow.cpp =================================================================== --- haiku/trunk/src/apps/deskcalc/CalcWindow.cpp 2009-05-09 15:17:06 UTC (rev 30678) +++ haiku/trunk/src/apps/deskcalc/CalcWindow.cpp 2009-05-09 15:22:52 UTC (rev 30679) @@ -38,9 +38,10 @@ fCalcView = new CalcView(frame, baseColor, settings); // create replicant dragger - frame.top = frame.bottom - 7.0f; - frame.left = frame.right - 7.0f; - BDragger* dragger = new BDragger(frame, fCalcView, + BRect replicant_frame(frame); + replicant_frame.top = replicant_frame.bottom - 7.0f; + replicant_frame.left = replicant_frame.right - 7.0f; + BDragger* dragger = new BDragger(replicant_frame, fCalcView, B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); // attach views From bonefish at mail.berlios.de Sat May 9 18:09:58 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Sat, 9 May 2009 18:09:58 +0200 Subject: [Haiku-commits] r30680 - haiku/trunk/src/apps/debuganalyzer/gui/thread_window Message-ID: <200905091609.n49G9whl023217@sheep.berlios.de> Author: bonefish Date: 2009-05-09 18:09:57 +0200 (Sat, 09 May 2009) New Revision: 30680 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30680&view=rev Modified: haiku/trunk/src/apps/debuganalyzer/gui/thread_window/ActivityPage.cpp Log: * ThreadActivityData::GetSamples(): - When guessing the initial thread state for an unschedule event also check the previous event, so we can decide whether the thread is still ready. Previously the time to the first schedule event could be accounted incorrectly. - Made the main loop a bit more robust with respect to unexpected thread states. * The check boxes for latency and preemption time were labeled the wrong way around. Modified: haiku/trunk/src/apps/debuganalyzer/gui/thread_window/ActivityPage.cpp =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/thread_window/ActivityPage.cpp 2009-05-09 15:22:52 UTC (rev 30679) +++ haiku/trunk/src/apps/debuganalyzer/gui/thread_window/ActivityPage.cpp 2009-05-09 16:09:57 UTC (rev 30680) @@ -99,10 +99,23 @@ { system_profiler_thread_scheduled* event = (system_profiler_thread_scheduled*)(header + 1); - if (event->thread == threadID) + if (event->thread == threadID) { + // thread scheduled -- it must have been ready before state = READY; - else - state = RUNNING; + } else { + // thread unscheduled -- it was running earlier, but should + // now be "still running" or "running", depending on whether + // it had been added to the run queue before + const system_profiler_event_header* previousHeader + = fModel->SchedulingEventAt(startIndex - 1); + if (previousHeader != NULL + && previousHeader->event + == B_SYSTEM_PROFILER_THREAD_ENQUEUED_IN_RUN_QUEUE) { + state = STILL_RUNNING; + } else + state = RUNNING; + } + previousEventTime = event->time; break; } @@ -154,27 +167,33 @@ // thread scheduled after having been preempted // before timeType = PREEMPTION_TIME; - } - - if (state == STILL_RUNNING) { + } else if (state == STILL_RUNNING) { // Thread was running and continues to run. - state = RUNNING; timeType = RUN_TIME; - } else if (state != RUNNING) { - state = RUNNING; + } else { + // Can only happen, if we're missing context. + // Impossible to guess what the thread was doing + // before. + timeType = UNSPECIFIED_TIME; } + + state = RUNNING; } else { // thread unscheduled if (state == STILL_RUNNING) { // thread preempted state = PREEMPTED; - timeType = RUN_TIME; } else if (state == RUNNING) { // thread starts waiting (it hadn't been added // to the run queue before being unscheduled) state = WAITING; - timeType = RUN_TIME; + } else { + // Can only happen, if we're missing context. + // Obviously the thread was running, but we + // can't guess the new thread state. } + + timeType = RUN_TIME; } break; @@ -248,9 +267,11 @@ timeType = LATENCY_TIME; break; case WAITING: - case UNKNOWN: timeType = WAIT_TIME; break; + case UNKNOWN: + timeType = UNSPECIFIED_TIME; + break; } if (fModel->GetThread()->DeletionTime() >= 0) { @@ -336,11 +357,11 @@ .Add(fWaitTimeCheckBox = new ColorCheckBox("Wait Time", kWaitTimeColor, new BMessage(MSG_CHECK_BOX_WAIT_TIME)), 1, 0) - .Add(fPreemptionTimeCheckBox = new ColorCheckBox("Latency Time", + .Add(fPreemptionTimeCheckBox = new ColorCheckBox("Preemption Time", kPreemptionTimeColor, new BMessage(MSG_CHECK_BOX_PREEMPTION_TIME)), 0, 1) - .Add(fLatencyTimeCheckBox = new ColorCheckBox("Preemption Time", + .Add(fLatencyTimeCheckBox = new ColorCheckBox("Latency Time", kLatencyTimeColor, new BMessage(MSG_CHECK_BOX_LATENCY_TIME)), 1, 1) From bonefish at mail.berlios.de Sat May 9 19:00:47 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Sat, 9 May 2009 19:00:47 +0200 Subject: [Haiku-commits] r30681 - haiku/trunk/src/apps/aboutsystem Message-ID: <200905091700.n49H0lY7018134@sheep.berlios.de> Author: bonefish Date: 2009-05-09 19:00:41 +0200 (Sat, 09 May 2009) New Revision: 30681 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30681&view=rev Modified: haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp Log: Search the license files in the standard user/common/system licenses directories. Modified: haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp =================================================================== --- haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp 2009-05-09 16:09:57 UTC (rev 30680) +++ haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp 2009-05-09 17:00:41 UTC (rev 30681) @@ -100,7 +100,8 @@ void PickRandomHaiku(); private: - status_t _GetLicensesPath(BPath& path); + status_t _GetLicensePath(const char* license, + BPath& path); void _AddCopyrightsFromAttribute(); BStringView* fMemView; @@ -562,12 +563,9 @@ // copyrights for various projects we use - BPath licensesPath; - _GetLicensesPath(licensesPath); + BPath mitPath; + _GetLicensePath("MIT", mitPath); - BPath mitPath(licensesPath); - mitPath.Append("MIT"); - font.SetSize(be_bold_font->Size() + 4); font.SetFace(B_BOLD_FACE); fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuGreen); @@ -1014,9 +1012,6 @@ fCreditsView->Insert(text); fCreditsView->Insert("\n"); - BPath licensesPath; - _GetLicensesPath(licensesPath); - if (licenses.CountLicenses() > 0) { if (licenses.CountLicenses() > 1) fCreditsView->Insert("Licenses: "); @@ -1025,14 +1020,16 @@ for (int32 i = 0; i < licenses.CountLicenses(); i++) { const char* license = licenses.LicenseAt(i); - BString licensePath(licensesPath.Path()); - licensePath << '/' << license; if (i > 0) fCreditsView->Insert(", "); - fCreditsView->InsertHyperText(license, - new OpenFileAction(licensePath)); + BPath licensePath; + if (_GetLicensePath(license, licensePath) == B_OK) { + fCreditsView->InsertHyperText(license, + new OpenFileAction(licensePath.Path())); + } else + fCreditsView->Insert(license); } fCreditsView->Insert("\n"); @@ -1123,13 +1120,27 @@ status_t -AboutView::_GetLicensesPath(BPath& path) +AboutView::_GetLicensePath(const char* license, BPath& path) { - status_t status = find_directory(B_SYSTEM_DATA_DIRECTORY, &path); - if (status != B_OK) - return status; + static const directory_which directoryConstants[] = { + B_USER_DATA_DIRECTORY, + B_COMMON_DATA_DIRECTORY, + B_SYSTEM_DATA_DIRECTORY + }; + static const int dirCount = 3; - return path.Append("licenses"); + for (int i = 0; i < dirCount; i++) { + struct stat st; + status_t error = find_directory(directoryConstants[i], &path); + if (error == B_OK && path.Append("licenses") == B_OK + && path.Append(license) == B_OK + && lstat(path.Path(), &st) == 0) { + return B_OK; + } + } + + path.Unset(); + return B_ENTRY_NOT_FOUND; } From bonefish at mail.berlios.de Sat May 9 20:30:28 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Sat, 9 May 2009 20:30:28 +0200 Subject: [Haiku-commits] r30682 - haiku/trunk/src/apps/debuganalyzer/gui/table Message-ID: <200905091830.n49IUSqa008115@sheep.berlios.de> Author: bonefish Date: 2009-05-09 20:30:20 +0200 (Sat, 09 May 2009) New Revision: 30682 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30682&view=rev Added: haiku/trunk/src/apps/debuganalyzer/gui/table/AbstractTable.cpp haiku/trunk/src/apps/debuganalyzer/gui/table/AbstractTable.h Modified: haiku/trunk/src/apps/debuganalyzer/gui/table/Jamfile haiku/trunk/src/apps/debuganalyzer/gui/table/Table.cpp haiku/trunk/src/apps/debuganalyzer/gui/table/Table.h haiku/trunk/src/apps/debuganalyzer/gui/table/TreeTable.cpp haiku/trunk/src/apps/debuganalyzer/gui/table/TreeTable.h Log: Pulled common base class AbstractTable out of Table and TreeTable. Added: haiku/trunk/src/apps/debuganalyzer/gui/table/AbstractTable.cpp =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/table/AbstractTable.cpp 2009-05-09 17:00:41 UTC (rev 30681) +++ haiku/trunk/src/apps/debuganalyzer/gui/table/AbstractTable.cpp 2009-05-09 18:30:20 UTC (rev 30682) @@ -0,0 +1,70 @@ +/* + * Copyright 2009, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ + +#include "table/AbstractTable.h" + +#include + +#include "table/TableColumn.h" + + +// #pragma mark - AbstractTableModel + + +AbstractTableModel::~AbstractTableModel() +{ +} + + +// #pragma mark - AbstractColumn + + +AbstractTable::AbstractColumn::AbstractColumn(TableColumn* tableColumn) + : + BColumn(tableColumn->Width(), tableColumn->MinWidth(), + tableColumn->MaxWidth(), tableColumn->Alignment()), + fTableColumn(tableColumn) +{ +} + + +AbstractTable::AbstractColumn::~AbstractColumn() +{ + delete fTableColumn; +} + + +// #pragma mark - AbstractTable + + +AbstractTable::AbstractTable(const char* name, uint32 flags, + border_style borderStyle, bool showHorizontalScrollbar) + : + BColumnListView(name, flags, borderStyle, showHorizontalScrollbar), + fColumns(20, true) +{ +} + + +AbstractTable::~AbstractTable() +{ +} + + +void +AbstractTable::AddColumn(TableColumn* column) +{ + if (column == NULL) + return; + + AbstractColumn* privateColumn = CreateColumn(column); + + if (!fColumns.AddItem(privateColumn)) { + delete privateColumn; + throw std::bad_alloc(); + } + + BColumnListView::AddColumn(privateColumn, column->ModelIndex()); +} Added: haiku/trunk/src/apps/debuganalyzer/gui/table/AbstractTable.h =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/table/AbstractTable.h 2009-05-09 17:00:41 UTC (rev 30681) +++ haiku/trunk/src/apps/debuganalyzer/gui/table/AbstractTable.h 2009-05-09 18:30:20 UTC (rev 30682) @@ -0,0 +1,63 @@ +/* + * Copyright 2009, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ +#ifndef ABSTRACT_TABLE_H +#define ABSTRACT_TABLE_H + +#include +#include + + +class TableColumn; + + +class AbstractTableModel { +public: + virtual ~AbstractTableModel(); + + virtual int32 CountColumns() const = 0; +}; + + +class AbstractTable : protected BColumnListView { +public: + AbstractTable(const char* name, uint32 flags, + border_style borderStyle = B_NO_BORDER, + bool showHorizontalScrollbar = true); + virtual ~AbstractTable(); + + BView* ToView() { return this; } + + virtual void AddColumn(TableColumn* column); + +protected: + class AbstractColumn; + + typedef BObjectList ColumnList; + +protected: + virtual AbstractColumn* CreateColumn(TableColumn* column) = 0; + +protected: + ColumnList fColumns; +}; + + +// implementation private + +class AbstractTable::AbstractColumn : public BColumn { +public: + AbstractColumn(TableColumn* tableColumn); + virtual ~AbstractColumn(); + + virtual void SetModel(AbstractTableModel* model) = 0; + + TableColumn* GetTableColumn() const { return fTableColumn; } + +protected: + TableColumn* fTableColumn; +}; + + +#endif // ABSTRACT_TABLE_H Modified: haiku/trunk/src/apps/debuganalyzer/gui/table/Jamfile =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/table/Jamfile 2009-05-09 17:00:41 UTC (rev 30681) +++ haiku/trunk/src/apps/debuganalyzer/gui/table/Jamfile 2009-05-09 18:30:20 UTC (rev 30682) @@ -8,6 +8,7 @@ MergeObject DebugAnalyzer_gui_table.o : + AbstractTable.cpp Table.cpp TableColumn.cpp TableColumns.cpp Modified: haiku/trunk/src/apps/debuganalyzer/gui/table/Table.cpp =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/table/Table.cpp 2009-05-09 17:00:41 UTC (rev 30681) +++ haiku/trunk/src/apps/debuganalyzer/gui/table/Table.cpp 2009-05-09 18:30:20 UTC (rev 30682) @@ -54,13 +54,13 @@ // #pragma mark - Column -class Table::Column : public BColumn { +class Table::Column : public AbstractColumn { public: Column(TableModel* model, TableColumn* tableColumn); virtual ~Column(); - void SetModel(TableModel* model); + virtual void SetModel(AbstractTableModel* model); protected: virtual void DrawTitle(BRect rect, BView* targetView); @@ -74,30 +74,26 @@ private: TableModel* fModel; - TableColumn* fTableColumn; }; Table::Column::Column(TableModel* model, TableColumn* tableColumn) : - BColumn(tableColumn->Width(), tableColumn->MinWidth(), - tableColumn->MaxWidth(), tableColumn->Alignment()), - fModel(model), - fTableColumn(tableColumn) + AbstractColumn(tableColumn), + fModel(model) { } Table::Column::~Column() { - delete fTableColumn; } void -Table::Column::SetModel(TableModel* model) +Table::Column::SetModel(AbstractTableModel* model) { - fModel = model; + fModel = dynamic_cast(model); } @@ -180,7 +176,7 @@ Table::Table(const char* name, uint32 flags, border_style borderStyle, bool showHorizontalScrollbar) : - BColumnListView(name, flags, borderStyle, showHorizontalScrollbar), + AbstractTable(name, flags, borderStyle, showHorizontalScrollbar), fModel(NULL) { } @@ -189,9 +185,8 @@ Table::Table(TableModel* model, const char* name, uint32 flags, border_style borderStyle, bool showHorizontalScrollbar) : - BColumnListView(name, flags, borderStyle, showHorizontalScrollbar), - fModel(NULL), - fColumns(20, true) + AbstractTable(name, flags, borderStyle, showHorizontalScrollbar), + fModel(NULL) { SetTableModel(model); } @@ -213,7 +208,7 @@ if (fModel != NULL) { Clear(); - for (int32 i = 0; Column* column = fColumns.ItemAt(i); i++) + for (int32 i = 0; AbstractColumn* column = fColumns.ItemAt(i); i++) column->SetModel(NULL); } @@ -222,7 +217,7 @@ if (fModel == NULL) return; - for (int32 i = 0; Column* column = fColumns.ItemAt(i); i++) + for (int32 i = 0; AbstractColumn* column = fColumns.ItemAt(i); i++) column->SetModel(fModel); // create the rows @@ -257,23 +252,6 @@ } -void -Table::AddColumn(TableColumn* column) -{ - if (column == NULL) - return; - - Column* privateColumn = new Column(fModel, column); - - if (!fColumns.AddItem(privateColumn)) { - delete privateColumn; - throw std::bad_alloc(); - } - - BColumnListView::AddColumn(privateColumn, column->ModelIndex()); -} - - bool Table::AddTableListener(TableListener* listener) { @@ -288,6 +266,13 @@ } +AbstractTable::AbstractColumn* +Table::CreateColumn(TableColumn* column) +{ + return new Column(fModel, column); +} + + void Table::ItemInvoked() { Modified: haiku/trunk/src/apps/debuganalyzer/gui/table/Table.h =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/table/Table.h 2009-05-09 17:00:41 UTC (rev 30681) +++ haiku/trunk/src/apps/debuganalyzer/gui/table/Table.h 2009-05-09 18:30:20 UTC (rev 30682) @@ -5,10 +5,9 @@ #ifndef TABLE_H #define TABLE_H -#include #include -#include +#include "table/AbstractTable.h" #include "table/TableColumn.h" #include "Variant.h" @@ -17,11 +16,10 @@ class Table; -class TableModel { +class TableModel : public AbstractTableModel { public: virtual ~TableModel(); - virtual int32 CountColumns() const = 0; virtual int32 CountRows() const = 0; virtual bool GetValueAt(int32 rowIndex, int32 columnIndex, @@ -37,7 +35,7 @@ }; -class Table : private BColumnListView { +class Table : public AbstractTable { public: Table(const char* name, uint32 flags, border_style borderStyle = B_NO_BORDER, @@ -48,20 +46,18 @@ bool showHorizontalScrollbar = true); virtual ~Table(); - BView* ToView() { return this; } - void SetTableModel(TableModel* model); TableModel* GetTableModel() const { return fModel; } - void AddColumn(TableColumn* column); - bool AddTableListener(TableListener* listener); void RemoveTableListener(TableListener* listener); +protected: + virtual AbstractColumn* CreateColumn(TableColumn* column); + private: class Column; - typedef BObjectList ColumnList; typedef BObjectList ListenerList; private: @@ -69,7 +65,6 @@ private: TableModel* fModel; - ColumnList fColumns; ListenerList fListeners; }; Modified: haiku/trunk/src/apps/debuganalyzer/gui/table/TreeTable.cpp =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/table/TreeTable.cpp 2009-05-09 17:00:41 UTC (rev 30681) +++ haiku/trunk/src/apps/debuganalyzer/gui/table/TreeTable.cpp 2009-05-09 18:30:20 UTC (rev 30682) @@ -54,13 +54,13 @@ // #pragma mark - Column -class TreeTable::Column : public BColumn { +class TreeTable::Column : public AbstractColumn { public: Column(TreeTableModel* model, TableColumn* tableColumn); virtual ~Column(); - void SetModel(TreeTableModel* model); + virtual void SetModel(AbstractTableModel* model); protected: virtual void DrawTitle(BRect rect, BView* targetView); @@ -74,30 +74,26 @@ private: TreeTableModel* fModel; - TableColumn* fTableColumn; }; TreeTable::Column::Column(TreeTableModel* model, TableColumn* tableColumn) : - BColumn(tableColumn->Width(), tableColumn->MinWidth(), - tableColumn->MaxWidth(), tableColumn->Alignment()), - fModel(model), - fTableColumn(tableColumn) + AbstractColumn(tableColumn), + fModel(model) { } TreeTable::Column::~Column() { - delete fTableColumn; } void -TreeTable::Column::SetModel(TreeTableModel* model) +TreeTable::Column::SetModel(AbstractTableModel* model) { - fModel = model; + fModel = dynamic_cast(model); } @@ -180,7 +176,7 @@ TreeTable::TreeTable(const char* name, uint32 flags, border_style borderStyle, bool showHorizontalScrollbar) : - BColumnListView(name, flags, borderStyle, showHorizontalScrollbar), + AbstractTable(name, flags, borderStyle, showHorizontalScrollbar), fModel(NULL) { } @@ -189,9 +185,8 @@ TreeTable::TreeTable(TreeTableModel* model, const char* name, uint32 flags, border_style borderStyle, bool showHorizontalScrollbar) : - BColumnListView(name, flags, borderStyle, showHorizontalScrollbar), - fModel(NULL), - fColumns(20, true) + AbstractTable(name, flags, borderStyle, showHorizontalScrollbar), + fModel(NULL) { SetTreeTableModel(model); } @@ -213,7 +208,7 @@ if (fModel != NULL) { Clear(); - for (int32 i = 0; Column* column = fColumns.ItemAt(i); i++) + for (int32 i = 0; AbstractColumn* column = fColumns.ItemAt(i); i++) column->SetModel(NULL); } @@ -222,7 +217,7 @@ if (fModel == NULL) return; - for (int32 i = 0; Column* column = fColumns.ItemAt(i); i++) + for (int32 i = 0; AbstractColumn* column = fColumns.ItemAt(i); i++) column->SetModel(fModel); // recursively create the rows @@ -267,23 +262,6 @@ } -void -TreeTable::AddColumn(TableColumn* column) -{ - if (column == NULL) - return; - - Column* privateColumn = new Column(fModel, column); - - if (!fColumns.AddItem(privateColumn)) { - delete privateColumn; - throw std::bad_alloc(); - } - - BColumnListView::AddColumn(privateColumn, column->ModelIndex()); -} - - bool TreeTable::AddTreeTableListener(TreeTableListener* listener) { @@ -298,6 +276,13 @@ } +AbstractTable::AbstractColumn* +TreeTable::CreateColumn(TableColumn* column) +{ + return new Column(fModel, column); +} + + void TreeTable::ItemInvoked() { Modified: haiku/trunk/src/apps/debuganalyzer/gui/table/TreeTable.h =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/table/TreeTable.h 2009-05-09 17:00:41 UTC (rev 30681) +++ haiku/trunk/src/apps/debuganalyzer/gui/table/TreeTable.h 2009-05-09 18:30:20 UTC (rev 30682) @@ -5,10 +5,9 @@ #ifndef TREE_TABLE_H #define TREE_TABLE_H -#include #include -#include +#include "table/AbstractTable.h" #include "table/TableColumn.h" #include "Variant.h" @@ -17,7 +16,7 @@ class TreeTable; -class TreeTableModel { +class TreeTableModel : public AbstractTableModel { public: virtual ~TreeTableModel(); @@ -27,8 +26,6 @@ virtual int32 CountChildren(void* parent) const = 0; virtual void* ChildAt(void* parent, int32 index) const = 0; - virtual int32 CountColumns() const = 0; - virtual bool GetValueAt(void* object, int32 columnIndex, Variant& value) = 0; }; @@ -43,7 +40,7 @@ }; -class TreeTable : private BColumnListView { +class TreeTable : public AbstractTable { public: TreeTable(const char* name, uint32 flags, border_style borderStyle = B_NO_BORDER, @@ -54,22 +51,20 @@ bool showHorizontalScrollbar = true); virtual ~TreeTable(); - BView* ToView() { return this; } - void SetTreeTableModel(TreeTableModel* model); TreeTableModel* GetTreeTableModel() const { return fModel; } - void AddColumn(TableColumn* column); - bool AddTreeTableListener( TreeTableListener* listener); void RemoveTreeTableListener( TreeTableListener* listener); +protected: + virtual AbstractColumn* CreateColumn(TableColumn* column); + private: class Column; - typedef BObjectList ColumnList; typedef BObjectList ListenerList; private: @@ -78,10 +73,8 @@ void _AddChildRows(void* parent, BRow* parentRow, int32 columnCount); - private: TreeTableModel* fModel; - ColumnList fColumns; ListenerList fListeners; }; From bonefish at mail.berlios.de Sat May 9 20:47:22 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Sat, 9 May 2009 20:47:22 +0200 Subject: [Haiku-commits] r30683 - in haiku/trunk: headers/private/interface src/kits/interface Message-ID: <200905091847.n49IlMnh009047@sheep.berlios.de> Author: bonefish Date: 2009-05-09 20:47:19 +0200 (Sat, 09 May 2009) New Revision: 30683 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30683&view=rev Modified: haiku/trunk/headers/private/interface/ColumnListView.h haiku/trunk/src/kits/interface/ColumnListView.cpp Log: * Introduced methods ResizeColumnToPreferred() and ResizeAllColumnsToPreferred(). * Automatic white space cleanup. Modified: haiku/trunk/headers/private/interface/ColumnListView.h =================================================================== --- haiku/trunk/headers/private/interface/ColumnListView.h 2009-05-09 18:30:20 UTC (rev 30682) +++ haiku/trunk/headers/private/interface/ColumnListView.h 2009-05-09 18:47:19 UTC (rev 30683) @@ -96,14 +96,14 @@ B_COLOR_HEADER_TEXT = 9, B_COLOR_SEPARATOR_LINE = 10, B_COLOR_SEPARATOR_BORDER = 11, - + B_COLOR_TOTAL = 12 }; enum ColumnListViewFont { B_FONT_ROW = 0, B_FONT_HEADER = 1, - + B_FONT_TOTAL = 2 }; @@ -144,7 +144,7 @@ BPrivate:: BRowContainer* fChildList; bool fIsExpanded; - float fHeight; + float fHeight; BRow* fNextSelected; BRow* fPrevSelected; BRow* fParent; @@ -166,7 +166,7 @@ float maxWidth, alignment align = B_ALIGN_LEFT); virtual ~BColumn(); - + float Width() const; void SetWidth(float width); float MinWidth() const; @@ -176,7 +176,7 @@ virtual void DrawField(BField* field, BRect rect, BView* targetView); virtual int CompareFields(BField* field1, BField* field2); - + virtual void MouseMoved(BColumnListView* parent, BRow* row, BField* field, BRect fieldRect, BPoint point, uint32 buttons, int32 code); @@ -185,25 +185,25 @@ BPoint point, uint32 buttons); virtual void MouseUp(BColumnListView* parent, BRow* row, BField* field); - + virtual void GetColumnName(BString* into) const; virtual float GetPreferredWidth(BField* field, BView* parent) const; - + bool IsVisible() const; void SetVisible(bool); - + bool WantsEvents() const; void SetWantsEvents(bool); - + bool ShowHeading() const; void SetShowHeading(bool); - + alignment Alignment() const; void SetAlignment(alignment); int32 LogicalFieldNum() const; - + /*! \param field The BField derivative to validate. @@ -219,10 +219,10 @@ logical field index where it occured. \note Do not call the inherited version of this, it just returns - true; + true; */ virtual bool AcceptsField(const BField* field) const; - + private: float fWidth; float fMinWidth; @@ -234,7 +234,7 @@ bool fWantsEvents; bool fShowHeading; alignment fAlignment; - + friend class BPrivate::OutlineView; friend class BColumnListView; friend class BPrivate::TitleView; @@ -265,8 +265,8 @@ void SetFocusRow(int32 index, bool select = false); void SetFocusRow(BRow* row, bool select = false); void SetMouseTrackingEnabled(bool); - - // Selection + + // Selection list_view_type SelectionMode() const; void Deselect(BRow* row); void AddToSelection(BRow* row); @@ -276,7 +276,7 @@ virtual void SetSelectionMessage(BMessage* message); BMessage* SelectionMessage(); uint32 SelectionCommand() const; - void SetSelectionMode(list_view_type type); + void SetSelectionMode(list_view_type type); // list_view_type is defined in ListView.h. // Sorting @@ -290,7 +290,7 @@ void AddStatusView(BView* view); BView* RemoveStatusView(); - // Column Manipulation + // Column Manipulation void AddColumn(BColumn* column, int32 logicalFieldIndex); void MoveColumn(BColumn* column, int32 index); @@ -299,9 +299,11 @@ BColumn* ColumnAt(int32 index) const; void SetColumnVisible(BColumn* column, bool isVisible); - void SetColumnVisible(int32, bool); + void SetColumnVisible(int32, bool); bool IsColumnVisible(int32) const; void SetColumnFlags(column_flags flags); + void ResizeColumnToPreferred(int32 index); + void ResizeAllColumnsToPreferred(); // Row manipulation const BRow* RowAt(int32 index, BRow *parent = 0) const; @@ -316,14 +318,14 @@ void AddRow(BRow* row, BRow* parent = NULL); void AddRow(BRow* row, int32 index, BRow* parent = NULL); - + void ScrollTo(const BRow* Row); void ScrollTo(BPoint point); - + // Does not delete row or children at this time. // todo: Make delete row and children void RemoveRow(BRow* row); - + void UpdateRow(BRow* row); void Clear(); @@ -334,12 +336,12 @@ uint32 mask = B_FONT_ALL); virtual void SetHighColor(rgb_color); void SetSelectionColor(rgb_color); - void SetBackgroundColor(rgb_color); + void SetBackgroundColor(rgb_color); void SetEditColor(rgb_color); const rgb_color SelectionColor() const; const rgb_color BackgroundColor() const; const rgb_color EditColor() const; - + // Appearance (NEW STYLE) void SetColor(ColumnListViewColor colorIndex, rgb_color color); @@ -349,10 +351,10 @@ rgb_color Color(ColumnListViewColor colorIndex) const; void GetFont(ColumnListViewFont fontIndex, BFont* font) const; - + BPoint SuggestTextPosition(const BRow* row, const BColumn* column = NULL) const; - + void SetLatchWidth(float width); float LatchWidth() const; virtual void DrawLatch(BView* view, BRect frame, Modified: haiku/trunk/src/kits/interface/ColumnListView.cpp =================================================================== --- haiku/trunk/src/kits/interface/ColumnListView.cpp 2009-05-09 18:30:20 UTC (rev 30682) +++ haiku/trunk/src/kits/interface/ColumnListView.cpp 2009-05-09 18:47:19 UTC (rev 30683) @@ -219,6 +219,7 @@ virtual ~TitleView(); void ColumnAdded(BColumn* column); + void ColumnResized(BColumn* column, float oldWidth); void SetColumnVisible(BColumn* column, bool visible); virtual void Draw(BRect updateRect); @@ -229,7 +230,7 @@ const BMessage* dragMessage); virtual void MouseUp(BPoint where); virtual void FrameResized(float width, float height); - + void MoveColumn(BColumn* column, int32 index); void SetColumnFlags(column_flags flags); @@ -253,7 +254,7 @@ BList* fSortColumns; float fColumnsWidth; BRect fVisibleRect; - + #if DOUBLE_BUFFERED_COLUMN_RESIZE BBitmap* fDrawBuffer; BView* fDrawBufferView; @@ -281,7 +282,7 @@ float fRightDragBoundry; BPoint fCurrentDragPosition; - + BBitmap* fUpSortArrow; BBitmap* fDownSortArrow; @@ -306,7 +307,7 @@ bool isFirstColumn); void StartSorting(); float GetColumnPreferredWidth(BColumn* column); - + void AddRow(BRow*, int32 index, BRow* TheRow); BRow* CurrentSelection(BRow* lastSelected) const; void ToggleFocusRowSelection(bool selectRange); @@ -388,10 +389,10 @@ ROW_CLICKED, DRAGGING_ROWS }; - + CurrentState fCurrentState; - + BColumnListView* fMasterView; list_view_type fSelectionMode; bool fTrackMouse; @@ -502,9 +503,9 @@ BField* field = (BField*) fFields.RemoveItem(0L); if (field == 0) break; - + delete field; - } + } } @@ -541,14 +542,14 @@ { if (fFields.ItemAt(logicalFieldIndex) != 0) delete (BField*)fFields.RemoveItem(logicalFieldIndex); - + if (NULL != fList) { ValidateField(field, logicalFieldIndex); BRect inv; fList->GetRowRect(this, &inv); fList->Invalidate(inv); } - + fFields.AddItem(field, logicalFieldIndex); } @@ -567,7 +568,7 @@ } -void +void BRow::ValidateFields() const { for (int32 i = 0; i < CountFields(); i++) @@ -575,7 +576,7 @@ } -void +void BRow::ValidateField(const BField* field, int32 logicalFieldIndex) const { // The Fields may be moved by the user, but the logicalFieldIndexes @@ -588,7 +589,7 @@ if( col->LogicalFieldNum() == logicalFieldIndex ) break; } - + if (NULL == col) { BString dbmessage("\n\n\tThe parent BColumnListView does not have " "\n\ta BColumn at the logical field index "); @@ -753,7 +754,7 @@ } -bool +bool BColumn::AcceptsField(const BField*) const { return true; @@ -882,7 +883,7 @@ void BColumnListView::SetMouseTrackingEnabled(bool Enabled) { - fOutlineView->SetMouseTrackingEnabled(Enabled); + fOutlineView->SetMouseTrackingEnabled(Enabled); } @@ -934,7 +935,7 @@ { if (fSelectionMessage == message) return; - + delete fSelectionMessage; fSelectionMessage = message; } @@ -952,7 +953,7 @@ { if (fSelectionMessage) return fSelectionMessage->what; - + return 0; } @@ -993,7 +994,7 @@ fSortColumns.AddItem(column); column->fSortAscending = ascending; - fTitleView->Invalidate(); + fTitleView->Invalidate(); fOutlineView->StartSorting(); } @@ -1028,7 +1029,7 @@ viewRect.OffsetBy(1, -1); else if (fBorderStyle == B_FANCY_BORDER) viewRect.OffsetBy(2, -2); - + view->SetResizingMode(B_FOLLOW_LEFT | B_FOLLOW_BOTTOM); view->ResizeTo(viewRect.Width(), viewRect.Height()); view->MoveTo(viewRect.left, viewRect.top); @@ -1149,11 +1150,43 @@ } +void +BColumnListView::ResizeColumnToPreferred(int32 index) +{ + BColumn* column = ColumnAt(index); + if (column == NULL) + return; + + // get the preferred column width + float width = fOutlineView->GetColumnPreferredWidth(column); + if (width < column->MinWidth()) + width = column->MinWidth(); + else if (width > column->MaxWidth()) + width = column->MaxWidth(); + + // set it + float oldWidth = column->Width(); + column->SetWidth(width); + + fTitleView->ColumnResized(column, oldWidth); + fOutlineView->Invalidate(); +} + + +void +BColumnListView::ResizeAllColumnsToPreferred() +{ + int32 count = CountColumns(); + for (int32 i = 0; i < count; i++) + ResizeColumnToPreferred(i); +} + + const BRow* BColumnListView::RowAt(int32 Index, BRow* parentRow) const { if (parentRow == 0) - return fOutlineView->RowList()->ItemAt(Index); + return fOutlineView->RowList()->ItemAt(Index); return parentRow->fChildList ? parentRow->fChildList->ItemAt(Index) : NULL; } @@ -1163,7 +1196,7 @@ BColumnListView::RowAt(int32 Index, BRow* parentRow) { if (parentRow == 0) - return fOutlineView->RowList()->ItemAt(Index); + return fOutlineView->RowList()->ItemAt(Index); return parentRow->fChildList ? parentRow->fChildList->ItemAt(Index) : 0; } @@ -1212,7 +1245,7 @@ BColumnListView::CountRows(BRow* parentRow) const { if (parentRow == 0) - return fOutlineView->RowList()->CountItems(); + return fOutlineView->RowList()->CountItems(); if (parentRow->fChildList) return parentRow->fChildList->CountItems(); else @@ -1290,14 +1323,14 @@ case B_FONT_ROW: fOutlineView->SetFont(font, mask); break; - + case B_FONT_HEADER: fTitleView->SetFont(font, mask); break; - + default: ASSERT(false); - break; + break; } } @@ -1309,14 +1342,14 @@ case B_FONT_ROW: fOutlineView->GetFont(font); break; - + case B_FONT_HEADER: fTitleView->GetFont(font); break; - + default: ASSERT(false); - break; + break; } } @@ -1327,13 +1360,13 @@ if ((int)color_num < 0) { ASSERT(false); color_num = (ColumnListViewColor) 0; - } - + } + if ((int)color_num >= (int)B_COLOR_TOTAL) { ASSERT(false); color_num = (ColumnListViewColor) (B_COLOR_TOTAL - 1); } - + fColorList[color_num] = color; } @@ -1344,13 +1377,13 @@ if ((int)color_num < 0) { ASSERT(false); color_num = (ColumnListViewColor) 0; - } - + } + if ((int)color_num >= (int)B_COLOR_TOTAL) { ASSERT(false); color_num = (ColumnListViewColor) (B_COLOR_TOTAL - 1); } - + return fColorList[color_num]; } @@ -1421,17 +1454,17 @@ BColumn* column = (BColumn*) fColumns.ItemAt(index); if (!column->IsVisible()) continue; - + if (column == inColumn) { rect.left = leftEdge; rect.right = rect.left + column->Width(); break; } - + leftEdge += column->Width() + 1; } } - + font_height fh; fOutlineView->GetFontHeight(&fh); float baseline = floor(rect.top + fh.ascent @@ -1458,27 +1491,27 @@ BColumnListView::DrawLatch(BView* view, BRect rect, LatchType position, BRow*) { const int32 rectInset = 4; - + view->SetHighColor(0, 0, 0); - + // Make Square int32 sideLen = rect.IntegerWidth(); if (sideLen > rect.IntegerHeight()) sideLen = rect.IntegerHeight(); - + // Make Center int32 halfWidth = rect.IntegerWidth() / 2; int32 halfHeight = rect.IntegerHeight() / 2; int32 halfSide = sideLen / 2; - + float left = rect.left + halfWidth - halfSide; float top = rect.top + halfHeight - halfSide; - + BRect itemRect(left, top, left + sideLen, top + sideLen); - + // Why it is a pixel high? I don't know. itemRect.OffsetBy(0, -1); - + itemRect.InsetBy(rectInset, rectInset); // Make it an odd number of pixels wide, the latch looks better this way @@ -1486,7 +1519,7 @@ itemRect.right += 1; itemRect.bottom += 1; } - + switch (position) { case B_OPEN_LATCH: view->StrokeRect(itemRect); @@ -1496,7 +1529,7 @@ BPoint(itemRect.right - 2, (itemRect.top + itemRect.bottom) / 2)); break; - + case B_PRESSED_LATCH: view->StrokeRect(itemRect); view->StrokeLine( @@ -1511,7 +1544,7 @@ itemRect.bottom - 2)); view->InvertRect(itemRect); break; - + case B_CLOSED_LATCH: view->StrokeRect(itemRect); view->StrokeLine( @@ -1525,7 +1558,7 @@ BPoint((itemRect.left + itemRect.right) / 2, itemRect.bottom - 2)); break; - + case B_NO_LATCH: // No drawing break; @@ -1571,7 +1604,7 @@ { char c = bytes[0]; switch (c) { - case B_RIGHT_ARROW: + case B_RIGHT_ARROW: case B_LEFT_ARROW: { float minVal, maxVal; @@ -1606,7 +1639,7 @@ (modifiers() & B_CONTROL_KEY) == 0, (modifiers() & B_SHIFT_KEY) != 0); break; - + case B_PAGE_UP: case B_PAGE_DOWN: { @@ -1616,26 +1649,26 @@ fVerticalScrollBar->GetSteps(&smallStep, &largeStep); float currentValue = fVerticalScrollBar->Value(); float newValue = currentValue; - + if (c == B_PAGE_UP) newValue -= largeStep; else newValue += largeStep; - + if (newValue > maxValue) newValue = maxValue; else if (newValue < minValue) newValue = minValue; - + fVerticalScrollBar->SetValue(newValue); // Option + pgup or pgdn scrolls and changes the selection. if (modifiers() & B_OPTION_KEY) fOutlineView->MoveFocusToVisibleRect(); - + break; } - + case B_ENTER: Invoke(); break; @@ -1646,7 +1679,7 @@ break; case '+': - fOutlineView->ToggleFocusRowOpen(); + fOutlineView->ToggleFocusRowOpen(); break; default: @@ -1660,8 +1693,8 @@ { if (!Messenger().IsValid()) SetTarget(Window()); - - if (SortingEnabled()) fOutlineView->StartSorting(); + + if (SortingEnabled()) fOutlineView->StartSorting(); } @@ -1718,9 +1751,9 @@ BRect cornerRect(rect.right - B_V_SCROLL_BAR_WIDTH, rect.bottom - B_H_SCROLL_BAR_HEIGHT, rect.right, rect.bottom); if (fBorderStyle == B_PLAIN_BORDER) { - BView::SetHighColor(0, 0, 0); + BView::SetHighColor(0, 0, 0); StrokeRect(rect); - cornerRect.OffsetBy(-1, -1); + cornerRect.OffsetBy(-1, -1); } else if (fBorderStyle == B_FANCY_BORDER) { bool isFocus = IsFocus() && Window()->IsActive(); @@ -1735,12 +1768,12 @@ BView::SetHighColor(184, 184, 184); else BView::SetHighColor(152, 152, 152); - + rect.InsetBy(1,1); StrokeRect(rect); cornerRect.OffsetBy(-2, -2); } - + BView::SetHighColor(ui_color(B_PANEL_BACKGROUND_COLOR)); // fills lower right rect between scroll bars FillRect(cornerRect); @@ -1889,7 +1922,7 @@ fVerticalScrollBar->MoveTo(vScrollBarRect.LeftTop()); fVerticalScrollBar->ResizeTo(vScrollBarRect.Width(), vScrollBarRect.Height()); - + fHorizontalScrollBar->MoveTo(hScrollBarRect.LeftTop()); fHorizontalScrollBar->ResizeTo(hScrollBarRect.Width(), hScrollBarRect.Height()); @@ -2016,7 +2049,7 @@ | B_ALLOW_COLUMN_POPUP | B_ALLOW_COLUMN_REMOVE) { SetViewColor(B_TRANSPARENT_COLOR); - + #if DOUBLE_BUFFERED_COLUMN_RESIZE // xxx this needs to be smart about the size of the backbuffer. BRect doubleBufferRect(0, 0, 600, 35); @@ -2047,7 +2080,7 @@ { delete fColumnPop; fColumnPop = NULL; - + #if DOUBLE_BUFFERED_COLUMN_RESIZE delete fDrawBuffer; #endif @@ -2071,6 +2104,15 @@ void +TitleView::ColumnResized(BColumn* column, float oldWidth) +{ + fColumnsWidth += column->Width() - oldWidth; + FixScrollBar(false); + Invalidate(); +} + + +void TitleView::SetColumnVisible(BColumn* column, bool visible) { if (column->fVisible == visible) @@ -2080,18 +2122,18 @@ // to invalidate. If hiding it, do it last. if (visible) column->fVisible = visible; - + BRect titleInvalid; GetTitleRect(column, &titleInvalid); - // Now really set the visibility + // Now really set the visibility column->fVisible = visible; - + if (visible) fColumnsWidth += column->Width(); else fColumnsWidth -= column->Width(); - + BRect outlineInvalid(fOutlineView->VisibleRect()); outlineInvalid.left = titleInvalid.left; titleInvalid.right = outlineInvalid.right; @@ -2116,7 +2158,7 @@ fVisibleRect.bottom); return; } - + leftEdge += column->Width() + 1; } @@ -2209,11 +2251,11 @@ TitleView::MoveColumn(BColumn* column, int32 index) { fColumns->RemoveItem((void*) column); - + if (-1 == index) { // Re-add the column at the end of the list. fColumns->AddItem((void*) column); - } else { + } else { fColumns->AddItem((void*) column, index); } } @@ -2231,8 +2273,8 @@ { float minWidth = fSelectedColumn->MinWidth(); float maxWidth = fSelectedColumn->MaxWidth(); - - float originalEdge = fSelectedColumnRect.left + fSelectedColumn->Width(); + + float originalEdge = fSelectedColumnRect.left + fSelectedColumn->Width(); if (preferred) { float width = fOutlineView->GetColumnPreferredWidth(fSelectedColumn); if (width < minWidth) @@ -2283,7 +2325,7 @@ fOutlineView->CopyBits(slaveSource, slaveDest); fOutlineView->RedrawColumn(fSelectedColumn, fSelectedColumnRect.left, fResizingFirstColumn); - + fColumnsWidth += dX; // Update the cursor @@ -2291,7 +2333,7 @@ SetViewCursor(fMinResizeCursor, true); else if (fSelectedColumn->Width() == maxWidth) SetViewCursor(fMaxResizeCursor, true); - else + else SetViewCursor(fResizeCursor, true); } } @@ -2302,7 +2344,7 @@ { float previousColumnLeftEdge = -1000000.0; float nextColumnRightEdge = 1000000.0; - + bool foundColumn = false; float leftEdge = MAX(kLeftMargin, fMasterView->LatchWidth()); int32 numColumns = fColumns->CountItems(); @@ -2310,8 +2352,8 @@ BColumn* column = (BColumn*) fColumns->ItemAt(index); if (!column->IsVisible()) continue; - - if (column == findColumn) { + + if (column == findColumn) { foundColumn = true; continue; } @@ -2324,9 +2366,9 @@ leftEdge += column->Width() + 1; } - - float rightEdge = leftEdge + findColumn->Width(); + float rightEdge = leftEdge + findColumn->Width(); + fLeftDragBoundry = MIN(previousColumnLeftEdge + findColumn->Width(), leftEdge); fRightDragBoundry = MAX(nextColumnRightEdge, rightEdge); @@ -2372,10 +2414,10 @@ font_height fh; GetFontHeight(&fh); - + float baseline = floor(drawRect.top + fh.ascent + (drawRect.Height() + 1 - (fh.ascent + fh.descent)) / 2); - + if (be_control_look != NULL) { BRect bgRect = rect; @@ -2399,7 +2441,7 @@ } else { view->SetHighColor(borderColor); - view->StrokeRect(rect); + view->StrokeRect(rect); view->BeginLineArray(4); view->AddLine(BPoint(rect.left + 1, rect.top + 1), BPoint(rect.right - 1, rect.top + 1), bevelHigh); @@ -2408,7 +2450,7 @@ view->AddLine(BPoint(rect.right - 1, rect.top + 1), BPoint(rect.right - 1, rect.bottom - 1), bevelLow); view->AddLine(BPoint(rect.left + 2, rect.bottom-1), - BPoint(rect.right - 1, rect.bottom - 1), bevelLow); + BPoint(rect.right - 1, rect.bottom - 1), bevelLow); view->EndLineArray(); view->SetHighColor(backgroundColor); @@ -2420,7 +2462,7 @@ // If no column given, nothing else to draw. if (!column) return; - + view->SetHighColor(fMasterView->Color(B_COLOR_HEADER_TEXT)); BFont font; @@ -2431,13 +2473,13 @@ if (sortIndex >= 0) { // Draw sort notation. BPoint upperLeft(drawRect.right - kSortIndicatorWidth, baseline); - + if (fSortColumns->CountItems() > 1) { char str[256]; sprintf(str, "%d", sortIndex + 1); const float w = view->StringWidth(str); upperLeft.x -= w; - + view->SetDrawingMode(B_OP_COPY); view->MovePenTo(BPoint(upperLeft.x + kSortIndicatorWidth, baseline)); @@ -2445,13 +2487,13 @@ } float bmh = fDownSortArrow->Bounds().Height()+1; - + view->SetDrawingMode(B_OP_OVER); - + if (column->fSortAscending) { BPoint leftTop(upperLeft.x, drawRect.top + (drawRect.IntegerHeight() - fDownSortArrow->Bounds().IntegerHeight()) / 2); - view->DrawBitmapAsync(fDownSortArrow, leftTop); + view->DrawBitmapAsync(fDownSortArrow, leftTop); } else { BPoint leftTop(upperLeft.x, drawRect.top + (drawRect.IntegerHeight() - fUpSortArrow->Bounds().IntegerHeight()) / 2); @@ -2497,7 +2539,7 @@ if (columnLeftEdge > invalidRect.right) break; - + if (columnLeftEdge + column->Width() >= invalidRect.left) { BRect titleRect(columnLeftEdge, 0, columnLeftEdge + column->Width(), fVisibleRect.Height()); @@ -2524,14 +2566,14 @@ DrawTitle(this, titleRect, NULL, false); } -#if DRAG_TITLE_OUTLINE - // (Internal) Column Drag Indicator +#if DRAG_TITLE_OUTLINE + // (Internal) Column Drag Indicator if (fCurrentState == DRAG_COLUMN_INSIDE_TITLE) { BRect dragRect(fSelectedColumnRect); dragRect.OffsetTo(fCurrentDragPosition.x - fClickPoint.x, 0); if (dragRect.Intersects(invalidRect)) { SetHighColor(0, 0, 255); - StrokeRect(dragRect); + StrokeRect(dragRect); } } #endif @@ -2584,7 +2626,7 @@ { if(fEditMode) return; - + int32 buttons = 1; Window()->CurrentMessage()->FindInt32("buttons", &buttons); if (buttons == B_SECONDARY_MOUSE_BUTTON @@ -2611,7 +2653,7 @@ fColumnPop->Go(ConvertToScreen(position), true, false, sticky, true); return; } - + fResizingFirstColumn = true; float leftEdge = MAX(kLeftMargin, fMasterView->LatchWidth()); for (int index = 0; index < fColumns->CountItems(); index++) { @@ -2623,7 +2665,7 @@ break; // Check for resizing a column - float rightEdge = leftEdge + column->Width(); + float rightEdge = leftEdge + column->Width(); if (column->ShowHeading()) { if (position.x > rightEdge - kColumnResizeAreaWidth / 2 @@ -2650,7 +2692,7 @@ fResizingFirstColumn = false; // Check for clicking on a column. - if (position.x > leftEdge && position.x < rightEdge) { + if (position.x > leftEdge && position.x < rightEdge) { fCurrentState = PRESSING_COLUMN; fSelectedColumn = column; fSelectedColumnRect.Set(leftEdge, 0, rightEdge, @@ -2706,7 +2748,7 @@ fCurrentState = DRAG_COLUMN_OUTSIDE_TITLE; fSelectedColumn->SetVisible(false); BRect dragRect(fSelectedColumnRect); - + // There is a race condition where the mouse may have // moved by the time we get to handle this message. // If the user drags a column very quickly, this @@ -2728,7 +2770,7 @@ break; } - + case DRAG_COLUMN_INSIDE_TITLE: { if (transit == B_EXITED_VIEW && (fColumnFlags & B_ALLOW_COLUMN_REMOVE)) { @@ -2749,7 +2791,7 @@ DragSelectedColumn(position); } -#if DRAG_TITLE_OUTLINE +#if DRAG_TITLE_OUTLINE // Set up the invalid rect to include the rect for the previous // position of the drag rect, as well as the new one. BRect invalidRect(fSelectedColumnRect); @@ -2758,13 +2800,13 @@ invalidRect.left -= fCurrentDragPosition.x - position.x; else [... truncated: 884 lines follow ...] From bonefish at mail.berlios.de Sat May 9 20:48:03 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Sat, 9 May 2009 20:48:03 +0200 Subject: [Haiku-commits] r30684 - haiku/trunk/src/apps/debuganalyzer/gui/table Message-ID: <200905091848.n49Im3VJ009141@sheep.berlios.de> Author: bonefish Date: 2009-05-09 20:48:01 +0200 (Sat, 09 May 2009) New Revision: 30684 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30684&view=rev Modified: haiku/trunk/src/apps/debuganalyzer/gui/table/AbstractTable.cpp haiku/trunk/src/apps/debuganalyzer/gui/table/AbstractTable.h Log: Added ResizeColumnToPreferred() and ResizeAllColumnsToPreferred(). Modified: haiku/trunk/src/apps/debuganalyzer/gui/table/AbstractTable.cpp =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/table/AbstractTable.cpp 2009-05-09 18:47:19 UTC (rev 30683) +++ haiku/trunk/src/apps/debuganalyzer/gui/table/AbstractTable.cpp 2009-05-09 18:48:01 UTC (rev 30684) @@ -68,3 +68,17 @@ BColumnListView::AddColumn(privateColumn, column->ModelIndex()); } + + +void +AbstractTable::ResizeColumnToPreferred(int32 index) +{ + BColumnListView::ResizeColumnToPreferred(index); +} + + +void +AbstractTable::ResizeAllColumnsToPreferred() +{ + BColumnListView::ResizeAllColumnsToPreferred(); +} Modified: haiku/trunk/src/apps/debuganalyzer/gui/table/AbstractTable.h =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/table/AbstractTable.h 2009-05-09 18:47:19 UTC (rev 30683) +++ haiku/trunk/src/apps/debuganalyzer/gui/table/AbstractTable.h 2009-05-09 18:48:01 UTC (rev 30684) @@ -30,6 +30,8 @@ BView* ToView() { return this; } virtual void AddColumn(TableColumn* column); + void ResizeColumnToPreferred(int32 index); + void ResizeAllColumnsToPreferred(); protected: class AbstractColumn; From bonefish at mail.berlios.de Sat May 9 20:48:48 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Sat, 9 May 2009 20:48:48 +0200 Subject: [Haiku-commits] r30685 - in haiku/trunk/src/apps/debuganalyzer/gui: main_window thread_window Message-ID: <200905091848.n49Immg7009172@sheep.berlios.de> Author: bonefish Date: 2009-05-09 20:48:45 +0200 (Sat, 09 May 2009) New Revision: 30685 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30685&view=rev Modified: haiku/trunk/src/apps/debuganalyzer/gui/main_window/TeamsPage.cpp haiku/trunk/src/apps/debuganalyzer/gui/main_window/ThreadsPage.cpp haiku/trunk/src/apps/debuganalyzer/gui/thread_window/WaitObjectsPage.cpp Log: After setting the model resize the table columns to their preferred sizes. Modified: haiku/trunk/src/apps/debuganalyzer/gui/main_window/TeamsPage.cpp =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/main_window/TeamsPage.cpp 2009-05-09 18:48:01 UTC (rev 30684) +++ haiku/trunk/src/apps/debuganalyzer/gui/main_window/TeamsPage.cpp 2009-05-09 18:48:45 UTC (rev 30685) @@ -116,6 +116,7 @@ if (fModel != NULL) { fTeamsTableModel = new(std::nothrow) TeamsTableModel(fModel); fTeamsTable->SetTableModel(fTeamsTableModel); + fTeamsTable->ResizeAllColumnsToPreferred(); } } Modified: haiku/trunk/src/apps/debuganalyzer/gui/main_window/ThreadsPage.cpp =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/main_window/ThreadsPage.cpp 2009-05-09 18:48:01 UTC (rev 30684) +++ haiku/trunk/src/apps/debuganalyzer/gui/main_window/ThreadsPage.cpp 2009-05-09 18:48:45 UTC (rev 30685) @@ -172,6 +172,7 @@ if (fModel != NULL) { fThreadsTableModel = new(std::nothrow) ThreadsTableModel(fModel); fThreadsTable->SetTableModel(fThreadsTableModel); + fThreadsTable->ResizeAllColumnsToPreferred(); } } Modified: haiku/trunk/src/apps/debuganalyzer/gui/thread_window/WaitObjectsPage.cpp =================================================================== --- haiku/trunk/src/apps/debuganalyzer/gui/thread_window/WaitObjectsPage.cpp 2009-05-09 18:48:01 UTC (rev 30684) +++ haiku/trunk/src/apps/debuganalyzer/gui/thread_window/WaitObjectsPage.cpp 2009-05-09 18:48:45 UTC (rev 30685) @@ -182,7 +182,7 @@ private: static Node* _CreateGroupNode(ThreadModel::WaitObjectGroup* group) { - // If the group has only one object, just create an object node. + // If the group has only one object, just create an object node. if (group->CountWaitObjects() == 1) return new ObjectNode(group->WaitObjectAt(0)); @@ -325,6 +325,7 @@ // TODO: Report error! } fWaitObjectsTree->SetTreeTableModel(fWaitObjectsTreeModel); + fWaitObjectsTree->ResizeAllColumnsToPreferred(); } } From kirilla at mail.berlios.de Sat May 9 22:19:58 2009 From: kirilla at mail.berlios.de (kirilla at BerliOS) Date: Sat, 9 May 2009 22:19:58 +0200 Subject: [Haiku-commits] r30686 - haiku/trunk/src/data/beos_mime/application Message-ID: <200905092019.n49KJwQ6017065@sheep.berlios.de> Author: kirilla Date: 2009-05-09 22:19:57 +0200 (Sat, 09 May 2009) New Revision: 30686 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30686&view=rev Added: haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.beshare haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.file haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.finger haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.ftp haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.http haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.https haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.mailto haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.mms haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.news haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.query haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.rsync haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.rtp haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.rtsp haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.sftp haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.ssh haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.telnet Log: Adding URL mime types. An application listing support for such a mime type signals being able to receive such a URL via argv. Each URL mime type is meant to have an application set as the preferred handler. Added: haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.beshare =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.beshare 2009-05-09 18:48:45 UTC (rev 30685) +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.beshare 2009-05-09 20:19:57 UTC (rev 30686) @@ -0,0 +1,7 @@ + +resource(0, "BEOS:TYPE") #'MIMS' "application/x-vnd.Be-meta-mime"; + +resource(1, "META:TYPE") "application/x-vnd.Be.URL.beshare"; + +resource(2, "META:S:DESC") #'MSDC' "BeShare URL"; + Added: haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.file =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.file 2009-05-09 18:48:45 UTC (rev 30685) +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.file 2009-05-09 20:19:57 UTC (rev 30686) @@ -0,0 +1,9 @@ + +resource(0, "BEOS:TYPE") #'MIMS' "application/x-vnd.Be-meta-mime"; + +resource(1, "META:TYPE") "application/x-vnd.Be.URL.file"; + +resource(2, "META:S:DESC") #'MSDC' "File URL"; + +resource(3, "META:L:DESC") #'MLDC' "Local filesystem URL"; + Added: haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.finger =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.finger 2009-05-09 18:48:45 UTC (rev 30685) +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.finger 2009-05-09 20:19:57 UTC (rev 30686) @@ -0,0 +1,6 @@ + +resource(0, "BEOS:TYPE") #'MIMS' "application/x-vnd.Be-meta-mime"; + +resource(1, "META:TYPE") "application/x-vnd.Be.URL.finger"; + +resource(2, "META:S:DESC") #'MSDC' "Finger URL"; Added: haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.ftp =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.ftp 2009-05-09 18:48:45 UTC (rev 30685) +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.ftp 2009-05-09 20:19:57 UTC (rev 30686) @@ -0,0 +1,9 @@ + +resource(0, "BEOS:TYPE") #'MIMS' "application/x-vnd.Be-meta-mime"; + +resource(1, "META:TYPE") "application/x-vnd.Be.URL.ftp"; + +resource(2, "META:S:DESC") #'MSDC' "FTP URL"; + +resource(3, "META:L:DESC") #'MLDC' "File Transfer Protocol URL"; + Added: haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.http =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.http 2009-05-09 18:48:45 UTC (rev 30685) +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.http 2009-05-09 20:19:57 UTC (rev 30686) @@ -0,0 +1,9 @@ + +resource(0, "BEOS:TYPE") #'MIMS' "application/x-vnd.Be-meta-mime"; + +resource(1, "META:TYPE") "application/x-vnd.Be.URL.http"; + +resource(2, "META:S:DESC") #'MSDC' "HTTP URL"; + +resource(3, "META:L:DESC") #'MLDC' "Hypertext Transfer Protocol URL"; + Added: haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.https =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.https 2009-05-09 18:48:45 UTC (rev 30685) +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.https 2009-05-09 20:19:57 UTC (rev 30686) @@ -0,0 +1,9 @@ + +resource(0, "BEOS:TYPE") #'MIMS' "application/x-vnd.Be-meta-mime"; + +resource(1, "META:TYPE") "application/x-vnd.Be.URL.https"; + +resource(2, "META:S:DESC") #'MSDC' "HTTPS URL"; + +resource(3, "META:L:DESC") #'MLDC' "Secure HyperText Transfer Protocol URL"; + Added: haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.mailto =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.mailto 2009-05-09 18:48:45 UTC (rev 30685) +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.mailto 2009-05-09 20:19:57 UTC (rev 30686) @@ -0,0 +1,9 @@ + +resource(0, "BEOS:TYPE") #'MIMS' "application/x-vnd.Be-meta-mime"; + +resource(1, "META:TYPE") "application/x-vnd.Be.URL.mailto"; + +resource(2, "META:S:DESC") #'MSDC' "Mailto URL"; + +resource(3, "META:L:DESC") #'MLDC' "Email Recipient URL"; + Added: haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.mms =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.mms 2009-05-09 18:48:45 UTC (rev 30685) +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.mms 2009-05-09 20:19:57 UTC (rev 30686) @@ -0,0 +1,9 @@ + +resource(0, "BEOS:TYPE") #'MIMS' "application/x-vnd.Be-meta-mime"; + +resource(1, "META:TYPE") "application/x-vnd.Be.URL.mms"; + +resource(2, "META:S:DESC") #'MSDC' "MMS URL"; + +resource(3, "META:L:DESC") #'MLDC' "Microsoft Media Server URL"; + Added: haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.news =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.news 2009-05-09 18:48:45 UTC (rev 30685) +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.news 2009-05-09 20:19:57 UTC (rev 30686) @@ -0,0 +1,9 @@ + +resource(0, "BEOS:TYPE") #'MIMS' "application/x-vnd.Be-meta-mime"; + +resource(1, "META:TYPE") "application/x-vnd.Be.URL.news"; + +resource(2, "META:S:DESC") #'MSDC' "News URL"; + +resource(3, "META:L:DESC") #'MLDC' "Usenet Newsgroup URL"; + Added: haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.query =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.query 2009-05-09 18:48:45 UTC (rev 30685) +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.query 2009-05-09 20:19:57 UTC (rev 30686) @@ -0,0 +1,9 @@ + +resource(0, "BEOS:TYPE") #'MIMS' "application/x-vnd.Be-meta-mime"; + +resource(1, "META:TYPE") "application/x-vnd.Be.URL.query"; + +resource(2, "META:S:DESC") #'MSDC' "Query URL"; + +resource(3, "META:L:DESC") #'MLDC' "Haiku Query URL"; + Added: haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.rsync =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.rsync 2009-05-09 18:48:45 UTC (rev 30685) +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.rsync 2009-05-09 20:19:57 UTC (rev 30686) @@ -0,0 +1,7 @@ + +resource(0, "BEOS:TYPE") #'MIMS' "application/x-vnd.Be-meta-mime"; + +resource(1, "META:TYPE") "application/x-vnd.Be.URL.rsync"; + +resource(2, "META:S:DESC") #'MSDC' "rsync URL"; + Added: haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.rtp =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.rtp 2009-05-09 18:48:45 UTC (rev 30685) +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.rtp 2009-05-09 20:19:57 UTC (rev 30686) @@ -0,0 +1,9 @@ + +resource(0, "BEOS:TYPE") #'MIMS' "application/x-vnd.Be-meta-mime"; + +resource(1, "META:TYPE") "application/x-vnd.Be.URL.rtp"; + +resource(2, "META:S:DESC") #'MSDC' "RTP URL"; + +resource(3, "META:L:DESC") #'MLDC' "Real-time Transport Protocol URL"; + Added: haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.rtsp =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.rtsp 2009-05-09 18:48:45 UTC (rev 30685) +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.rtsp 2009-05-09 20:19:57 UTC (rev 30686) @@ -0,0 +1,9 @@ + +resource(0, "BEOS:TYPE") #'MIMS' "application/x-vnd.Be-meta-mime"; + +resource(1, "META:TYPE") "application/x-vnd.Be.URL.rtsp"; + +resource(2, "META:S:DESC") #'MSDC' "RTSP URL"; + +resource(3, "META:L:DESC") #'MLDC' "Real Time Streaming Protocol URL"; + Added: haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.sftp =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.sftp 2009-05-09 18:48:45 UTC (rev 30685) +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.sftp 2009-05-09 20:19:57 UTC (rev 30686) @@ -0,0 +1,9 @@ + +resource(0, "BEOS:TYPE") #'MIMS' "application/x-vnd.Be-meta-mime"; + +resource(1, "META:TYPE") "application/x-vnd.Be.URL.sftp"; + +resource(2, "META:S:DESC") #'MSDC' "SFTP URL"; + +resource(3, "META:L:DESC") #'MLDC' "SSH File Transfer Protocol URL"; + Added: haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.ssh =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.ssh 2009-05-09 18:48:45 UTC (rev 30685) +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.ssh 2009-05-09 20:19:57 UTC (rev 30686) @@ -0,0 +1,9 @@ + +resource(0, "BEOS:TYPE") #'MIMS' "application/x-vnd.Be-meta-mime"; + +resource(1, "META:TYPE") "application/x-vnd.Be.URL.ssh"; + +resource(2, "META:S:DESC") #'MSDC' "SSH URL"; + +resource(3, "META:L:DESC") #'MLDC' "Secure Shell URL"; + Added: haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.telnet =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.telnet 2009-05-09 18:48:45 UTC (rev 30685) +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.telnet 2009-05-09 20:19:57 UTC (rev 30686) @@ -0,0 +1,9 @@ + +resource(0, "BEOS:TYPE") #'MIMS' "application/x-vnd.Be-meta-mime"; + +resource(1, "META:TYPE") "application/x-vnd.Be.URL.telnet"; + +resource(2, "META:S:DESC") #'MSDC' "Telnet URL"; + +resource(3, "META:L:DESC") #'MLDC' "Telnet URL"; + From jonas at kirilla.com Sat May 9 22:52:44 2009 From: jonas at kirilla.com (Jonas =?iso-8859-1?q?Sundstr=F6m?=) Date: Sat, 09 May 2009 22:52:44 +0200 CEST Subject: [Haiku-commits] r30686 - haiku/trunk/src/data/beos_mime/application In-Reply-To: <200905092019.n49KJwQ6017065@sheep.berlios.de> Message-ID: <8784721694-BeMail@kirilla> kirilla at BerliOS wrote: ... > Log: > Adding URL mime types. ... A keen eye might see that I left out the sh:// URL which I don?t know much about. (Shell? Safe?) /Jonas. From revol at free.fr Sat May 9 23:15:40 2009 From: revol at free.fr (=?utf-8?q?Fran=C3=A7ois?= Revol) Date: Sat, 09 May 2009 23:15:40 +0200 CEST Subject: [Haiku-commits] r30686 - haiku/trunk/src/data/beos_mime/application In-Reply-To: <8784721694-BeMail@kirilla> Message-ID: <22124439679-BeMail@laptop> > kirilla at BerliOS wrote: > ... > > Log: > > Adding URL mime types. > ... > > A keen eye might see that I left out the sh:// > URL which I don?t know much about. (Shell? Safe?) Yeah shell, that's a custom one I added to urlwrapper, which does display a warning before running it. Fran?ois. From stpere at mail.berlios.de Sun May 10 00:48:52 2009 From: stpere at mail.berlios.de (stpere at mail.berlios.de) Date: Sun, 10 May 2009 00:48:52 +0200 Subject: [Haiku-commits] r30687 - haiku/trunk/src/apps/terminal Message-ID: <200905092248.n49MmqBN011852@sheep.berlios.de> Author: stpere Date: 2009-05-10 00:48:22 +0200 (Sun, 10 May 2009) New Revision: 30687 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30687&view=rev Modified: haiku/trunk/src/apps/terminal/TermWindow.cpp haiku/trunk/src/apps/terminal/TermWindow.h Log: This adds a Text Size menu to increase/decrease the size of the font. This follows the enhancement suggestion #3203. Modified: haiku/trunk/src/apps/terminal/TermWindow.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermWindow.cpp 2009-05-09 20:19:57 UTC (rev 30686) +++ haiku/trunk/src/apps/terminal/TermWindow.cpp 2009-05-09 22:48:22 UTC (rev 30687) @@ -206,9 +206,6 @@ // make menu bar _SetupMenu(); - AddShortcut('+', B_COMMAND_KEY, new BMessage(kIncreaseFontSize)); - AddShortcut('-', B_COMMAND_KEY, new BMessage(kDecreaseFontSize)); - // shortcuts to switch tabs for (int32 i = 0; i < 9; i++) { BMessage* message = new BMessage(kSetActiveTab); @@ -300,8 +297,16 @@ fEncodingmenu = new BMenu("Text Encoding"); fEncodingmenu->SetRadioMode(true); MakeEncodingMenu(fEncodingmenu, false); + + fSizeMenu = new BMenu("Text Size"); + fSizeMenu->AddItem(new BMenuItem("Increase", + new BMessage(kIncreaseFontSize), '+', B_COMMAND_KEY)); + fSizeMenu->AddItem(new BMenuItem("Decrease", + new BMessage(kDecreaseFontSize), '-', B_COMMAND_KEY)); + fHelpmenu->AddItem(fWindowSizeMenu); fHelpmenu->AddItem(fEncodingmenu); + fHelpmenu->AddItem(fSizeMenu); fHelpmenu->AddSeparatorItem(); fHelpmenu->AddItem(new BMenuItem("Preferences" B_UTF8_ELLIPSIS, new BMessage(MENU_PREF_OPEN))); Modified: haiku/trunk/src/apps/terminal/TermWindow.h =================================================================== --- haiku/trunk/src/apps/terminal/TermWindow.h 2009-05-09 20:19:57 UTC (rev 30686) +++ haiku/trunk/src/apps/terminal/TermWindow.h 2009-05-09 22:48:22 UTC (rev 30687) @@ -96,6 +96,7 @@ BMenu *fEncodingmenu; BMenu *fHelpmenu; BMenu *fWindowSizeMenu; + BMenu *fSizeMenu; BMessage *fPrintSettings; PrefWindow *fPrefWindow; From stpere at mail.berlios.de Sun May 10 01:46:57 2009 From: stpere at mail.berlios.de (stpere at mail.berlios.de) Date: Sun, 10 May 2009 01:46:57 +0200 Subject: [Haiku-commits] r30688 - haiku/trunk/src/apps/activitymonitor Message-ID: <200905092346.n49Nkvaa013558@sheep.berlios.de> Author: stpere Date: 2009-05-10 01:46:44 +0200 (Sun, 10 May 2009) New Revision: 30688 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30688&view=rev Modified: haiku/trunk/src/apps/activitymonitor/ActivityWindow.cpp Log: When adding a new view in Activity Monitor, make sure the new view use the same refresh interval as the already existing views, to avoid having different refresh intervals active in the monitor. Modified: haiku/trunk/src/apps/activitymonitor/ActivityWindow.cpp =================================================================== --- haiku/trunk/src/apps/activitymonitor/ActivityWindow.cpp 2009-05-09 22:48:22 UTC (rev 30687) +++ haiku/trunk/src/apps/activitymonitor/ActivityWindow.cpp 2009-05-09 23:46:44 UTC (rev 30688) @@ -332,8 +332,11 @@ void ActivityWindow::_AddDefaultView() { - ActivityView* view = new ActivityView("ActivityMonitor", NULL); + BMessage settings; + settings.AddInt64("refresh interval", RefreshInterval()); + ActivityView* view = new ActivityView("ActivityMonitor", &settings); + switch (ActivityViewCount()) { case 0: // The first view defaults to memory usage From stpere at mail.berlios.de Sun May 10 06:04:19 2009 From: stpere at mail.berlios.de (stpere at mail.berlios.de) Date: Sun, 10 May 2009 06:04:19 +0200 Subject: [Haiku-commits] r30689 - haiku/trunk/src/kits/interface Message-ID: <200905100404.n4A44Ju6011426@sheep.berlios.de> Author: stpere Date: 2009-05-10 06:04:06 +0200 (Sun, 10 May 2009) New Revision: 30689 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30689&view=rev Modified: haiku/trunk/src/kits/interface/ListView.cpp Log: Make ScrollToSelection() use "Contains" rather than an "Intersects" to determine if it should scroll. This make the end key work (trigger the scroll) if the last item is overlapping the bottom boundary. This fixes bug #1820. Modified: haiku/trunk/src/kits/interface/ListView.cpp =================================================================== --- haiku/trunk/src/kits/interface/ListView.cpp 2009-05-09 23:46:44 UTC (rev 30688) +++ haiku/trunk/src/kits/interface/ListView.cpp 2009-05-10 04:04:06 UTC (rev 30689) @@ -880,7 +880,7 @@ { BRect itemFrame = ItemFrame(CurrentSelection(0)); - if (Bounds().Intersects(itemFrame.InsetByCopy(0.0f, 2.0f))) + if (Bounds().Contains(itemFrame)) return; if (itemFrame.top < Bounds().top) From stippi at mail.berlios.de Sun May 10 11:00:20 2009 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 10 May 2009 11:00:20 +0200 Subject: [Haiku-commits] r30690 - haiku/trunk/src/add-ons/disk_systems/intel Message-ID: <200905100900.n4A90KlY020872@sheep.berlios.de> Author: stippi Date: 2009-05-10 11:00:19 +0200 (Sun, 10 May 2009) New Revision: 30690 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30690&view=rev Modified: haiku/trunk/src/add-ons/disk_systems/intel/ExtendedPartitionAddOn.cpp haiku/trunk/src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp Log: Added optional tracing facilities. Modified: haiku/trunk/src/add-ons/disk_systems/intel/ExtendedPartitionAddOn.cpp =================================================================== --- haiku/trunk/src/add-ons/disk_systems/intel/ExtendedPartitionAddOn.cpp 2009-05-10 04:04:06 UTC (rev 30689) +++ haiku/trunk/src/add-ons/disk_systems/intel/ExtendedPartitionAddOn.cpp 2009-05-10 09:00:19 UTC (rev 30690) @@ -5,10 +5,9 @@ #include "ExtendedPartitionAddOn.h" +#include #include -#include - #include #include #include @@ -17,7 +16,15 @@ #include "IntelDiskSystem.h" +//#define TRACE_EXTENDED_PARTITION_ADD_ON +#undef TRACE +#ifdef TRACE_EXTENDED_PARTITION_ADD_ON +# define TRACE(x...) printf(x) +#else +# define TRACE(x...) do {} while (false) +#endif + using std::nothrow; @@ -244,6 +251,9 @@ ExtendedPartitionHandle::GetNextSupportedType(const BMutablePartition* child, int32* cookie, BString* type) { + TRACE("%p->ExtendedPartitionHandle::GetNextSupportedType(child: %p, " + "cookie: %ld)\n", this, child, *cookie); + if (*cookie != 0) return B_ENTRY_NOT_FOUND; *cookie = *cookie + 1; Modified: haiku/trunk/src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp =================================================================== --- haiku/trunk/src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp 2009-05-10 04:04:06 UTC (rev 30689) +++ haiku/trunk/src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp 2009-05-10 09:00:19 UTC (rev 30690) @@ -6,6 +6,7 @@ #include "PartitionMapAddOn.h" #include +#include #include #include @@ -16,6 +17,15 @@ #include "IntelDiskSystem.h" +//#define TRACE_PARTITION_MAP_ADD_ON +#undef TRACE +#ifdef TRACE_PARTITION_MAP_ADD_ON +# define TRACE(x...) printf(x) +#else +# define TRACE(x...) do {} while (false) +#endif + + using std::nothrow; @@ -251,6 +261,8 @@ PartitionMapHandle::GetNextSupportedType(const BMutablePartition* child, int32* cookie, BString* type) { + TRACE("%p->PartitionMapHandle::GetNextSupportedType(child: %p, " + "cookie: %ld)\n", this, child, *cookie); // TODO: What are we supposed to do with the child? // we support creating two types, primary and extended From stippi at mail.berlios.de Sun May 10 11:02:13 2009 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 10 May 2009 11:02:13 +0200 Subject: [Haiku-commits] r30691 - haiku/trunk/src/add-ons/kernel/partitioning_systems/intel Message-ID: <200905100902.n4A92DH9021203@sheep.berlios.de> Author: stippi Date: 2009-05-10 11:02:13 +0200 (Sun, 10 May 2009) New Revision: 30691 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30691&view=rev Modified: haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/PartitionLocker.cpp Log: Whitespace cleanup. Modified: haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/PartitionLocker.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/PartitionLocker.cpp 2009-05-10 09:00:19 UTC (rev 30690) +++ haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/PartitionLocker.cpp 2009-05-10 09:02:13 UTC (rev 30691) @@ -14,7 +14,7 @@ PartitionLocker::PartitionLocker(partition_id partitionID) : fDevice(NULL), fPartitionID(partitionID) -{ +{ } // destructor From stippi at mail.berlios.de Sun May 10 11:07:21 2009 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 10 May 2009 11:07:21 +0200 Subject: [Haiku-commits] r30692 - in haiku/trunk: headers/private src/add-ons Message-ID: <200905100907.n4A97LrK022061@sheep.berlios.de> Author: stippi Date: 2009-05-10 11:07:21 +0200 (Sun, 10 May 2009) New Revision: 30692 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30692&view=rev Removed: haiku/trunk/headers/private/disk_scanner/ haiku/trunk/src/add-ons/disk_scanner/ Log: Removed this old code left-overs. I've looked through everything and AFAIKT, every code has been moved to and adopted in the new Disk Device API backend. From stippi at mail.berlios.de Sun May 10 11:12:50 2009 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 10 May 2009 11:12:50 +0200 Subject: [Haiku-commits] r30693 - haiku/trunk/src/kits/storage/disk_device Message-ID: <200905100912.n4A9Co71023016@sheep.berlios.de> Author: stippi Date: 2009-05-10 11:12:49 +0200 (Sun, 10 May 2009) New Revision: 30693 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30693&view=rev Modified: haiku/trunk/src/kits/storage/disk_device/DiskDevice.cpp haiku/trunk/src/kits/storage/disk_device/Partition.cpp haiku/trunk/src/kits/storage/disk_device/PartitionDelegate.cpp Log: Added tracing facilities and more tracing in some error code paths. Modified: haiku/trunk/src/kits/storage/disk_device/DiskDevice.cpp =================================================================== --- haiku/trunk/src/kits/storage/disk_device/DiskDevice.cpp 2009-05-10 09:07:21 UTC (rev 30692) +++ haiku/trunk/src/kits/storage/disk_device/DiskDevice.cpp 2009-05-10 09:12:49 UTC (rev 30693) @@ -29,6 +29,15 @@ #include "DiskSystemAddOnManager.h" +//#define TRACE_DISK_DEVICE +#undef TRACE +#ifdef TRACE_DISK_DEVICE +# define TRACE(x...) printf(x) +#else +# define TRACE(x...) do {} while (false) +#endif + + /*! \class BDiskDevice \brief A BDiskDevice object represents a storage device. */ @@ -241,17 +250,25 @@ status_t BDiskDevice::PrepareModifications() { + TRACE("%p->BDiskDevice::PrepareModifications()\n", this); + // check initialization status_t error = InitCheck(); - if (error != B_OK) + if (error != B_OK) { + TRACE(" InitCheck() failed\n"); return error; - if (fDelegate) + } + if (fDelegate) { + TRACE(" already prepared!\n"); return B_BAD_VALUE; + } // make sure the disk system add-ons are loaded error = DiskSystemAddOnManager::Default()->LoadDiskSystems(); - if (error != B_OK) + if (error != B_OK) { + TRACE(" failed to load disk systems\n"); return error; + } // recursively create the delegates error = _CreateDelegates(); @@ -259,9 +276,12 @@ // init them if (error == B_OK) error = _InitDelegates(); + else + TRACE(" failed to create delegates\n"); // delete all of them, if something went wrong if (error != B_OK) { + TRACE(" failed to init delegates\n"); _DeleteDelegates(); DiskSystemAddOnManager::Default()->UnloadDiskSystems(); } Modified: haiku/trunk/src/kits/storage/disk_device/Partition.cpp =================================================================== --- haiku/trunk/src/kits/storage/disk_device/Partition.cpp 2009-05-10 09:07:21 UTC (rev 30692) +++ haiku/trunk/src/kits/storage/disk_device/Partition.cpp 2009-05-10 09:12:49 UTC (rev 30693) @@ -30,6 +30,15 @@ #include "PartitionDelegate.h" +//#define TRACE_PARTITION +#undef TRACE +#ifdef TRACE_PARTITION +# define TRACE(x...) printf(x) +#else +# define TRACE(x...) do {} while (false) +#endif + + using std::nothrow; @@ -1103,9 +1112,14 @@ status_t BPartition::GetNextSupportedType(int32 *cookie, BString* type) const { + TRACE("%p->BPartition::GetNextSupportedType(%ld)\n", this, *cookie); + BPartition* parent = Parent(); - if (!parent || !fDelegate) + if (!parent || !fDelegate) { + TRACE(" not prepared (parent: %p, fDelegate: %p)!\n", parent, + fDelegate); return B_NO_INIT; + } return parent->fDelegate->GetNextSupportedChildType(fDelegate, cookie, type); @@ -1116,8 +1130,12 @@ status_t BPartition::GetNextSupportedChildType(int32 *cookie, BString* type) const { - if (!fDelegate) + TRACE("%p->BPartition::GetNextSupportedChildType(%ld)\n", this, *cookie); + + if (!fDelegate) { + TRACE(" not prepared!\n"); return B_NO_INIT; + } return fDelegate->GetNextSupportedChildType(NULL, cookie, type); } Modified: haiku/trunk/src/kits/storage/disk_device/PartitionDelegate.cpp =================================================================== --- haiku/trunk/src/kits/storage/disk_device/PartitionDelegate.cpp 2009-05-10 09:07:21 UTC (rev 30692) +++ haiku/trunk/src/kits/storage/disk_device/PartitionDelegate.cpp 2009-05-10 09:12:49 UTC (rev 30693) @@ -5,14 +5,20 @@ #include "PartitionDelegate.h" +#include + #include #include "DiskSystemAddOnManager.h" +//#define TRACE_PARTITION_DELEGATE #undef TRACE -#define TRACE(format...) -//#define TRACE(format...) printf(format) +#ifdef TRACE_PARTITION_DELEGATE +# define TRACE(x...) printf(x) +#else +# define TRACE(x...) do {} while (false) +#endif // constructor @@ -61,24 +67,28 @@ status_t BPartition::Delegate::InitAfterHierarchy() { - if (!fMutablePartition.ContentType()) + TRACE("%p->BPartition::Delegate::InitAfterHierarchy()\n", this); + + if (!fMutablePartition.ContentType()) { + TRACE(" no content type\n"); return B_OK; + } // init disk system and handle DiskSystemAddOnManager* manager = DiskSystemAddOnManager::Default(); BDiskSystemAddOn* addOn = manager->GetAddOn( fMutablePartition.ContentType()); if (!addOn) { - TRACE("BPartition::Delegate::InitAfterHierarchy(): add-on for disk " - "system \"%s\" not found\n", fMutablePartition.ContentType()); + TRACE(" add-on for disk system \"%s\" not found\n", + fMutablePartition.ContentType()); return B_OK; } BPartitionHandle* handle; status_t error = addOn->CreatePartitionHandle(&fMutablePartition, &handle); if (error != B_OK) { - TRACE("BPartition::Delegate::InitAfterHierarchy(): Failed to create " - "partition handle for partition %ld, disk system: \"%s\": %s\n", + TRACE(" failed to create partition handle for partition %ld, disk " + "system: \"%s\": %s\n", Partition()->ID(), addOn->Name(), strerror(error)); manager->PutAddOn(addOn); return error; @@ -379,8 +389,13 @@ BPartition::Delegate::GetNextSupportedChildType(Delegate* child, int32 *cookie, BString* type) const { - if (!fPartitionHandle) + TRACE("%p->BPartition::Delegate::GetNextSupportedChildType(child: %p, " + "cookie: %ld)\n", this, child, *cookie); + + if (!fPartitionHandle) { + TRACE(" no partition handle!\n"); return B_NO_INIT; + } return fPartitionHandle->GetNextSupportedType( child ? &child->fMutablePartition : NULL, cookie, type); From stippi at mail.berlios.de Sun May 10 11:13:44 2009 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 10 May 2009 11:13:44 +0200 Subject: [Haiku-commits] r30694 - haiku/trunk/src/add-ons/kernel/busses Message-ID: <200905100913.n4A9DiXw023275@sheep.berlios.de> Author: stippi Date: 2009-05-10 11:13:44 +0200 (Sun, 10 May 2009) New Revision: 30694 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30694&view=rev Modified: haiku/trunk/src/add-ons/kernel/busses/Jamfile Log: Fixed indentation Modified: haiku/trunk/src/add-ons/kernel/busses/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/Jamfile 2009-05-10 09:12:49 UTC (rev 30693) +++ haiku/trunk/src/add-ons/kernel/busses/Jamfile 2009-05-10 09:13:44 UTC (rev 30694) @@ -2,9 +2,9 @@ # HACK: remove this when the old ide code is removed! if $(HAIKU_ATA_STACK) = 1 { -SubInclude HAIKU_TOP src add-ons kernel busses ata ; + SubInclude HAIKU_TOP src add-ons kernel busses ata ; } else { -SubInclude HAIKU_TOP src add-ons kernel busses ide ; + SubInclude HAIKU_TOP src add-ons kernel busses ide ; } SubInclude HAIKU_TOP src add-ons kernel busses agp_gart ; From stippi at mail.berlios.de Sun May 10 11:22:36 2009 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 10 May 2009 11:22:36 +0200 Subject: [Haiku-commits] r30695 - in haiku/trunk: build/jam src/add-ons/kernel/busses/ata/generic_ide_pci src/add-ons/kernel/busses/ata/ide_isa src/add-ons/kernel/busses/ata/it8211 src/add-ons/kernel/busses/ata/legacy_sata src/add-ons/kernel/busses/ata/promise_tx2 src/add-ons/kernel/busses/ata/silicon_image_3112 src/system/kernel/device_manager Message-ID: <200905100922.n4A9MalK024569@sheep.berlios.de> Author: stippi Date: 2009-05-10 11:22:35 +0200 (Sun, 10 May 2009) New Revision: 30695 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30695&view=rev Modified: haiku/trunk/build/jam/HaikuImage haiku/trunk/src/add-ons/kernel/busses/ata/generic_ide_pci/generic_ide_pci.c haiku/trunk/src/add-ons/kernel/busses/ata/ide_isa/ide_isa.c haiku/trunk/src/add-ons/kernel/busses/ata/it8211/it8211.c haiku/trunk/src/add-ons/kernel/busses/ata/legacy_sata/legacy_sata.c haiku/trunk/src/add-ons/kernel/busses/ata/promise_tx2/promise_tx2.c haiku/trunk/src/add-ons/kernel/busses/ata/silicon_image_3112/silicon_image_3112.c haiku/trunk/src/system/kernel/device_manager/device_manager.cpp Log: * Change the drivers that use the ATA stack (ata_adapter) to publish themselves in busses/ata instead of busses/ide. * Re-introduce Francois change to install these drivers in busses/ata when building with HAIKU_ATA_STACK = 1. * Adopted the device manager to look for drivers in busses/ata additionally to busses/ide. This change works fine with a clean installation on a computer where I can (and indeed have to) use the new ATA stack. Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2009-05-10 09:13:44 UTC (rev 30694) +++ haiku/trunk/build/jam/HaikuImage 2009-05-10 09:22:35 UTC (rev 30695) @@ -165,8 +165,17 @@ : $(SYSTEM_ADD_ONS_BUS_MANAGERS) ; AddFilesToHaikuImage system add-ons kernel busses agp_gart : $(X86_ONLY)intel ; -AddFilesToHaikuImage system add-ons kernel busses ide - : generic_ide_pci it8211 legacy_sata silicon_image_3112 $(X86_ONLY)ide_isa ; + +if $(HAIKU_ATA_STACK) = 1 { + AddFilesToHaikuImage system add-ons kernel busses ata + : generic_ide_pci it8211 legacy_sata silicon_image_3112 + $(X86_ONLY)ide_isa ; +} else { + AddFilesToHaikuImage system add-ons kernel busses ide + : generic_ide_pci it8211 legacy_sata silicon_image_3112 + $(X86_ONLY)ide_isa ; +} + AddFilesToHaikuImage system add-ons kernel busses scsi : ahci ; AddFilesToHaikuImage system add-ons kernel busses usb Modified: haiku/trunk/src/add-ons/kernel/busses/ata/generic_ide_pci/generic_ide_pci.c =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/ata/generic_ide_pci/generic_ide_pci.c 2009-05-10 09:13:44 UTC (rev 30694) +++ haiku/trunk/src/add-ons/kernel/busses/ata/generic_ide_pci/generic_ide_pci.c 2009-05-10 09:22:35 UTC (rev 30695) @@ -11,8 +11,8 @@ #include -#define GENERIC_IDE_PCI_CONTROLLER_MODULE_NAME "busses/ide/generic_ide_pci/driver_v1" -#define GENERIC_IDE_PCI_CHANNEL_MODULE_NAME "busses/ide/generic_ide_pci/channel/v1" +#define GENERIC_IDE_PCI_CONTROLLER_MODULE_NAME "busses/ata/generic_ide_pci/driver_v1" +#define GENERIC_IDE_PCI_CHANNEL_MODULE_NAME "busses/ata/generic_ide_pci/channel/v1" #define IDE_PCI_CONTROLLER_TYPE_NAME "ide pci controller" Modified: haiku/trunk/src/add-ons/kernel/busses/ata/ide_isa/ide_isa.c =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/ata/ide_isa/ide_isa.c 2009-05-10 09:13:44 UTC (rev 30694) +++ haiku/trunk/src/add-ons/kernel/busses/ata/ide_isa/ide_isa.c 2009-05-10 09:22:35 UTC (rev 30695) @@ -30,7 +30,7 @@ #endif -#define IDE_ISA_MODULE_NAME "busses/ide/ide_isa/driver_v1" +#define IDE_ISA_MODULE_NAME "busses/ata/ide_isa/driver_v1" // private node item: // io address of command block Modified: haiku/trunk/src/add-ons/kernel/busses/ata/it8211/it8211.c =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/ata/it8211/it8211.c 2009-05-10 09:13:44 UTC (rev 30694) +++ haiku/trunk/src/add-ons/kernel/busses/ata/it8211/it8211.c 2009-05-10 09:22:35 UTC (rev 30695) @@ -8,8 +8,8 @@ #include -#define IT8211_CONTROLLER_MODULE_NAME "busses/ide/it8211/driver_v1" -#define IT8211_CHANNEL_MODULE_NAME "busses/ide/it8211/channel/v1" +#define IT8211_CONTROLLER_MODULE_NAME "busses/ata/it8211/driver_v1" +#define IT8211_CHANNEL_MODULE_NAME "busses/ata/it8211/channel/v1" #define PCI_VENDOR_ITE 0x1283 #define PCI_DEVICE_ITE_IT8211 0x8211 Modified: haiku/trunk/src/add-ons/kernel/busses/ata/legacy_sata/legacy_sata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/ata/legacy_sata/legacy_sata.c 2009-05-10 09:13:44 UTC (rev 30694) +++ haiku/trunk/src/add-ons/kernel/busses/ata/legacy_sata/legacy_sata.c 2009-05-10 09:22:35 UTC (rev 30695) @@ -13,7 +13,7 @@ #define DRIVER_PRETTY_NAME "Legacy SATA" #define CONTROLLER_NAME DRIVER_PRETTY_NAME -#define CONTROLLER_MODULE_NAME "busses/ide/legacy_sata/driver_v1" +#define CONTROLLER_MODULE_NAME "busses/ata/legacy_sata/driver_v1" #define CHANNEL_MODULE_NAME "busses/ide/legacy_sata/channel/v1" #define TRACE(a...) dprintf(DRIVER_PRETTY_NAME ": " a) Modified: haiku/trunk/src/add-ons/kernel/busses/ata/promise_tx2/promise_tx2.c =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/ata/promise_tx2/promise_tx2.c 2009-05-10 09:13:44 UTC (rev 30694) +++ haiku/trunk/src/add-ons/kernel/busses/ata/promise_tx2/promise_tx2.c 2009-05-10 09:22:35 UTC (rev 30695) @@ -21,8 +21,8 @@ #include "wrapper.h" -#define PROMISE_TX2_CONTROLLER_MODULE_NAME "busses/ide/promise_tx2/device_v1" -#define PROMISE_TX2_CHANNEL_MODULE_NAME "busses/ide/promise_tx2/channel/v1" +#define PROMISE_TX2_CONTROLLER_MODULE_NAME "busses/ata/promise_tx2/device_v1" +#define PROMISE_TX2_CHANNEL_MODULE_NAME "busses/ata/promise_tx2/channel/v1" static ide_for_controller_interface *ide; Modified: haiku/trunk/src/add-ons/kernel/busses/ata/silicon_image_3112/silicon_image_3112.c =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/ata/silicon_image_3112/silicon_image_3112.c 2009-05-10 09:13:44 UTC (rev 30694) +++ haiku/trunk/src/add-ons/kernel/busses/ata/silicon_image_3112/silicon_image_3112.c 2009-05-10 09:22:35 UTC (rev 30695) @@ -19,8 +19,8 @@ #define DRIVER_PRETTY_NAME "Silicon Image SATA" #define CONTROLLER_NAME DRIVER_PRETTY_NAME -#define CONTROLLER_MODULE_NAME "busses/ide/silicon_image_3112/driver_v1" -#define CHANNEL_MODULE_NAME "busses/ide/silicon_image_3112/channel/v1" +#define CONTROLLER_MODULE_NAME "busses/ata/silicon_image_3112/driver_v1" +#define CHANNEL_MODULE_NAME "busses/ata/silicon_image_3112/channel/v1" enum asic_type { ASIC_SI3112 = 0, @@ -765,7 +765,7 @@ command = *channel->bm_command_reg; *channel->bm_command_reg = command & ~IDE_BM_COMMAND_START_STOP; - + channel->dma_active = false; *channel->bm_status_reg = status | IDE_BM_STATUS_ERROR; @@ -774,7 +774,7 @@ if ((status & IDE_BM_STATUS_ACTIVE) != 0) { TRACE("dma_finish: buffer too large\n"); return B_DEV_DATA_OVERRUN; - } + } if ((status & IDE_BM_STATUS_ERROR) != 0) { FLOW("dma_finish: failed\n"); return B_ERROR; Modified: haiku/trunk/src/system/kernel/device_manager/device_manager.cpp =================================================================== --- haiku/trunk/src/system/kernel/device_manager/device_manager.cpp 2009-05-10 09:13:44 UTC (rev 30694) +++ haiku/trunk/src/system/kernel/device_manager/device_manager.cpp 2009-05-10 09:22:35 UTC (rev 30695) @@ -1521,11 +1521,13 @@ _AddPath(*stack, "busses", "scsi"); break; case PCI_ide: + _AddPath(*stack, "busses", "ata"); _AddPath(*stack, "busses", "ide"); break; case PCI_sata: // TODO: check for ahci interface _AddPath(*stack, "busses", "scsi"); + _AddPath(*stack, "busses", "ata"); _AddPath(*stack, "busses", "ide"); break; default: From stippi at mail.berlios.de Sun May 10 13:21:27 2009 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sun, 10 May 2009 13:21:27 +0200 Subject: [Haiku-commits] r30696 - haiku/trunk/src/apps/deskcalc Message-ID: <200905101121.n4ABLRvg019117@sheep.berlios.de> Author: stippi Date: 2009-05-10 13:21:24 +0200 (Sun, 10 May 2009) New Revision: 30696 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30696&view=rev Modified: haiku/trunk/src/apps/deskcalc/CalcWindow.cpp Log: Fixed small coding style violations. Modified: haiku/trunk/src/apps/deskcalc/CalcWindow.cpp =================================================================== --- haiku/trunk/src/apps/deskcalc/CalcWindow.cpp 2009-05-10 09:22:35 UTC (rev 30695) +++ haiku/trunk/src/apps/deskcalc/CalcWindow.cpp 2009-05-10 11:21:24 UTC (rev 30696) @@ -38,10 +38,10 @@ fCalcView = new CalcView(frame, baseColor, settings); // create replicant dragger - BRect replicant_frame(frame); - replicant_frame.top = replicant_frame.bottom - 7.0f; - replicant_frame.left = replicant_frame.right - 7.0f; - BDragger* dragger = new BDragger(replicant_frame, fCalcView, + BRect replicantFrame(frame); + replicantFrame.top = replicantFrame.bottom - 7.0f; + replicantFrame.left = replicantFrame.right - 7.0f; + BDragger* dragger = new BDragger(replicantFrame, fCalcView, B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); // attach views From stippi at mail.berlios.de Sun May 10 13:26:04 2009 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sun, 10 May 2009 13:26:04 +0200 Subject: [Haiku-commits] r30697 - haiku/trunk/src/apps/deskcalc Message-ID: <200905101126.n4ABQ4La024271@sheep.berlios.de> Author: stippi Date: 2009-05-10 13:26:03 +0200 (Sun, 10 May 2009) New Revision: 30697 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30697&view=rev Modified: haiku/trunk/src/apps/deskcalc/CalcView.cpp Log: * Repurposed the calculator icon. The icon only shows when the keypad is hidden, so someone using it to trigger evaluation is highly unlikely, since he can just press return/enter. But when DeskCalc is embedded into the Desktop, it is convenient to clear the text view. (Clicking anywhere in DeskCalc already gives the text view focus.) * Automatic whitespace cleanup. Modified: haiku/trunk/src/apps/deskcalc/CalcView.cpp =================================================================== --- haiku/trunk/src/apps/deskcalc/CalcView.cpp 2009-05-10 11:21:24 UTC (rev 30696) +++ haiku/trunk/src/apps/deskcalc/CalcView.cpp 2009-05-10 11:26:03 UTC (rev 30697) @@ -82,7 +82,7 @@ CalcView *CalcView::Instantiate(BMessage *archive) { if (!validate_instantiation(archive, "CalcView")) - return NULL; + return NULL; return new CalcView(archive); } @@ -130,7 +130,7 @@ // parse calculator description _ParseCalcDesc(fKeypadDescription); - + // colorize based on base color. _Colorize(); @@ -182,7 +182,7 @@ _LoadSettings(archive); // replicant means size and window limit dont need changes fShowKeypad = fOptions->show_keypad; - + // create pop-up menu system _CreatePopUpMenu(); @@ -225,28 +225,28 @@ // act on posted message type switch (message->what) { - + // handle "cut" case B_CUT: Cut(); break; - + // handle copy case B_COPY: Copy(); break; - + // handle paste case B_PASTE: // access system clipboard - if (be_clipboard->Lock()) { + if (be_clipboard->Lock()) { BMessage *clipper = be_clipboard->Data(); //clipper->PrintToStream(); Paste(clipper); - be_clipboard->Unlock(); + be_clipboard->Unlock(); } break; - + // (replicant) about box requested case B_ABOUT_REQUESTED: AboutRequested(); @@ -342,10 +342,10 @@ updateRect, fBaseColor, flags); } else { BeginLineArray(8); - + rgb_color lightShadow = tint_color(fBaseColor, B_DARKEN_1_TINT); rgb_color darkShadow = tint_color(fBaseColor, B_DARKEN_3_TINT); - + AddLine(BPoint(expressionRect.left, expressionRect.bottom), BPoint(expressionRect.left, expressionRect.top), lightShadow); @@ -358,7 +358,7 @@ AddLine(BPoint(expressionRect.left + 1, expressionRect.bottom), BPoint(expressionRect.right - 1, expressionRect.bottom), fLightColor); - + expressionRect.InsetBy(1, 1); AddLine(BPoint(expressionRect.left, expressionRect.bottom), BPoint(expressionRect.left, expressionRect.top), @@ -372,7 +372,7 @@ AddLine(BPoint(expressionRect.left + 1, expressionRect.bottom), BPoint(expressionRect.right - 1, expressionRect.bottom), fBaseColor); - + EndLineArray(); } } @@ -441,10 +441,10 @@ // paint keypad b/g SetHighColor(fBaseColor); FillRect(updateRect & keypadRect); - + // render key main grid BeginLineArray(((fColums + fRows) << 1) + 1); - + // render cols AddLine(BPoint(0.0, sizeDisp), BPoint(0.0, fHeight), @@ -460,7 +460,7 @@ AddLine(BPoint(fColums * sizeCol, sizeDisp), BPoint(fColums * sizeCol, fHeight), fDarkColor); - + // render rows for (int row = 0; row < fRows; row++) { AddLine(BPoint(0.0, sizeDisp + row * sizeRow - 1.0), @@ -473,10 +473,10 @@ AddLine(BPoint(0.0, sizeDisp + fRows * sizeRow), BPoint(fWidth, sizeDisp + fRows * sizeRow), fDarkColor); - + // main grid complete EndLineArray(); - + // render key symbols float halfSizeCol = sizeCol * 0.5f; SetHighColor(fButtonTextColor); @@ -502,8 +502,11 @@ CalcView::MouseDown(BPoint point) { // ensure this view is the current focus - if (!IsFocus()) + if (!fExpressionTextView->IsFocus()) { + // Call our version of MakeFocus(), since that will also apply the + // num_lock setting. MakeFocus(); + } // read mouse buttons state int32 buttons = 0; @@ -513,8 +516,9 @@ if ((B_PRIMARY_MOUSE_BUTTON & buttons) == 0) { BMenuItem* selected; if ((selected = fPopUpMenu->Go(ConvertToScreen(point))) != NULL - && selected->Message() != NULL) - MessageReceived(selected->Message()); + && selected->Message() != NULL) { + Window()->PostMessage(selected->Message(), this); + } return; } @@ -524,7 +528,7 @@ bounds.left = bounds.right - fCalcIcon->Bounds().Width(); if (bounds.Contains(point)) { // user clicked on calculator icon - fExpressionTextView->ApplyChanges(); + fExpressionTextView->Clear(); } } return; @@ -534,15 +538,15 @@ float sizeDisp = fHeight * kDisplayScaleY; float sizeCol = fWidth / (float)fColums; float sizeRow = (fHeight - sizeDisp) / (float)fRows; - + // calculate location within grid int gridCol = (int)floorf(point.x / sizeCol); int gridRow = (int)floorf((point.y - sizeDisp) / sizeRow); - + // check limits if ((gridCol >= 0) && (gridCol < fColums) && (gridRow >= 0) && (gridRow < fRows)) { - + // process key press int key = gridRow * fColums + gridCol; _FlashKey(key, FLAGS_MOUSE_DOWN); @@ -557,6 +561,9 @@ void CalcView::MouseUp(BPoint point) { + if (!fShowKeypad) + return; + int keys = fRows * fColums; for (int i = 0; i < keys; i++) { if (fKeypad[i].flags & FLAGS_MOUSE_DOWN) { @@ -571,41 +578,41 @@ CalcView::KeyDown(const char *bytes, int32 numBytes) { // if single byte character... - if (numBytes == 1) { - + if (numBytes == 1) { + //printf("Key pressed: %c\n", bytes[0]); - + switch (bytes[0]) { - + case B_ENTER: // translate to evaluate key _PressKey("="); break; - + case B_LEFT_ARROW: case B_BACKSPACE: // translate to backspace key _PressKey("BS"); break; - + case B_SPACE: case B_ESCAPE: case 'c': // translate to clear key _PressKey("C"); break; - + // bracket translation case '[': case '{': _PressKey("("); break; - + case ']': case '}': _PressKey(")"); break; - + default: { // scan the keymap array for match int keys = fRows * fColums; @@ -628,8 +635,8 @@ if (focused) { // set num lock if (fOptions->auto_num_lock) { - set_keyboard_locks(B_NUM_LOCK | - (modifiers() & (B_CAPS_LOCK | B_SCROLL_LOCK))); + set_keyboard_locks(B_NUM_LOCK + | (modifiers() & (B_CAPS_LOCK | B_SCROLL_LOCK))); } } @@ -732,16 +739,16 @@ expression.String(), expression.Length()); //clipper->PrintToStream(); - be_clipboard->Commit(); - be_clipboard->Unlock(); + be_clipboard->Commit(); + be_clipboard->Unlock(); } } - + void CalcView::Paste(BMessage *message) { - // handle color drops first + // handle color drops first // read incoming color const rgb_color* dropColor = NULL; ssize_t dataSize; @@ -750,14 +757,14 @@ (const void**)&dropColor, &dataSize) == B_OK && dataSize == sizeof(rgb_color)) { - + // calculate view relative drop point BPoint dropPoint = ConvertFromScreen(message->DropPoint()); - + // calculate current keypad area float sizeDisp = fHeight * kDisplayScaleY; BRect keypadRect(0.0, sizeDisp, fWidth, fHeight); - + // check location of color drop if (keypadRect.Contains(dropPoint) && dropColor) { fBaseColor = *dropColor; @@ -802,7 +809,7 @@ fColums = 5; if (archive->FindInt16("rows", &fRows) < B_OK) fRows = 4; - + // read color scheme const rgb_color* color; ssize_t size; @@ -814,7 +821,7 @@ } else { fBaseColor = *color; } - + if (archive->FindData("rgbDisplay", B_RGB_COLOR_TYPE, (const void**)&color, &size) < B_OK || size != sizeof(rgb_color)) { @@ -823,7 +830,7 @@ } else { fExpressionBGColor = *color; } - + // load options fOptions->LoadSettings(archive); @@ -841,7 +848,7 @@ // parse calculator description _ParseCalcDesc(fKeypadDescription); - + // colorize based on base color. _Colorize(); @@ -859,7 +866,7 @@ ret = archive->AddInt16("cols", fColums); if (ret == B_OK) ret = archive->AddInt16("rows", fRows); - + // record color scheme if (ret == B_OK) ret = archive->AddData("rgbBaseColor", B_RGB_COLOR_TYPE, @@ -967,7 +974,7 @@ // will forward the respective KeyDown event to us fExpressionTextView->AddKeypadLabel(key->label); - // advance + // advance while (isspace(*p)) ++p; key++; @@ -1026,6 +1033,9 @@ void CalcView::_FlashKey(int32 key, uint32 flashFlags) { + if (!fShowKeypad) + return; + if (flashFlags != 0) fKeypad[key].flags |= flashFlags; else @@ -1065,7 +1075,7 @@ fLightColor.green = (uint8)(fBaseColor.green * 1.25); fLightColor.blue = (uint8)(fBaseColor.blue * 1.25); fLightColor.alpha = 255; - + fDarkColor.red = (uint8)(fBaseColor.red * 0.75); fDarkColor.green = (uint8)(fBaseColor.green * 0.75); fDarkColor.blue = (uint8)(fBaseColor.blue * 0.75); @@ -1167,7 +1177,7 @@ } } - + void CalcView::_FetchAppIcon(BBitmap* into) { From axeld at pinc-software.de Sun May 10 13:37:43 2009 From: axeld at pinc-software.de (=?ISO-8859-1?Q?Axel_D=F6rfler?=) Date: Sun, 10 May 2009 13:37:43 +0200 Subject: [Haiku-commits] r30679 - haiku/trunk/src/apps/deskcalc In-Reply-To: <200905091523.n49FN4FB018618@sheep.berlios.de> References: <200905091523.n49FN4FB018618@sheep.berlios.de> Message-ID: <4A06BC87.20608@pinc-software.de> stpere at mail.berlios.de wrote: > + BRect replicant_frame(frame); > + replicant_frame.top = replicant_frame.bottom - 7.0f; > + replicant_frame.left = replicant_frame.right - 7.0f; I guess you have looked at our coding style guide before, but we still use upper caps as word delimiter in variables, not underscores; the name here would be replicantFrame. Bye, Axel. From zooey at mail.berlios.de Sun May 10 15:09:43 2009 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Sun, 10 May 2009 15:09:43 +0200 Subject: [Haiku-commits] r30698 - haiku/trunk/src/kits/interface Message-ID: <200905101309.n4AD9hHB027941@sheep.berlios.de> Author: zooey Date: 2009-05-10 15:09:41 +0200 (Sun, 10 May 2009) New Revision: 30698 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30698&view=rev Modified: haiku/trunk/src/kits/interface/TextView.cpp Log: Fixed two bug(let)s in BTextView that I encountered when working on the Keymap preflet: * obscure the cursor only if the textview has the focus * initiate a drag not only if the cursor has moved to another index, but also when the cursor has moved more than three pixels, since otherwise it was impossible to drag the first character to the left or top of the view (as the corresponding index was always zero) Modified: haiku/trunk/src/kits/interface/TextView.cpp =================================================================== --- haiku/trunk/src/kits/interface/TextView.cpp 2009-05-10 11:26:03 UTC (rev 30697) +++ haiku/trunk/src/kits/interface/TextView.cpp 2009-05-10 13:09:41 UTC (rev 30698) @@ -117,6 +117,7 @@ int32 clickOffset; bool shiftDown; BRect selectionRect; + BPoint where; int32 anchor; int32 selStart; @@ -552,6 +553,7 @@ fTrackingMouse->clickOffset = OffsetAt(where); fTrackingMouse->shiftDown = modifiers & B_SHIFT_KEY; + fTrackingMouse->where = where; bigtime_t clickTime = system_time(); bigtime_t clickSpeed = 0; @@ -738,7 +740,8 @@ } // hide the cursor and caret - be_app->ObscureCursor(); + if (IsFocus()) + be_app->ObscureCursor(); _HideCaret(); switch (keyPressed) { @@ -4458,8 +4461,11 @@ int32 currentOffset = OffsetAt(where); if (fTrackingMouse->selectionRect.IsValid()) { // we are tracking the mouse for drag action, if the mouse has moved - // from where it was clicked, we initiate a drag now: - if (currentOffset != fTrackingMouse->clickOffset) { + // to another index or more than three pixels from where it was clicked, + // we initiate a drag now: + if (currentOffset != fTrackingMouse->clickOffset + || fabs(fTrackingMouse->where.x - where.x) > 3 + || fabs(fTrackingMouse->where.y - where.y) > 3) { _StopMouseTracking(); _InitiateDrag(); return true; @@ -5126,7 +5132,8 @@ _HideCaret(); - be_app->ObscureCursor(); + if (IsFocus()) + be_app->ObscureCursor(); // If we find the "be:confirmed" boolean (and the boolean is true), // it means it's over for now, so the current InlineInput object From zooey at mail.berlios.de Sun May 10 15:47:54 2009 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Sun, 10 May 2009 15:47:54 +0200 Subject: [Haiku-commits] r30699 - haiku/trunk/src/preferences/keymap Message-ID: <200905101347.n4ADlsNk032556@sheep.berlios.de> Author: zooey Date: 2009-05-10 15:47:54 +0200 (Sun, 10 May 2009) New Revision: 30699 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30699&view=rev Modified: haiku/trunk/src/preferences/keymap/KeyboardLayoutView.cpp haiku/trunk/src/preferences/keymap/KeyboardLayoutView.h haiku/trunk/src/preferences/keymap/Keymap.cpp haiku/trunk/src/preferences/keymap/Keymap.h Log: * dead keys can now be enabled/disabled via middle mouse button * fDragKey must be reset in MouseUp() as otherwise it is not possible to drag a key from one keymap to the textview and then from the textview to the same key of another keymap * _HandleDeadKey() now ignores modifier keys as otherwise dead keys that required pressing a modifier (like the tilde on the German keyboard) failed to highlight the resulting characters What's still missing is a way to edit the resulting characters for each dead key, but I am not yet sure how to do that in an elegant way Modified: haiku/trunk/src/preferences/keymap/KeyboardLayoutView.cpp =================================================================== --- haiku/trunk/src/preferences/keymap/KeyboardLayoutView.cpp 2009-05-10 13:09:41 UTC (rev 30698) +++ haiku/trunk/src/preferences/keymap/KeyboardLayoutView.cpp 2009-05-10 13:47:54 UTC (rev 30699) @@ -33,6 +33,7 @@ fEditable(true), fModifiers(0), fDeadKey(0), + fButtons(0), fDragKey(NULL), fDropTarget(NULL), fOldSize(0, 0) @@ -139,25 +140,45 @@ if (key == NULL) return; - if (fKeymap != NULL && fKeymap->IsModifierKey(key->code)) { - if (_KeyState(key->code)) { - uint32 modifier = fKeymap->Modifier(key->code); - if ((modifier & modifiers()) == 0) { - _SetKeyState(key->code, false); - fModifiers &= ~modifier; + int32 buttons = 0; + if (Looper() != NULL && Looper()->CurrentMessage() != NULL) + Looper()->CurrentMessage()->FindInt32("buttons", &buttons); + + if ((buttons & B_TERTIARY_MOUSE_BUTTON) != 0 + && (fButtons & B_TERTIARY_MOUSE_BUTTON) == 0) { + // toggle the "deadness" of dead keys via middle mouse button + if (fKeymap != NULL) { + bool isEnabled = false; + uint8 deadKey + = fKeymap->IsDeadKey(key->code, fModifiers, &isEnabled); + if (deadKey > 0) { + fKeymap->SetDeadKeyEnabled(key->code, fModifiers, !isEnabled); + _InvalidateKey(key); + } + } + } else { + if (fKeymap != NULL && fKeymap->IsModifierKey(key->code)) { + if (_KeyState(key->code)) { + uint32 modifier = fKeymap->Modifier(key->code); + if ((modifier & modifiers()) == 0) { + _SetKeyState(key->code, false); + fModifiers &= ~modifier; + Invalidate(); + } + } else { + _SetKeyState(key->code, true); + fModifiers |= fKeymap->Modifier(key->code); Invalidate(); } + + // TODO: if possible, we could handle the lock keys for real } else { _SetKeyState(key->code, true); - fModifiers |= fKeymap->Modifier(key->code); - Invalidate(); + _InvalidateKey(key); } + } - // TODO: if possible, we could handle the lock keys for real - } else { - _SetKeyState(key->code, true); - _InvalidateKey(key); - } + fButtons = buttons; } @@ -165,23 +186,38 @@ KeyboardLayoutView::MouseUp(BPoint point) { Key* key = _KeyAt(fClickPoint); + + int32 buttons = 0; + if (Looper() != NULL && Looper()->CurrentMessage() != NULL) + Looper()->CurrentMessage()->FindInt32("buttons", &buttons); + if (key != NULL) { - // modifier keys are sticky when used with the mouse - if (fKeymap != NULL && fKeymap->IsModifierKey(key->code)) - return; + if ((fButtons & B_TERTIARY_MOUSE_BUTTON) != 0 + && (buttons & B_TERTIARY_MOUSE_BUTTON) == 0) { + _SetKeyState(key->code, false); + _InvalidateKey(key); + fButtons = buttons; + } else { + fButtons = buttons; - _SetKeyState(key->code, false); + // modifier keys are sticky when used with the mouse + if (fKeymap != NULL && fKeymap->IsModifierKey(key->code)) + return; - if (_HandleDeadKey(key->code, fModifiers) && fDeadKey != 0) - return; + _SetKeyState(key->code, false); - _InvalidateKey(key); + if (_HandleDeadKey(key->code, fModifiers) && fDeadKey != 0) + return; - if (fDragKey == NULL && fKeymap != NULL) { - // Send fake key down message to target - _SendFakeKeyDown(key); + _InvalidateKey(key); + + if (fDragKey == NULL && fKeymap != NULL) { + // Send fake key down message to target + _SendFakeKeyDown(key); + } } } + fDragKey = NULL; } @@ -192,6 +228,10 @@ if (fKeymap == NULL) return; + // rule out dragging for tertiary mouse button + if ((fButtons & B_TERTIARY_MOUSE_BUTTON) != 0) + return; + if (dragMessage != NULL) { if (fEditable) { _InvalidateKey(fDropTarget); @@ -202,7 +242,7 @@ return; } - + int32 buttons; if (Window()->CurrentMessage() == NULL || Window()->CurrentMessage()->FindInt32("buttons", &buttons) != B_OK @@ -515,7 +555,7 @@ { be_control_look->DrawButtonFrame(view, rect, updateRect, base, background, pressed ? BControlLook::B_ACTIVATED : 0); - be_control_look->DrawButtonBackground(view, rect, updateRect, + be_control_look->DrawButtonBackground(view, rect, updateRect, base, pressed ? BControlLook::B_ACTIVATED : 0); } @@ -529,11 +569,12 @@ key_kind keyKind = kNormalKey; int32 deadKey = 0; bool secondDeadKey = false; + bool isDeadKeyEnabled = true; char text[32]; if (fKeymap != NULL) { _GetKeyLabel(key, text, sizeof(text), keyKind); - deadKey = fKeymap->IsDeadKey(key->code, fModifiers); + deadKey = fKeymap->IsDeadKey(key->code, fModifiers, &isDeadKeyEnabled); secondDeadKey = fKeymap->IsDeadSecondKey(key->code, fModifiers, fDeadKey); } else { @@ -545,7 +586,7 @@ if (secondDeadKey) base = kSecondDeadKeyColor; - else if (deadKey > 0) + else if (deadKey > 0 && isDeadKeyEnabled) base = kDeadKeyColor; if (key->shape == kRectangleKeyShape) { @@ -641,7 +682,7 @@ be_control_look->DrawButtonFrame(view, rect, updateRect, base, background, BControlLook::B_DISABLED); - be_control_look->DrawButtonBackground(view, rect, updateRect, + be_control_look->DrawButtonBackground(view, rect, updateRect, base, BControlLook::B_DISABLED); } @@ -857,14 +898,17 @@ bool KeyboardLayoutView::_HandleDeadKey(uint32 key, int32 modifiers) { - if (fKeymap == NULL) + if (fKeymap == NULL || fKeymap->IsModifierKey(key)) return false; - int32 deadKey = fKeymap->IsDeadKey(key, modifiers); + bool isEnabled = false; + int32 deadKey = fKeymap->IsDeadKey(key, modifiers, &isEnabled); if (fDeadKey != deadKey) { - Invalidate(); - fDeadKey = deadKey; - return true; + if (isEnabled) { + Invalidate(); + fDeadKey = deadKey; + return true; + } } else if (fDeadKey != 0) { Invalidate(); fDeadKey = 0; Modified: haiku/trunk/src/preferences/keymap/KeyboardLayoutView.h =================================================================== --- haiku/trunk/src/preferences/keymap/KeyboardLayoutView.h 2009-05-10 13:09:41 UTC (rev 30698) +++ haiku/trunk/src/preferences/keymap/KeyboardLayoutView.h 2009-05-10 13:47:54 UTC (rev 30699) @@ -97,6 +97,7 @@ uint8 fKeyState[16]; int32 fModifiers; int32 fDeadKey; + int32 fButtons; BPoint fClickPoint; Key* fDragKey; Modified: haiku/trunk/src/preferences/keymap/Keymap.cpp =================================================================== --- haiku/trunk/src/preferences/keymap/Keymap.cpp 2009-05-10 13:09:41 UTC (rev 30698) +++ haiku/trunk/src/preferences/keymap/Keymap.cpp 2009-05-10 13:47:54 UTC (rev 30699) @@ -351,57 +351,28 @@ } -//! Checks whether a key is a dead key. +/*! Checks whether a key is a dead key. + If it is, the enabled/disabled state of that dead key will be passed + out via isEnabled (isEnabled is not touched for non-dead keys). +*/ uint8 -Keymap::IsDeadKey(uint32 keyCode, uint32 modifiers) +Keymap::IsDeadKey(uint32 keyCode, uint32 modifiers, bool* isEnabled) { - if (fChars == NULL) - return 0; - uint32 tableMask = 0; int32 offset = _Offset(keyCode, modifiers, &tableMask); - if (offset <= 0) - return 0; + uint8 deadKeyIndex = _GetDeadKeyIndex(offset); + if (deadKeyIndex > 0 && isEnabled != NULL) { + uint32 deadTables[] = { + fKeys.acute_tables, + fKeys.grave_tables, + fKeys.circumflex_tables, + fKeys.dieresis_tables, + fKeys.tilde_tables + }; + *isEnabled = (deadTables[deadKeyIndex - 1] & tableMask) != 0; + } - uint32 numBytes = fChars[offset]; - if (!numBytes) - return 0; - - char chars[4]; - strncpy(chars, &fChars[offset + 1], numBytes); - chars[numBytes] = 0; - - int32 deadOffsets[] = { - fKeys.acute_dead_key[1], - fKeys.grave_dead_key[1], - fKeys.circumflex_dead_key[1], - fKeys.dieresis_dead_key[1], - fKeys.tilde_dead_key[1] - }; - - uint32 deadTables[] = { - fKeys.acute_tables, - fKeys.grave_tables, - fKeys.circumflex_tables, - fKeys.dieresis_tables, - fKeys.tilde_tables - }; - - for (int32 i = 0; i < 5; i++) { - if ((deadTables[i] & tableMask) == 0) - continue; - - if (offset == deadOffsets[i]) - return i + 1; - - uint32 deadNumBytes = fChars[deadOffsets[i]]; - if (!deadNumBytes) - continue; - - if (strncmp(chars, &fChars[deadOffsets[i] + 1], deadNumBytes) == 0) - return i + 1; - } - return 0; + return deadKeyIndex; } @@ -448,6 +419,33 @@ } +//! Enables/disables the "deadness" of the given keycode/modifier combo. +void +Keymap::SetDeadKeyEnabled(uint32 keyCode, uint32 modifiers, bool enabled) +{ + uint32 tableMask = 0; + int32 offset = _Offset(keyCode, modifiers, &tableMask); + uint8 deadKeyIndex = _GetDeadKeyIndex(offset); + if (deadKeyIndex > 0) { + uint32* deadTables[] = { + &fKeys.acute_tables, + &fKeys.grave_tables, + &fKeys.circumflex_tables, + &fKeys.dieresis_tables, + &fKeys.tilde_tables + }; + + if (enabled) + (*deadTables[deadKeyIndex - 1]) |= tableMask; + else + (*deadTables[deadKeyIndex - 1]) &= ~tableMask; + + if (fModificationMessage != NULL) + fTarget.SendMessage(fModificationMessage); + } +} + + //! Get the char for a key given modifiers and active dead key void Keymap::GetChars(uint32 keyCode, uint32 modifiers, uint8 activeDeadKey, @@ -693,3 +691,46 @@ return offset; } + + +uint8 +Keymap::_GetDeadKeyIndex(int32 offset) +{ + if (fChars == NULL || offset <= 0) + return 0; + + uint32 numBytes = fChars[offset]; + if (!numBytes) + return 0; + + char chars[4]; + strncpy(chars, &fChars[offset + 1], numBytes); + chars[numBytes] = 0; + + int32 deadOffsets[] = { + fKeys.acute_dead_key[1], + fKeys.grave_dead_key[1], + fKeys.circumflex_dead_key[1], + fKeys.dieresis_dead_key[1], + fKeys.tilde_dead_key[1] + }; + + uint8 result = 0; + for (int32 i = 0; i < 5; i++) { + if (offset == deadOffsets[i]) { + result = i + 1; + break; + } + + uint32 deadNumBytes = fChars[deadOffsets[i]]; + if (!deadNumBytes) + continue; + + if (strncmp(chars, &fChars[deadOffsets[i] + 1], deadNumBytes) == 0) { + result = i + 1; + break; + } + } + + return result; +} Modified: haiku/trunk/src/preferences/keymap/Keymap.h =================================================================== --- haiku/trunk/src/preferences/keymap/Keymap.h 2009-05-10 13:09:41 UTC (rev 30698) +++ haiku/trunk/src/preferences/keymap/Keymap.h 2009-05-10 13:47:54 UTC (rev 30699) @@ -33,9 +33,12 @@ uint32 KeyForModifier(uint32 modifier); status_t SetModifier(uint32 keyCode, uint32 modifier); - uint8 IsDeadKey(uint32 keyCode, uint32 modifiers); + uint8 IsDeadKey(uint32 keyCode, uint32 modifiers, + bool* isEnabled = NULL); bool IsDeadSecondKey(uint32 keyCode, uint32 modifiers, uint8 activeDeadKey); + void SetDeadKeyEnabled(uint32 keyCode, uint32 modifiers, + bool enabled); void GetChars(uint32 keyCode, uint32 modifiers, uint8 activeDeadKey, char** chars, int32* numBytes); @@ -54,6 +57,7 @@ private: int32 _Offset(uint32 keyCode, uint32 modifiers, uint32* _table = NULL); + uint8 _GetDeadKeyIndex(int32 offset); char* fChars; key_map fKeys; From bga at bug-br.org.br Sun May 10 11:15:07 2009 From: bga at bug-br.org.br (Bruno Albuquerque) Date: Sun, 10 May 2009 11:15:07 Subject: [Haiku-commits] r30699 - haiku/trunk/src/preferences/keymap In-Reply-To: <200905101347.n4ADlsNk032556@sheep.berlios.de> Message-ID: <3829379719-BeMail@Gaspode> On Sun, 10 May 2009 15:47:54 +0200, zooey at BerliOS said: > * dead keys can now be enabled/disabled via middle mouse button This is great! Thanks a lot! With this change I was able to change the "`" key in the US- International keymap to be a dead key. That being said, I saw some problems: 1 - The entry box where you type to test changes does not seem to be picking up the modification which results in weird behaviour. Closing the Keymap preferences and opening it again makes it work. 2 - I was not able to set the "'" key as a dead key. In the US- International keymap this is equivalent to the acute diacritical sign (not sure if this is relevant, but "'" with the C key should result in C with a cedilla). Couldn't set the """ key either (same physical key in the keyboard but with shift pressed). This would be umlaut diacritical sign. -Bruno From bga at bug-br.org.br Sun May 10 11:16:53 2009 From: bga at bug-br.org.br (Bruno Albuquerque) Date: Sun, 10 May 2009 11:16:53 Subject: [Haiku-commits] r30699 - haiku/trunk/src/preferences/keymap In-Reply-To: <3829379719-BeMail@Gaspode> Message-ID: <3935643380-BeMail@Gaspode> On Sun, 10 May 2009 11:15:07, Bruno Albuquerque said: > On Sun, 10 May 2009 15:47:54 +0200, zooey at BerliOS said: > > > * dead keys can now be enabled/disabled via middle mouse button > > This is great! Thanks a lot! > > With this change I was able to change the "`" key in the US- > International keymap to be a dead key. That being said, I saw some > problems: > > 1 - The entry box where you type to test changes does not seem to be > picking up the modification which results in weird behaviour. Closing > the Keymap preferences and opening it again makes it work. > 2 - I was not able to set the "'" key as a dead key. In the US- > International keymap this is equivalent to the acute diacritical sign > (not sure if this is relevant, but "'" with the C key should result > in > C with a cedilla). Couldn't set the """ key either (same physical key > in the keyboard but with shift pressed). This would be umlaut > diacritical sign. Forgot to mention. A way to export this to a keymap file (so it could be used to update the broken keymaps we have) would be great. -Bruno From zooey at hirschkaefer.de Sun May 10 17:06:50 2009 From: zooey at hirschkaefer.de (Oliver Tappe) Date: Sun, 10 May 2009 17:06:50 +0200 Subject: [Haiku-commits] r30699 - haiku/trunk/src/preferences/keymap In-Reply-To: <3829379719-BeMail@Gaspode> References: <3829379719-BeMail@Gaspode> Message-ID: <20090510170650.778.2@bepc.1241944063.fake> On 2009-05-10 at 12:15:07 [+0200], Bruno Albuquerque wrote: > On Sun, 10 May 2009 15:47:54 +0200, zooey at BerliOS said: > > > * dead keys can now be enabled/disabled via middle mouse button > > This is great! Thanks a lot! > > With this change I was able to change the "`" key in the US- > International keymap to be a dead key. That being said, I saw some > problems: > > 1 - The entry box where you type to test changes does not seem to be > picking up the modification which results in weird behaviour. Closing > the Keymap preferences and opening it again makes it work. Have you pressed the 'Use' button before you tried to type into the textview? Otherwise, it will still be using the old keymap. I find that a bit cumbersome, but that's how it is, currenty. > 2 - I was not able to set the "'" key as a dead key. In the US- > International keymap this is equivalent to the acute diacritical sign > (not sure if this is relevant, but "'" with the C key should result in > C with a cedilla). Couldn't set the """ key either (same physical key > in the keyboard but with shift pressed). This would be umlaut > diacritical sign. Ah, thanks for mentioning. I will look into those, now. cheers, Oliver From zooey at hirschkaefer.de Sun May 10 17:09:50 2009 From: zooey at hirschkaefer.de (Oliver Tappe) Date: Sun, 10 May 2009 17:09:50 +0200 Subject: [Haiku-commits] r30699 - haiku/trunk/src/preferences/keymap In-Reply-To: <3935643380-BeMail@Gaspode> References: <3935643380-BeMail@Gaspode> Message-ID: <20090510170950.962.3@bepc.1241944063.fake> On 2009-05-10 at 12:16:53 [+0200], Bruno Albuquerque wrote: [ ... ] > > Forgot to mention. A way to export this to a keymap file (so it could > be used to update the broken keymaps we have) would be great. After you have pressed 'Use', you can invoke 'keymap -d' (note to lowercase 'k' ;-) in order to dump the current keymap. But intend to work on the US-International keymap myself as a testcase for my upcoming improvements to the dead-key handling of Keymap. If everything works out, our US-International keymap should match the one found in Linux (at least concerning the dead key functionality). cheers, Oliver From stpere at gmail.com Sun May 10 18:24:19 2009 From: stpere at gmail.com (Philippe Saint-Pierre) Date: Sun, 10 May 2009 12:24:19 -0400 Subject: [Haiku-commits] r30679 - haiku/trunk/src/apps/deskcalc In-Reply-To: <4A06BC87.20608@pinc-software.de> References: <200905091523.n49FN4FB018618@sheep.berlios.de> <4A06BC87.20608@pinc-software.de> Message-ID: 2009/5/10 Axel D?rfler > stpere at mail.berlios.de wrote: > > + BRect replicant_frame(frame); > > + replicant_frame.top = replicant_frame.bottom - 7.0f; > > + replicant_frame.left = replicant_frame.right - 7.0f; > > I guess you have looked at our coding style guide before, but we still > use upper caps as word delimiter in variables, not underscores; the name > here would be replicantFrame. > > Bye, > Axel. Sorry about that. I will pay even more attention next time. Thanks Stephan for fixing it for me ! Philippe -------------- next part -------------- An HTML attachment was scrubbed... URL: From superstippi at gmx.de Sun May 10 18:44:36 2009 From: superstippi at gmx.de (Stephan Assmus) Date: Sun, 10 May 2009 18:44:36 +0200 Subject: [Haiku-commits] r30679 - haiku/trunk/src/apps/deskcalc In-Reply-To: References: <200905091523.n49FN4FB018618@sheep.berlios.de> <4A06BC87.20608@pinc-software.de> Message-ID: <20090510184436.102618.1@bepc.1241960361.fake> On 2009-05-10 at 17:24:19 [+0200], Philippe Saint-Pierre wrote: > 2009/5/10 Axel D?rfler > > > stpere at mail.berlios.de wrote: > > > + BRect replicant_frame(frame); > > > + replicant_frame.top = replicant_frame.bottom - 7.0f; > > > + replicant_frame.left = replicant_frame.right - 7.0f; > > > > I guess you have looked at our coding style guide before, but we still > > use upper caps as word delimiter in variables, not underscores; the > > name here would be replicantFrame. > > > > Bye, > > Axel. > > > Sorry about that. I will pay even more attention next time. Thanks > Stephan for fixing it for me ! No worries, I hope it was ok to do so. It just so happened that I found that annoyance with the calculator icon and then fixed that on the way. Best regards, -Stephan From stippi at mail.berlios.de Sun May 10 19:04:08 2009 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 10 May 2009 19:04:08 +0200 Subject: [Haiku-commits] r30700 - in haiku/trunk: headers/os/drivers/bus headers/private/drivers src/add-ons/kernel/busses/ata src/add-ons/kernel/busses/ata/generic_ide_pci src/add-ons/kernel/busses/ata/ide_isa src/add-ons/kernel/busses/ata/it8211 src/add-ons/kernel/busses/ata/legacy_sata src/add-ons/kernel/busses/ata/promise_tx2 src/add-ons/kernel/busses/ata/silicon_image_3112 src/add-ons/kernel/generic/ata_adapter Message-ID: <200905101704.n4AH48oK012239@sheep.berlios.de> Author: stippi Date: 2009-05-10 19:04:04 +0200 (Sun, 10 May 2009) New Revision: 30700 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30700&view=rev Added: haiku/trunk/headers/private/drivers/ata_adapter.h Modified: haiku/trunk/headers/os/drivers/bus/ATA.h haiku/trunk/src/add-ons/kernel/busses/ata/Jamfile haiku/trunk/src/add-ons/kernel/busses/ata/generic_ide_pci/generic_ide_pci.c haiku/trunk/src/add-ons/kernel/busses/ata/ide_isa/ide_isa.c haiku/trunk/src/add-ons/kernel/busses/ata/it8211/it8211.c haiku/trunk/src/add-ons/kernel/busses/ata/legacy_sata/legacy_sata.c haiku/trunk/src/add-ons/kernel/busses/ata/promise_tx2/promise_tx2.c haiku/trunk/src/add-ons/kernel/busses/ata/silicon_image_3112/silicon_image_3112.c haiku/trunk/src/add-ons/kernel/generic/ata_adapter/ata_adapter.c Log: I am trying to help a bit with the transition from IDE to ATA stack. * Copied ide_adapter.h as ata_adapter.h in attempt to further separate the two stacks. * Continued renaming stuff in drivers/bus/ATA.h * Make all the busses/ata drivers include the new headers, specifically ata_types.h, ata_adapter.h and bus/ATA.h, they were all including ide_types and bus/IDE.h still * Some renaming of global variables for coding style consistency * Removed the promise driver from the build, it's not used on the image and I don't believe it compiled even for the old IDE stack. * There is no more Command Queueing in the new ATA stack, so I removed the capability indication from the busses/ata drivers and ata_adapter.h. The new ATA stack still boots fine on my computer and I proof-read the diff like two times. Basically, this was a careful search&replace job only. The only things I am not sure about is renaming some publishing related strings, but it seems to all work fine. Modified: haiku/trunk/headers/os/drivers/bus/ATA.h =================================================================== --- haiku/trunk/headers/os/drivers/bus/ATA.h 2009-05-10 13:47:54 UTC (rev 30699) +++ haiku/trunk/headers/os/drivers/bus/ATA.h 2009-05-10 17:04:04 UTC (rev 30700) @@ -25,7 +25,7 @@ typedef unsigned int ata_reg_mask; // channel cookie, issued by ata bus manager -typedef void *ata_channel; +typedef void* ata_channel; // interface of controller driver typedef struct { Copied: haiku/trunk/headers/private/drivers/ata_adapter.h (from rev 30689, haiku/trunk/headers/private/drivers/ide_adapter.h) =================================================================== --- haiku/trunk/headers/private/drivers/ide_adapter.h 2009-05-10 04:04:06 UTC (rev 30689) +++ haiku/trunk/headers/private/drivers/ata_adapter.h 2009-05-10 17:04:04 UTC (rev 30700) @@ -0,0 +1,208 @@ +/* + * Copyright 2005-2007, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Copyright 2002-04, Thomas Kurschel. All rights reserved. + * + * Distributed under the terms of the MIT License. + */ +#ifndef _ATA_PCI_H +#define _ATA_PCI_H + +/* + ATA adapter library + + Module to simplify writing an ATA adapter driver. + + The interface is not very abstract, i.e. the actual driver is + free to access any controller or channel data of this library. +*/ + + +#include +#include +#include + + +// one Physical Region Descriptor (PRD) +// (one region must not cross 64K boundary; +// the PRD table must not cross a 64K boundary) +typedef struct prd_entry { + uint32 address; // physical address of block (must be even) + uint16 count; // size of block, 0 stands for 65536 (must be even) + uint8 res6; + LBITFIELD8_2( + res7_0 : 7, + EOT : 1 // 1 for last entry + ); +} prd_entry; + +// IDE bus master command register +#define ATA_BM_COMMAND_START_STOP 0x01 +#define ATA_BM_COMMAND_READ_FROM_DEVICE 0x08 + +// IDE bus master status register +#define ATA_BM_STATUS_ACTIVE 0x01 +#define ATA_BM_STATUS_ERROR 0x02 +#define ATA_BM_STATUS_INTERRUPT 0x04 +#define ATA_BM_STATUS_MASTER_DMA 0x20 +#define ATA_BM_STATUS_SLAVE_DMA 0x40 +#define ATA_BM_STATUS_SIMPLEX_DMA 0x80 + +// offset of bus master registers +enum { + ATA_BM_COMMAND_REG = 0, + ATA_BM_STATUS_REG = 2, + ATA_BM_PRDT_ADDRESS = 4 + // offset of PRDT register; content must be dword-aligned +}; + +// bit mask in class_api of PCI configuration +// (for adapters that can run in compatability mode) +enum { + ATA_API_PRIMARY_NATIVE = 1, // primary channel is in native mode + ATA_API_PRIMARY_FIXED = 2, // primary channel can be switched to native mode + ATA_API_SECONDARY_NATIVE = 4, // secondary channel is in native mode + ATA_API_SECONDARY_FIXED = 8 // secondary channel can be switched to native mode +}; + + +// (maximum) size of S/G table +// there are so many restrictions that we want to keep it inside one page +// to be sure that we fulfill them all +#define ATA_ADAPTER_MAX_SG_COUNT (B_PAGE_SIZE / sizeof( prd_entry )) + + +// channel node items +// io address of command block (uint16) +#define ATA_ADAPTER_COMMAND_BLOCK_BASE "ata_adapter/command_block_base" +// io address of control block (uint16) +#define ATA_ADAPTER_CONTROL_BLOCK_BASE "ata_adapter/control_block_base" +// interrupt number (uint8) +// can also be defined in controller node if both channels use same IRQ! +#define ATA_ADAPTER_INTNUM "ata_adapter/irq" +// 0 if primary channel, 1 if secondary channel, 2 if tertiary, ... (uint8) +#define ATA_ADAPTER_CHANNEL_INDEX "ata_adapter/channel_index" + +// controller node items +// io address of bus master registers (uint16) +#define ATA_ADAPTER_BUS_MASTER_BASE "ata_adapter/bus_master_base" + + +// info about one channel +typedef struct ata_adapter_channel_info { + pci_device_module_info *pci; + pci_device *device; + + uint16 command_block_base; // io address command block + uint16 control_block_base; // io address control block + uint16 bus_master_base; + int intnum; // interrupt number + + uint32 lost; // != 0 if device got removed, i.e. if it must not + // be accessed anymore + + ata_channel ataChannel; + device_node *node; + + int32 (*inthand)( void *arg ); + + area_id prd_area; + prd_entry *prdt; + uint32 prdt_phys; + uint32 dmaing; +} ata_adapter_channel_info; + + +// info about controller +typedef struct ata_adapter_controller_info { + pci_device_module_info *pci; + pci_device *device; + + uint16 bus_master_base; + + uint32 lost; // != 0 if device got removed, i.e. if it must not + // be accessed anymore + + device_node *node; +} ata_adapter_controller_info; + + +// interface of IDE adapter library +typedef struct { + module_info info; + + void (*set_channel)(ata_adapter_channel_info *channel, + ata_channel ataChannel); + + // function calls that can be forwarded from actual driver + status_t (*write_command_block_regs)(ata_adapter_channel_info *channel, + ata_task_file *tf, ata_reg_mask mask); + status_t (*read_command_block_regs)(ata_adapter_channel_info *channel, + ata_task_file *tf, ata_reg_mask mask); + + uint8 (*get_altstatus) (ata_adapter_channel_info *channel); + status_t (*write_device_control) (ata_adapter_channel_info *channel, uint8 val); + + status_t (*write_pio)(ata_adapter_channel_info *channel, uint16 *data, int count, bool force_16bit); + status_t (*read_pio)(ata_adapter_channel_info *channel, uint16 *data, int count, bool force_16bit); + + status_t (*prepare_dma)(ata_adapter_channel_info *channel, const physical_entry *sg_list, + size_t sg_list_count, bool to_device); + status_t (*start_dma)(ata_adapter_channel_info *channel); + status_t (*finish_dma)(ata_adapter_channel_info *channel); + + // default functions that should be replaced by a more specific version + // (copy them from source code of this library and modify them at will) + int32 (*inthand)(void *arg); + + // functions that must be called by init/uninit etc. of channel driver + status_t (*init_channel)(device_node *node, + ata_adapter_channel_info **cookie, size_t total_data_size, + int32 (*inthand)(void *arg)); + void (*uninit_channel)(ata_adapter_channel_info *channel); + void (*channel_removed)(ata_adapter_channel_info *channel); + + // publish channel node + status_t (*publish_channel)(device_node *controller_node, + const char *channel_module_name, uint16 command_block_base, + uint16 control_block_base, uint8 intnum, bool can_dma, + uint8 channel_index, const char *name, + const io_resource *resources, device_node **node); + // verify channel configuration and publish node on success + status_t (*detect_channel)(pci_device_module_info *pci, pci_device *pciDevice, + device_node *controller_node, const char *channel_module_name, + bool controller_can_dma, uint16 command_block_base, + uint16 control_block_base, uint16 bus_master_base, + uint8 intnum, uint8 channel_index, const char *name, + device_node **node, bool supports_compatibility_mode); + + // functions that must be called by init/uninit etc. of controller driver + status_t (*init_controller)(device_node *node, + ata_adapter_controller_info **cookie, size_t total_data_size); + void (*uninit_controller)(ata_adapter_controller_info *controller); + void (*controller_removed)(ata_adapter_controller_info *controller); + + // publish controller node + status_t (*publish_controller)(device_node *parent, uint16 bus_master_base, + io_resource *resources, const char *controller_driver, + const char *controller_driver_type, const char *controller_name, + bool can_dma, bool can_cq, uint32 dma_alignment, uint32 dma_boundary, + uint32 max_sg_block_size, device_node **node); + // verify controller configuration and publish node on success + status_t (*detect_controller)(pci_device_module_info *pci, pci_device *pciDevice, + device_node *parent, uint16 bus_master_base, + const char *controller_driver, const char *controller_driver_type, + const char *controller_name, bool can_dma, bool can_cq, + uint32 dma_alignment, uint32 dma_boundary, uint32 max_sg_block_size, + device_node **node); + // standard master probe for controller that registers controller and channel nodes + status_t (*probe_controller)(device_node *parent, const char *controller_driver, + const char *controller_driver_type, const char *controller_name, + const char *channel_module_name, bool can_dma, bool can_cq, + uint32 dma_alignment, uint32 dma_boundary, uint32 max_sg_block_size, + bool supports_compatibility_mode); +} ata_adapter_interface; + + +#define ATA_ADAPTER_MODULE_NAME "generic/ata_adapter/v1" + +#endif /* _ATA_PCI_H */ Modified: haiku/trunk/src/add-ons/kernel/busses/ata/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/ata/Jamfile 2009-05-10 13:47:54 UTC (rev 30699) +++ haiku/trunk/src/add-ons/kernel/busses/ata/Jamfile 2009-05-10 17:04:04 UTC (rev 30700) @@ -3,6 +3,6 @@ SubInclude HAIKU_TOP src add-ons kernel busses ata generic_ide_pci ; SubInclude HAIKU_TOP src add-ons kernel busses ata ide_isa ; SubInclude HAIKU_TOP src add-ons kernel busses ata it8211 ; -SubInclude HAIKU_TOP src add-ons kernel busses ata promise_tx2 ; +#SubInclude HAIKU_TOP src add-ons kernel busses ata promise_tx2 ; SubInclude HAIKU_TOP src add-ons kernel busses ata silicon_image_3112 ; SubInclude HAIKU_TOP src add-ons kernel busses ata legacy_sata ; Modified: haiku/trunk/src/add-ons/kernel/busses/ata/generic_ide_pci/generic_ide_pci.c =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/ata/generic_ide_pci/generic_ide_pci.c 2009-05-10 13:47:54 UTC (rev 30699) +++ haiku/trunk/src/add-ons/kernel/busses/ata/generic_ide_pci/generic_ide_pci.c 2009-05-10 17:04:04 UTC (rev 30700) @@ -9,64 +9,64 @@ #include #include -#include +#include #define GENERIC_IDE_PCI_CONTROLLER_MODULE_NAME "busses/ata/generic_ide_pci/driver_v1" #define GENERIC_IDE_PCI_CHANNEL_MODULE_NAME "busses/ata/generic_ide_pci/channel/v1" -#define IDE_PCI_CONTROLLER_TYPE_NAME "ide pci controller" +#define ATA_PCI_CONTROLLER_TYPE_NAME "ata pci controller" -ide_for_controller_interface *ide; -static ide_adapter_interface *ide_adapter; -device_manager_info *pnp; +ata_for_controller_interface *sATA; +static ata_adapter_interface *sATAAdapter; +device_manager_info *sDeviceManager; static void -set_channel(void *cookie, ide_channel channel) +set_channel(void *cookie, ata_channel channel) { - ide_adapter->set_channel((ide_adapter_channel_info *)cookie, channel); + sATAAdapter->set_channel((ata_adapter_channel_info *)cookie, channel); } static status_t -write_command_block_regs(void *channel_cookie, ide_task_file *tf, ide_reg_mask mask) +write_command_block_regs(void *channel_cookie, ata_task_file *tf, ata_reg_mask mask) { - return ide_adapter->write_command_block_regs((ide_adapter_channel_info *)channel_cookie, tf, mask); + return sATAAdapter->write_command_block_regs((ata_adapter_channel_info *)channel_cookie, tf, mask); } static status_t -read_command_block_regs(void *channel_cookie, ide_task_file *tf, ide_reg_mask mask) +read_command_block_regs(void *channel_cookie, ata_task_file *tf, ata_reg_mask mask) { - return ide_adapter->read_command_block_regs((ide_adapter_channel_info *)channel_cookie, tf, mask); + return sATAAdapter->read_command_block_regs((ata_adapter_channel_info *)channel_cookie, tf, mask); } static uint8 get_altstatus(void *channel_cookie) { - return ide_adapter->get_altstatus((ide_adapter_channel_info *)channel_cookie); + return sATAAdapter->get_altstatus((ata_adapter_channel_info *)channel_cookie); } static status_t write_device_control(void *channel_cookie, uint8 val) { - return ide_adapter->write_device_control((ide_adapter_channel_info *)channel_cookie, val); + return sATAAdapter->write_device_control((ata_adapter_channel_info *)channel_cookie, val); } static status_t write_pio(void *channel_cookie, uint16 *data, int count, bool force_16bit) { - return ide_adapter->write_pio((ide_adapter_channel_info *)channel_cookie, data, count, force_16bit); + return sATAAdapter->write_pio((ata_adapter_channel_info *)channel_cookie, data, count, force_16bit); } static status_t read_pio(void *channel_cookie, uint16 *data, int count, bool force_16bit) { - return ide_adapter->read_pio((ide_adapter_channel_info *)channel_cookie, data, count, force_16bit); + return sATAAdapter->read_pio((ata_adapter_channel_info *)channel_cookie, data, count, force_16bit); } @@ -75,73 +75,73 @@ const physical_entry *sg_list, size_t sg_list_count, bool to_device) { - return ide_adapter->prepare_dma((ide_adapter_channel_info *)channel_cookie, sg_list, sg_list_count, to_device); + return sATAAdapter->prepare_dma((ata_adapter_channel_info *)channel_cookie, sg_list, sg_list_count, to_device); } static status_t start_dma(void *channel_cookie) { - return ide_adapter->start_dma((ide_adapter_channel_info *)channel_cookie); + return sATAAdapter->start_dma((ata_adapter_channel_info *)channel_cookie); } static status_t finish_dma(void *channel_cookie) { - return ide_adapter->finish_dma((ide_adapter_channel_info *)channel_cookie); + return sATAAdapter->finish_dma((ata_adapter_channel_info *)channel_cookie); } static status_t init_channel(device_node *node, void **channel_cookie) { - return ide_adapter->init_channel(node, - (ide_adapter_channel_info **)channel_cookie, - sizeof(ide_adapter_channel_info), ide_adapter->inthand); + return sATAAdapter->init_channel(node, + (ata_adapter_channel_info **)channel_cookie, + sizeof(ata_adapter_channel_info), sATAAdapter->inthand); } static void uninit_channel(void *channel_cookie) { - ide_adapter->uninit_channel((ide_adapter_channel_info *)channel_cookie); + sATAAdapter->uninit_channel((ata_adapter_channel_info *)channel_cookie); } static void channel_removed(void *channel_cookie) { - ide_adapter->channel_removed((ide_adapter_channel_info *)channel_cookie); + sATAAdapter->channel_removed((ata_adapter_channel_info *)channel_cookie); } static status_t -init_controller(device_node *node, ide_adapter_controller_info **cookie) +init_controller(device_node *node, ata_adapter_controller_info **cookie) { - return ide_adapter->init_controller(node, cookie, - sizeof( ide_adapter_controller_info)); + return sATAAdapter->init_controller(node, cookie, + sizeof( ata_adapter_controller_info)); } static void -uninit_controller(ide_adapter_controller_info *controller) +uninit_controller(ata_adapter_controller_info *controller) { - ide_adapter->uninit_controller(controller); + sATAAdapter->uninit_controller(controller); } static void -controller_removed(ide_adapter_controller_info *controller) +controller_removed(ata_adapter_controller_info *controller) { - return ide_adapter->controller_removed(controller); + return sATAAdapter->controller_removed(controller); } static status_t probe_controller(device_node *parent) { - return ide_adapter->probe_controller(parent, + return sATAAdapter->probe_controller(parent, GENERIC_IDE_PCI_CONTROLLER_MODULE_NAME, "generic_ide_pci", "Generic IDE PCI Controller", GENERIC_IDE_PCI_CHANNEL_MODULE_NAME, @@ -161,9 +161,9 @@ uint16 baseClass, subClass; // make sure parent is an PCI IDE mass storage host adapter device node - if (pnp->get_attr_string(parent, B_DEVICE_BUS, &bus, false) != B_OK - || pnp->get_attr_uint16(parent, B_DEVICE_TYPE, &baseClass, false) != B_OK - || pnp->get_attr_uint16(parent, B_DEVICE_SUB_TYPE, &subClass, false) != B_OK) + if (sDeviceManager->get_attr_string(parent, B_DEVICE_BUS, &bus, false) != B_OK + || sDeviceManager->get_attr_uint16(parent, B_DEVICE_TYPE, &baseClass, false) != B_OK + || sDeviceManager->get_attr_uint16(parent, B_DEVICE_SUB_TYPE, &subClass, false) != B_OK) return -1; if (strcmp(bus, "pci") || baseClass != PCI_mass_storage) @@ -182,15 +182,15 @@ module_dependency module_dependencies[] = { - { IDE_FOR_CONTROLLER_MODULE_NAME, (module_info **)&ide }, - { B_DEVICE_MANAGER_MODULE_NAME, (module_info **)&pnp }, - { IDE_ADAPTER_MODULE_NAME, (module_info **)&ide_adapter }, + { ATA_FOR_CONTROLLER_MODULE_NAME, (module_info **)&sATA }, + { B_DEVICE_MANAGER_MODULE_NAME, (module_info **)&sDeviceManager }, + { ATA_ADAPTER_MODULE_NAME, (module_info **)&sATAAdapter }, {} }; // exported interface -static ide_controller_interface channel_interface = { +static ata_controller_interface channel_interface = { { { GENERIC_IDE_PCI_CHANNEL_MODULE_NAME, Modified: haiku/trunk/src/add-ons/kernel/busses/ata/ide_isa/ide_isa.c =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/ata/ide_isa/ide_isa.c 2009-05-10 13:47:54 UTC (rev 30699) +++ haiku/trunk/src/add-ons/kernel/busses/ata/ide_isa/ide_isa.c 2009-05-10 17:04:04 UTC (rev 30700) @@ -16,10 +16,8 @@ #include #include +#include #include -#include -#include -#include //#define TRACE_IDE_ISA @@ -30,19 +28,19 @@ #endif -#define IDE_ISA_MODULE_NAME "busses/ata/ide_isa/driver_v1" +#define ATA_ISA_MODULE_NAME "busses/ata/ide_isa/driver_v1" // private node item: // io address of command block -#define IDE_ISA_COMMAND_BLOCK_BASE "ide_isa/command_block_base" +#define ATA_ISA_COMMAND_BLOCK_BASE "ide_isa/command_block_base" // io address of control block -#define IDE_ISA_CONTROL_BLOCK_BASE "ide_isa/control_block_base" +#define ATA_ISA_CONTROL_BLOCK_BASE "ide_isa/control_block_base" // interrupt number -#define IDE_ISA_INTNUM "ide_isa/irq" +#define ATA_ISA_INTNUM "ide_isa/irq" -ide_for_controller_interface *ide; -device_manager_info *pnp; +ata_for_controller_interface *sATA; +device_manager_info *sDeviceManager; // info about one channel @@ -55,34 +53,33 @@ uint32 lost; // != 0 if device got removed, i.e. if it must not // be accessed anymore - ide_channel ide_channel; + ata_channel ataChannel; device_node *node; } channel_info; -/*! publish node of an ide channel */ +/*! publish node of an ata channel */ static status_t publish_channel(device_node *parent, uint16 command_block_base, uint16 control_block_base, uint8 intnum, const char *name) { device_attr attrs[] = { - { B_DEVICE_FIXED_CHILD, B_STRING_TYPE, { string: IDE_FOR_CONTROLLER_MODULE_NAME }}, + { B_DEVICE_FIXED_CHILD, B_STRING_TYPE, { string: ATA_FOR_CONTROLLER_MODULE_NAME }}, - // properties of this controller for ide bus manager - { IDE_CONTROLLER_MAX_DEVICES_ITEM, B_UINT8_TYPE, { ui8: 2 }}, - { IDE_CONTROLLER_CAN_DMA_ITEM, B_UINT8_TYPE, { ui8: 0 }}, - { IDE_CONTROLLER_CAN_CQ_ITEM, B_UINT8_TYPE, { ui8: 1 }}, - { IDE_CONTROLLER_CONTROLLER_NAME_ITEM, B_STRING_TYPE, { string: name }}, + // properties of this controller for ata bus manager + { ATA_CONTROLLER_MAX_DEVICES_ITEM, B_UINT8_TYPE, { ui8: 2 }}, + { ATA_CONTROLLER_CAN_DMA_ITEM, B_UINT8_TYPE, { ui8: 0 }}, + { ATA_CONTROLLER_CONTROLLER_NAME_ITEM, B_STRING_TYPE, { string: name }}, // DMA properties; the 16 bit alignment is not necessary as - // the ide bus manager handles that very efficiently, but why + // the ata bus manager handles that very efficiently, but why // not use the block device manager for doing that? { B_DMA_ALIGNMENT, B_UINT32_TYPE, { ui32: 1 }}, // private data to identify device - { IDE_ISA_COMMAND_BLOCK_BASE, B_UINT16_TYPE, { ui16: command_block_base }}, - { IDE_ISA_CONTROL_BLOCK_BASE, B_UINT16_TYPE, { ui16: control_block_base }}, - { IDE_ISA_INTNUM, B_UINT8_TYPE, { ui8: intnum }}, + { ATA_ISA_COMMAND_BLOCK_BASE, B_UINT16_TYPE, { ui16: command_block_base }}, + { ATA_ISA_CONTROL_BLOCK_BASE, B_UINT16_TYPE, { ui16: control_block_base }}, + { ATA_ISA_INTNUM, B_UINT8_TYPE, { ui8: intnum }}, { NULL } }; io_resource resources[3] = { @@ -94,7 +91,7 @@ TRACE("publishing %s, resources %#x %#x %d\n", name, command_block_base, control_block_base, intnum); - return pnp->register_node(parent, IDE_ISA_MODULE_NAME, attrs, resources, + return sDeviceManager->register_node(parent, ATA_ISA_MODULE_NAME, attrs, resources, NULL); } @@ -103,16 +100,16 @@ static void -set_channel(void *cookie, ide_channel ideChannel) +set_channel(void *cookie, ata_channel ataChannel) { channel_info *channel = cookie; - channel->ide_channel = ideChannel; + channel->ataChannel = ataChannel; } static status_t -write_command_block_regs(void *channel_cookie, ide_task_file *tf, - ide_reg_mask mask) +write_command_block_regs(void *channel_cookie, ata_task_file *tf, + ata_reg_mask mask) { channel_info *channel = channel_cookie; uint16 ioaddr = channel->command_block_base; @@ -139,8 +136,8 @@ static status_t -read_command_block_regs(void *channel_cookie, ide_task_file *tf, - ide_reg_mask mask) +read_command_block_regs(void *channel_cookie, ata_task_file *tf, + ata_reg_mask mask) { channel_info *channel = channel_cookie; uint16 ioaddr = channel->command_block_base; @@ -256,7 +253,7 @@ // acknowledge IRQ status = channel->isa->read_io_8(channel->command_block_base + 7); - return ide->irq_handler(channel->ide_channel, status); + return sATA->interrupt_handler(channel->ataChannel, status); } @@ -291,7 +288,7 @@ const char *bus; // make sure parent is really the ISA bus manager - if (pnp->get_attr_string(parent, B_DEVICE_BUS, &bus, false)) + if (sDeviceManager->get_attr_string(parent, B_DEVICE_BUS, &bus, false)) return B_ERROR; if (strcmp(bus, "isa")) @@ -318,14 +315,14 @@ TRACE("ISA-IDE: channel init\n"); // get device data - if (pnp->get_attr_uint16(node, IDE_ISA_COMMAND_BLOCK_BASE, &command_block_base, false) != B_OK - || pnp->get_attr_uint16(node, IDE_ISA_CONTROL_BLOCK_BASE, &control_block_base, false) != B_OK - || pnp->get_attr_uint8(node, IDE_ISA_INTNUM, &irq, false) != B_OK) + if (sDeviceManager->get_attr_uint16(node, ATA_ISA_COMMAND_BLOCK_BASE, &command_block_base, false) != B_OK + || sDeviceManager->get_attr_uint16(node, ATA_ISA_CONTROL_BLOCK_BASE, &control_block_base, false) != B_OK + || sDeviceManager->get_attr_uint8(node, ATA_ISA_INTNUM, &irq, false) != B_OK) return B_ERROR; - parent = pnp->get_parent_node(node); - pnp->get_driver(parent, (driver_module_info **)&isa, NULL); - pnp->put_node(parent); + parent = sDeviceManager->get_parent_node(node); + sDeviceManager->get_driver(parent, (driver_module_info **)&isa, NULL); + sDeviceManager->put_node(parent); channel = (channel_info *)malloc(sizeof(channel_info)); if (channel == NULL) @@ -340,7 +337,7 @@ channel->command_block_base = command_block_base; channel->control_block_base = control_block_base; channel->intnum = irq; - channel->ide_channel = NULL; + channel->ataChannel = NULL; res = install_io_interrupt_handler(channel->intnum, inthand, channel, 0); @@ -351,7 +348,7 @@ } // enable interrupts so the channel is ready to run - write_device_control(channel, ide_devctrl_bit3); + write_device_control(channel, ATA_DEVICE_CONTROL_BIT3); *_cookie = channel; return B_OK; @@ -370,7 +367,7 @@ TRACE("ISA-IDE: channel uninit\n"); // disable IRQs - write_device_control(channel, ide_devctrl_bit3 | ide_devctrl_nien); + write_device_control(channel, ATA_DEVICE_CONTROL_BIT3 | ATA_DEVICE_CONTROL_DISABLE_INTS); // catch spurious interrupt // (some controllers generate an IRQ when you _disable_ interrupts, @@ -416,16 +413,16 @@ module_dependency module_dependencies[] = { - { IDE_FOR_CONTROLLER_MODULE_NAME, (module_info **)&ide }, - { B_DEVICE_MANAGER_MODULE_NAME, (module_info **)&pnp }, + { ATA_FOR_CONTROLLER_MODULE_NAME, (module_info **)&sATA }, + { B_DEVICE_MANAGER_MODULE_NAME, (module_info **)&sDeviceManager }, {} }; // exported interface -static ide_controller_interface sISAControllerInterface = { +static ata_controller_interface sISAControllerInterface = { { { - IDE_ISA_MODULE_NAME, + ATA_ISA_MODULE_NAME, 0, NULL }, Modified: haiku/trunk/src/add-ons/kernel/busses/ata/it8211/it8211.c =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/ata/it8211/it8211.c 2009-05-10 13:47:54 UTC (rev 30699) +++ haiku/trunk/src/add-ons/kernel/busses/ata/it8211/it8211.c 2009-05-10 17:04:04 UTC (rev 30700) @@ -6,7 +6,7 @@ #include #include -#include +#include #define IT8211_CONTROLLER_MODULE_NAME "busses/ata/it8211/driver_v1" #define IT8211_CHANNEL_MODULE_NAME "busses/ata/it8211/channel/v1" @@ -14,64 +14,64 @@ #define PCI_VENDOR_ITE 0x1283 #define PCI_DEVICE_ITE_IT8211 0x8211 -static ide_adapter_interface *sIDEAdapter; +static ata_adapter_interface *sATAAdapter; static device_manager_info *sDeviceManager; static void -it8211_set_channel(void *channelCookie, ide_channel channel) +it8211_set_channel(void *channelCookie, ata_channel channel) { - sIDEAdapter->set_channel((ide_adapter_channel_info *)channelCookie, + sATAAdapter->set_channel((ata_adapter_channel_info *)channelCookie, channel); } static status_t -it8211_write_command_block_regs(void *channelCookie, ide_task_file *taskFile, - ide_reg_mask registerMask) +it8211_write_command_block_regs(void *channelCookie, ata_task_file *taskFile, + ata_reg_mask registerMask) { - return sIDEAdapter->write_command_block_regs( - (ide_adapter_channel_info *)channelCookie, taskFile, registerMask); + return sATAAdapter->write_command_block_regs( + (ata_adapter_channel_info *)channelCookie, taskFile, registerMask); } static status_t -it8211_read_command_block_regs(void *channelCookie, ide_task_file *taskFile, - ide_reg_mask registerMask) +it8211_read_command_block_regs(void *channelCookie, ata_task_file *taskFile, + ata_reg_mask registerMask) { - return sIDEAdapter->read_command_block_regs( - (ide_adapter_channel_info *)channelCookie, taskFile, registerMask); + return sATAAdapter->read_command_block_regs( + (ata_adapter_channel_info *)channelCookie, taskFile, registerMask); } static uint8 it8211_get_altstatus(void *channelCookie) { - return sIDEAdapter->get_altstatus((ide_adapter_channel_info *)channelCookie); + return sATAAdapter->get_altstatus((ata_adapter_channel_info *)channelCookie); } static status_t it8211_write_device_control(void *channelCookie, uint8 value) { - return sIDEAdapter->write_device_control( - (ide_adapter_channel_info *)channelCookie, value); + return sATAAdapter->write_device_control( + (ata_adapter_channel_info *)channelCookie, value); } static status_t it8211_write_pio(void *channelCookie, uint16 *data, int count, bool force16bit) { - return sIDEAdapter->write_pio( - (ide_adapter_channel_info *)channelCookie, data, count, force16bit); + return sATAAdapter->write_pio( + (ata_adapter_channel_info *)channelCookie, data, count, force16bit); } static status_t it8211_read_pio(void *channelCookie, uint16 *data, int count, bool force16bit) { - return sIDEAdapter->read_pio( - (ide_adapter_channel_info *)channelCookie, data, count, force16bit); + return sATAAdapter->read_pio( + (ata_adapter_channel_info *)channelCookie, data, count, force16bit); } @@ -79,7 +79,7 @@ it8211_prepare_dma(void *channelCookie, const physical_entry *sgList, size_t sgListCount, bool toDevice) { - return sIDEAdapter->prepare_dma((ide_adapter_channel_info *)channelCookie, + return sATAAdapter->prepare_dma((ata_adapter_channel_info *)channelCookie, sgList, sgListCount, toDevice); } @@ -87,67 +87,67 @@ static status_t it8211_start_dma(void *channelCookie) { - return sIDEAdapter->start_dma((ide_adapter_channel_info *)channelCookie); + return sATAAdapter->start_dma((ata_adapter_channel_info *)channelCookie); } static status_t it8211_finish_dma(void *channelCookie) { - return sIDEAdapter->finish_dma((ide_adapter_channel_info *)channelCookie); + return sATAAdapter->finish_dma((ata_adapter_channel_info *)channelCookie); } static status_t init_channel(device_node *node, void **channelCookie) { - return sIDEAdapter->init_channel(node, - (ide_adapter_channel_info **)channelCookie, - sizeof(ide_adapter_channel_info), sIDEAdapter->inthand); + return sATAAdapter->init_channel(node, + (ata_adapter_channel_info **)channelCookie, + sizeof(ata_adapter_channel_info), sATAAdapter->inthand); } static void uninit_channel(void *channelCookie) { - sIDEAdapter->uninit_channel((ide_adapter_channel_info *)channelCookie); + sATAAdapter->uninit_channel((ata_adapter_channel_info *)channelCookie); } static void channel_removed(void *channelCookie) { - sIDEAdapter->channel_removed((ide_adapter_channel_info *)channelCookie); + sATAAdapter->channel_removed((ata_adapter_channel_info *)channelCookie); } static status_t init_controller(device_node *node, void **cookie) { - return sIDEAdapter->init_controller(node, - (ide_adapter_controller_info **)cookie, - sizeof(ide_adapter_controller_info)); + return sATAAdapter->init_controller(node, + (ata_adapter_controller_info **)cookie, + sizeof(ata_adapter_controller_info)); } static void uninit_controller(void *cookie) { - sIDEAdapter->uninit_controller((ide_adapter_controller_info *)cookie); + sATAAdapter->uninit_controller((ata_adapter_controller_info *)cookie); } static void controller_removed(void *cookie) { - sIDEAdapter->controller_removed((ide_adapter_controller_info *)cookie); + sATAAdapter->controller_removed((ata_adapter_controller_info *)cookie); } static status_t probe_controller(device_node *parent) { - return sIDEAdapter->probe_controller(parent, + return sATAAdapter->probe_controller(parent, IT8211_CONTROLLER_MODULE_NAME, "it8211", "ITE IT8211", IT8211_CHANNEL_MODULE_NAME, true, /* DMA */ @@ -182,13 +182,13 @@ module_dependency module_dependencies[] = { { B_DEVICE_MANAGER_MODULE_NAME, (module_info **)&sDeviceManager }, - { IDE_ADAPTER_MODULE_NAME, (module_info **)&sIDEAdapter }, + { ATA_ADAPTER_MODULE_NAME, (module_info **)&sATAAdapter }, {} }; // exported interface -static ide_controller_interface sChannelInterface = { +static ata_controller_interface sChannelInterface = { { { IT8211_CHANNEL_MODULE_NAME, Modified: haiku/trunk/src/add-ons/kernel/busses/ata/legacy_sata/legacy_sata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/ata/legacy_sata/legacy_sata.c 2009-05-10 13:47:54 UTC (rev 30699) +++ haiku/trunk/src/add-ons/kernel/busses/ata/legacy_sata/legacy_sata.c 2009-05-10 17:04:04 UTC (rev 30700) @@ -6,15 +6,13 @@ #include #include #include -#include -#include -#include +#include #define DRIVER_PRETTY_NAME "Legacy SATA" #define CONTROLLER_NAME DRIVER_PRETTY_NAME #define CONTROLLER_MODULE_NAME "busses/ata/legacy_sata/driver_v1" -#define CHANNEL_MODULE_NAME "busses/ide/legacy_sata/channel/v1" +#define CHANNEL_MODULE_NAME "busses/ata/legacy_sata/channel/v1" #define TRACE(a...) dprintf(DRIVER_PRETTY_NAME ": " a) #define FLOW(a...) dprintf(DRIVER_PRETTY_NAME ": " a) @@ -55,9 +53,9 @@ "Tertiary Channel", "Quaternary Channel" }; -static ide_for_controller_interface* ide; -static ide_adapter_interface* ide_adapter; -static device_manager_info* dm; +static ata_for_controller_interface* sATA; +static ata_adapter_interface* sATAAdapter; +static device_manager_info* sDeviceManager; static float @@ -69,15 +67,15 @@ const char *bus = NULL; // get the bus (should be PCI) - if (dm->get_attr_string(parent, B_DEVICE_BUS, &bus, false) != B_OK) + if (sDeviceManager->get_attr_string(parent, B_DEVICE_BUS, &bus, false) != B_OK) return B_ERROR; if (strcmp(bus, "pci") != 0) { return B_ERROR; } // get vendor and device ID - if ((res=dm->get_attr_uint16(parent, B_DEVICE_VENDOR_ID, &vendor_id, false)) != B_OK - || (res=dm->get_attr_uint16(parent, B_DEVICE_ID, &device_id, false)) != B_OK) { + if ((res = sDeviceManager->get_attr_uint16(parent, B_DEVICE_VENDOR_ID, &vendor_id, false)) != B_OK + || (res = sDeviceManager->get_attr_uint16(parent, B_DEVICE_ID, &device_id, false)) != B_OK) { return res; } @@ -140,7 +138,7 @@ TRACE("controller_probe\n"); - dm->get_driver(parent, (driver_module_info **)&pci, (void **)&device); + sDeviceManager->get_driver(parent, (driver_module_info **)&pci, (void **)&device); device_id = pci->read_pci_config(device, PCI_device_id, 2); vendor_id = pci->read_pci_config(device, PCI_vendor_id, 2); @@ -192,7 +190,7 @@ control_block_base[index] &= PCI_address_io_mask; } - res = ide_adapter->detect_controller(pci, device, parent, bus_master_base, + res = sATAAdapter->detect_controller(pci, device, parent, bus_master_base, CONTROLLER_MODULE_NAME, "" /* XXX: unused: controller_driver_type*/, CONTROLLER_NAME, true, true, 1, 0xffff, 0x10000, &controller_node); // don't register if controller is already registered! @@ -207,7 +205,7 @@ // ignore errors during registration of channels - could be a simple rescan collision for (index = 0; index < num_channels; index++) { - res = ide_adapter->detect_channel(pci, device, controller_node, CHANNEL_MODULE_NAME, + res = sATAAdapter->detect_channel(pci, device, controller_node, CHANNEL_MODULE_NAME, true, command_block_base[index], control_block_base[index], bus_master_base, int_num, index, kChannelNames[index], &channels[index], false); @@ -227,129 +225,129 @@ static status_t controller_init(device_node *node, void **controller_cookie) { - return ide_adapter->init_controller( - node, (ide_adapter_controller_info**)controller_cookie, - sizeof(ide_adapter_controller_info)); + return sATAAdapter->init_controller( + node, (ata_adapter_controller_info**)controller_cookie, + sizeof(ata_adapter_controller_info)); } static void controller_uninit(void *controller_cookie) { - ide_adapter->uninit_controller(controller_cookie); + sATAAdapter->uninit_controller(controller_cookie); } static void controller_removed(void *controller_cookie) { - ide_adapter->controller_removed( - (ide_adapter_controller_info*)controller_cookie); + sATAAdapter->controller_removed( + (ata_adapter_controller_info*)controller_cookie); } static status_t channel_init(device_node *node, void **channel_cookie) { - return ide_adapter->init_channel(node, - (ide_adapter_channel_info**)channel_cookie, - sizeof(ide_adapter_channel_info), - ide_adapter->inthand); + return sATAAdapter->init_channel(node, + (ata_adapter_channel_info**)channel_cookie, + sizeof(ata_adapter_channel_info), + sATAAdapter->inthand); } static void channel_uninit(void *channel_cookie) { - ide_adapter->uninit_channel(channel_cookie); + sATAAdapter->uninit_channel(channel_cookie); [... truncated: 1377 lines follow ...] From axeld at pinc-software.de Sun May 10 23:24:41 2009 From: axeld at pinc-software.de (=?ISO-8859-1?Q?Axel_D=F6rfler?=) Date: Sun, 10 May 2009 23:24:41 +0200 Subject: [Haiku-commits] r30699 - haiku/trunk/src/preferences/keymap In-Reply-To: <20090510170650.778.2@bepc.1241944063.fake> References: <3829379719-BeMail@Gaspode> <20090510170650.778.2@bepc.1241944063.fake> Message-ID: <4A074619.707@pinc-software.de> Oliver Tappe wrote: >> 1 - The entry box where you type to test changes does not seem to be >> picking up the modification which results in weird behaviour. Closing >> the Keymap preferences and opening it again makes it work. > Have you pressed the 'Use' button before you tried to type into the textview? > Otherwise, it will still be using the old keymap. I find that a bit > cumbersome, but that's how it is, currenty. The "sample" textview in the Keymap preferences should always work with the keymap you see on screen; it should be independent from the one in use - however, deadkey handling is done in the input_server (you don't even get a notice that a key has been pressed), so deadkeys can't work this way. Not sure how to handle this better, but I guess we could have an extra message sent from the input_server for deadkeys, too. Otherwise, intercepting the input method stuff could work, as that already does something like that to be able to draw the highlighting for BTextViews. Bye, Axel. From kirilla at mail.berlios.de Sun May 10 23:33:24 2009 From: kirilla at mail.berlios.de (kirilla at BerliOS) Date: Sun, 10 May 2009 23:33:24 +0200 Subject: [Haiku-commits] r30701 - haiku/trunk/src/apps/stylededit Message-ID: <200905102133.n4ALXOJN007277@sheep.berlios.de> Author: kirilla Date: 2009-05-10 23:33:23 +0200 (Sun, 10 May 2009) New Revision: 30701 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30701&view=rev Modified: haiku/trunk/src/apps/stylededit/StyledEditApp.cpp haiku/trunk/src/apps/stylededit/StyledEditApp.h haiku/trunk/src/apps/stylededit/StyledEditWindow.cpp haiku/trunk/src/apps/stylededit/StyledEditWindow.h Log: Make StyledEdit check its open windows before launching a new one for an entry_ref. Simplify the application class somewhat by removing DispatchMessage() and replacing the custom made ArgvReceivedEx() with a standard ArgvReceived(). Rely on BPath to take care of paths relative to the current working directory - don't do it manually. Modified: haiku/trunk/src/apps/stylededit/StyledEditApp.cpp =================================================================== --- haiku/trunk/src/apps/stylededit/StyledEditApp.cpp 2009-05-10 17:04:04 UTC (rev 30700) +++ haiku/trunk/src/apps/stylededit/StyledEditApp.cpp 2009-05-10 21:33:23 UTC (rev 30701) @@ -5,6 +5,7 @@ * Authors: * Mattias Sundblad * Andrew Bachmann + * Jonas Sundstr?m */ @@ -115,6 +116,7 @@ fWindowCount = 0; fNextUntitledWindow = 1; + fBadArguments = false; styled_edit_app = this; } @@ -127,31 +129,6 @@ void -StyledEditApp::DispatchMessage(BMessage *msg, BHandler *handler) -{ - if (msg->what == B_ARGV_RECEIVED) { - int32 argc; - if (msg->FindInt32("argc", &argc) != B_OK) - argc = 0; - - const char** argv = new const char*[argc]; - for (int arg = 0; arg < argc; arg++) { - if (msg->FindString("argv", arg, &argv[arg]) != B_OK) { - argv[arg] = ""; - } - } - const char* cwd; - if (msg->FindString("cwd", &cwd) != B_OK) - cwd = ""; - - ArgvReceivedEx(argc, argv, cwd); - delete[] argv; - } else - BApplication::DispatchMessage(msg, handler); -} - - -void StyledEditApp::MessageReceived(BMessage *message) { switch (message->what) { @@ -188,12 +165,56 @@ } -void +status_t StyledEditApp::OpenDocument(entry_ref* ref) { + // traverse eventual symlink + BEntry entry(ref, true); + entry.GetRef(ref); + + if (entry.IsDirectory()) { + BPath path(&entry); + fprintf(stderr, + "Can't open directory \"%s\" for editing.\n", + path.Path()); + return B_ERROR; + } + + BEntry parent; + entry.GetParent(&parent); + + if (!entry.Exists() && !parent.Exists()) { + fprintf(stderr, + "Can't create file. Missing parent directory.\n"); + return B_ERROR; + } + + BWindow* window = NULL; + StyledEditWindow* document = NULL; + + for (int32 index = 0; ; index++) { + window = WindowAt(index); + if (window == NULL) + break; + + document = dynamic_cast(window); + if (document == NULL) + continue; + + if (document->IsDocumentEntryRef(ref)) { + if (document->Lock()) { + document->Activate(); + document->Unlock(); + return B_OK; + } + } + } + cascade(); new StyledEditWindow(gWindowRect, ref, fOpenAsEncoding); fWindowCount++; + + return B_OK; } @@ -222,32 +243,18 @@ void -StyledEditApp::ArgvReceivedEx(int32 argc, const char* argv[], const char* cwd) +StyledEditApp::ArgvReceived(int32 argc, char* argv[]) { for (int i = 1 ; (i < argc) ; i++) { - BPath path; - if (argv[i][0] == '/') - path.SetTo(argv[i]); - else - path.SetTo(cwd, argv[i]); + BPath path(argv[i]); + entry_ref ref; + get_ref_for_path(path.Path(), &ref); + + status_t status; + status = OpenDocument(&ref); - if (path.InitCheck() != B_OK) { - fprintf(stderr, "Setting path failed: \""); - if (argv[i][0] == '/') - fprintf(stderr, "%s\".\n", argv[i]); - else - fprintf(stderr, "%s/%s\".\n", cwd, argv[i]); - continue; - } - - entry_ref ref; - status_t status = get_ref_for_path(path.Path(), &ref); - if (status != B_OK) { - fprintf(stderr, "Could not open \"%s\": %s.\n", path.Path(), strerror(status)); - continue; - } - - OpenDocument(&ref); + if (status != B_OK && IsLaunching()) + fBadArguments = true; } } @@ -255,7 +262,12 @@ void StyledEditApp::ReadyToRun() { - if (fWindowCount == 0) + if (fWindowCount > 0) + return; + + if (fBadArguments) + Quit(); + else OpenDocument(); } Modified: haiku/trunk/src/apps/stylededit/StyledEditApp.h =================================================================== --- haiku/trunk/src/apps/stylededit/StyledEditApp.h 2009-05-10 17:04:04 UTC (rev 30700) +++ haiku/trunk/src/apps/stylededit/StyledEditApp.h 2009-05-10 21:33:23 UTC (rev 30701) @@ -5,6 +5,7 @@ * Authors: * Mattias Sundblad * Andrew Bachmann + * Jonas Sundstr?m */ #ifndef STYLED_EDIT_APP #define STYLED_EDIT_APP @@ -28,14 +29,13 @@ virtual ~StyledEditApp(); virtual void MessageReceived(BMessage *message); + virtual void ArgvReceived(int32 argc, char** argv); virtual void RefsReceived(BMessage *message); virtual void ReadyToRun(); - virtual void DispatchMessage(BMessage *an_event, BHandler *handler); - int32 NumberOfWindows(); void OpenDocument(); - void OpenDocument(entry_ref *ref); + status_t OpenDocument(entry_ref *ref); void CloseDocument(); private: @@ -47,7 +47,7 @@ uint32 fOpenAsEncoding; int32 fWindowCount; int32 fNextUntitledWindow; - + bool fBadArguments; }; extern StyledEditApp* styled_edit_app; Modified: haiku/trunk/src/apps/stylededit/StyledEditWindow.cpp =================================================================== --- haiku/trunk/src/apps/stylededit/StyledEditWindow.cpp 2009-05-10 17:04:04 UTC (rev 30700) +++ haiku/trunk/src/apps/stylededit/StyledEditWindow.cpp 2009-05-10 21:33:23 UTC (rev 30701) @@ -6,6 +6,7 @@ * Mattias Sundblad * Andrew Bachmann * Philippe Saint-Pierre + * Jonas Sundstr?m */ #include "Constants.h" @@ -27,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -1345,3 +1347,31 @@ return alert->Go(); } + + +bool +StyledEditWindow::IsDocumentEntryRef(const entry_ref* ref) +{ + if (ref == NULL) + return false; + + if (fSaveMessage == NULL) + return false; + + entry_ref dir; + const char* name; + if (fSaveMessage->FindRef("directory", &dir) != B_OK + || fSaveMessage->FindString("name", &name) != B_OK) + return false; + + entry_ref documentRef; + BPath documentPath(&dir); + documentPath.Append(name); + get_ref_for_path(documentPath.Path(), &documentRef); + + if (*ref == documentRef) + return true; + + return false; +} + Modified: haiku/trunk/src/apps/stylededit/StyledEditWindow.h =================================================================== --- haiku/trunk/src/apps/stylededit/StyledEditWindow.h 2009-05-10 17:04:04 UTC (rev 30700) +++ haiku/trunk/src/apps/stylededit/StyledEditWindow.h 2009-05-10 21:33:23 UTC (rev 30701) @@ -5,6 +5,7 @@ * Authors: * Mattias Sundblad * Andrew Bachmann + * Jonas Sundstr?m */ #ifndef STYLED_EDIT_WINDOW_H #define STYLED_EDIT_WINDOW_H @@ -43,6 +44,7 @@ status_t PageSetup(const char *documentname); void Print(const char *documentname); void SearchAllWindows(BString find, BString replace, bool casesens); + bool IsDocumentEntryRef(const entry_ref *ref); private: void InitWindow(uint32 encoding = 0); From ingo_weinhold at gmx.de Mon May 11 00:32:05 2009 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Mon, 11 May 2009 00:32:05 +0200 Subject: [Haiku-commits] r30690 - haiku/trunk/src/add-ons/disk_systems/intel In-Reply-To: <200905100900.n4A90KlY020872@sheep.berlios.de> References: <200905100900.n4A90KlY020872@sheep.berlios.de> Message-ID: <20090511003205.530.3@knochen-vm.localdomain> On 2009-05-10 at 11:00:20 [+0200], stippi at BerliOS wrote: > Author: stippi > Date: 2009-05-10 11:00:19 +0200 (Sun, 10 May 2009) > New Revision: 30690 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30690&view=rev > > Modified: > haiku/trunk/src/add-ons/disk_systems/intel/ExtendedPartitionAddOn.cpp > haiku/trunk/src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp > Log: > Added optional tracing facilities. > > > Modified: > haiku/trunk/src/add-ons/disk_systems/intel/ExtendedPartitionAddOn.cpp > =================================================================== > --- haiku/trunk/src/add-ons/disk_systems/intel/ExtendedPartitionAddOn.cpp > 2009-05-10 04:04:06 UTC (rev 30689) > +++ haiku/trunk/src/add-ons/disk_systems/intel/ExtendedPartitionAddOn.cpp > 2009-05-10 09:00:19 UTC (rev 30690) > @@ -5,10 +5,9 @@ > > #include "ExtendedPartitionAddOn.h" > > +#include > #include > > -#include > - > #include > #include > #include is a standard C++ header, which is why it was in a separate group. The first group is standard C/POSIX headers. CU, Ingo From kirilla at mail.berlios.de Mon May 11 02:48:04 2009 From: kirilla at mail.berlios.de (kirilla at BerliOS) Date: Mon, 11 May 2009 02:48:04 +0200 Subject: [Haiku-commits] r30702 - in haiku/trunk: headers/private headers/private/support src/bin src/kits/support Message-ID: <200905110048.n4B0m4qF000425@sheep.berlios.de> Author: kirilla Date: 2009-05-11 02:48:03 +0200 (Mon, 11 May 2009) New Revision: 30702 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30702&view=rev Added: haiku/trunk/headers/private/support/ haiku/trunk/headers/private/support/Url.h haiku/trunk/src/kits/support/Url.cpp Modified: haiku/trunk/src/bin/Jamfile haiku/trunk/src/bin/urlwrapper.cpp haiku/trunk/src/kits/support/Jamfile Log: Move Url class out of /bin/urlwrapper into BPrivate::Support. I plan to add a Launch()-method that will make it useful to /bin/open, AboutSystem, People and other applications. Added: haiku/trunk/headers/private/support/Url.h =================================================================== --- haiku/trunk/headers/private/support/Url.h 2009-05-10 21:33:23 UTC (rev 30701) +++ haiku/trunk/headers/private/support/Url.h 2009-05-11 00:48:03 UTC (rev 30702) @@ -0,0 +1,49 @@ +/* + * Copyright 2007-2009, Haiku Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _URL_H +#define _URL_H + +#include + +namespace BPrivate { +namespace Support { + +class BUrl : public BString { +public: + BUrl(const char *url); + ~BUrl(); + + status_t ParseAndSplit(); + status_t InitCheck() const; + + bool HasHost() const; + bool HasPort() const; + bool HasUser() const; + bool HasPass() const; + bool HasPath() const; + + BString Proto() const; + BString Full() const; + BString Host() const; + BString Port() const; + BString User() const; + BString Pass() const; + + BString proto; + BString full; + BString host; + BString port; + BString user; + BString pass; + BString path; +private: + status_t fStatus; +}; + +}; // namespace Support +}; // namespace BPrivate + +#endif // _URL_H + Modified: haiku/trunk/src/bin/Jamfile =================================================================== --- haiku/trunk/src/bin/Jamfile 2009-05-10 21:33:23 UTC (rev 30701) +++ haiku/trunk/src/bin/Jamfile 2009-05-11 00:48:03 UTC (rev 30702) @@ -2,7 +2,7 @@ SetSubDirSupportedPlatformsBeOSCompatible ; -UsePrivateHeaders app shared storage usb ; +UsePrivateHeaders app shared storage support usb ; UsePrivateSystemHeaders ; SubDirHdrs $(HAIKU_TOP) src add-ons kernel file_cache ; Modified: haiku/trunk/src/bin/urlwrapper.cpp =================================================================== --- haiku/trunk/src/bin/urlwrapper.cpp 2009-05-10 21:33:23 UTC (rev 30701) +++ haiku/trunk/src/bin/urlwrapper.cpp 2009-05-11 00:48:03 UTC (rev 30702) @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -50,37 +51,7 @@ const char *kVLCSig = "application/x-vnd.videolan-vlc"; #endif -// TODO: make a public BUrl class for use by apps ? -class Url : public BString { -public: - Url(const char *url) : BString(url) { fStatus = ParseAndSplit(); }; - ~Url() {}; -status_t InitCheck() const { return fStatus; }; -status_t ParseAndSplit(); -bool HasHost() const { return host.Length(); }; -bool HasPort() const { return port.Length(); }; -bool HasUser() const { return user.Length(); }; -bool HasPass() const { return pass.Length(); }; -bool HasPath() const { return path.Length(); }; -BString Proto() const { return BString(proto); }; -BString Full() const { return BString(full); }; // RFC1738's "sheme-part" -BString Host() const { return BString(host); }; -BString Port() const { return BString(port); }; -BString User() const { return BString(user); }; -BString Pass() const { return BString(pass); }; - -BString proto; -BString full; -BString host; -BString port; -BString user; -BString pass; -BString path; -private: -status_t fStatus; -}; - class UrlWrapperApp : public BApplication { public: @@ -96,79 +67,10 @@ }; -// proto:[//]user:pass at host:port/path -status_t Url::ParseAndSplit() -{ - int32 v; - BString left; - v = FindFirst(":"); - if (v < 0) - return B_BAD_VALUE; - - // TODO: proto and host should be lowercased. - // see http://en.wikipedia.org/wiki/URL_normalization - - CopyInto(proto, 0, v); - CopyInto(left, v + 1, Length() - v); - // TODO: RFC1738 says the // part should indicate the uri follows the u:p at h:p/path convention, so it should be used to check for special cases. - if (left.FindFirst("//") == 0) - left.RemoveFirst("//"); - full = left; - - // path part - // actually some apps handle file://[host]/path - // but I have no idea what proto it implies... - // or maybe it's just to emphasize on "localhost". - v = left.FindFirst("/"); - if (v == 0 || proto == "file") { - path = left; - return 0; - } - // some protos actually implies path if it's the only component - if ((v < 0) && (proto == "beshare" || proto == "irc")) { - path = left; - return 0; - } - - if (v > -1) { - left.MoveInto(path, v+1, left.Length()-v); - left.Remove(v, 1); - } - - // user:pass at host - v = left.FindFirst("@"); - if (v > -1) { - left.MoveInto(user, 0, v); - left.Remove(0, 1); - v = user.FindFirst(":"); - if (v > -1) { - user.MoveInto(pass, v, user.Length() - v); - pass.Remove(0, 1); - } - } else if (proto == "finger") { - // single component implies user - // see also: http://www.subir.com/lynx/lynx_help/lynx_url_support.html - user = left; - return 0; - } - - // host:port - v = left.FindFirst(":"); - if (v > -1) { - left.MoveInto(port, v + 1, left.Length() - v); - left.Remove(v, 1); - } - - // not much left... - host = left; - - return 0; -} - status_t UrlWrapperApp::SplitUrl(const char *url, BString &host, BString &port, BString &user, BString &pass, BString &path) { - Url u(url); + BPrivate::Support::BUrl u(url); if (u.InitCheck() < 0) return u.InitCheck(); host = u.host; @@ -318,7 +220,7 @@ const char *pausec = " ; read -p 'Press any key'"; char *args[] = { "/bin/sh", "-c", NULL, NULL}; - Url u(argv[1]); + BPrivate::Support::BUrl u(argv[1]); BString url = u.Full(); if (u.InitCheck() < 0) { fprintf(stderr, "malformed url: '%s'\n", u.String()); @@ -578,3 +480,4 @@ app.Run(); return 0; } + Modified: haiku/trunk/src/kits/support/Jamfile =================================================================== --- haiku/trunk/src/kits/support/Jamfile 2009-05-10 21:33:23 UTC (rev 30701) +++ haiku/trunk/src/kits/support/Jamfile 2009-05-11 00:48:03 UTC (rev 30702) @@ -2,7 +2,7 @@ SetSubDirSupportedPlatforms haiku libbe_test ; -UsePrivateHeaders shared app media ; +UsePrivateHeaders shared app media support ; MergeObject support_kit.o : Archivable.cpp @@ -18,4 +18,5 @@ Referenceable.cpp StopWatch.cpp String.cpp + Url.cpp ; Added: haiku/trunk/src/kits/support/Url.cpp =================================================================== --- haiku/trunk/src/kits/support/Url.cpp 2009-05-10 21:33:23 UTC (rev 30701) +++ haiku/trunk/src/kits/support/Url.cpp 2009-05-11 00:48:03 UTC (rev 30702) @@ -0,0 +1,189 @@ +/* + * Copyright 2007, Haiku. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Fran?ois Revol, revol at free.fr + * Jonas Sundstr?m, jonas at kirilla.com + */ + +/*! Url class for parsing an URL and opening it with its preferred handler. */ + + +#include "Url.h" + +namespace BPrivate { +namespace Support { + +BUrl::BUrl(const char *url) + : BString(url) +{ + fStatus = ParseAndSplit(); +} + + +BUrl::~BUrl() +{ +} + + +status_t +BUrl::InitCheck() const +{ + return fStatus; +} + + +status_t +BUrl::ParseAndSplit() +{ + // proto:[//]user:pass at host:port/path + + int32 v; + BString left; + + v = FindFirst(":"); + if (v < 0) + return B_BAD_VALUE; + + // TODO: proto and host should be lowercased. + // see http://en.wikipedia.org/wiki/URL_normalization + + CopyInto(proto, 0, v); + CopyInto(left, v + 1, Length() - v); + // TODO: RFC1738 says the // part should indicate the uri follows the u:p at h:p/path convention, so it should be used to check for special cases. + if (left.FindFirst("//") == 0) + left.RemoveFirst("//"); + full = left; + + // path part + // actually some apps handle file://[host]/path + // but I have no idea what proto it implies... + // or maybe it's just to emphasize on "localhost". + v = left.FindFirst("/"); + if (v == 0 || proto == "file") { + path = left; + return 0; + } + // some protos actually implies path if it's the only component + if ((v < 0) && (proto == "beshare" || proto == "irc")) { + path = left; + return 0; + } + + if (v > -1) { + left.MoveInto(path, v+1, left.Length()-v); + left.Remove(v, 1); + } + + // user:pass at host + v = left.FindFirst("@"); + if (v > -1) { + left.MoveInto(user, 0, v); + left.Remove(0, 1); + v = user.FindFirst(":"); + if (v > -1) { + user.MoveInto(pass, v, user.Length() - v); + pass.Remove(0, 1); + } + } else if (proto == "finger") { + // single component implies user + // see also: http://www.subir.com/lynx/lynx_help/lynx_url_support.html + user = left; + return 0; + } + + // host:port + v = left.FindFirst(":"); + if (v > -1) { + left.MoveInto(port, v + 1, left.Length() - v); + left.Remove(v, 1); + } + + // not much left... + host = left; + + return 0; +} + + +bool +BUrl::HasHost() const +{ + return host.Length(); +} + + +bool +BUrl::HasPort() const +{ + return port.Length(); +} + + +bool +BUrl::HasUser() const +{ + return user.Length(); +} + + +bool +BUrl::HasPass() const +{ + return pass.Length(); +} + + +bool +BUrl::HasPath() const +{ + return path.Length(); +} + + +BString +BUrl::Proto() const +{ + return BString(proto); +} + + +BString +BUrl::Full() const +{ + // RFC1738's "sheme-part" + return BString(full); +} + + +BString +BUrl::Host() const +{ + return BString(host); +} + + +BString +BUrl::Port() const +{ + return BString(port); +} + + +BString +BUrl::User() const +{ + return BString(user); +} + + +BString +BUrl::Pass() const +{ + return BString(pass); +} + +}; // namespace Support +}; // namespace BPrivate + From bga at mail.berlios.de Mon May 11 02:55:44 2009 From: bga at mail.berlios.de (bga at BerliOS) Date: Mon, 11 May 2009 02:55:44 +0200 Subject: [Haiku-commits] r30703 - haiku/trunk/src/servers/cddb_daemon Message-ID: <200905110055.n4B0tifH002190@sheep.berlios.de> Author: bga Date: 2009-05-11 02:55:42 +0200 (Mon, 11 May 2009) New Revision: 30703 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30703&view=rev Added: haiku/trunk/src/servers/cddb_daemon/cddb_server.cpp haiku/trunk/src/servers/cddb_daemon/cddb_server.h Modified: haiku/trunk/src/servers/cddb_daemon/Jamfile haiku/trunk/src/servers/cddb_daemon/cddb_daemon.cpp haiku/trunk/src/servers/cddb_daemon/cddb_daemon.h Log: Work in progress. Just commiting so I don't lose this code due to OpenBFS bugs for the third time. :P - Implement CDDBServer class. - Include relevant CDDB commands. - Initial processing of CDDB data. Change device name. This is close to be complete but I hit some cdda-fs bugs that need to be fixed before I will finish this. Modified: haiku/trunk/src/servers/cddb_daemon/Jamfile =================================================================== --- haiku/trunk/src/servers/cddb_daemon/Jamfile 2009-05-11 00:48:03 UTC (rev 30702) +++ haiku/trunk/src/servers/cddb_daemon/Jamfile 2009-05-11 00:55:42 UTC (rev 30703) @@ -4,5 +4,6 @@ Server cddb_daemon : cddb_daemon.cpp - : be + cddb_server.cpp + : be bnetapi ; Modified: haiku/trunk/src/servers/cddb_daemon/cddb_daemon.cpp =================================================================== --- haiku/trunk/src/servers/cddb_daemon/cddb_daemon.cpp 2009-05-11 00:48:03 UTC (rev 30702) +++ haiku/trunk/src/servers/cddb_daemon/cddb_daemon.cpp 2009-05-11 00:55:42 UTC (rev 30703) @@ -8,12 +8,16 @@ #include "cddb_daemon.h" +#include "cddb_server.h" + #include #include #include #include +#include #include +#include #include #include @@ -31,16 +35,9 @@ BVolume volume; while (fVolumeRoster->GetNextVolume(&volume) == B_OK) { - scsi_toc_toc* toc = (scsi_toc_toc*)malloc(kMaxTocSize); - if (toc == NULL) + if (_Lookup(volume.Device()) != B_OK) { continue; - - uint32 cddbId; - if (_CanLookup(volume.Device(), &cddbId, toc)) { - printf("CD can be looked up. CDDB id = %lu.\n", cddbId); - // TODO(bga): Implement and enable CDDB database lookup. } - free(toc); } } @@ -62,19 +59,8 @@ if (opcode == B_DEVICE_MOUNTED) { dev_t device; if (message->FindInt32("new device", &device) == B_OK) { - scsi_toc_toc* toc = - (scsi_toc_toc *)malloc(kMaxTocSize); - if (toc == NULL) + if (_Lookup(device) != B_OK) break; - - uint32 cddbId; - if (_CanLookup(device, &cddbId, toc)) { - printf("CD can be looked up. CDDB id = %lu.\n", - cddbId); - // TODO(bga): Implement and enable CDDB - // database lookup. - } - free(toc); } } } @@ -85,6 +71,69 @@ } +status_t +CDDBDaemon::_Lookup(const dev_t device) +{ + scsi_toc_toc* toc = (scsi_toc_toc*)malloc(kMaxTocSize); + if (toc == NULL) + return B_NO_MEMORY; + + uint32 cddbId; + if (!_CanLookup(device, &cddbId, toc)) { + free(toc); + return B_BAD_TYPE; + } + + printf("CD can be looked up. CDDB id = %08lx.\n", cddbId); + + CDDBServer cddb_server("freedb.freedb.org:80"); + + status_t result; + + BList queryResponse; + if ((result = cddb_server.Query(cddbId, toc, &queryResponse)) != B_OK) { + free(toc); + return result; + } + + free(toc); + + QueryResponseData* diskData = _SelectResult(&queryResponse); + if (diskData == NULL) { + return B_BAD_INDEX; + } + + ReadResponseData readResponse; + if ((result = cddb_server.Read(diskData, &readResponse)) != B_OK) { + return result; + } + + if (_WriteCDData(device, diskData, &readResponse) == B_OK) { + printf("CD data saved.\n"); + } else { + printf("CD data not saved.\n" ); + } + + // Delete itens in the query response BList; + int32 count = queryResponse.CountItems(); + for (int32 i = 0; i < count; ++i) { + delete (QueryResponseData*)queryResponse.RemoveItem(0L); + } + + queryResponse.MakeEmpty(); + + // Delete itens in the track data BList in the read response data; + count = readResponse.tracks.CountItems(); + for (int32 i = 0; i < count; ++i) { + delete (TrackData*)readResponse.tracks.RemoveItem(0L); + } + + readResponse.tracks.MakeEmpty(); + + return B_OK; +} + + bool CDDBDaemon::_CanLookup(const dev_t device, uint32* cddbId, scsi_toc_toc* toc) const @@ -122,6 +171,37 @@ } +QueryResponseData* +CDDBDaemon::_SelectResult(BList* response) const +{ + // Select a single CD match from the response and return it. + // + // TODO(bga):Right now it just picks the first entry on the list but + // someday we may want to let the user choose one. + if (response->CountItems() != 0) + return (QueryResponseData*)response->ItemAt(0L); + + return NULL; +} + + +status_t +CDDBDaemon::_WriteCDData(dev_t device, QueryResponseData* diskData, + ReadResponseData* readResponse) +{ + // Rename volume. + BVolume volume(device); + + status_t result; + if ((result = volume.SetName((diskData->title).String())) != B_OK) { + printf("Can't set volume name.\n"); + return result; + } + + return B_ERROR; +} + + int main(void) { CDDBDaemon* cddbDaemon = new CDDBDaemon(); cddbDaemon->Run(); Modified: haiku/trunk/src/servers/cddb_daemon/cddb_daemon.h =================================================================== --- haiku/trunk/src/servers/cddb_daemon/cddb_daemon.h 2009-05-11 00:48:03 UTC (rev 30702) +++ haiku/trunk/src/servers/cddb_daemon/cddb_daemon.h 2009-05-11 00:55:42 UTC (rev 30703) @@ -10,23 +10,32 @@ #define _CDDB_DAEMON_H #include -#include -#include #include +struct ReadResponseData; +struct QueryResponseData; + +class BList; +class BMessage; +class BVolumeRoster; + class CDDBDaemon : public BApplication { public: - CDDBDaemon(); - virtual ~CDDBDaemon(); + CDDBDaemon(); + virtual ~CDDBDaemon(); - virtual void MessageReceived(BMessage* message); + virtual void MessageReceived(BMessage* message); private: - bool _CanLookup(const dev_t device, uint32* cddbId, - scsi_toc_toc* toc) const; + status_t _Lookup(const dev_t device); + bool _CanLookup(const dev_t device, uint32* cddbId, + scsi_toc_toc* toc) const; + QueryResponseData* _SelectResult(BList* response) const; + status_t _WriteCDData(dev_t device, QueryResponseData* diskData, + ReadResponseData* readResponse); - BVolumeRoster* fVolumeRoster; + BVolumeRoster* fVolumeRoster; }; #endif // _CDDB_DAEMON_H Added: haiku/trunk/src/servers/cddb_daemon/cddb_server.cpp =================================================================== --- haiku/trunk/src/servers/cddb_daemon/cddb_server.cpp 2009-05-11 00:48:03 UTC (rev 30702) +++ haiku/trunk/src/servers/cddb_daemon/cddb_server.cpp 2009-05-11 00:55:42 UTC (rev 30703) @@ -0,0 +1,376 @@ +/* + * Copyright 2008-2009, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Bruno Albuquerque, bga at bug-br.org.br + */ + +#include "cddb_server.h" + +#include +#include +#include +#include + + +static const char* kDefaultLocalHostName = "unknown"; +static const uint32 kDefaultPortNumber = 80; + +static const uint32 kFramesPerSecond = 75; +static const uint32 kFramesPerMinute = kFramesPerSecond * 60; + + +CDDBServer::CDDBServer(const BString& cddbServer): + fInitialized(false), + fConnected(false) +{ + + // Set up local host name. + char localHostName[MAXHOSTNAMELEN + 1]; + if (gethostname(localHostName, MAXHOSTNAMELEN + 1) == 0) { + fLocalHostName = localHostName; + } else { + fLocalHostName = kDefaultLocalHostName; + } + + // Set up local user name. + char* user = getenv("USER"); + if (user == NULL) { + fLocalUserName = "unknown"; + } else { + fLocalUserName = user; + } + + // Set up server address; + if (_ParseAddress(cddbServer) == B_OK) + fInitialized = true; +} + + +status_t +CDDBServer::Query(uint32 cddbId, const scsi_toc_toc* toc, BList* queryResponse) +{ + if (_OpenConnection() != B_OK) + return B_ERROR; + + // Convert CDDB id to hexadecimal format. + char hexCddbId[9]; + sprintf(hexCddbId, "%08lx", cddbId); + + // Assemble the Query command. + int32 numTracks = toc->last_track + 1 - toc->first_track; + + BString cddbCommand("cddb query "); + cddbCommand << hexCddbId << " " << numTracks << " "; + + // Add track offsets in frames. + for (int32 i = 0; i < numTracks; ++i) { + const scsi_cd_msf& start = toc->tracks[i].start.time; + + uint32 startFrameOffset = start.minute * kFramesPerMinute + + start.second * kFramesPerSecond + start.frame; + + cddbCommand << startFrameOffset << " "; + } + + // Add total disc time in seconds. Last track is lead-out. + const scsi_cd_msf& lastTrack = toc->tracks[numTracks].start.time; + uint32 totalTimeInSeconds = lastTrack.minute * 60 + lastTrack.second; + cddbCommand << totalTimeInSeconds; + + BString output; + status_t result; + result = _SendCddbCommand(cddbCommand, &output); + + if (result == B_OK) { + // Remove the header from the reply. + output.Remove(0, output.FindFirst("\r\n\r\n") + 4); + + // Check status code. + BString statusCode; + output.MoveInto(statusCode, 0, 3); + if (statusCode == "210") { + // Multiple results, remove the first line and parse the others. + output.Remove(0, output.FindFirst("\r\n") + 2); + } else if (statusCode == "200") { + // Remove the first char which is a left over space. + output.Remove(0, 1); + } else { + // Something bad happened. + return B_ERROR; + } + + // Process all entries. + bool done = false; + while (!done) { + QueryResponseData* responseData = new QueryResponseData; + + output.MoveInto(responseData->category, 0, output.FindFirst(" ")); + output.Remove(0, 1); + + output.MoveInto(responseData->cddbId, 0, output.FindFirst(" ")); + output.Remove(0, 1); + + output.MoveInto(responseData->artist, 0, output.FindFirst(" / ")); + output.Remove(0, 3); + + output.MoveInto(responseData->title, 0, output.FindFirst("\r\n")); + output.Remove(0, 2); + + queryResponse->AddItem(responseData); + + if (output == "" || output == ".\r\n") { + // All returned data was processed exit the loop. + done = true; + } + } + } else { + printf("Error sending CDDB command : \"%s\".\n", cddbCommand.String()); + } + + _CloseConnection(); + return result; +} + + +status_t +CDDBServer::Read(QueryResponseData* diskData, ReadResponseData* readResponse) +{ + if (_OpenConnection() != B_OK) + return B_ERROR; + + // Assemble the Read command. + BString cddbCommand("cddb read "); + cddbCommand << diskData->category << " " << diskData->cddbId; + + BString output; + status_t result; + result = _SendCddbCommand(cddbCommand, &output); + + if (result == B_OK) { + // Remove the header from the reply. + output.Remove(0, output.FindFirst("\r\n\r\n") + 4); + + // Check status code. + BString statusCode; + output.MoveInto(statusCode, 0, 3); + if (statusCode == "210") { + // Remove first line and parse the others. + output.Remove(0, output.FindFirst("\r\n") + 2); + } else { + // Something bad happened. + return B_ERROR; + } + + // Process all entries. + bool done = false; + while (!done) { + if (output[0] == '#') { + // Comment. Remove it. + output.Remove(0, output.FindFirst("\r\n") + 2); + continue; + } + + // Extract one line to reduce the scope of processing to it. + BString line; + output.MoveInto(line, 0, output.FindFirst("\r\n")); + output.Remove(0, 2); + + // Obtain prefix. + BString prefix; + line.MoveInto(prefix, 0, line.FindFirst("=")); + line.Remove(0, 1); + + if (prefix == "DTITLE") { + // Disk title. + BString artist; + line.MoveInto(artist, 0, line.FindFirst(" / ")); + line.Remove(0, 3); + readResponse->title = line; + readResponse->artist = artist; + } else if (prefix == "DYEAR") { + // Disk year. + char* firstInvalid; + errno = 0; + uint32 year = strtoul(line.String(), &firstInvalid, 10); + if ((errno == ERANGE && + (year == (uint32)LONG_MAX || year == (uint32)LONG_MIN)) + || (errno != 0 && year == 0)) { + // Year out of range. + printf("Year out of range: %s\n", line.String()); + return B_ERROR; + } + + if (firstInvalid == line.String()) { + printf("Invalid year: %s\n", line.String()); + return B_ERROR; + } + + readResponse->year = year; + } else if (prefix == "DGENRE") { + // Disk genre. + readResponse->genre = line; + } else if (prefix.FindFirst("TTITLE") == 0) { + // Track title. + BString index; + prefix.MoveInto(index, 6, prefix.Length() - 6); + + TrackData* trackData = new TrackData; + + char* firstInvalid; + errno = 0; + uint32 track = strtoul(index.String(), &firstInvalid, 10); + if ((errno == ERANGE && + (track == (uint32)LONG_MAX || track == (uint32)LONG_MIN)) + || (errno != 0 && track == 0)) { + // Track out of range. + printf("Track out of range: %s\n", index.String()); + delete trackData; + return B_ERROR; + } + + if (firstInvalid == index.String()) { + printf("Invalid track: %s\n", index.String()); + delete trackData; + return B_ERROR; + } + + trackData->trackNumber = track; + + int32 pos = line.FindFirst(" / " ); + if (pos != B_ERROR) { + // We have track specific artist information. + BString artist; + line.MoveInto(artist, 0, pos); + line.Remove(0, 3); + trackData->artist = artist; + } else { + trackData->artist = diskData->artist; + } + + trackData->title = line; + + (readResponse->tracks).AddItem(trackData); + } else { + printf("Unhandled or unknown prefix: %s\n", prefix.String()); + } + + if (output == "" || output == ".\r\n") { + // All returned data was processed exit the loop. + done = true; + } + } + } else { + printf("Error sending CDDB command : \"%s\".\n", cddbCommand.String()); + } + + _CloseConnection(); + return B_OK; +} + + +status_t +CDDBServer::_ParseAddress(const BString& cddbServer) +{ + // Set up server address. + int32 pos = cddbServer.FindFirst(":"); + if (pos == B_ERROR) { + // It seems we do not have the address:port format. Use hostname as-is. + fCddbServerAddr.SetTo(cddbServer.String(), kDefaultPortNumber); + if (fCddbServerAddr.InitCheck() == B_OK) + return B_OK; + } else { + // Parse address:port format. + int32 port; + BString newCddbServer(cddbServer); + BString portString; + newCddbServer.MoveInto(portString, pos + 1, + newCddbServer.CountChars() - pos + 1); + if (portString.CountChars() > 0) { + char* firstInvalid; + errno = 0; + port = strtol(portString.String(), &firstInvalid, 10); + if ((errno == ERANGE && (port == LONG_MAX || port == LONG_MIN)) + || (errno != 0 && port == 0)) { + return B_ERROR; + } + if (firstInvalid == portString.String()) { + return B_ERROR; + } + + newCddbServer.RemoveAll(":"); + fCddbServerAddr.SetTo(newCddbServer.String(), port); + if (fCddbServerAddr.InitCheck() == B_OK) + return B_OK; + } + } + + return B_ERROR; +} + + +status_t +CDDBServer::_OpenConnection() +{ + if (!fInitialized) + return B_ERROR; + + if (fConnected) + return B_OK; + + if (fConnection.Connect(fCddbServerAddr) == B_OK) { + fConnected = true; + return B_OK; + } + + return B_ERROR; +} + + +void +CDDBServer::_CloseConnection() +{ + if (!fConnected) + return; + + fConnection.Close(); + fConnected = false; +} + + +status_t +CDDBServer::_SendCddbCommand(const BString& command, BString* output) +{ + if (!fConnected) + return B_ERROR; + + // Assemble full command string. + BString fullCommand; + fullCommand << command << "&hello=" << fLocalUserName << " " << + fLocalHostName << " cddb_daemon 1.0&proto=6"; + + // Replace spaces by + signs. + fullCommand.ReplaceAll(" ", "+"); + + // And now add command header and footer. + fullCommand.Prepend("GET /~cddb/cddb.cgi?cmd="); + fullCommand << " HTTP 1.0\n\n"; + + int32 result = fConnection.Send((void*)fullCommand.String(), + fullCommand.Length()); + if (result == fullCommand.Length()) { + BNetBuffer netBuffer; + while (fConnection.Receive(netBuffer, 10) != 0) { + // Do nothing. Data is automatically appended to the NetBuffer. + } + + // AppendString automatically adds the terminating \0. + netBuffer.AppendString(""); + + output->SetTo((char*)netBuffer.Data(), netBuffer.Size()); + return B_OK; + } + + return B_ERROR; +} Added: haiku/trunk/src/servers/cddb_daemon/cddb_server.h =================================================================== --- haiku/trunk/src/servers/cddb_daemon/cddb_server.h 2009-05-11 00:48:03 UTC (rev 30702) +++ haiku/trunk/src/servers/cddb_daemon/cddb_server.h 2009-05-11 00:55:42 UTC (rev 30703) @@ -0,0 +1,73 @@ +/* + * Copyright 2008-2009, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Bruno Albuquerque, bga at bug-br.org.br + */ + +#ifndef _CDDB_SERVER_H +#define _CDDB_SERVER_H + +#include +#include +#include +#include + +#include + + +// CD track specific data. +struct TrackData { + uint32 trackNumber; + BString title; + BString artist; +}; + + +// Query command response. +struct QueryResponseData { + BString category; + BString cddbId; + BString artist; + BString title; +}; + + +// Read command response. +struct ReadResponseData { + BString title; + BString artist; + BString genre; + uint32 year; + BList tracks; // TrackData items. +}; + + +class CDDBServer { +public: + CDDBServer(const BString& cddbServer); + + // CDDB commands interface. + status_t Query(uint32 cddbId, const scsi_toc_toc* toc, + BList* queryResponse); + status_t Read(QueryResponseData* diskData, + ReadResponseData* readResponse); + +private: + status_t _ParseAddress(const BString& cddbServer); + + status_t _OpenConnection(); + void _CloseConnection(); + + status_t _SendCddbCommand(const BString& command, BString* output); + + BString fLocalHostName; + BString fLocalUserName; + BNetAddress fCddbServerAddr; + BNetEndpoint fConnection; + bool fInitialized; + bool fConnected; +}; + +#endif // _CDDB_SERVER_H From revol at free.fr Mon May 11 03:06:50 2009 From: revol at free.fr (=?utf-8?q?Fran=C3=A7ois?= Revol) Date: Mon, 11 May 2009 03:06:50 +0200 CEST Subject: [Haiku-commits] =?utf-8?q?r30702_-_in_haiku/trunk=3A_headers/priv?= =?utf-8?q?ate_headers/private/support_src/bin_src/kits/support?= In-Reply-To: <200905110048.n4B0m4qF000425@sheep.berlios.de> Message-ID: <17037336299-BeMail@laptop> > Author: kirilla > Date: 2009-05-11 02:48:03 +0200 (Mon, 11 May 2009) > New Revision: 30702 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30702&view=rev > > Added: > haiku/trunk/headers/private/support/ > haiku/trunk/headers/private/support/Url.h > haiku/trunk/src/kits/support/Url.cpp > Modified: > haiku/trunk/src/bin/Jamfile > haiku/trunk/src/bin/urlwrapper.cpp > haiku/trunk/src/kits/support/Jamfile > Log: > Move Url class out of /bin/urlwrapper into BPrivate::Support. I plan > to > add a Launch()-method that will make it useful to /bin/open, > AboutSystem, People and other applications. Oh cool, I was too shy to try this ;) It can probably be made useful to other apps too... I need to add irc: handling in Vision... Fran?ois. From axeld at pinc-software.de Mon May 11 09:21:39 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Mon, 11 May 2009 09:21:39 +0200 CEST Subject: [Haiku-commits] r30690 - haiku/trunk/src/add-ons/disk_systems/intel In-Reply-To: <20090511003205.530.3@knochen-vm.localdomain> Message-ID: <980300307-BeMail@zon> Ingo Weinhold wrote: > is a standard C++ header, which is why it was in a separate > group. The > first group is standard C/POSIX headers. FWIW I usually put those into the same group as well (ie. standard headers) - I only separate them, when there are enough of them :-) Bye, Axel. From jonas at kirilla.com Mon May 11 09:39:49 2009 From: jonas at kirilla.com (Jonas =?iso-8859-1?q?Sundstr=F6m?=) Date: Mon, 11 May 2009 09:39:49 +0200 CEST Subject: [Haiku-commits] r30702 - in haiku/trunk: headers/private headers/private/support src/bin src/kits/support In-Reply-To: <17037336299-BeMail@laptop> Message-ID: <878287085-BeMail@kirilla> "Fran?ois Revol" wrote: ... > > Log: > > Move Url class out of /bin/urlwrapper into BPrivate::Support. ... > Oh cool, I was too shy to try this ;) > > It can probably be made useful to other apps too... > I need to add irc: handling in Vision... Thanks Fran?ois! I?m glad you like it! /Jonas. From axeld at pinc-software.de Mon May 11 09:40:37 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Mon, 11 May 2009 09:40:37 +0200 CEST Subject: [Haiku-commits] r30701 - haiku/trunk/src/apps/stylededit In-Reply-To: <200905102133.n4ALXOJN007277@sheep.berlios.de> Message-ID: <2118407577-BeMail@zon> kirilla at BerliOS wrote: > Log: > Make StyledEdit check its open windows before launching a new one > for an entry_ref. Simplify the application class somewhat by removing > DispatchMessage() and replacing the custom made ArgvReceivedEx() > with a standard ArgvReceived(). Rely on BPath to take care of paths > relative to the current working directory - don't do it manually. Sometimes it's better to ask before removing/simplyfying code you obviously don't understand - it actually has a reason to be there: when you open a document with a relative path from the shell, and StyledEdit is already open, the new document cannot be opened anymore, as it's sent to the old StyledEdit -- and that one cannot possibly know the current working directory of the new StyledEdit without looking at the "cwd" that comes with this message. Please revert. Bye, Axel. From axeld at pinc-software.de Mon May 11 09:42:42 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Mon, 11 May 2009 09:42:42 +0200 CEST Subject: [Haiku-commits] =?utf-8?q?r30702_-_in_haiku/trunk=3A_headers/priv?= =?utf-8?q?ate_headers/private/support_src/bin_src/kits/support?= In-Reply-To: <200905110048.n4B0m4qF000425@sheep.berlios.de> Message-ID: <2243967341-BeMail@zon> kirilla at BerliOS wrote: > +class BUrl : public BString { > +public: > + BUrl(const char *url); > + ~BUrl(); > + > + status_t ParseAndSplit(); > + status_t InitCheck() const; Our coding style asks for a different kind of indentation for class headers... > + BString proto; > + BString full; > + BString host; > + BString port; Public members in a supposed to be one-day-public class? Why the getters in the first place then? Bye, Axel. From jonas at kirilla.com Mon May 11 09:44:11 2009 From: jonas at kirilla.com (Jonas =?iso-8859-1?q?Sundstr=F6m?=) Date: Mon, 11 May 2009 09:44:11 +0200 CEST Subject: [Haiku-commits] r30702 - in haiku/trunk: headers/private headers/private/support src/bin src/kits/support In-Reply-To: <17037336299-BeMail@laptop> Message-ID: <1140042978-BeMail@kirilla> > Author: kirilla > Date: 2009-05-11 02:48:03 +0200 (Mon, 11 May 2009) > New Revision: 30702 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30702&view=rev > > Added: > haiku/trunk/headers/private/support/ > haiku/trunk/headers/private/support/Url.h > haiku/trunk/src/kits/support/Url.cpp I think headers/private/support is an okay choice for where to put it. If I had put it in private/net, users of BUrl would have to link against the network lib(s?) to use the class even though they might not need to do any actual networking. (Like "People", once it gets its URL link.) Any other thoughts on the matter? /Jonas. From jonas at kirilla.com Mon May 11 09:51:05 2009 From: jonas at kirilla.com (Jonas =?iso-8859-1?q?Sundstr=F6m?=) Date: Mon, 11 May 2009 09:51:05 +0200 CEST Subject: [Haiku-commits] r30702 - in haiku/trunk: headers/private headers/private/support src/bin src/kits/support In-Reply-To: <2243967341-BeMail@zon> Message-ID: <1554418429-BeMail@kirilla> "Axel D?rfler" wrote: > kirilla at BerliOS wrote: > > +class BUrl : public BString { > > +public: > > + BUrl(const char *url); > > + ~BUrl(); > > + > > + status_t ParseAndSplit(); > > + status_t InitCheck() const; > > Our coding style asks for a different kind of indentation for class > headers... > > > + BString proto; > > + BString full; > > + BString host; > > + BString port; > > Public members in a supposed to be one-day-public class? Why the > getters in the first place then? Will fix these tonight. Thanks. /Jonas. From jonas at kirilla.com Mon May 11 09:51:42 2009 From: jonas at kirilla.com (Jonas =?iso-8859-1?q?Sundstr=F6m?=) Date: Mon, 11 May 2009 09:51:42 +0200 CEST Subject: [Haiku-commits] r30701 - haiku/trunk/src/apps/stylededit In-Reply-To: <2118407577-BeMail@zon> Message-ID: <1591979757-BeMail@kirilla> "Axel D?rfler" wrote: > kirilla at BerliOS wrote: > > Log: > > Make StyledEdit check its open windows before launching a new one > > for an entry_ref. Simplify the application class somewhat by > > removing > > DispatchMessage() and replacing the custom made ArgvReceivedEx() > > with a standard ArgvReceived(). Rely on BPath to take care of paths > > relative to the current working directory - don't do it manually. > > Sometimes it's better to ask before removing/simplyfying code you > obviously don't understand - it actually has a reason to be there: > when > you open a document with a relative path from the shell, and > StyledEdit > is already open, the new document cannot be opened anymore, as it's > sent to the old StyledEdit -- and that one cannot possibly know the > current working directory of the new StyledEdit without looking at > the > "cwd" that comes with this message. > Please revert. (Hour spent testing, and yet this I didn?t think of. I thought it was some old code that worked around deficiencies in the API back in OpenBeOS days.) Ack. Will do so tonight, CET. /Jonas. From stippi at mail.berlios.de Mon May 11 10:05:53 2009 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Mon, 11 May 2009 10:05:53 +0200 Subject: [Haiku-commits] r30704 - haiku/trunk/src/add-ons/kernel/drivers/audio/hda Message-ID: <200905110805.n4B85rnv031800@sheep.berlios.de> Author: stippi Date: 2009-05-11 10:05:51 +0200 (Mon, 11 May 2009) New Revision: 30704 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30704&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_controller.cpp Log: * Fix by Cyan: Do the offset calculation taking the rate base into account. Fixes using the HDA driver with frame rates based on 44100Hz. * Automatic white space cleanup. Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_controller.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_controller.cpp 2009-05-11 00:55:42 UTC (rev 30703) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_controller.cpp 2009-05-11 08:05:51 UTC (rev 30704) @@ -449,9 +449,9 @@ return stream; } - dprintf("hda: hda_audio_group_get_widgets failed for %s stream\n", + dprintf("hda: hda_audio_group_get_widgets failed for %s stream\n", type == STREAM_PLAYBACK ? " playback" : "record"); - + free(stream); return NULL; } @@ -512,7 +512,7 @@ corb_t verb[2]; uint8* buffer; status_t rc; - + /* Clear previously allocated memory */ if (stream->buffer_area >= B_OK) { delete_area(stream->buffer_area); @@ -546,10 +546,17 @@ break; } } - - // Stream interrupts seem to arrive too early on most HDA - // so we adjust buffer descriptors to take this into account - uint32 offset = (stream->sample_size * stream->num_channels) * stream->rate / 48000; + + // Stream interrupts seem to arrive too early on most HDA + // so we adjust buffer descriptors to take this into account + uint32 offset; + if (format & FORMAT_44_1_BASE_RATE) { + offset = (stream->sample_size * stream->num_channels) * stream->rate + / 44100; + } else { + offset = (stream->sample_size * stream->num_channels) * stream->rate + / 48000; + } if (stream->controller->pci_info.vendor_id != INTEL_VENDORID) offset *= 32; @@ -732,7 +739,7 @@ { uint16 capabilities, stateStatus, cmd; status_t status; - + /* Map MMIO registers */ controller->regs_area = map_physical_memory("hda_hw_regs", (void*)controller->pci_info.u.h0.base_registers[0], @@ -761,20 +768,20 @@ /* TCSEL is reset to TC0 (clear 0-2 bits) */ update_pci_register(controller, PCI_HDA_TCSEL, PCI_HDA_TCSEL_MASK, 0, 1); - + /* Enable snooping for ATI and Nvidia, right now for all their hda-devices, but only based on guessing. */ switch (controller->pci_info.vendor_id) { case NVIDIA_VENDORID: - update_pci_register(controller, NVIDIA_HDA_TRANSREG, + update_pci_register(controller, NVIDIA_HDA_TRANSREG, NVIDIA_HDA_TRANSREG_MASK, NVIDIA_HDA_ENABLE_COHBITS, 1); - update_pci_register(controller, NVIDIA_HDA_ISTRM_COH, + update_pci_register(controller, NVIDIA_HDA_ISTRM_COH, ~NVIDIA_HDA_ENABLE_COHBIT, NVIDIA_HDA_ENABLE_COHBIT, 1); - update_pci_register(controller, NVIDIA_HDA_OSTRM_COH, + update_pci_register(controller, NVIDIA_HDA_OSTRM_COH, ~NVIDIA_HDA_ENABLE_COHBIT, NVIDIA_HDA_ENABLE_COHBIT, 1); break; case ATI_VENDORID: - update_pci_register(controller, ATI_HDA_MISC_CNTR2, + update_pci_register(controller, ATI_HDA_MISC_CNTR2, ATI_HDA_MISC_CNTR2_MASK, ATI_HDA_ENABLE_SNOOP, 1); break; case INTEL_VENDORID: From axeld at pinc-software.de Mon May 11 11:10:06 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Mon, 11 May 2009 11:10:06 +0200 CEST Subject: [Haiku-commits] r30702 - in haiku/trunk: headers/private headers/private/support src/bin src/kits/support In-Reply-To: <1140042978-BeMail@kirilla> Message-ID: <7487335487-BeMail@zon> "Jonas Sundstr?m" wrote: > > Author: kirilla > > Date: 2009-05-11 02:48:03 +0200 (Mon, 11 May 2009) > > New Revision: 30702 > > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30702&view=rev > > > > Added: > > haiku/trunk/headers/private/support/ > > haiku/trunk/headers/private/support/Url.h > > haiku/trunk/src/kits/support/Url.cpp > I think headers/private/support is an okay choice > for where to put it. > > If I had put it in private/net, users of BUrl would > have to link against the network lib(s?) to use the > class even though they might not need to do any actual > networking. (Like "People", once it gets its URL link.) > > Any other thoughts on the matter? I think it does not belong to net, but fits fine where it is now. Bye, Axel. From axeld at pinc-software.de Mon May 11 11:12:31 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Mon, 11 May 2009 11:12:31 +0200 CEST Subject: [Haiku-commits] r30701 - haiku/trunk/src/apps/stylededit In-Reply-To: <1591979757-BeMail@kirilla> Message-ID: <7632774407-BeMail@zon> "Jonas Sundstr?m" wrote: > (Hour spent testing, and yet this I didn?t think of. > I thought it was some old code that worked around > deficiencies in the API back in OpenBeOS days.) To prevent this in the future, one might think to add some comments to the functions :-) If you don't like the DispatchMessage() hack (as I do), you can just retrieve the "cwd" from the current message, as you usually do to get the buttons in MouseDown(). I think that would be a lot cleaner and probably easier to grasp as well. > Ack. Will do so tonight, CET. Thanks! Bye, Axel. From zooey at hirschkaefer.de Mon May 11 12:11:49 2009 From: zooey at hirschkaefer.de (Oliver Tappe) Date: Mon, 11 May 2009 12:11:49 +0200 Subject: [Haiku-commits] r30699 - haiku/trunk/src/preferences/keymap In-Reply-To: <4A074619.707@pinc-software.de> References: <3829379719-BeMail@Gaspode> <20090510170650.778.2@bepc.1241944063.fake> <4A074619.707@pinc-software.de> Message-ID: <20090511121149.745.3@bepc.1242027499.fake> On 2009-05-10 at 22:24:41 [+0200], Axel D?rfler wrote: > Oliver Tappe wrote: > >> 1 - The entry box where you type to test changes does not seem to be > >> picking up the modification which results in weird behaviour. Closing > >> the Keymap preferences and opening it again makes it work. > > Have you pressed the 'Use' button before you tried to type into the > > textview? > > Otherwise, it will still be using the old keymap. I find that a bit > > cumbersome, but that's how it is, currenty. > > The "sample" textview in the Keymap preferences should always work with > the keymap you see on screen; it should be independent from the one in > use - however, deadkey handling is done in the input_server (you don't > even get a notice that a key has been pressed), so deadkeys can't work > this way. > Not sure how to handle this better, but I guess we could have an extra > message sent from the input_server for deadkeys, too. Otherwise, > intercepting the input method stuff could work, as that already does > something like that to be able to draw the highlighting for BTextViews. Ok, I will have a look at that today. Apart from the need to implement drag and drop for the composed characters resulting from pressing a dead key and a second key, I wonder if it makes sense to add support to the Keymap preflet for changing the dead keys at all, and if so, in what way. Three options came to my mind: 1. Do not bother to change anything and let the "power user" edit the keymap by hand. 2. Add a menu to the preflet where the user can chose from a given set of concrete dead key characters for each of the five dead keys: 0xC2B4 and ' for Acute ` for Grave ^ for Circumflex 0xC2A8 and " for Diaeresis (maybe : too?) ~ for Tilde This is easy to implement, but would lock the set of supported dead key characters. 3. Add one text control for each of the five dead keys, allowing the user to enter whatever character should be used as the trigger character for that specific dead key. This is obiously the most flexible, but would require quite some screen space and might be confusing for new users. Perhaps it could be moved to an 'Advanded' tab-page? I personally like solution 2, as I find that the best compromise between simplicity and configurability. Opinions, anyone? cheers, Oliver From ingo_weinhold at gmx.de Mon May 11 13:14:39 2009 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Mon, 11 May 2009 13:14:39 +0200 Subject: [Haiku-commits] r30701 - haiku/trunk/src/apps/stylededit In-Reply-To: <7632774407-BeMail@zon> References: <7632774407-BeMail@zon> Message-ID: <20090511131439.512.1@knochen-vm.localdomain> On 2009-05-11 at 11:12:31 [+0200], Axel D?rfler wrote: > "Jonas Sundstr?m" wrote: > > (Hour spent testing, and yet this I didn?t think of. > > I thought it was some old code that worked around > > deficiencies in the API back in OpenBeOS days.) > > To prevent this in the future, one might think to add some comments to > the functions :-) > If you don't like the DispatchMessage() hack (as I do), you can just > retrieve the "cwd" from the current message, as you usually do to get > the buttons in MouseDown(). I think that would be a lot cleaner and > probably easier to grasp as well. I just noticed that only BApplication itself seems to add the "cwd" field, but BRoster doesn't. I suppose there shouldn't be a reason for that, or should there? CU, Ingo From revol at free.fr Mon May 11 14:06:16 2009 From: revol at free.fr (=?utf-8?q?Fran=C3=A7ois?= Revol) Date: Mon, 11 May 2009 14:06:16 +0200 CEST Subject: [Haiku-commits] r30702 - in haiku/trunk: headers/private headers/private/support src/bin src/kits/support In-Reply-To: <2243967341-BeMail@zon> Message-ID: <3148886128-BeMail@laptop> > kirilla at BerliOS wrote: > > +class BUrl : public BString { > > +public: > > + BUrl(const char *url); > > + ~BUrl(); > > + > > + status_t ParseAndSplit(); > > + status_t InitCheck() const; > > Our coding style asks for a different kind of indentation for class > headers... > > > + BString proto; > > + BString full; > > + BString host; > > + BString port; > > Public members in a supposed to be one-day-public class? Why the > getters in the first place then? lazyness :p Fran?ois. From axeld at pinc-software.de Mon May 11 15:18:40 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Mon, 11 May 2009 15:18:40 +0200 CEST Subject: [Haiku-commits] r30701 - haiku/trunk/src/apps/stylededit In-Reply-To: <20090511131439.512.1@knochen-vm.localdomain> Message-ID: <22401991080-BeMail@zon> Ingo Weinhold wrote: > On 2009-05-11 at 11:12:31 [+0200], Axel D?rfler > > wrote: > > To prevent this in the future, one might think to add some comments > > to > > the functions :-) > > If you don't like the DispatchMessage() hack (as I do), you can > > just > > retrieve the "cwd" from the current message, as you usually do to > > get > > the buttons in MouseDown(). I think that would be a lot cleaner and > > probably easier to grasp as well. > I just noticed that only BApplication itself seems to add the "cwd" > field, > but BRoster doesn't. I suppose there shouldn't be a reason for that, > or > should there? I wonder why it worked fine before that change then? But yes, BRoster should probably just do so. Bye, Axel. From humdingerb at mail.berlios.de Mon May 11 17:36:41 2009 From: humdingerb at mail.berlios.de (humdingerb at mail.berlios.de) Date: Mon, 11 May 2009 17:36:41 +0200 Subject: [Haiku-commits] r30705 - haiku/trunk/docs/userguide/en/installation Message-ID: <200905111536.n4BFafSl014826@sheep.berlios.de> Author: humdingerb Date: 2009-05-11 17:36:40 +0200 (Mon, 11 May 2009) New Revision: 30705 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30705&view=rev Modified: haiku/trunk/docs/userguide/en/installation/install-source-linux.html Log: It was brought to my attention that 'HAIKU_DONT_CLEAR_IMAGE = 1' is supposed to be redundant in case of a @disk build. I'm woefully ignorant of the intricacies of our buildsystem, so I just accepted that and ran with it. :) Thanks Matt (and Urias by proxy). Modified: haiku/trunk/docs/userguide/en/installation/install-source-linux.html =================================================================== --- haiku/trunk/docs/userguide/en/installation/install-source-linux.html 2009-05-11 08:05:51 UTC (rev 30704) +++ haiku/trunk/docs/userguide/en/installation/install-source-linux.html 2009-05-11 15:36:40 UTC (rev 30705) @@ -128,7 +128,7 @@ switch $(HAIKU_BUILD_PROFILE) { case "disk" : { - HAIKU_DONT_CLEAR_IMAGE = 1 ; + } @@ -175,7 +175,7 @@ switch $(HAIKU_BUILD_PROFILE) { case "disk" : { - HAIKU_DONT_CLEAR_IMAGE = 1 ; + } From umccullough at gmail.com Mon May 11 17:47:53 2009 From: umccullough at gmail.com (Urias McCullough) Date: Mon, 11 May 2009 08:47:53 -0700 Subject: [Haiku-commits] r30705 - haiku/trunk/docs/userguide/en/installation In-Reply-To: <200905111536.n4BFafSl014826@sheep.berlios.de> References: <200905111536.n4BFafSl014826@sheep.berlios.de> Message-ID: <1e80d8750905110847u7b820493n15334f89d87495fb@mail.gmail.com> On Mon, May 11, 2009 at 8:36 AM, wrote: > Author: humdingerb > Date: 2009-05-11 17:36:40 +0200 (Mon, 11 May 2009) > New Revision: 30705 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30705&view=rev > > Modified: > ? haiku/trunk/docs/userguide/en/installation/install-source-linux.html > Log: > It was brought to my attention that 'HAIKU_DONT_CLEAR_IMAGE = 1' is supposed to be redundant in case of a @disk build. I'm woefully ignorant of the intricacies of our buildsystem, so I just accepted that and ran with it. :) Thanks Matt (and Urias by proxy). There's no need to be ignorant :) Take a look here, and you can see how the different build profiles work: http://dev.haiku-os.org/browser/haiku/trunk/build/jam/MiscRules#L268 Specifically, it's line 321 which sets the HAIKU_DONT_CLEAR_IMAGE when profile type is "disk". Hope that helps clear it up :D - Urias From humdingerb at googlemail.com Mon May 11 18:02:18 2009 From: humdingerb at googlemail.com (Humdinger) Date: Mon, 11 May 2009 18:02:18 +0200 Subject: [Haiku-commits] r30705 - haiku/trunk/docs/userguide/en/installation In-Reply-To: <1e80d8750905110847u7b820493n15334f89d87495fb@mail.gmail.com> References: <200905111536.n4BFafSl014826@sheep.berlios.de> <1e80d8750905110847u7b820493n15334f89d87495fb@mail.gmail.com> Message-ID: <4A084C0A.1050809@googlemail.com> Urias McCullough wrote: >> I'm woefully ignorant of the intricacies of our buildsystem, so I just accepted that >> and ran with it. :) Thanks Matt (and Urias by proxy). > > There's no need to be ignorant :) > > Take a look here, and you can see how the different build profiles work: > > http://dev.haiku-os.org/browser/haiku/trunk/build/jam/MiscRules#L268 > > Specifically, it's line 321 which sets the HAIKU_DONT_CLEAR_IMAGE when profile type is > "disk". > > Hope that helps clear it up :D Thanks, I'm feeling a bit less ignorant now. :) One thing's now a bit awkward: case "disk" : { } The "disk" case is now completely empty. But I don't want to remove it as for this guide it's useful to show how it works. Any idea what we could put there? Maybe just some other optional package? Regards, Humdinger -- --=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=- Deutsche Haiku News @ http://www.haiku-gazette.de From humdingerb at mail.berlios.de Mon May 11 18:08:27 2009 From: humdingerb at mail.berlios.de (humdingerb at mail.berlios.de) Date: Mon, 11 May 2009 18:08:27 +0200 Subject: [Haiku-commits] r30706 - in haiku/trunk/docs/userguide/en: . applications Message-ID: <200905111608.n4BG8RZB019979@sheep.berlios.de> Author: humdingerb Date: 2009-05-11 18:08:21 +0200 (Mon, 11 May 2009) New Revision: 30706 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30706&view=rev Removed: haiku/trunk/docs/userguide/en/installation.html Modified: haiku/trunk/docs/userguide/en/applications/apps-people.html Log: Removed out of date installation.html which was moved to /installation/install-source-linux.html a while back. Thanks for noticing, Matt. Modified: haiku/trunk/docs/userguide/en/applications/apps-people.html =================================================================== --- haiku/trunk/docs/userguide/en/applications/apps-people.html 2009-05-11 15:36:40 UTC (rev 30705) +++ haiku/trunk/docs/userguide/en/applications/apps-people.html 2009-05-11 16:08:21 UTC (rev 30706) @@ -43,10 +43,21 @@ Location:/boot/system/apps/People Settings:~/config/settings/People_data -

        Documentation is still missing. If you want to work on it, please announce it on the Documentation mailing list to avoid duplication.

        +

        People is a simple contact database using the attributes of Haiku's filesystem to store addresses and other contact information. Every contact is saved as one Person file with its data in separate attributes. All are indexed and therefore searchable with a query.

        + +people.png + +

        The Group attribute at the bottom allows assigning a person to one or more groups. Useful for "mass mailing" a number of people who, for example, work on a specific project. The drop-down menu offers all currently existing groups. If a person belongs to more than one group, the group names are delimited with a ",".

        + +

        These Person files are usually all saved in /boot/home/people/. To get a list of all your contacts, just open your people folder and display all attributes of interest. If you choose to organize your Person files in different folders, just use a query to display them all in one window.

        + +people-files.png + +

        You can treat these files like any other: You can sort according to attributes (even a second sorting order by holding SHIFT while clicking) and of course delete, duplicate or rename Person files. Even the contact information can be edited directly: Clicking on an attribute (or ALT E) to edit works just like renaming a file. Once you're in edit mode, TAB and SHIFT TAB will jump from column to column.

        + - + Deleted: haiku/trunk/docs/userguide/en/installation.html From humdingerb at mail.berlios.de Mon May 11 18:12:56 2009 From: humdingerb at mail.berlios.de (humdingerb at mail.berlios.de) Date: Mon, 11 May 2009 18:12:56 +0200 Subject: [Haiku-commits] r30707 - in haiku/trunk/docs/userguide: en images/apps-images Message-ID: <200905111612.n4BGCuth020706@sheep.berlios.de> Author: humdingerb Date: 2009-05-11 18:12:53 +0200 (Mon, 11 May 2009) New Revision: 30707 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30707&view=rev Added: haiku/trunk/docs/userguide/images/apps-images/people-files.png haiku/trunk/docs/userguide/images/apps-images/people.png Modified: haiku/trunk/docs/userguide/en/applications.html Log: The apps-people.html wasn't supposed to be commited yet, but what done is done, so here's the rest... :) Modified: haiku/trunk/docs/userguide/en/applications.html =================================================================== --- haiku/trunk/docs/userguide/en/applications.html 2009-05-11 16:08:21 UTC (rev 30706) +++ haiku/trunk/docs/userguide/en/applications.html 2009-05-11 16:12:53 UTC (rev 30707) @@ -100,7 +100,7 @@ iconPe  An advanced texteditor with syntax coloring and much more. [still missing] iconPeople  - A contact manager. [still missing] + A contact manager. iconPoorMan  A simple web server. iconScreenshot  Added: haiku/trunk/docs/userguide/images/apps-images/people-files.png =================================================================== (Binary files differ) Property changes on: haiku/trunk/docs/userguide/images/apps-images/people-files.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: haiku/trunk/docs/userguide/images/apps-images/people.png =================================================================== (Binary files differ) Property changes on: haiku/trunk/docs/userguide/images/apps-images/people.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream From mattmadia at gmail.com Mon May 11 18:13:54 2009 From: mattmadia at gmail.com (Matt Madia) Date: Mon, 11 May 2009 16:13:54 +0000 Subject: [Haiku-commits] r30705 - haiku/trunk/docs/userguide/en/installation In-Reply-To: <4A084C0A.1050809@googlemail.com> References: <200905111536.n4BFafSl014826@sheep.berlios.de> <1e80d8750905110847u7b820493n15334f89d87495fb@mail.gmail.com> <4A084C0A.1050809@googlemail.com> Message-ID: <1e42d8c50905110913s19f548ceg4dff5f9696b9e630@mail.gmail.com> On Mon, May 11, 2009 at 4:02 PM, Humdinger wrote: > One thing's now a bit awkward: > > case "disk" : { > > } > > The "disk" case is now completely empty. But I don't want to remove it as for this guide > it's useful to show how it works. > Any idea what we could put there? Maybe just some other optional package? case "disk" : { # When the BuildProfile $(type) = "disk", the following is not necessary. # HAIKU_DONT_CLEAR_IMAGE = 1 ; # haiku/trunk/build/jam/MiscRules explicitly sets this variable in this case. } --mmadia From anevilyak at mail.berlios.de Mon May 11 18:39:27 2009 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Mon, 11 May 2009 18:39:27 +0200 Subject: [Haiku-commits] r30708 - haiku/trunk/build/jam Message-ID: <200905111639.n4BGdRRd030231@sheep.berlios.de> Author: anevilyak Date: 2009-05-11 18:39:21 +0200 (Mon, 11 May 2009) New Revision: 30708 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30708&view=rev Modified: haiku/trunk/build/jam/OptionalBuildFeatures Log: Patch by Matt Madia: Update OpenSSL to v0.9.8k. Thanks! Modified: haiku/trunk/build/jam/OptionalBuildFeatures =================================================================== --- haiku/trunk/build/jam/OptionalBuildFeatures 2009-05-11 16:12:53 UTC (rev 30707) +++ haiku/trunk/build/jam/OptionalBuildFeatures 2009-05-11 16:39:21 UTC (rev 30708) @@ -12,7 +12,7 @@ } local baseURL = http://haiku-files.org/files/optional-packages ; -HAIKU_OPENSSL_PACKAGE = openssl-0.9.8j-gcc2-2009-01-28 ; +HAIKU_OPENSSL_PACKAGE = openssl-0.9.8k-gcc2-haiku-2009-05-10 ; HAIKU_OPENSSL_URL = $(baseURL)/$(HAIKU_OPENSSL_PACKAGE).zip ; if $(HAIKU_BUILD_FEATURE_SSL) { From superstippi at gmx.de Mon May 11 18:42:19 2009 From: superstippi at gmx.de (=?ISO-8859-1?Q?Stephan_A=DFmus?=) Date: Mon, 11 May 2009 18:42:19 +0200 Subject: [Haiku-commits] r30705 - haiku/trunk/docs/userguide/en/installation In-Reply-To: <4A084C0A.1050809@googlemail.com> References: <200905111536.n4BFafSl014826@sheep.berlios.de> <1e80d8750905110847u7b820493n15334f89d87495fb@mail.gmail.com> <4A084C0A.1050809@googlemail.com> Message-ID: <4A08556B.1050109@gmx.de> Humdinger schrieb: > Urias McCullough wrote: >>> I'm woefully ignorant of the intricacies of our buildsystem, so I just accepted that >>> and ran with it. :) Thanks Matt (and Urias by proxy). >> There's no need to be ignorant :) >> >> Take a look here, and you can see how the different build profiles work: >> >> http://dev.haiku-os.org/browser/haiku/trunk/build/jam/MiscRules#L268 >> >> Specifically, it's line 321 which sets the HAIKU_DONT_CLEAR_IMAGE when profile type is >> "disk". >> >> Hope that helps clear it up :D > > Thanks, I'm feeling a bit less ignorant now. :) > > One thing's now a bit awkward: > > case "disk" : { > > } > > The "disk" case is now completely empty. But I don't want to remove it as for this guide > it's useful to show how it works. > Any idea what we could put there? Maybe just some other optional package? Yes, some other optional package should suffice. Maybe you can use the space to show other tricks that have not already been shown, like adding more targets from the build, or unzipping something located on the host system onto the image. Best regards, -Stephan Best regards, -Stephan From philippe.houdoin at gmail.com Mon May 11 19:30:00 2009 From: philippe.houdoin at gmail.com (Philippe Houdoin) Date: Mon, 11 May 2009 19:30:00 +0200 Subject: [Haiku-commits] r30705 - haiku/trunk/docs/userguide/en/installation Message-ID: Hi, > One thing's now a bit awkward: > > case "disk" : { > > } > > The "disk" case is now completely empty. But I don't want to remove it as for this guide > it's useful to show how it works. > Any idea what we could put there? Maybe just some other optional package? What about this: case "disk" : { HAIKU_IMAGE_LABEL = CustomHaikuBuild ; } Bye, Philippe. From axeld at pinc-software.de Mon May 11 20:49:08 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Mon, 11 May 2009 20:49:08 +0200 CEST Subject: [Haiku-commits] r30699 - haiku/trunk/src/preferences/keymap In-Reply-To: <20090511121149.745.3@bepc.1242027499.fake> Message-ID: <42199401047-BeMail@zon> Oliver Tappe wrote: > On 2009-05-10 at 22:24:41 [+0200], Axel D?rfler > > wrote: > > The "sample" textview in the Keymap preferences should always work > > with > > the keymap you see on screen; it should be independent from the one > > in > > use - however, deadkey handling is done in the input_server (you > > don't > > even get a notice that a key has been pressed), so deadkeys can't > > work > > this way. > > Not sure how to handle this better, but I guess we could have an > > extra > > message sent from the input_server for deadkeys, too. Otherwise, > > intercepting the input method stuff could work, as that already > > does > > something like that to be able to draw the highlighting for > > BTextViews. > Ok, I will have a look at that today. Great! > Apart from the need to implement drag and drop for the composed > characters > resulting from pressing a dead key and a second key, I wonder if it > makes > sense to add support to the Keymap preflet for changing the dead keys > at all, > and if so, in what way. Three options came to my mind: > > 1. Do not bother to change anything and let the "power user" edit the > keymap > by hand. > > 2. Add a menu to the preflet where the user can chose from a given > set of > concrete dead key characters for each of the five dead keys: > 0xC2B4 and ' for Acute > ` for Grave > ^ for Circumflex > 0xC2A8 and " for Diaeresis (maybe : too?) > ~ for Tilde > This is easy to implement, but would lock the set of supported dead > key > characters. > > 3. Add one text control for each of the five dead keys, allowing the > user to > enter whatever character should be used as the trigger character for > that > specific dead key. This is obiously the most flexible, but would > require > quite some screen space and might be confusing for new users. Perhaps > it > could be moved to an 'Advanded' tab-page? > > I personally like solution 2, as I find that the best compromise > between > simplicity and configurability. I would lean to 2) as well, but one could also add a list view that is only visible when a dead key is selected, and solve it using this one. We also need a table that includes all modifier keys, so you cannot lose them that easily :-) Bye, Axel. From kirilla at mail.berlios.de Mon May 11 21:31:19 2009 From: kirilla at mail.berlios.de (kirilla at BerliOS) Date: Mon, 11 May 2009 21:31:19 +0200 Subject: [Haiku-commits] r30709 - haiku/trunk/src/apps/stylededit Message-ID: <200905111931.n4BJVJSJ021605@sheep.berlios.de> Author: kirilla Date: 2009-05-11 21:31:18 +0200 (Mon, 11 May 2009) New Revision: 30709 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30709&view=rev Modified: haiku/trunk/src/apps/stylededit/StyledEditApp.cpp Log: Partial revert. Reimplementing the previous behaviour of accounting for differences in current working directory between the running single-launch process and later invocations of the same, as this is necessary to handle correctly any relative paths given on the command-line. Added comment. Modified: haiku/trunk/src/apps/stylededit/StyledEditApp.cpp =================================================================== --- haiku/trunk/src/apps/stylededit/StyledEditApp.cpp 2009-05-11 16:39:21 UTC (rev 30708) +++ haiku/trunk/src/apps/stylededit/StyledEditApp.cpp 2009-05-11 19:31:18 UTC (rev 30709) @@ -245,8 +245,48 @@ void StyledEditApp::ArgvReceived(int32 argc, char* argv[]) { + // StyledEdit has the "single launch" flag set in its + // resources. This means that while StyledEdit is running, + // additional StyledEdit invocations will not result in a + // new process but re-use the existing one, calling the + // hook methods of the BApplication subclass: ArgvReceived(), + // RefsReceived() or MessageReceived(B_SILENT_RELAUNCH), + // depending on the nature of the invocation. + + // An implication of this relevant to ArgvReceived() is + // that the running application might have a current + // working directory different from the one of a later + // invocation. Arguments received from the later invocation, + // if having relative paths, will be incorrect when + // interpreted as relative to the current working directory. + + // BApplication's ArgvReceived() method does not supply + // the cwd of the invocation, but the BMessage by which + // the arguments get communicated to the BApplication + // supplies a cwd string. So we ask the BApplication, + // to show the current message - the one that triggered + // the ArgvReceived() hook method - extract the cwd + // string from it and patch any relative paths in argv. + + // This does not take into account --option handling + // and how to avoid prepending a path to such arguments + + const char* cwd = ""; + BMessage* message = CurrentMessage(); + + if (message != NULL) { + if (message->FindString("cwd", &cwd) != B_OK) + cwd = ""; + } + for (int i = 1 ; (i < argc) ; i++) { - BPath path(argv[i]); + BPath path; + if (argv[i][0] == '/') + path.SetTo(argv[i]); + else + path.SetTo(cwd, argv[i]); + // patch relative paths only + entry_ref ref; get_ref_for_path(path.Path(), &ref); From mmlr at mail.berlios.de Tue May 12 00:35:55 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Tue, 12 May 2009 00:35:55 +0200 Subject: [Haiku-commits] r30710 - haiku/trunk/src/add-ons/kernel/busses/usb Message-ID: <200905112235.n4BMZtjT018762@sheep.berlios.de> Author: mmlr Date: 2009-05-12 00:35:50 +0200 (Tue, 12 May 2009) New Revision: 30710 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30710&view=rev Modified: haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp haiku/trunk/src/add-ons/kernel/busses/usb/uhci_hardware.h Log: * Move the actual and maximum length calculation into two inline functions. * Use those to make sure the size is retrieved correctly in all cases (which it wasn't in the short packet tests). * Don't detect short packets for control transfers as we need the status packet to finish the transfer and cannot quit earlier. * Only check for short packets when we also have the short packet flag set. Modified: haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp 2009-05-11 19:31:18 UTC (rev 30709) +++ haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp 2009-05-11 22:35:50 UTC (rev 30710) @@ -684,8 +684,8 @@ } if ((descriptor->link_phy & TD_TERMINATE) - || (descriptor->status & TD_STATUS_ACTLEN_MASK) - < (descriptor->token >> TD_TOKEN_MAXLEN_SHIFT)) { + || uhci_td_actual_length(descriptor) + < uhci_td_maximum_length(descriptor)) { transferOK = true; break; } @@ -1295,8 +1295,9 @@ } if ((descriptor->link_phy & TD_TERMINATE) - || (descriptor->status & TD_STATUS_ACTLEN_MASK) - < (descriptor->token >> TD_TOKEN_MAXLEN_SHIFT)) { + || ((descriptor->status & TD_CONTROL_SPD) != 0 + && uhci_td_actual_length(descriptor) + < uhci_td_maximum_length(descriptor))) { // all descriptors are done, or we have a short packet TRACE("td (0x%08lx) ok\n", descriptor->this_phy); callbackStatus = B_OK; @@ -1903,7 +1904,8 @@ result->status |= TD_CONTROL_ISOCHRONOUS; else { result->status |= TD_CONTROL_3_ERRORS; - if (direction == TD_TOKEN_IN) + if (direction == TD_TOKEN_IN + && (pipe->Type() & USB_OBJECT_CONTROL_PIPE) == 0) result->status |= TD_CONTROL_SPD; } if (pipe->Speed() == USB_SPEED_LOWSPEED) @@ -2086,9 +2088,7 @@ break; dataToggle = (current->token >> TD_TOKEN_DATA_TOGGLE_SHIFT) & 0x01; - size_t bufferSize = (current->status & TD_STATUS_ACTLEN_MASK) + 1; - if (bufferSize == TD_STATUS_ACTLEN_NULL + 1) - bufferSize = 0; + size_t bufferSize = uhci_td_actual_length(current); while (true) { size_t length = min_c(bufferSize - bufferOffset, @@ -2144,11 +2144,7 @@ uint8 dataToggle = 0; while (current && (current->status & TD_STATUS_ACTIVE) == 0) { - size_t length = (current->status & TD_STATUS_ACTLEN_MASK) + 1; - if (length == TD_STATUS_ACTLEN_NULL + 1) - length = 0; - - actualLength += length; + actualLength += uhci_td_actual_length(current); dataToggle = (current->token >> TD_TOKEN_DATA_TOGGLE_SHIFT) & 0x01; if (current->link_phy & TD_TERMINATE) @@ -2191,11 +2187,8 @@ uhci_td *current = transfer->descriptors[i]; size_t bufferSize = current->buffer_size; - size_t actualLength = (current->status & TD_STATUS_ACTLEN_MASK) + 1; + size_t actualLength = uhci_td_actual_length(current); - if (actualLength == TD_STATUS_ACTLEN_NULL + 1) - actualLength = 0; - isochronousData->packet_descriptors[i].actual_length = actualLength; if (actualLength > 0) Modified: haiku/trunk/src/add-ons/kernel/busses/usb/uhci_hardware.h =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/uhci_hardware.h 2009-05-11 19:31:18 UTC (rev 30709) +++ haiku/trunk/src/add-ons/kernel/busses/usb/uhci_hardware.h 2009-05-11 22:35:50 UTC (rev 30710) @@ -140,6 +140,26 @@ #define TD_LINK_MASK 0xfffffff0 +static inline size_t +uhci_td_maximum_length(uhci_td *descriptor) +{ + size_t length = (descriptor->token >> TD_TOKEN_MAXLEN_SHIFT) + 1; + if (length == TD_STATUS_ACTLEN_NULL + 1) + return 0; + return length; +} + + +static inline size_t +uhci_td_actual_length(uhci_td *descriptor) +{ + size_t length = (descriptor->status & TD_STATUS_ACTLEN_MASK) + 1; + if (length == TD_STATUS_ACTLEN_NULL + 1) + return 0; + return length; +} + + // Represents a Queue Head (QH) typedef struct { From jonas at kirilla.com Tue May 12 00:57:13 2009 From: jonas at kirilla.com (Jonas =?iso-8859-1?q?Sundstr=F6m?=) Date: Tue, 12 May 2009 00:57:13 +0200 CEST Subject: [Haiku-commits] r30702 - in haiku/trunk: headers/private headers/private/support src/bin src/kits/support In-Reply-To: <1554418429-BeMail@kirilla> Message-ID: <23298105645-BeMail@kirilla> "Jonas Sundstr?m" wrote: > "Axel D?rfler" wrote: ... > > Our coding style asks for a different kind > > of indentation for class headers... ... > > Public members in a supposed to be one-day- > > public class? Why the getters in the first > > place then? > > Will fix these tonight. Thanks. New ETA: tomorrow. I've made changes which I think are fine, but I need a little more time to test some of the adaptations I did in urlwrapper. Committing them separately would break the build. (Url.cpp/.h and urlwrapper.cpp/.h) And yes, my keys '<|>' are in order now. ;) /Jonas. From mmlr at mail.berlios.de Tue May 12 01:33:01 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Tue, 12 May 2009 01:33:01 +0200 Subject: [Haiku-commits] r30711 - haiku/trunk/src/add-ons/kernel/bus_managers/usb Message-ID: <200905112333.n4BNX19v013737@sheep.berlios.de> Author: mmlr Date: 2009-05-12 01:32:59 +0200 (Tue, 12 May 2009) New Revision: 30711 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30711&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/usb/Transfer.cpp Log: In case we already did initialize and prepare kernel access, no need to do it again. Especially not because it'd likely fail because we are now most probably in the kernel. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/usb/Transfer.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/usb/Transfer.cpp 2009-05-11 22:35:50 UTC (rev 30710) +++ haiku/trunk/src/add-ons/kernel/bus_managers/usb/Transfer.cpp 2009-05-11 23:32:59 UTC (rev 30711) @@ -126,6 +126,10 @@ status_t Transfer::InitKernelAccess() { + // nothing to do if we are already prepared + if (fClonedArea >= B_OK) + return B_OK; + // we might need to access a buffer in userspace. this will not // be possible in the kernel space finisher thread unless we // get the proper area id for the space we need and then clone it From mmlr at mail.berlios.de Tue May 12 01:37:31 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Tue, 12 May 2009 01:37:31 +0200 Subject: [Haiku-commits] r30712 - haiku/trunk/src/add-ons/kernel/busses/usb Message-ID: <200905112337.n4BNbV05029515@sheep.berlios.de> Author: mmlr Date: 2009-05-12 01:37:30 +0200 (Tue, 12 May 2009) New Revision: 30712 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30712&view=rev Modified: haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp Log: * Simplify the way fragmented transfers are resubmited. * This also paves the way for a different way to handle transfer freeing. * Also fixes that errors in reappending would previously not be propagated to the caller. Modified: haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp 2009-05-11 23:32:59 UTC (rev 30711) +++ haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp 2009-05-11 23:37:30 UTC (rev 30712) @@ -1361,31 +1361,20 @@ TRACE("still %ld bytes left on transfer\n", transfer->transfer->VectorLength()); + Transfer *resubmit = transfer->transfer; + // free the used descriptors transfer->queue->RemoveTransfer(transfer->transfer_queue); FreeDescriptorChain(transfer->first_descriptor); // resubmit the advanced transfer so the rest // of the buffers are transmitted over the bus - transfer->transfer->PrepareKernelAccess(); - status_t result = CreateFilledTransfer(transfer->transfer, - &transfer->first_descriptor, - &transfer->transfer_queue); - transfer->data_descriptor = transfer->first_descriptor; - if (result == B_OK && Lock()) { - // reappend the transfer - if (fLastTransfer) - fLastTransfer->link = transfer; - if (!fFirstTransfer) - fFirstTransfer = transfer; + resubmit->PrepareKernelAccess(); + if (SubmitTransfer(resubmit) != B_OK) + resubmit->Finished(B_ERROR, 0); - fLastTransfer = transfer; - Unlock(); - - transfer->queue->AppendTransfer(transfer->transfer_queue); - transfer = next; - continue; - } + transfer = next; + continue; } // the transfer is done, but we already set the From mmlr at mail.berlios.de Tue May 12 01:56:28 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Tue, 12 May 2009 01:56:28 +0200 Subject: [Haiku-commits] r30713 - haiku/trunk/src/add-ons/kernel/busses/usb Message-ID: <200905112356.n4BNuSXU030633@sheep.berlios.de> Author: mmlr Date: 2009-05-12 01:56:26 +0200 (Tue, 12 May 2009) New Revision: 30713 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30713&view=rev Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ehci.h haiku/trunk/src/add-ons/kernel/busses/usb/ohci.h haiku/trunk/src/add-ons/kernel/busses/usb/uhci.h Log: Cleanup. Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ehci.h =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/ehci.h 2009-05-11 23:37:30 UTC (rev 30712) +++ haiku/trunk/src/add-ons/kernel/busses/usb/ehci.h 2009-05-11 23:56:26 UTC (rev 30713) @@ -5,7 +5,6 @@ * Authors: * Michael Lotz */ - #ifndef EHCI_H #define EHCI_H @@ -18,13 +17,13 @@ class EHCIRootHub; -typedef struct transfer_data_s { - Transfer *transfer; - ehci_qh *queue_head; - ehci_qtd *data_descriptor; +typedef struct transfer_data { + Transfer * transfer; + ehci_qh * queue_head; + ehci_qtd * data_descriptor; bool incoming; bool canceled; - transfer_data_s *link; + transfer_data * link; } transfer_data; @@ -75,7 +74,7 @@ void Cleanup(); // Queue Head functions - ehci_qh *CreateQueueHead(); + ehci_qh * CreateQueueHead(); status_t InitQueueHead(ehci_qh *queueHead, Pipe *pipe); void FreeQueueHead(ehci_qh *queueHead); @@ -97,7 +96,8 @@ bool *directionIn); // Descriptor functions - ehci_qtd *CreateDescriptor(size_t bufferSizeToAllocate, + ehci_qtd * CreateDescriptor( + size_t bufferSizeToAllocate, uint8 pid); status_t CreateDescriptorChain(Pipe *pipe, ehci_qtd **firstDescriptor, @@ -112,7 +112,8 @@ void LinkDescriptors(ehci_qtd *first, ehci_qtd *last, ehci_qtd *alt); - size_t WriteDescriptorChain(ehci_qtd *topDescriptor, + size_t WriteDescriptorChain( + ehci_qtd *topDescriptor, iovec *vector, size_t vectorCount); size_t ReadDescriptorChain(ehci_qtd *topDescriptor, iovec *vector, size_t vectorCount, @@ -129,36 +130,36 @@ inline uint16 ReadCapReg16(uint32 reg); inline uint32 ReadCapReg32(uint32 reg); -static pci_module_info *sPCIModule; +static pci_module_info * sPCIModule; - uint8 *fCapabilityRegisters; - uint8 *fOperationalRegisters; + uint8 * fCapabilityRegisters; + uint8 * fOperationalRegisters; area_id fRegisterArea; - pci_info *fPCIInfo; - Stack *fStack; + pci_info * fPCIInfo; + Stack * fStack; uint32 fEnabledInterrupts; // Periodic transfer framelist and interrupt entries area_id fPeriodicFrameListArea; - addr_t *fPeriodicFrameList; - interrupt_entry *fInterruptEntries; + addr_t * fPeriodicFrameList; + interrupt_entry * fInterruptEntries; // Async transfer queue management - ehci_qh *fAsyncQueueHead; + ehci_qh * fAsyncQueueHead; sem_id fAsyncAdvanceSem; // Maintain a linked list of transfers - transfer_data *fFirstTransfer; - transfer_data *fLastTransfer; + transfer_data * fFirstTransfer; + transfer_data * fLastTransfer; sem_id fFinishTransfersSem; thread_id fFinishThread; sem_id fCleanupSem; thread_id fCleanupThread; bool fStopThreads; - ehci_qh *fFreeListHead; + ehci_qh * fFreeListHead; // Root Hub - EHCIRootHub *fRootHub; + EHCIRootHub * fRootHub; uint8 fRootHubAddress; // Port management Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ohci.h =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/ohci.h 2009-05-11 23:37:30 UTC (rev 30712) +++ haiku/trunk/src/add-ons/kernel/busses/usb/ohci.h 2009-05-11 23:56:26 UTC (rev 30713) @@ -7,7 +7,6 @@ * Salvatore Benedetto * Michael Lotz */ - #ifndef OHCI_H #define OHCI_H @@ -19,15 +18,15 @@ struct pci_module_info; class OHCIRootHub; -typedef struct transfer_data_s { - Transfer *transfer; - ohci_endpoint_descriptor *endpoint; - ohci_general_td *first_descriptor; - ohci_general_td *data_descriptor; - ohci_general_td *last_descriptor; +typedef struct transfer_data { + Transfer * transfer; + ohci_endpoint_descriptor * endpoint; + ohci_general_td * first_descriptor; + ohci_general_td * data_descriptor; + ohci_general_td * last_descriptor; bool incoming; bool canceled; - transfer_data_s *link; + transfer_data * link; } transfer_data; @@ -89,15 +88,15 @@ transfer_data *transfer); // Endpoint related methods - ohci_endpoint_descriptor *_AllocateEndpoint(); + ohci_endpoint_descriptor * _AllocateEndpoint(); void _FreeEndpoint( ohci_endpoint_descriptor *endpoint); status_t _InsertEndpointForPipe(Pipe *pipe); status_t _RemoveEndpointForPipe(Pipe *pipe); - ohci_endpoint_descriptor *_FindInterruptEndpoint(uint8 interval); + ohci_endpoint_descriptor * _FindInterruptEndpoint(uint8 interval); // Transfer descriptor related methods - ohci_general_td *_CreateGeneralDescriptor( + ohci_general_td * _CreateGeneralDescriptor( size_t bufferSize); void _FreeGeneralDescriptor( ohci_general_td *descriptor); @@ -122,7 +121,7 @@ void _LinkDescriptors(ohci_general_td *first, ohci_general_td *second); - ohci_isochronous_td *_CreateIsochronousDescriptor(); + ohci_isochronous_td * _CreateIsochronousDescriptor(); void _FreeIsochronousDescriptor( ohci_isochronous_td *descriptor); @@ -140,33 +139,33 @@ void _PrintDescriptorChain( ohci_general_td *topDescriptor); -static pci_module_info *sPCIModule; - pci_info *fPCIInfo; - Stack *fStack; +static pci_module_info * sPCIModule; + pci_info * fPCIInfo; + Stack * fStack; - uint8 *fOperationalRegisters; + uint8 * fOperationalRegisters; area_id fRegisterArea; // Host Controller Communication Area related stuff area_id fHccaArea; - ohci_hcca *fHcca; - ohci_endpoint_descriptor **fInterruptEndpoints; + ohci_hcca * fHcca; + ohci_endpoint_descriptor ** fInterruptEndpoints; // Endpoint management mutex fEndpointLock; - ohci_endpoint_descriptor *fDummyControl; - ohci_endpoint_descriptor *fDummyBulk; - ohci_endpoint_descriptor *fDummyIsochronous; + ohci_endpoint_descriptor * fDummyControl; + ohci_endpoint_descriptor * fDummyBulk; + ohci_endpoint_descriptor * fDummyIsochronous; // Maintain a linked list of transfer - transfer_data *fFirstTransfer; - transfer_data *fLastTransfer; + transfer_data * fFirstTransfer; + transfer_data * fLastTransfer; sem_id fFinishTransfersSem; thread_id fFinishThread; bool fStopFinishThread; // Root Hub - OHCIRootHub *fRootHub; + OHCIRootHub * fRootHub; uint8 fRootHubAddress; // Port management Modified: haiku/trunk/src/add-ons/kernel/busses/usb/uhci.h =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/uhci.h 2009-05-11 23:37:30 UTC (rev 30712) +++ haiku/trunk/src/add-ons/kernel/busses/usb/uhci.h 2009-05-11 23:56:26 UTC (rev 30713) @@ -7,7 +7,6 @@ * Niels S. Reedijk * Salvatore Benedetto */ - #ifndef UHCI_H #define UHCI_H @@ -54,39 +53,39 @@ private: status_t fStatus; - Stack *fStack; - uhci_qh *fQueueHead; - uhci_td *fStrayDescriptor; - uhci_qh *fQueueTop; + Stack * fStack; + uhci_qh * fQueueHead; + uhci_td * fStrayDescriptor; + uhci_qh * fQueueTop; mutex fLock; }; -typedef struct transfer_data_s { - Transfer *transfer; - Queue *queue; - uhci_qh *transfer_queue; - uhci_td *first_descriptor; - uhci_td *data_descriptor; +typedef struct transfer_data { + Transfer * transfer; + Queue * queue; + uhci_qh * transfer_queue; + uhci_td * first_descriptor; + uhci_td * data_descriptor; bool incoming; bool canceled; - transfer_data_s *link; + transfer_data * link; } transfer_data; // This structure is used to create a list of // descriptors per isochronous transfer -typedef struct isochronous_transfer_data_s { - Transfer *transfer; +typedef struct isochronous_transfer_data { + Transfer * transfer; // The next field is used to keep track // of every isochronous descriptor as they are NOT // linked to each other in a queue like in every other // transfer type - uhci_td **descriptors; + uhci_td ** descriptors; uint16 last_to_process; bool incoming; bool is_active; - isochronous_transfer_data_s *link; + isochronous_transfer_data * link; } isochronous_transfer_data; @@ -145,22 +144,22 @@ // Isochronous transfer functions static int32 FinishIsochronousThread(void *data); void FinishIsochronousTransfers(); - isochronous_transfer_data *FindIsochronousTransfer(uhci_td *descriptor); + isochronous_transfer_data * FindIsochronousTransfer(uhci_td *descriptor); status_t LinkIsochronousDescriptor( uhci_td *descriptor, uint16 frame); - uhci_td *UnlinkIsochronousDescriptor(uint16 frame); + uhci_td * UnlinkIsochronousDescriptor(uint16 frame); // Transfer queue functions - uhci_qh *CreateTransferQueue(uhci_td *descriptor); + uhci_qh * CreateTransferQueue(uhci_td *descriptor); void FreeTransferQueue(uhci_qh *queueHead); bool LockIsochronous(); void UnlockIsochronous(); // Descriptor functions - uhci_td *CreateDescriptor(Pipe *pipe, + uhci_td * CreateDescriptor(Pipe *pipe, uint8 direction, size_t bufferSizeToAllocate); status_t CreateDescriptorChain(Pipe *pipe, @@ -198,51 +197,50 @@ inline uint16 ReadReg16(uint32 reg); inline uint32 ReadReg32(uint32 reg); -static pci_module_info *sPCIModule; +static pci_module_info * sPCIModule; uint32 fRegisterBase; - pci_info *fPCIInfo; - Stack *fStack; + pci_info * fPCIInfo; + Stack * fStack; uint32 fEnabledInterrupts; // Frame list memory area_id fFrameArea; - uint32 *fFrameList; + uint32 * fFrameList; // fFrameBandwidth[n] holds the available bandwidth // of the nth frame in microseconds - uint16 *fFrameBandwidth; + uint16 * fFrameBandwidth; // fFirstIsochronousTransfer[n] and fLastIsochronousDescriptor[n] // keeps track of the first and last isochronous transfer descriptor // in the nth frame - uhci_td **fFirstIsochronousDescriptor; - uhci_td **fLastIsochronousDescriptor; + uhci_td ** fFirstIsochronousDescriptor; + uhci_td ** fLastIsochronousDescriptor; // Queues int32 fQueueCount; - Queue **fQueues; + Queue ** fQueues; // Maintain a linked list of transfers - transfer_data *fFirstTransfer; - transfer_data *fLastTransfer; + transfer_data * fFirstTransfer; + transfer_data * fLastTransfer; sem_id fFinishTransfersSem; thread_id fFinishThread; bool fStopFinishThread; // Maintain a linked list of isochronous transfers - isochronous_transfer_data *fFirstIsochronousTransfer; - isochronous_transfer_data *fLastIsochronousTransfer; + isochronous_transfer_data * fFirstIsochronousTransfer; + isochronous_transfer_data * fLastIsochronousTransfer; sem_id fFinishIsochronousTransfersSem; thread_id fFinishIsochronousThread; mutex fIsochronousLock; bool fStopFinishIsochronousThread; // Root hub - UHCIRootHub *fRootHub; + UHCIRootHub * fRootHub; uint8 fRootHubAddress; uint8 fPortResetChange; - }; From mmlr at mail.berlios.de Tue May 12 03:55:17 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Tue, 12 May 2009 03:55:17 +0200 Subject: [Haiku-commits] r30714 - haiku/trunk/src/add-ons/kernel/busses/usb Message-ID: <200905120155.n4C1tHOI009966@sheep.berlios.de> Author: mmlr Date: 2009-05-12 03:55:15 +0200 (Tue, 12 May 2009) New Revision: 30714 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30714&view=rev Modified: haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp haiku/trunk/src/add-ons/kernel/busses/usb/uhci.h Log: Do not free the descriptor chains and transfer queue head directly when finishing transfers. The host controller might still be using some of those structures. In the (unlikely) case that a freed memory chunk would be immediately re-used and filled with new values this would lead the controller to either find invalid values and assert a process error or it could follow invalid list links leading to host system errors. We have to wait with freeing until the controller processing the next frame to make sure this cannot happen. The unlikely case should also have been the cause of bug #2481. Modified: haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp 2009-05-11 23:56:26 UTC (rev 30713) +++ haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp 2009-05-12 01:55:15 UTC (rev 30714) @@ -334,12 +334,15 @@ fLastTransfer(NULL), fFinishTransfersSem(-1), fFinishThread(-1), - fStopFinishThread(false), + fStopThreads(false), + fFreeList(NULL), + fCleanupThread(-1), + fCleanupSem(-1), + fCleanupCount(0), fFirstIsochronousTransfer(NULL), fLastIsochronousTransfer(NULL), fFinishIsochronousTransfersSem(-1), fFinishIsochronousThread(-1), - fStopFinishIsochronousThread(false), fRootHub(NULL), fRootHubAddress(0), fPortResetChange(0) @@ -456,18 +459,28 @@ fLastIsochronousDescriptor[i] = NULL; } - // Create semaphore the finisher thread will wait for + // Create semaphore the finisher and cleanup threads will wait for fFinishTransfersSem = create_sem(0, "UHCI Finish Transfers"); if (fFinishTransfersSem < B_OK) { TRACE_ERROR("failed to create finisher semaphore\n"); return; } - // Create the finisher service thread + fCleanupSem = create_sem(0, "UHCI Cleanup"); + if (fCleanupSem < B_OK) { + TRACE_ERROR("failed to create cleanup semaphore\n"); + return; + } + + // Create the finisher service and cleanup threads fFinishThread = spawn_kernel_thread(FinishThread, "uhci finish thread", B_URGENT_DISPLAY_PRIORITY, (void *)this); resume_thread(fFinishThread); + fCleanupThread = spawn_kernel_thread(CleanupThread, + "uhci cleanup thread", B_NORMAL_PRIORITY, (void *)this); + resume_thread(fCleanupThread); + // Create a lock for the isochronous transfer list mutex_init(&fIsochronousLock, "UHCI isochronous lock"); @@ -519,11 +532,12 @@ #endif int32 result = 0; - fStopFinishThread = true; - fStopFinishIsochronousThread = true; + fStopThreads = true; delete_sem(fFinishTransfersSem); + delete_sem(fCleanupSem); delete_sem(fFinishIsochronousTransfersSem); wait_for_thread(fFinishThread, &result); + wait_for_thread(fCleanupThread, &result); wait_for_thread(fFinishIsochronousThread, &result); LockIsochronous(); @@ -1217,7 +1231,7 @@ void UHCI::FinishTransfers() { - while (!fStopFinishThread) { + while (!fStopThreads) { if (acquire_sem(fFinishTransfersSem) < B_OK) continue; @@ -1364,8 +1378,9 @@ Transfer *resubmit = transfer->transfer; // free the used descriptors - transfer->queue->RemoveTransfer(transfer->transfer_queue); - FreeDescriptorChain(transfer->first_descriptor); + transfer->queue->RemoveTransfer( + transfer->transfer_queue); + AddToFreeList(transfer); // resubmit the advanced transfer so the rest // of the buffers are transmitted over the bus @@ -1388,18 +1403,85 @@ // remove and free the hardware queue and its descriptors transfer->queue->RemoveTransfer(transfer->transfer_queue); - FreeDescriptorChain(transfer->first_descriptor); - FreeTransferQueue(transfer->transfer_queue); - delete transfer->transfer; - delete transfer; + AddToFreeList(transfer); transfer = next; } } } +void +UHCI::AddToFreeList(transfer_data *transfer) +{ + transfer->free_after_frame = ReadReg16(UHCI_FRNUM); + if (!Lock()) + return; + + transfer->link = fFreeList; + fFreeList = transfer; + Unlock(); + + if (atomic_add(&fCleanupCount, 1) == 0) + release_sem(fCleanupSem); +} + + int32 +UHCI::CleanupThread(void *data) +{ + ((UHCI *)data)->Cleanup(); + return B_OK; +} + + +void +UHCI::Cleanup() +{ + while (!fStopThreads) { + if (acquire_sem(fCleanupSem) != B_OK) + continue; + + bigtime_t nextTime = system_time() + 1000; + while (atomic_get(&fCleanupCount) != 0) { + // wait for the frame to pass + snooze_until(nextTime, B_SYSTEM_TIMEBASE); + nextTime += 1000; + + if (!Lock()) + continue; + + // find the first entry we may free + transfer_data **link = &fFreeList; + transfer_data *transfer = fFreeList; + uint16 frameNumber = ReadReg16(UHCI_FRNUM); + while (transfer) { + if (transfer->free_after_frame != frameNumber) { + *link = NULL; + break; + } + + link = &transfer->link; + transfer = transfer->link; + } + + Unlock(); + + // the transfers below this one are all freeable + while (transfer) { + transfer_data *next = transfer->link; + FreeDescriptorChain(transfer->first_descriptor); + FreeTransferQueue(transfer->transfer_queue); + delete transfer; + atomic_add(&fCleanupCount, -1); + transfer = next; + } + } + } +} + + +int32 UHCI::FinishIsochronousThread(void *data) { ((UHCI *)data)->FinishIsochronousTransfers(); @@ -1415,7 +1497,7 @@ * of a transfer, it processes the entire transfer. */ - while (!fStopFinishIsochronousThread) { + while (!fStopThreads) { // Go to sleep if there are not isochronous transfer to process if (acquire_sem(fFinishIsochronousTransfersSem) < B_OK) return; Modified: haiku/trunk/src/add-ons/kernel/busses/usb/uhci.h =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/uhci.h 2009-05-11 23:56:26 UTC (rev 30713) +++ haiku/trunk/src/add-ons/kernel/busses/usb/uhci.h 2009-05-12 01:55:15 UTC (rev 30714) @@ -69,6 +69,7 @@ uhci_td * data_descriptor; bool incoming; bool canceled; + uint16 free_after_frame; transfer_data * link; } transfer_data; @@ -137,6 +138,10 @@ static int32 FinishThread(void *data); void FinishTransfers(); + void AddToFreeList(transfer_data *transfer); +static int32 CleanupThread(void *data); + void Cleanup(); + status_t CreateFilledTransfer(Transfer *transfer, uhci_td **_firstDescriptor, uhci_qh **_transferQueue); @@ -227,15 +232,19 @@ transfer_data * fLastTransfer; sem_id fFinishTransfersSem; thread_id fFinishThread; - bool fStopFinishThread; + bool fStopThreads; + transfer_data * fFreeList; + thread_id fCleanupThread; + sem_id fCleanupSem; + int32 fCleanupCount; + // Maintain a linked list of isochronous transfers isochronous_transfer_data * fFirstIsochronousTransfer; isochronous_transfer_data * fLastIsochronousTransfer; sem_id fFinishIsochronousTransfersSem; thread_id fFinishIsochronousThread; mutex fIsochronousLock; - bool fStopFinishIsochronousThread; // Root hub UHCIRootHub * fRootHub; From mattmadia at gmail.com Tue May 12 05:12:02 2009 From: mattmadia at gmail.com (Matt Madia) Date: Tue, 12 May 2009 03:12:02 +0000 Subject: [Haiku-commits] r30706 - in haiku/trunk/docs/userguide/en: . applications In-Reply-To: <200905111608.n4BG8RZB019979@sheep.berlios.de> References: <200905111608.n4BG8RZB019979@sheep.berlios.de> Message-ID: <1e42d8c50905112012o14fe7eb1r14aaec33ee625a88@mail.gmail.com> On Mon, May 11, 2009 at 4:08 PM, wrote: > Removed: > haiku/trunk/docs/userguide/en/installation.html I think you meant to remove haiku/trunk/docs/userguide/en/installing.html --mmadia From superstippi at gmx.de Tue May 12 08:03:45 2009 From: superstippi at gmx.de (Stephan Assmus) Date: Tue, 12 May 2009 08:03:45 +0200 Subject: [Haiku-commits] r30714 - haiku/trunk/src/add-ons/kernel/busses/usb In-Reply-To: <200905120155.n4C1tHOI009966@sheep.berlios.de> References: <200905120155.n4C1tHOI009966@sheep.berlios.de> Message-ID: <20090512080345.340.1@bepc.1242107982.fake> On 2009-05-12 at 02:55:17 [+0200], mmlr at mail.berlios.de wrote: > Author: mmlr > Date: 2009-05-12 03:55:15 +0200 (Tue, 12 May 2009) New Revision: 30714 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30714&view=rev > > Modified: > haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp > haiku/trunk/src/add-ons/kernel/busses/usb/uhci.h > Log: > Do not free the descriptor chains and transfer queue head directly when > finishing transfers. The host controller might still be using some of > those structures. In the (unlikely) case that a freed memory chunk would > be immediately re-used and filled with new values this would lead the > controller to either find invalid values and assert a process error or it > could follow invalid list links leading to host system errors. We have to > wait with freeing until the controller processing the next frame to make > sure this cannot happen. The unlikely case should also have been the > cause of bug #2481. YAY!! Thanks so much! Best regards, -Stephan From axeld at pinc-software.de Tue May 12 10:53:38 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Tue, 12 May 2009 10:53:38 +0200 CEST Subject: [Haiku-commits] r30709 - haiku/trunk/src/apps/stylededit In-Reply-To: <200905111931.n4BJVJSJ021605@sheep.berlios.de> Message-ID: <7635773795-BeMail@zon> kirilla at BerliOS wrote: > Log: > Partial revert. Reimplementing the previous behaviour of accounting > for > differences in current working directory between the running single- > launch > process and later invocations of the same, as this is necessary to > handle > correctly any relative paths given on the command-line. Added > comment. Great, thanks! > StyledEditApp::ArgvReceived(int32 argc, char* argv[]) > { > + // StyledEdit has the "single launch" flag set in its > + // resources. This means that while StyledEdit is running, > + // additional StyledEdit invocations will not result in a > + // new process but re-use the existing one, calling the > + // hook methods of the BApplication subclass: ArgvReceived(), > + // RefsReceived() or MessageReceived(B_SILENT_RELAUNCH), > + // depending on the nature of the invocation. > + > + // An implication of this relevant to ArgvReceived() is > + // that the running application might have a current > + // working directory different from the one of a later > + // invocation. Arguments received from the later invocation, > + // if having relative paths, will be incorrect when > + // interpreted as relative to the current working directory. > + > + // BApplication's ArgvReceived() method does not supply > + // the cwd of the invocation, but the BMessage by which > + // the arguments get communicated to the BApplication > + // supplies a cwd string. So we ask the BApplication, > + // to show the current message - the one that triggered > + // the ArgvReceived() hook method - extract the cwd > + // string from it and patch any relative paths in argv. > + > + // This does not take into account --option handling > + // and how to avoid prepending a path to such arguments I am a friend of short comments, though - the essence of this should not need more than a few lines, I would assume :-) > for (int i = 1 ; (i < argc) ; i++) { > - BPath path(argv[i]); > + BPath path; > + if (argv[i][0] == '/') > + path.SetTo(argv[i]); > + else > + path.SetTo(cwd, argv[i]); > + // patch relative paths only Please use {} in multi-line statements (that also includes comments). I like this version a lot better than the previous one! Bye, Axel. From axeld at pinc-software.de Tue May 12 10:56:39 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Tue, 12 May 2009 10:56:39 +0200 CEST Subject: [Haiku-commits] r30702 - in haiku/trunk: headers/private headers/private/support src/bin src/kits/support In-Reply-To: <23298105645-BeMail@kirilla> Message-ID: <7816890469-BeMail@zon> "Jonas Sundstr?m" wrote: > And yes, my keys '<|>' are in order now. ;) Wohoo! :-) BTW I didn't mean to be disrespectful when I claimed you shouldn't change code you do not fully understand; we just have to be very careful not to introduce new regressions in new changes. Some code (like this one) deserves to be refactored and needs some comments to be easier to grasp, and to be able to understand the side effects of eventual changes. Tracker, for example, is very error prone even when doing minor changes. Bye, Axel. From anevilyak at gmail.com Tue May 12 16:02:39 2009 From: anevilyak at gmail.com (Rene Gollent) Date: Tue, 12 May 2009 09:02:39 -0500 Subject: [Haiku-commits] r30714 - haiku/trunk/src/add-ons/kernel/busses/usb In-Reply-To: <20090512080345.340.1@bepc.1242107982.fake> References: <200905120155.n4C1tHOI009966@sheep.berlios.de> <20090512080345.340.1@bepc.1242107982.fake> Message-ID: On Tue, May 12, 2009 at 1:03 AM, Stephan Assmus wrote: > > YAY!! Thanks so much! I guess that means 2481 is fixed for you? :) Regards, Rene From dlmcpaul at mail.berlios.de Tue May 12 16:27:26 2009 From: dlmcpaul at mail.berlios.de (dlmcpaul at BerliOS) Date: Tue, 12 May 2009 16:27:26 +0200 Subject: [Haiku-commits] r30715 - haiku/trunk/src/kits/media Message-ID: <200905121427.n4CERQWb023062@sheep.berlios.de> Author: dlmcpaul Date: 2009-05-12 16:27:26 +0200 (Tue, 12 May 2009) New Revision: 30715 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30715&view=rev Modified: haiku/trunk/src/kits/media/MediaRoster.cpp Log: Implement SniffRef Modified: haiku/trunk/src/kits/media/MediaRoster.cpp =================================================================== --- haiku/trunk/src/kits/media/MediaRoster.cpp 2009-05-12 01:55:15 UTC (rev 30714) +++ haiku/trunk/src/kits/media/MediaRoster.cpp 2009-05-12 14:27:26 UTC (rev 30715) @@ -2847,7 +2847,55 @@ BMediaRoster::SniffRef(const entry_ref& file, uint64 requireNodeKinds, dormant_node_info* _node, BMimeType* mimeType) { - UNIMPLEMENTED(); + CALLED(); + + TRACE("BMediaRoster::SniffRef looking for a node to handle %s : %Ld\n",file.name, requireNodeKinds); + + if (_node == NULL) + return B_BAD_VALUE; + + BMimeType aMimeType; + + dormant_node_info nodes[30]; + int32 count = 30; + int32 highestCapability = -1; + float capability; + + media_node node; + + // Get all dormant nodes using GetDormantNodes + if (B_OK == GetDormantNodes(nodes, &count, NULL, NULL, NULL, requireNodeKinds | B_FILE_INTERFACE, 0)) { + // Call SniffRefFor on each node that matches requireNodeKinds + for (int32 i=0;i References: <200905121427.n4CERQWb023062@sheep.berlios.de> Message-ID: <4A09886D.5060701@bug-br.org.br> dlmcpaul at BerliOS wrote: > Author: dlmcpaul > Date: 2009-05-12 16:27:26 +0200 (Tue, 12 May 2009) > New Revision: 30715 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30715&view=rev > > Modified: > haiku/trunk/src/kits/media/MediaRoster.cpp > Log: > Implement SniffRef This is great! Thanks for that. Is dragging a media file to Cortex working now (I am at work, can not test)? -Bruno From superstippi at gmx.de Tue May 12 18:18:32 2009 From: superstippi at gmx.de (Stephan Assmus) Date: Tue, 12 May 2009 18:18:32 +0200 Subject: [Haiku-commits] r30714 - haiku/trunk/src/add-ons/kernel/busses/usb In-Reply-To: References: <200905120155.n4C1tHOI009966@sheep.berlios.de> <20090512080345.340.1@bepc.1242107982.fake> Message-ID: <20090512181832.759.2@bepc.1242127971.fake> On 2009-05-12 at 15:02:39 [+0200], Rene Gollent wrote: > On Tue, May 12, 2009 at 1:03 AM, Stephan Assmus > wrote: > > > > YAY!! Thanks so much! > > I guess that means 2481 is fixed for you? :) I am still testing that. Usually, I would get it at least once over the course of a day, usually more often. So far, I have not seen it, but app_server did crash once so far, so the system isn't up since the morning anymore. I am very hopeful! :-) Best regards, -Stepha From axeld at pinc-software.de Tue May 12 19:13:31 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Tue, 12 May 2009 19:13:31 +0200 CEST Subject: [Haiku-commits] r30715 - haiku/trunk/src/kits/media In-Reply-To: <200905121427.n4CERQWb023062@sheep.berlios.de> Message-ID: <37628918510-BeMail@zon> dlmcpaul at BerliOS wrote: > + // Get all dormant nodes using GetDormantNodes > + if (B_OK == GetDormantNodes(nodes, &count, NULL, NULL, NULL, > requireNodeKinds | > B_FILE_INTERFACE, 0)) { > + // Call SniffRefFor on each node that matches requireNodeKinds > + for (int32 i=0;i + if (B_OK == InstantiateDormantNode(nodes[i],&node)) { > + > + if (B_OK == SniffRefFor(node,file,&aMimeType,& > capability)) { David, please have a look at our coding style guide! The (B_OK == ...) is explicitly forbidden there, and please use spaces between terms and after commas! Bye, Axel. From humdingerb at googlemail.com Tue May 12 19:41:12 2009 From: humdingerb at googlemail.com (Humdinger) Date: Tue, 12 May 2009 19:41:12 +0200 Subject: [Haiku-commits] r30706 - in haiku/trunk/docs/userguide/en: . applications In-Reply-To: <1e42d8c50905112012o14fe7eb1r14aaec33ee625a88@mail.gmail.com> References: <200905111608.n4BG8RZB019979@sheep.berlios.de> <1e42d8c50905112012o14fe7eb1r14aaec33ee625a88@mail.gmail.com> Message-ID: <4A09B4B8.6070608@googlemail.com> Matt Madia wrote: > On Mon, May 11, 2009 at 4:08 PM, wrote: >> Removed: >> haiku/trunk/docs/userguide/en/installation.html > > I think you meant to remove haiku/trunk/docs/userguide/en/installing.html Blast! You're right. This installation business is nothing but trouble... What's the right way to re-activate the removed installation.html file? I tried a bit with "svn revert" but apparently, I don't quite get its usage... Sorry for messing these normally easy things up. Regards, Humdinger -- --=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=- Deutsche Haiku News @ http://www.haiku-gazette.de From mattmadia at gmail.com Tue May 12 20:03:18 2009 From: mattmadia at gmail.com (Matt Madia) Date: Tue, 12 May 2009 18:03:18 +0000 Subject: [Haiku-commits] r30706 - in haiku/trunk/docs/userguide/en: . applications In-Reply-To: <4A09B4B8.6070608@googlemail.com> References: <200905111608.n4BG8RZB019979@sheep.berlios.de> <1e42d8c50905112012o14fe7eb1r14aaec33ee625a88@mail.gmail.com> <4A09B4B8.6070608@googlemail.com> Message-ID: <1e42d8c50905121103k61f018a3t74b35f7416f82d7b@mail.gmail.com> On Tue, May 12, 2009 at 5:41 PM, Humdinger wrote: > Matt Madia wrote: >> On Mon, May 11, 2009 at 4:08 PM, wrote: >>> Removed: >>> haiku/trunk/docs/userguide/en/installation.html >> >> I think you meant to remove haiku/trunk/docs/userguide/en/installing.html > > Blast! You're right. This installation business is nothing but trouble... > > What's the right way to re-activate the removed installation.html file? > I tried a bit with "svn revert" but apparently, I don't quite get its usage... > Sorry for messing these normally easy things up. > maybe : svn update -r 30705 haiku/trunk/docs/userguide/en/installation.html svn add haiku/trunk/docs/userguide/en/installation.html svn commit From stippi at mail.berlios.de Tue May 12 20:03:38 2009 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Tue, 12 May 2009 20:03:38 +0200 Subject: [Haiku-commits] r30716 - haiku/trunk/src/kits/tracker Message-ID: <200905121803.n4CI3cXR002773@sheep.berlios.de> Author: stippi Date: 2009-05-12 20:03:36 +0200 (Tue, 12 May 2009) New Revision: 30716 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30716&view=rev Modified: haiku/trunk/src/kits/tracker/AutoMounter.cpp haiku/trunk/src/kits/tracker/AutoMounter.h Log: * When inserting USB sticks, the read-only mount suggestion was completely bypassed, same for invoking "Mount All". Now, the "initial scan" parameter is used to decide if the user should be alarmed. Basically, it means you get to decide for every mounted volume if you want it rather read-only. In the old code: - If you wanted a stick mounted read-only, you had to go to "Tracker Settings" and disabled auto-ejecting, unmount the stick, then re-mount to get it to ask you for read-only mounting. - But then, it would remember this setting, so when you unplugged the stick and then replugged it, it would mount it read-only again. This may be nice for later, but for now, I want to decide if I am willing to take the risk each time. * The new code also has the implication that when you plug a drive with more than one partition, you are being asked for each one. I extended the alert to also mention the partition name. Modified: haiku/trunk/src/kits/tracker/AutoMounter.cpp =================================================================== --- haiku/trunk/src/kits/tracker/AutoMounter.cpp 2009-05-12 14:27:26 UTC (rev 30715) +++ haiku/trunk/src/kits/tracker/AutoMounter.cpp 2009-05-12 18:03:36 UTC (rev 30716) @@ -99,6 +99,70 @@ } +static bool +suggest_mount_flags(const BPartition* partition, uint32* _flags) +{ + uint32 mountFlags = 0; + + bool askReadOnly = true; + bool isBFS = false; + + if (partition->ContentType() != NULL + && strcmp(partition->ContentType(), kPartitionTypeBFS) == 0) { +#if 0 + askReadOnly = false; +#endif + isBFS = true; + } + + BDiskSystem diskSystem; + status_t status = partition->GetDiskSystem(&diskSystem); + if (status == B_OK && !diskSystem.SupportsWriting()) + askReadOnly = false; + + if (partition->IsReadOnly()) + askReadOnly = false; + + if (askReadOnly) { + // Suggest to the user to mount read-only until Haiku is more mature. + BString string; + string << "Mounting volume "; + if (partition->ContentName() != NULL) + string << "'" << partition->ContentName() << "'\n\n"; + else + string << "\n\n"; + // TODO: Use distro name instead of "Haiku"... + if (!isBFS) { + string << "The file system on this volume is not the Haiku file " + "system. It is strongly suggested to mount it in read-only " + "mode. "; + } else { + string << "It is suggested to mount all additional Haiku volumes " + "in read-only mode. "; + } + string << "This will prevent unintentional data loss because of " + "errors in Haiku."; + BAlert* alert = new BAlert("Mount Warning", string.String(), + "Mount Read/Write", "Cancel", "Mount Read-only", + B_WIDTH_FROM_WIDEST, B_WARNING_ALERT); + alert->SetShortcut(1, B_ESCAPE); + int32 choice = alert->Go(); + switch (choice) { + case 0: + break; + case 1: + return false; + case 2: + mountFlags |= B_MOUNT_READ_ONLY; + break; + } + } + + *_flags = mountFlags; + return true; +} + + void AutoMounter::_MountVolumes(mount_mode normal, mount_mode removable, bool initialRescan) @@ -158,11 +222,18 @@ } uint32 mountFlags; - BString mountFlagsKey(path.Path()); - mountFlagsKey << kMountFlagsKeyExtension; - if (fPrevious.FindInt32(mountFlagsKey.String(), - (int32*)&mountFlags) < B_OK) { - mountFlags = 0; + if (!fInitialRescan) { + // Ask the user about mount flags if this is not the + // initial scan. + if (!suggest_mount_flags(partition, &mountFlags)) + return false; + } else { + BString mountFlagsKey(path.Path()); + mountFlagsKey << kMountFlagsKeyExtension; + if (fPrevious.FindInt32(mountFlagsKey.String(), + (int32*)&mountFlags) < B_OK) { + mountFlags = 0; + } } if (partition->Mount(NULL, mountFlags) == B_OK @@ -190,68 +261,6 @@ } -bool -AutoMounter::_SuggestMountFlags(const BPartition* partition, - uint32* _flags) const -{ - uint32 mountFlags = 0; - - bool askReadOnly = true; - bool isBFS = false; - - if (partition->ContentType() != NULL - && strcmp(partition->ContentType(), kPartitionTypeBFS) == 0) { -#if 0 - askReadOnly = false; -#endif - isBFS = true; - } - - BDiskSystem diskSystem; - status_t status = partition->GetDiskSystem(&diskSystem); - if (status == B_OK && !diskSystem.SupportsWriting()) - askReadOnly = false; - - if (partition->IsReadOnly()) - askReadOnly = false; - - if (askReadOnly) { - // Suggest to the user to mount read-only until Haiku is more mature. - // TODO: would be nice to skip this for file systems which don't have - // support for writing anyways. - BString string; - // TODO: Use distro name instead of "Haiku"... - if (!isBFS) { - string << "The file system on this volume is not the Haiku file " - "system. It is strongly suggested to mount it in read-only " - "mode. "; - } else { - string << "It is suggested to mount all additional Haiku volumes " - "in read-only mode. "; - } - string << "This will prevent unintentional data loss because of " - "errors in Haiku."; - BAlert* alert = new BAlert("Mount Warning", string.String(), - "Mount Read/Write", "Cancel", "Mount Read-only", - B_WIDTH_FROM_WIDEST, B_WARNING_ALERT); - alert->SetShortcut(1, B_ESCAPE); - int32 choice = alert->Go(); - switch (choice) { - case 0: - break; - case 1: - return false; - case 2: - mountFlags |= B_MOUNT_READ_ONLY; - break; - } - } - - *_flags = mountFlags; - return true; -} - - void AutoMounter::_MountVolume(const BMessage* message) { @@ -266,7 +275,7 @@ return; uint32 mountFlags; - if (!_SuggestMountFlags(partition, &mountFlags)) + if (!suggest_mount_flags(partition, &mountFlags)) return; status_t status = partition->Mount(NULL, mountFlags); @@ -638,7 +647,8 @@ break; case B_DEVICE_UPDATE: - message->PrintToStream(); +printf("B_DEVICE_UPDATE\n"); +message->PrintToStream(); int32 event; if (message->FindInt32("event", &event) != B_OK || (event != B_DEVICE_MEDIA_CHANGED Modified: haiku/trunk/src/kits/tracker/AutoMounter.h =================================================================== --- haiku/trunk/src/kits/tracker/AutoMounter.h 2009-05-12 14:27:26 UTC (rev 30715) +++ haiku/trunk/src/kits/tracker/AutoMounter.h 2009-05-12 18:03:36 UTC (rev 30716) @@ -73,8 +73,6 @@ kRestorePreviousVolumes }; - bool _SuggestMountFlags(const BPartition* partition, - uint32* _flags) const; void _MountVolumes(mount_mode normal, mount_mode removable, bool initialRescan); void _MountVolume(const BMessage* message); From ingo_weinhold at gmx.de Tue May 12 20:04:54 2009 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Tue, 12 May 2009 20:04:54 +0200 Subject: [Haiku-commits] r30706 - in haiku/trunk/docs/userguide/en: . applications In-Reply-To: <4A09B4B8.6070608@googlemail.com> References: <200905111608.n4BG8RZB019979@sheep.berlios.de> <1e42d8c50905112012o14fe7eb1r14aaec33ee625a88@mail.gmail.com> <4A09B4B8.6070608@googlemail.com> Message-ID: <20090512200454.350.1@knochen-vm.localdomain> On 2009-05-12 at 19:41:12 [+0200], Humdinger wrote: > Matt Madia wrote: > > On Mon, May 11, 2009 at 4:08 PM, wrote: > >> Removed: > >> haiku/trunk/docs/userguide/en/installation.html > > > > I think you meant to remove haiku/trunk/docs/userguide/en/installing.html > > Blast! You're right. This installation business is nothing but trouble... > > What's the right way to re-activate the removed installation.html file? > I tried a bit with "svn revert" but apparently, I don't quite get its > usage... "svn revert" is only for local changes you want to undo. Since the change has already been committed, you'll have to copy the previous revision of the file from the repository: svn cp -r 30705 https://svn.berlios.de/svnroot/repos/haiku/haiku/trunk/docs/userguide/en/installation.html installation.html ... and commit it again. CU, Ingo From superstippi at gmx.de Tue May 12 20:06:22 2009 From: superstippi at gmx.de (Stephan Assmus) Date: Tue, 12 May 2009 20:06:22 +0200 Subject: [Haiku-commits] r30716 - haiku/trunk/src/kits/tracker In-Reply-To: <200905121803.n4CI3cXR002773@sheep.berlios.de> References: <200905121803.n4CI3cXR002773@sheep.berlios.de> Message-ID: <20090512200622.2530.5@bepc.1242127971.fake> On 2009-05-12 at 19:03:38 [+0200], stippi at mail.berlios.de wrote: > Author: stippi > Date: 2009-05-12 20:03:36 +0200 (Tue, 12 May 2009) New Revision: 30716 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30716&view=rev > > Modified: > haiku/trunk/src/kits/tracker/AutoMounter.cpp > haiku/trunk/src/kits/tracker/AutoMounter.h > Log: > * When inserting USB sticks, the read-only mount suggestion was completely > bypassed, same for invoking "Mount All". Now, the "initial scan" > parameter is used to decide if the user should be alarmed. Basically, > it means you get to decide for every mounted volume if you want it > rather read-only. > In the old code: > - If you wanted a stick mounted read-only, you had to go to "Tracker > Settings" > and disabled auto-ejecting, unmount the stick, then re-mount to get it > to ask you for read-only mounting. > - But then, it would remember this setting, so when you unplugged the > stick > and then replugged it, it would mount it read-only again. This may be > nice for later, but for now, I want to decide if I am willing to take > the risk each time. > * The new code also has the implication that when you plug a drive with > more > than one partition, you are being asked for each one. I extended the > alert to also mention the partition name. BTW, I just thought of it... using _MountVolumes() upon disk device notification the way it's currently done should result in mounting each and every removable volume, not only the just inserted one! Best regards, -Stephan From bonefish at mail.berlios.de Tue May 12 20:11:49 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Tue, 12 May 2009 20:11:49 +0200 Subject: [Haiku-commits] r30717 - haiku/trunk/src/kits/app Message-ID: <200905121811.n4CIBnL1004218@sheep.berlios.de> Author: bonefish Date: 2009-05-12 20:11:46 +0200 (Tue, 12 May 2009) New Revision: 30717 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30717&view=rev Modified: haiku/trunk/src/kits/app/Roster.cpp Log: When sending a B_ARGV_RECEIVED message also add a "cwd" field. Modified: haiku/trunk/src/kits/app/Roster.cpp =================================================================== --- haiku/trunk/src/kits/app/Roster.cpp 2009-05-12 18:03:36 UTC (rev 30716) +++ haiku/trunk/src/kits/app/Roster.cpp 2009-05-12 18:11:46 UTC (rev 30717) @@ -2423,12 +2423,19 @@ } } - // send B_ARGV_RECEIVED or B_REFS_RECEIVED or B_SILENT_RELAUNCH (if already running) + // send B_ARGV_RECEIVED or B_REFS_RECEIVED or B_SILENT_RELAUNCH (if + // already running) if (args && argc > 1) { BMessage message(B_ARGV_RECEIVED); message.AddInt32("argc", argc); for (int32 i = 0; i < argc; i++) message.AddString("argv", args[i]); + + // also add current working directory + char cwd[B_PATH_NAME_LENGTH]; + if (getcwd(cwd, B_PATH_NAME_LENGTH) != NULL) + message.AddString("cwd", cwd); + messenger.SendMessage(&message); } else if (ref) { printf("_SendToRunning : B_REFS_RECEIVED\n"); From humdingerb at googlemail.com Tue May 12 20:23:23 2009 From: humdingerb at googlemail.com (Humdinger) Date: Tue, 12 May 2009 20:23:23 +0200 Subject: [Haiku-commits] r30706 - in haiku/trunk/docs/userguide/en: . applications In-Reply-To: <1e42d8c50905121103k61f018a3t74b35f7416f82d7b@mail.gmail.com> References: <200905111608.n4BG8RZB019979@sheep.berlios.de> <1e42d8c50905112012o14fe7eb1r14aaec33ee625a88@mail.gmail.com> <4A09B4B8.6070608@googlemail.com> <1e42d8c50905121103k61f018a3t74b35f7416f82d7b@mail.gmail.com> Message-ID: <4A09BE9B.2080609@googlemail.com> bonefish wrote: > svn cp -r 30705 https://svn.berlios.de/svnroot/repos/haiku/haiku/trunk/docs/userguide/en/installation.html installation.html For some reason that didn't work for me. But... Matt Madia wrote: > maybe : > svn update -r 30705 haiku/trunk/docs/userguide/en/installation.html > svn add haiku/trunk/docs/userguide/en/installation.html > svn commit The first line worked, I have the file again locally. Only adding it back doesn't work: It's supposedly already under version control. Unfortunately I have to go now. I'll try again tomorrow. Or, if anyone else would like to solve the issue, be my guest. Regards, Humdinger -- --=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=- Deutsche Haiku News @ http://www.haiku-gazette.de From zooey at mail.berlios.de Tue May 12 20:31:18 2009 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Tue, 12 May 2009 20:31:18 +0200 Subject: [Haiku-commits] r30718 - haiku/trunk/src/preferences/keymap Message-ID: <200905121831.n4CIVIcs007751@sheep.berlios.de> Author: zooey Date: 2009-05-12 20:31:17 +0200 (Tue, 12 May 2009) New Revision: 30718 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30718&view=rev Modified: haiku/trunk/src/preferences/keymap/Keymap.cpp haiku/trunk/src/preferences/keymap/Keymap.h haiku/trunk/src/preferences/keymap/KeymapWindow.cpp haiku/trunk/src/preferences/keymap/KeymapWindow.h Log: * Added support for selecting the dead key trigger characters from a menubar, offering two choices for acute and diaeresis as well as allowing to switch off each dead key completely. * moved the textview on a line of its own such that the dead key menu and the modifier-switching button live together on one line * added enum dead_key_index and used it at a couple of places instead of having to use the magic numbers 1-5 * refactored the actual updating of the fChars buffer from SetKey() into _SetChars(), which is now being invoked by SetDeadKeyTrigger(), too Modified: haiku/trunk/src/preferences/keymap/Keymap.cpp =================================================================== --- haiku/trunk/src/preferences/keymap/Keymap.cpp 2009-05-12 18:11:46 UTC (rev 30717) +++ haiku/trunk/src/preferences/keymap/Keymap.cpp 2009-05-12 18:31:17 UTC (rev 30718) @@ -446,6 +446,78 @@ } +/*! Returns the trigger character string that is currently set for the dead + key with the given index (which is 1..5). +*/ +void +Keymap::GetDeadKeyTrigger(dead_key_index deadKeyIndex, BString& outTrigger) +{ + outTrigger = ""; + if (deadKeyIndex < 1 || deadKeyIndex > 5) + return; + + int32 deadOffsets[] = { + fKeys.acute_dead_key[1], + fKeys.grave_dead_key[1], + fKeys.circumflex_dead_key[1], + fKeys.dieresis_dead_key[1], + fKeys.tilde_dead_key[1] + }; + + int32 offset = deadOffsets[deadKeyIndex - 1]; + if (offset < 0 || offset >= (int32)fCharsSize) + return; + + uint32 deadNumBytes = fChars[offset]; + if (!deadNumBytes) + return; + + outTrigger.SetTo(&fChars[offset + 1], deadNumBytes); +} + + +/*! Sets the trigger character string that shall be used for the dead key + with the given index (which is 1..5). +*/ +void +Keymap::SetDeadKeyTrigger(dead_key_index deadKeyIndex, const BString& trigger) +{ + if (deadKeyIndex < 1 || deadKeyIndex > 5) + return; + + int32 deadOffsets[] = { + fKeys.acute_dead_key[1], + fKeys.grave_dead_key[1], + fKeys.circumflex_dead_key[1], + fKeys.dieresis_dead_key[1], + fKeys.tilde_dead_key[1] + }; + + int32 offset = deadOffsets[deadKeyIndex - 1]; + if (offset < 0 || offset >= (int32)fCharsSize) + return; + + if (_SetChars(offset, trigger.String(), trigger.Length())) { + // reset modifier table such that new dead key is enabled wherever + // it is available + uint32* deadTables[] = { + &fKeys.acute_tables, + &fKeys.grave_tables, + &fKeys.circumflex_tables, + &fKeys.dieresis_tables, + &fKeys.tilde_tables + }; + *deadTables[deadKeyIndex - 1] + = B_CONTROL_TABLE | B_OPTION_CAPS_SHIFT_TABLE | B_OPTION_CAPS_TABLE + | B_OPTION_SHIFT_TABLE | B_OPTION_TABLE | B_CAPS_SHIFT_TABLE + | B_CAPS_TABLE | B_SHIFT_TABLE | B_NORMAL_TABLE; + + if (fModificationMessage != NULL) + fTarget.SendMessage(fModificationMessage); + } +} + + //! Get the char for a key given modifiers and active dead key void Keymap::GetChars(uint32 keyCode, uint32 modifiers, uint8 activeDeadKey, @@ -487,11 +559,21 @@ // here we take an potential active dead key int32 *deadKey; switch (activeDeadKey) { - case 1: deadKey = fKeys.acute_dead_key; break; - case 2: deadKey = fKeys.grave_dead_key; break; - case 3: deadKey = fKeys.circumflex_dead_key; break; - case 4: deadKey = fKeys.dieresis_dead_key; break; - case 5: deadKey = fKeys.tilde_dead_key; break; + case kDeadKeyAcute: + deadKey = fKeys.acute_dead_key; + break; + case kDeadKeyGrave: + deadKey = fKeys.grave_dead_key; + break; + case kDeadKeyCircumflex: + deadKey = fKeys.circumflex_dead_key; + break; + case kDeadKeyDiaeresis: + deadKey = fKeys.dieresis_dead_key; + break; + case kDeadKeyTilde: + deadKey = fKeys.tilde_dead_key; + break; default: { // if not dead, we copy and return the char @@ -556,54 +638,10 @@ if (numBytes > 6) return; - int32 oldNumBytes = fChars[offset]; - - if (oldNumBytes == numBytes - && !memcmp(&fChars[offset + 1], bytes, numBytes)) { - // nothing to do - return; + if (_SetChars(offset, bytes, numBytes)) { + if (fModificationMessage != NULL) + fTarget.SendMessage(fModificationMessage); } - - // TODO: handle dead keys! - - int32 diff = numBytes - oldNumBytes; - if (diff != 0) { - fCharsSize += diff; - - if (diff > 0) { - // make space for the new data - char* chars = new(std::nothrow) char[fCharsSize]; - if (chars != NULL) { - memcpy(chars, fChars, offset + oldNumBytes + 1); - memcpy(&chars[offset + 1 + numBytes], - &fChars[offset + 1 + oldNumBytes], - fCharsSize - 2 - offset - diff); - delete[] fChars; - fChars = chars; - } else - return; - } else if (diff < 0) { - // shrink table - memmove(&fChars[offset + numBytes], &fChars[offset + oldNumBytes], - fCharsSize - offset - 2 - diff); - } - - // update offsets - - int32* data = fKeys.control_map; - int32 size = sizeof(fKeys.control_map) / 4 * 9 - + sizeof(fKeys.acute_dead_key) / 4 * 5; - for (int32 i = 0; i < size; i++) { - if (data[i] > offset) - data[i] += diff; - } - } - - memcpy(&fChars[offset + 1], bytes, numBytes); - fChars[offset] = numBytes; - - if (fModificationMessage != NULL) - fTarget.SendMessage(fModificationMessage); } @@ -693,6 +731,56 @@ } +bool +Keymap::_SetChars(int32 offset, const char* bytes, int32 numBytes) +{ + int32 oldNumBytes = fChars[offset]; + + if (oldNumBytes == numBytes + && !memcmp(&fChars[offset + 1], bytes, numBytes)) { + // nothing to do + return false; + } + + int32 diff = numBytes - oldNumBytes; + if (diff != 0) { + fCharsSize += diff; + + if (diff > 0) { + // make space for the new data + char* chars = new(std::nothrow) char[fCharsSize]; + if (chars != NULL) { + memcpy(chars, fChars, offset + oldNumBytes + 1); + memcpy(&chars[offset + 1 + numBytes], + &fChars[offset + 1 + oldNumBytes], + fCharsSize - 2 - offset - diff); + delete[] fChars; + fChars = chars; + } else + return false; + } else if (diff < 0) { + // shrink table + memmove(&fChars[offset + numBytes], &fChars[offset + oldNumBytes], + fCharsSize - offset - 2 - diff); + } + + // update offsets + int32* data = fKeys.control_map; + int32 size = sizeof(fKeys.control_map) / 4 * 9 + + sizeof(fKeys.acute_dead_key) / 4 * 5; + for (int32 i = 0; i < size; i++) { + if (data[i] > offset) + data[i] += diff; + } + } + + memcpy(&fChars[offset + 1], bytes, numBytes); + fChars[offset] = numBytes; + + return true; +} + + uint8 Keymap::_GetDeadKeyIndex(int32 offset) { Modified: haiku/trunk/src/preferences/keymap/Keymap.h =================================================================== --- haiku/trunk/src/preferences/keymap/Keymap.h 2009-05-12 18:11:46 UTC (rev 30717) +++ haiku/trunk/src/preferences/keymap/Keymap.h 2009-05-12 18:31:17 UTC (rev 30718) @@ -13,8 +13,18 @@ #include #include #include +#include +enum dead_key_index { + kDeadKeyAcute = 1, + kDeadKeyGrave, + kDeadKeyCircumflex, + kDeadKeyDiaeresis, + kDeadKeyTilde +}; + + class Keymap { public: Keymap(); @@ -39,6 +49,11 @@ uint8 activeDeadKey); void SetDeadKeyEnabled(uint32 keyCode, uint32 modifiers, bool enabled); + void GetDeadKeyTrigger(dead_key_index deadKeyIndex, + BString& outTrigger); + void SetDeadKeyTrigger(dead_key_index deadKeyIndex, + const BString& trigger); + void GetChars(uint32 keyCode, uint32 modifiers, uint8 activeDeadKey, char** chars, int32* numBytes); @@ -57,6 +72,8 @@ private: int32 _Offset(uint32 keyCode, uint32 modifiers, uint32* _table = NULL); + bool _SetChars(int32 offset, const char* bytes, + int32 numBytes); uint8 _GetDeadKeyIndex(int32 offset); char* fChars; Modified: haiku/trunk/src/preferences/keymap/KeymapWindow.cpp =================================================================== --- haiku/trunk/src/preferences/keymap/KeymapWindow.cpp 2009-05-12 18:11:46 UTC (rev 30717) +++ haiku/trunk/src/preferences/keymap/KeymapWindow.cpp 2009-05-12 18:31:17 UTC (rev 30718) @@ -51,7 +51,15 @@ static const uint32 kMsgRevertKeymap = 'Rvrt'; static const uint32 kMsgKeymapUpdated = 'upkM'; +static const uint32 kMsgDeadKeyAcuteChanged = 'dkAc'; +static const uint32 kMsgDeadKeyCircumflexChanged = 'dkCc'; +static const uint32 kMsgDeadKeyDiaeresisChanged = 'dkDc'; +static const uint32 kMsgDeadKeyGraveChanged = 'dkGc'; +static const uint32 kMsgDeadKeyTildeChanged = 'dkTc'; +static const char* kDeadKeyTriggerNone = ""; + + KeymapWindow::KeymapWindow() : BWindow(BRect(80, 50, 880, 380), "Keymap", B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS), @@ -80,8 +88,10 @@ .Add(fKeyboardLayoutView) //.Add(new BStringView("text label", "Sample and Clipboard:")) .Add(BGroupLayoutBuilder(B_HORIZONTAL, 10) - .Add(fTextControl) + .Add(_CreateDeadKeyMenu(), 0.0) + .AddGlue() .Add(fSwitchShortcutsButton)) + .Add(fTextControl) .AddGlue(0.0) .Add(BGroupLayoutBuilder(B_HORIZONTAL, 10) .AddGlue(0.0) @@ -153,6 +163,7 @@ fAppliedMap = fCurrentMap; fCurrentMap.SetTarget(this, new BMessage(kMsgKeymapUpdated)); + _UpdateDeadKeyMenu(); _UpdateSwitchShortcutButton(); Unlock(); @@ -307,6 +318,71 @@ fUserListView->Select(0L); break; + case kMsgDeadKeyAcuteChanged: + { + BMenuItem *item = fAcuteMenu->FindMarked(); + if (item != NULL) { + const char* trigger = item->Label(); + if (strcmp(trigger, kDeadKeyTriggerNone) == 0) + trigger = NULL; + fCurrentMap.SetDeadKeyTrigger(kDeadKeyAcute, trigger); + fKeyboardLayoutView->Invalidate(); + } + break; + } + + case kMsgDeadKeyCircumflexChanged: + { + BMenuItem *item = fCircumflexMenu->FindMarked(); + if (item != NULL) { + const char* trigger = item->Label(); + if (strcmp(trigger, kDeadKeyTriggerNone) == 0) + trigger = NULL; + fCurrentMap.SetDeadKeyTrigger(kDeadKeyCircumflex, trigger); + fKeyboardLayoutView->Invalidate(); + } + break; + } + + case kMsgDeadKeyDiaeresisChanged: + { + BMenuItem *item = fDiaeresisMenu->FindMarked(); + if (item != NULL) { + const char* trigger = item->Label(); + if (strcmp(trigger, kDeadKeyTriggerNone) == 0) + trigger = NULL; + fCurrentMap.SetDeadKeyTrigger(kDeadKeyDiaeresis, trigger); + fKeyboardLayoutView->Invalidate(); + } + break; + } + + case kMsgDeadKeyGraveChanged: + { + BMenuItem *item = fGraveMenu->FindMarked(); + if (item != NULL) { + const char* trigger = item->Label(); + if (strcmp(trigger, kDeadKeyTriggerNone) == 0) + trigger = NULL; + fCurrentMap.SetDeadKeyTrigger(kDeadKeyGrave, trigger); + fKeyboardLayoutView->Invalidate(); + } + break; + } + + case kMsgDeadKeyTildeChanged: + { + BMenuItem *item = fTildeMenu->FindMarked(); + if (item != NULL) { + const char* trigger = item->Label(); + if (strcmp(trigger, kDeadKeyTriggerNone) == 0) + trigger = NULL; + fCurrentMap.SetDeadKeyTrigger(kDeadKeyTilde, trigger); + fKeyboardLayoutView->Invalidate(); + } + break; + } + default: BWindow::MessageReceived(message); break; @@ -372,6 +448,61 @@ } +BMenuBar* +KeymapWindow::_CreateDeadKeyMenu() +{ + BMenuBar* menuBar = new BMenuBar("deadkeymenubar"); + fDeadKeyMenu = new BMenu("Select Dead Keys"); + menuBar->AddItem(fDeadKeyMenu); + + fAcuteMenu = new BMenu("Acute Trigger"); + fAcuteMenu->SetRadioMode(true); + fAcuteMenu->AddItem(new BMenuItem("\xC2\xB4", + new BMessage(kMsgDeadKeyAcuteChanged))); + fAcuteMenu->AddItem(new BMenuItem("'", + new BMessage(kMsgDeadKeyAcuteChanged))); + fAcuteMenu->AddItem(new BMenuItem(kDeadKeyTriggerNone, + new BMessage(kMsgDeadKeyAcuteChanged))); + fDeadKeyMenu->AddItem(fAcuteMenu); + + fCircumflexMenu = new BMenu("Circumflex Trigger"); + fCircumflexMenu->SetRadioMode(true); + fCircumflexMenu->AddItem(new BMenuItem("^", + new BMessage(kMsgDeadKeyCircumflexChanged))); + fCircumflexMenu->AddItem(new BMenuItem(kDeadKeyTriggerNone, + new BMessage(kMsgDeadKeyCircumflexChanged))); + fDeadKeyMenu->AddItem(fCircumflexMenu); + + fDiaeresisMenu = new BMenu("Diaeresis Trigger"); + fDiaeresisMenu->SetRadioMode(true); + fDiaeresisMenu->AddItem(new BMenuItem("\xC2\xA8", + new BMessage(kMsgDeadKeyDiaeresisChanged))); + fDiaeresisMenu->AddItem(new BMenuItem("\"", + new BMessage(kMsgDeadKeyDiaeresisChanged))); + fDiaeresisMenu->AddItem(new BMenuItem(kDeadKeyTriggerNone, + new BMessage(kMsgDeadKeyDiaeresisChanged))); + fDeadKeyMenu->AddItem(fDiaeresisMenu); + + fGraveMenu = new BMenu("Grave Trigger"); + fGraveMenu->SetRadioMode(true); + fGraveMenu->AddItem(new BMenuItem("`", + new BMessage(kMsgDeadKeyGraveChanged))); + fGraveMenu->AddItem(new BMenuItem(kDeadKeyTriggerNone, + new BMessage(kMsgDeadKeyGraveChanged))); + fDeadKeyMenu->AddItem(fGraveMenu); + + fTildeMenu = new BMenu("Tilde Trigger"); + fTildeMenu->SetRadioMode(true); + fTildeMenu->AddItem(new BMenuItem("~", + new BMessage(kMsgDeadKeyTildeChanged))); + fTildeMenu->AddItem(new BMenuItem(kDeadKeyTriggerNone, + new BMessage(kMsgDeadKeyTildeChanged))); + fDeadKeyMenu->AddItem(fTildeMenu); + + return menuBar; +} + + BView* KeymapWindow::_CreateMapLists() { @@ -457,12 +588,57 @@ } +/*! Marks the menu items corresponding to the dead key state of the current + key map. +*/ void +KeymapWindow::_UpdateDeadKeyMenu() +{ + BString trigger; + fCurrentMap.GetDeadKeyTrigger(kDeadKeyAcute, trigger); + if (!trigger.Length()) + trigger = kDeadKeyTriggerNone; + BMenuItem* menuItem = fAcuteMenu->FindItem(trigger.String()); + if (menuItem) + menuItem->SetMarked(true); + + fCurrentMap.GetDeadKeyTrigger(kDeadKeyCircumflex, trigger); + if (!trigger.Length()) + trigger = kDeadKeyTriggerNone; + menuItem = fCircumflexMenu->FindItem(trigger.String()); + if (menuItem) + menuItem->SetMarked(true); + + fCurrentMap.GetDeadKeyTrigger(kDeadKeyDiaeresis, trigger); + if (!trigger.Length()) + trigger = kDeadKeyTriggerNone; + menuItem = fDiaeresisMenu->FindItem(trigger.String()); + if (menuItem) + menuItem->SetMarked(true); + + fCurrentMap.GetDeadKeyTrigger(kDeadKeyGrave, trigger); + if (!trigger.Length()) + trigger = kDeadKeyTriggerNone; + menuItem = fGraveMenu->FindItem(trigger.String()); + if (menuItem) + menuItem->SetMarked(true); + + fCurrentMap.GetDeadKeyTrigger(kDeadKeyTilde, trigger); + if (!trigger.Length()) + trigger = kDeadKeyTriggerNone; + menuItem = fTildeMenu->FindItem(trigger.String()); + if (menuItem) + menuItem->SetMarked(true); +} + + +void KeymapWindow::_UpdateButtons() { fUseButton->SetEnabled(!fCurrentMap.Equals(fAppliedMap)); fRevertButton->SetEnabled(!fCurrentMap.Equals(fPreviousMap)); + _UpdateDeadKeyMenu(); _UpdateSwitchShortcutButton(); } Modified: haiku/trunk/src/preferences/keymap/KeymapWindow.h =================================================================== --- haiku/trunk/src/preferences/keymap/KeymapWindow.h 2009-05-12 18:11:46 UTC (rev 30717) +++ haiku/trunk/src/preferences/keymap/KeymapWindow.h 2009-05-12 18:31:17 UTC (rev 30718) @@ -46,6 +46,9 @@ void _UseKeymap(); void _RevertKeymap(); + BMenuBar* _CreateDeadKeyMenu(); + void _UpdateDeadKeyMenu(); + void _FillSystemMaps(); void _FillUserMaps(); void _SetListViewSize(BListView* listView); @@ -64,6 +67,12 @@ KeyboardLayoutView* fKeyboardLayoutView; BTextControl* fTextControl; BButton* fSwitchShortcutsButton; + BMenu* fDeadKeyMenu; + BMenu* fAcuteMenu; + BMenu* fCircumflexMenu; + BMenu* fDiaeresisMenu; + BMenu* fGraveMenu; + BMenu* fTildeMenu; Keymap fCurrentMap; Keymap fPreviousMap; From stippi at mail.berlios.de Tue May 12 20:32:12 2009 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Tue, 12 May 2009 20:32:12 +0200 Subject: [Haiku-commits] r30719 - haiku/trunk/src/kits/tracker Message-ID: <200905121832.n4CIWCk8007886@sheep.berlios.de> Author: stippi Date: 2009-05-12 20:32:11 +0200 (Tue, 12 May 2009) New Revision: 30719 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30719&view=rev Modified: haiku/trunk/src/kits/tracker/AutoMounter.cpp haiku/trunk/src/kits/tracker/AutoMounter.h Log: Fixed a number of remaining problems with the AutoMounter: * During boot, the mount mode was ignored for any removable volumes, they simply got mounted always. * When automounting later, all partitions on all removable devices would be mounted, not only the ones on the newly inserted device. Modified: haiku/trunk/src/kits/tracker/AutoMounter.cpp =================================================================== --- haiku/trunk/src/kits/tracker/AutoMounter.cpp 2009-05-12 18:31:17 UTC (rev 30718) +++ haiku/trunk/src/kits/tracker/AutoMounter.cpp 2009-05-12 18:32:11 UTC (rev 30719) @@ -165,7 +165,7 @@ void AutoMounter::_MountVolumes(mount_mode normal, mount_mode removable, - bool initialRescan) + bool initialRescan, partition_id deviceID) { if (normal == kNoVolumes && removable == kNoVolumes) return; @@ -173,12 +173,14 @@ class InitialMountVisitor : public BDiskDeviceVisitor { public: InitialMountVisitor(mount_mode normalMode, mount_mode removableMode, - bool initialRescan, BMessage& previous) + bool initialRescan, BMessage& previous, + partition_id deviceID) : fNormalMode(normalMode), fRemovableMode(removableMode), fInitialRescan(initialRescan), - fPrevious(previous) + fPrevious(previous), + fOnlyOnDeviceID(deviceID) { } @@ -196,7 +198,17 @@ virtual bool Visit(BPartition* partition, int32 level) { - mount_mode mode = partition->Device()->IsRemovableMedia() + if (fOnlyOnDeviceID >= 0) { + // only mount partitions on the given device id + BPartition* device = partition; + while (device->Parent() != NULL) + device = device->Parent(); + if (device->ID() != fOnlyOnDeviceID) + return false; + } + + mount_mode mode = !fInitialRescan + && partition->Device()->IsRemovableMedia() ? fRemovableMode : fNormalMode; if (mode == kNoVolumes || partition->IsMounted() @@ -248,11 +260,12 @@ } private: - mount_mode fNormalMode; - mount_mode fRemovableMode; - bool fInitialRescan; - BMessage& fPrevious; - } visitor(normal, removable, initialRescan, fSettings); + mount_mode fNormalMode; + mount_mode fRemovableMode; + bool fInitialRescan; + BMessage& fPrevious; + partition_id fOnlyOnDeviceID; + } visitor(normal, removable, initialRescan, fSettings, deviceID); BDiskDeviceList devices; status_t status = devices.Fetch(); @@ -638,24 +651,26 @@ _WriteSettings(); if (rescanNow) - _MountVolumes(fNormalMode, fRemovableMode, false); + _MountVolumes(fNormalMode, fRemovableMode); break; } case kMountAllNow: - _MountVolumes(kAllVolumes, kAllVolumes, false); + _MountVolumes(kAllVolumes, kAllVolumes); break; case B_DEVICE_UPDATE: -printf("B_DEVICE_UPDATE\n"); -message->PrintToStream(); int32 event; if (message->FindInt32("event", &event) != B_OK || (event != B_DEVICE_MEDIA_CHANGED && event != B_DEVICE_ADDED)) break; - _MountVolumes(kNoVolumes, fRemovableMode, false); + partition_id deviceID; + if (message->FindInt32("id", &deviceID) != B_OK) + break; + + _MountVolumes(kNoVolumes, fRemovableMode, false, deviceID); break; #if 0 Modified: haiku/trunk/src/kits/tracker/AutoMounter.h =================================================================== --- haiku/trunk/src/kits/tracker/AutoMounter.h 2009-05-12 18:31:17 UTC (rev 30718) +++ haiku/trunk/src/kits/tracker/AutoMounter.h 2009-05-12 18:32:11 UTC (rev 30719) @@ -42,6 +42,7 @@ #ifndef __HAIKU__ # include "DeviceMap.h" #else +# include class BPartition; class BPath; #endif @@ -74,7 +75,9 @@ }; void _MountVolumes(mount_mode normal, - mount_mode removable, bool initialRescan); + mount_mode removable, + bool initialRescan = false, + partition_id deviceID = -1); void _MountVolume(const BMessage* message); bool _SuggestForceUnmount(const char* name, status_t error); From stippi at mail.berlios.de Tue May 12 20:35:33 2009 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Tue, 12 May 2009 20:35:33 +0200 Subject: [Haiku-commits] r30720 - haiku/trunk/src/kits/tracker Message-ID: <200905121835.n4CIZXMf008387@sheep.berlios.de> Author: stippi Date: 2009-05-12 20:35:31 +0200 (Tue, 12 May 2009) New Revision: 30720 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30720&view=rev Modified: haiku/trunk/src/kits/tracker/AutoMounter.cpp Log: Make the partition ID check more flexible, if partitions just pop up out of nowhere, we still want to be able to automount them, even though the notification is not for a device. Modified: haiku/trunk/src/kits/tracker/AutoMounter.cpp =================================================================== --- haiku/trunk/src/kits/tracker/AutoMounter.cpp 2009-05-12 18:32:11 UTC (rev 30719) +++ haiku/trunk/src/kits/tracker/AutoMounter.cpp 2009-05-12 18:35:31 UTC (rev 30720) @@ -200,9 +200,15 @@ { if (fOnlyOnDeviceID >= 0) { // only mount partitions on the given device id + // or if the partition ID is already matched BPartition* device = partition; - while (device->Parent() != NULL) + while (device->Parent() != NULL) { + if (device->ID() == fOnlyOnDeviceID) { + // we are happy + break; + } device = device->Parent(); + } if (device->ID() != fOnlyOnDeviceID) return false; } From anevilyak at gmail.com Tue May 12 20:38:38 2009 From: anevilyak at gmail.com (Rene Gollent) Date: Tue, 12 May 2009 13:38:38 -0500 Subject: [Haiku-commits] r30720 - haiku/trunk/src/kits/tracker In-Reply-To: <200905121835.n4CIZXMf008387@sheep.berlios.de> References: <200905121835.n4CIZXMf008387@sheep.berlios.de> Message-ID: On Tue, May 12, 2009 at 1:35 PM, wrote: > Author: stippi > Date: 2009-05-12 20:35:31 +0200 (Tue, 12 May 2009) > New Revision: 30720 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30720&view=rev > > Modified: > ? haiku/trunk/src/kits/tracker/AutoMounter.cpp > Log: > Make the partition ID check more flexible, if partitions just pop up out of > nowhere, we still want to be able to automount them, even though the > notification is not for a device. > > Just wondering, when would that happen? :) Regards, Rene From zooey at mail.berlios.de Tue May 12 20:49:33 2009 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Tue, 12 May 2009 20:49:33 +0200 Subject: [Haiku-commits] r30721 - haiku/trunk/src/preferences/keymap Message-ID: <200905121849.n4CInXd5010680@sheep.berlios.de> Author: zooey Date: 2009-05-12 20:49:32 +0200 (Tue, 12 May 2009) New Revision: 30721 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30721&view=rev Modified: haiku/trunk/src/preferences/keymap/Keymap.cpp Log: * fixed data corruption and later crash when an error occurs in Save() Modified: haiku/trunk/src/preferences/keymap/Keymap.cpp =================================================================== --- haiku/trunk/src/preferences/keymap/Keymap.cpp 2009-05-12 18:35:31 UTC (rev 30720) +++ haiku/trunk/src/preferences/keymap/Keymap.cpp 2009-05-12 18:49:32 UTC (rev 30721) @@ -168,43 +168,38 @@ return status; } - for (uint32 i = 0; i < sizeof(fKeys) / 4; i++) { + for (uint32 i = 0; i < sizeof(fKeys) / 4; i++) ((uint32*)&fKeys)[i] = B_HOST_TO_BENDIAN_INT32(((uint32*)&fKeys)[i]); - } ssize_t bytesWritten = file.Write(&fKeys, sizeof(fKeys)); - if (bytesWritten < (ssize_t)sizeof(fKeys)) { - if (bytesWritten < 0) - return bytesWritten; - return B_IO_ERROR; - } + if (bytesWritten < (ssize_t)sizeof(fKeys)) + status = bytesWritten < 0 ? bytesWritten : B_IO_ERROR; - for (uint32 i = 0; i < sizeof(fKeys) / 4; i++) { + for (uint32 i = 0; i < sizeof(fKeys) / 4; i++) ((uint32*)&fKeys)[i] = B_BENDIAN_TO_HOST_INT32(((uint32*)&fKeys)[i]); - } - fCharsSize = B_HOST_TO_BENDIAN_INT32(fCharsSize); + if (status == B_OK) { + fCharsSize = B_HOST_TO_BENDIAN_INT32(fCharsSize); - bytesWritten = file.Write(&fCharsSize, sizeof(uint32)); - if (bytesWritten < (ssize_t)sizeof(uint32)) { - if (bytesWritten < 0) - return bytesWritten; - return B_IO_ERROR; + bytesWritten = file.Write(&fCharsSize, sizeof(uint32)); + if (bytesWritten < (ssize_t)sizeof(uint32)) + status = bytesWritten < 0 ? bytesWritten : B_IO_ERROR; + + fCharsSize = B_BENDIAN_TO_HOST_INT32(fCharsSize); } - fCharsSize = B_BENDIAN_TO_HOST_INT32(fCharsSize); + if (status == B_OK) { + bytesWritten = file.Write(fChars, fCharsSize); + if (bytesWritten < (ssize_t)fCharsSize) + status = bytesWritten < 0 ? bytesWritten : B_IO_ERROR; + } - bytesWritten = file.Write(fChars, fCharsSize); - if (bytesWritten < (ssize_t)fCharsSize) { - if (bytesWritten < 0) - return bytesWritten; - return B_IO_ERROR; + if (status == B_OK) { + file.WriteAttr("keymap:name", B_STRING_TYPE, 0, fName, strlen(fName)); + // Failing would be non-fatal } - file.WriteAttr("keymap:name", B_STRING_TYPE, 0, fName, strlen(fName)); - // Failing would be non-fatal - - return B_OK; + return status; } From superstippi at gmx.de Tue May 12 20:54:08 2009 From: superstippi at gmx.de (Stephan Assmus) Date: Tue, 12 May 2009 20:54:08 +0200 Subject: [Haiku-commits] r30720 - haiku/trunk/src/kits/tracker In-Reply-To: References: <200905121835.n4CIZXMf008387@sheep.berlios.de> Message-ID: <20090512205408.5985.6@bepc.1242127971.fake> On 2009-05-12 at 19:38:38 [+0200], Rene Gollent wrote: > On Tue, May 12, 2009 at 1:35 PM, wrote: > > Author: stippi > > Date: 2009-05-12 20:35:31 +0200 (Tue, 12 May 2009) New Revision: 30720 > > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30720&view=rev > > > > Modified: > > haiku/trunk/src/kits/tracker/AutoMounter.cpp > > Log: > > Make the partition ID check more flexible, if partitions just pop up > > out of nowhere, we still want to be able to automount them, even though > > the notification is not for a device. > > Just wondering, when would that happen? :) I don't know, maybe when creating a new partition in DriveSetup -- once that's supported? :-P Best regards, -Stephan From axeld at mail.berlios.de Tue May 12 21:15:06 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 12 May 2009 21:15:06 +0200 Subject: [Haiku-commits] r30722 - haiku/trunk/src/bin Message-ID: <200905121915.n4CJF6KT014068@sheep.berlios.de> Author: axeld Date: 2009-05-12 21:15:06 +0200 (Tue, 12 May 2009) New Revision: 30722 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30722&view=rev Modified: haiku/trunk/src/bin/copyattr.cpp Log: * Cleanup. Modified: haiku/trunk/src/bin/copyattr.cpp =================================================================== --- haiku/trunk/src/bin/copyattr.cpp 2009-05-12 18:49:32 UTC (rev 30721) +++ haiku/trunk/src/bin/copyattr.cpp 2009-05-12 19:15:06 UTC (rev 30722) @@ -104,10 +104,10 @@ // AttributeFilter struct AttributeFilter { - AttributeFilter() - : fName(NULL), - fType(B_ANY_TYPE) + : + fName(NULL), + fType(B_ANY_TYPE) { } @@ -133,10 +133,11 @@ // Parameters struct Parameters { Parameters() - : copy_data(false), - recursive(false), - move_files(false), - verbose(false) + : + copy_data(false), + recursive(false), + move_files(false), + verbose(false) { } @@ -169,6 +170,7 @@ fprintf((error ? stderr : stdout), kUsage, commandName); } + // print_usage_and_exit static void print_usage_and_exit(bool error) @@ -177,6 +179,7 @@ exit(error ? 1 : 0); } + // next_arg static const char * next_arg(int &argi, bool optional = false) @@ -190,11 +193,11 @@ return kArgv[argi++]; } + // copy_attributes static void -copy_attributes(const char *sourcePath, BNode &source, - const char *destPath, BNode &destination, - const Parameters ¶meters) +copy_attributes(const char *sourcePath, BNode &source, const char *destPath, + BNode &destination, const Parameters ¶meters) { char attrName[B_ATTR_NAME_LENGTH]; while (source.GetNextAttrName(attrName) == B_OK) { @@ -249,10 +252,11 @@ } } + // copy_file_data static void -copy_file_data(const char *sourcePath, BFile &source, - const char *destPath, BFile &destination, const Parameters ¶meters) +copy_file_data(const char *sourcePath, BFile &source, const char *destPath, + BFile &destination, const Parameters ¶meters) { char buffer[kCopyBufferSize]; off_t offset = 0; @@ -280,6 +284,7 @@ } } + // copy_entry static void copy_entry(const char *sourcePath, const char *destPath, @@ -299,7 +304,7 @@ // stat destination struct stat destStat; - bool destExists = (lstat(destPath, &destStat) == 0); + bool destExists = lstat(destPath, &destStat) == 0; if (!destExists && !parameters.copy_data) { fprintf(stderr, "Error: Destination file \"%s\" does not exist.\n", @@ -611,6 +616,7 @@ } } + // main int main(int argc, const char *const *argv) From zooey at mail.berlios.de Tue May 12 21:41:15 2009 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Tue, 12 May 2009 21:41:15 +0200 Subject: [Haiku-commits] r30723 - haiku/trunk/src/preferences/keymap Message-ID: <200905121941.n4CJfFFm017578@sheep.berlios.de> Author: zooey Date: 2009-05-12 21:41:14 +0200 (Tue, 12 May 2009) New Revision: 30723 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30723&view=rev Modified: haiku/trunk/src/preferences/keymap/KeymapWindow.cpp Log: * Removed the 'Use' button from the keymap preflet, since several people have mentioned that they tend to forget pressing it (including me, of course), in effect losing all changes. The way the code currently works, having it didn't really make sense IMO, as any change will only ever be applied to the "current" keymap. If you want to keep your keymap more persistently, you need to save it into a named file, anyway. Please give it a try and shout if this is unacceptable. Modified: haiku/trunk/src/preferences/keymap/KeymapWindow.cpp =================================================================== --- haiku/trunk/src/preferences/keymap/KeymapWindow.cpp 2009-05-12 19:15:06 UTC (rev 30722) +++ haiku/trunk/src/preferences/keymap/KeymapWindow.cpp 2009-05-12 19:41:14 UTC (rev 30723) @@ -75,7 +75,6 @@ fSwitchShortcutsButton = new BButton("switch", "", new BMessage(kMsgSwitchShortcuts)); - fUseButton = new BButton("useButton", "Use", new BMessage(kMsgUseKeymap)); fRevertButton = new BButton("revertButton", "Revert", new BMessage(kMsgRevertKeymap)); @@ -95,7 +94,6 @@ .AddGlue(0.0) .Add(BGroupLayoutBuilder(B_HORIZONTAL, 10) .AddGlue(0.0) - .Add(fUseButton) .Add(fRevertButton))) .SetInsets(10, 10, 10, 10))); @@ -635,7 +633,9 @@ void KeymapWindow::_UpdateButtons() { - fUseButton->SetEnabled(!fCurrentMap.Equals(fAppliedMap)); + if (!fCurrentMap.Equals(fAppliedMap)) + _UseKeymap(); + fRevertButton->SetEnabled(!fCurrentMap.Equals(fPreviousMap)); _UpdateDeadKeyMenu(); From zooey at hirschkaefer.de Tue May 12 21:51:38 2009 From: zooey at hirschkaefer.de (Oliver Tappe) Date: Tue, 12 May 2009 21:51:38 +0200 Subject: [Haiku-commits] r30699 - haiku/trunk/src/preferences/keymap In-Reply-To: <42199401047-BeMail@zon> References: <42199401047-BeMail@zon> Message-ID: <20090512215138.2576.8@bepc.1242114422.fake> On 2009-05-11 at 20:53:21 [+0200], Axel D?rfler wrote: > Oliver Tappe wrote: > > On 2009-05-10 at 22:24:41 [+0200], Axel D?rfler > > > wrote: > > > The "sample" textview in the Keymap preferences should always work > > > with > > > the keymap you see on screen; it should be independent from the one > > > in > > > use - however, deadkey handling is done in the input_server (you > > > don't > > > even get a notice that a key has been pressed), so deadkeys can't > > > work > > > this way. > > > Not sure how to handle this better, but I guess we could have an > > > extra > > > message sent from the input_server for deadkeys, too. Otherwise, > > > intercepting the input method stuff could work, as that already > > > does > > > something like that to be able to draw the highlighting for > > > BTextViews. > > Ok, I will have a look at that today. Wrong day, but anyway: I have "fixed" this by simply removing the "Use" button from the preflet and switching it to auto-use any changes. We will see what problems this causes (if at all). But BTextView and/or the input method stuff exhibit bugs when handling dead keys that lead to strange characters being inserted - looking into that now. cheers, Oliver cheers, Oliver > > Great! > > > Apart from the need to implement drag and drop for the composed > > characters > > resulting from pressing a dead key and a second key, I wonder if it > > makes > > sense to add support to the Keymap preflet for changing the dead keys > > at all, > > and if so, in what way. Three options came to my mind: > > > > 1. Do not bother to change anything and let the "power user" edit the > > keymap > > by hand. > > > > 2. Add a menu to the preflet where the user can chose from a given > > set of > > concrete dead key characters for each of the five dead keys: > > 0xC2B4 and ' for Acute > > ` for Grave > > ^ for Circumflex > > 0xC2A8 and " for Diaeresis (maybe : too?) > > ~ for Tilde > > This is easy to implement, but would lock the set of supported dead > > key > > characters. > > > > 3. Add one text control for each of the five dead keys, allowing the > > user to > > enter whatever character should be used as the trigger character for > > that > > specific dead key. This is obiously the most flexible, but would > > require > > quite some screen space and might be confusing for new users. Perhaps > > it > > could be moved to an 'Advanded' tab-page? > > > > I personally like solution 2, as I find that the best compromise > > between > > simplicity and configurability. > > I would lean to 2) as well, but one could also add a list view that is > only visible when a dead key is selected, and solve it using this one. > We also need a table that includes all modifier keys, so you cannot > lose them that easily :-) > > Bye, > Axel. > > _______________________________________________ > Haiku-commits mailing list > Haiku-commits at lists.berlios.de > https://lists.berlios.de/mailman/listinfo/haiku-commits From axeld at pinc-software.de Tue May 12 21:52:33 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Tue, 12 May 2009 21:52:33 +0200 CEST Subject: [Haiku-commits] r30723 - haiku/trunk/src/preferences/keymap In-Reply-To: <200905121941.n4CJfFFm017578@sheep.berlios.de> Message-ID: <47170469127-BeMail@zon> zooey at BerliOS wrote: > Log: > * Removed the 'Use' button from the keymap preflet, since several > people have > mentioned that they tend to forget pressing it (including me, of > course), in > effect losing all changes. > The way the code currently works, having it didn't really make > sense IMO, > as any change will only ever be applied to the "current" keymap. If > you want > to keep your keymap more persistently, you need to save it into a > named file, > anyway. > Please give it a try and shout if this is unacceptable. The only problem I see with this is that you can have an unsaved (under a new name) customized keymap, and overwrite it with this. Of course, one could just press "Revert" as long as the application is still open, so it's not that different from how other preferences apps are working. So I guess we're good to go with this solution - I think it's better than what I would have done (ie. adding a "You have unsaved changes" kind of dialog). This makes the BTextView customization pretty much superfluous, though. Also on the plus side, it solves the dead key problem :-) Bye, Axel. From zooey at mail.berlios.de Tue May 12 21:52:52 2009 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Tue, 12 May 2009 21:52:52 +0200 Subject: [Haiku-commits] r30724 - haiku/trunk/src/preferences/keymap Message-ID: <200905121952.n4CJqqfa019640@sheep.berlios.de> Author: zooey Date: 2009-05-12 21:52:51 +0200 (Tue, 12 May 2009) New Revision: 30724 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30724&view=rev Modified: haiku/trunk/src/preferences/keymap/KeymapWindow.h Log: * should have been part of r30723 Modified: haiku/trunk/src/preferences/keymap/KeymapWindow.h =================================================================== --- haiku/trunk/src/preferences/keymap/KeymapWindow.h 2009-05-12 19:41:14 UTC (rev 30723) +++ haiku/trunk/src/preferences/keymap/KeymapWindow.h 2009-05-12 19:52:51 UTC (rev 30724) @@ -60,7 +60,6 @@ BListView* fSystemListView; BListView* fUserListView; - BButton* fUseButton; BButton* fRevertButton; BMenu* fLayoutMenu; BMenu* fFontMenu; From kirilla at mail.berlios.de Tue May 12 22:01:39 2009 From: kirilla at mail.berlios.de (kirilla at BerliOS) Date: Tue, 12 May 2009 22:01:39 +0200 Subject: [Haiku-commits] r30725 - haiku/trunk/src/apps/stylededit Message-ID: <200905122001.n4CK1dRx020511@sheep.berlios.de> Author: kirilla Date: 2009-05-12 22:01:38 +0200 (Tue, 12 May 2009) New Revision: 30725 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30725&view=rev Modified: haiku/trunk/src/apps/stylededit/StyledEditApp.cpp Log: Clean up: shortening comment, adding if/else braces. Thanks Axel\! Modified: haiku/trunk/src/apps/stylededit/StyledEditApp.cpp =================================================================== --- haiku/trunk/src/apps/stylededit/StyledEditApp.cpp 2009-05-12 19:52:51 UTC (rev 30724) +++ haiku/trunk/src/apps/stylededit/StyledEditApp.cpp 2009-05-12 20:01:38 UTC (rev 30725) @@ -245,32 +245,13 @@ void StyledEditApp::ArgvReceived(int32 argc, char* argv[]) { - // StyledEdit has the "single launch" flag set in its - // resources. This means that while StyledEdit is running, - // additional StyledEdit invocations will not result in a - // new process but re-use the existing one, calling the - // hook methods of the BApplication subclass: ArgvReceived(), - // RefsReceived() or MessageReceived(B_SILENT_RELAUNCH), - // depending on the nature of the invocation. + // If StyledEdit is already running and gets invoked again + // we need to account for a possible mismatch in current + // working directory. The paths of the new arguments are + // relative to the cwd of the invocation, if they are not + // absolute. This cwd we find as a string named "cwd" in + // the BLooper's current message. - // An implication of this relevant to ArgvReceived() is - // that the running application might have a current - // working directory different from the one of a later - // invocation. Arguments received from the later invocation, - // if having relative paths, will be incorrect when - // interpreted as relative to the current working directory. - - // BApplication's ArgvReceived() method does not supply - // the cwd of the invocation, but the BMessage by which - // the arguments get communicated to the BApplication - // supplies a cwd string. So we ask the BApplication, - // to show the current message - the one that triggered - // the ArgvReceived() hook method - extract the cwd - // string from it and patch any relative paths in argv. - - // This does not take into account --option handling - // and how to avoid prepending a path to such arguments - const char* cwd = ""; BMessage* message = CurrentMessage(); @@ -281,11 +262,12 @@ for (int i = 1 ; (i < argc) ; i++) { BPath path; - if (argv[i][0] == '/') + if (argv[i][0] == '/') { path.SetTo(argv[i]); - else + } else { path.SetTo(cwd, argv[i]); // patch relative paths only + } entry_ref ref; get_ref_for_path(path.Path(), &ref); From axeld at mail.berlios.de Tue May 12 22:03:59 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 12 May 2009 22:03:59 +0200 Subject: [Haiku-commits] r30726 - haiku/trunk/src/system/kernel/device_manager Message-ID: <200905122003.n4CK3xed020742@sheep.berlios.de> Author: axeld Date: 2009-05-12 22:03:58 +0200 (Tue, 12 May 2009) New Revision: 30726 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30726&view=rev Modified: haiku/trunk/src/system/kernel/device_manager/BaseDevice.cpp haiku/trunk/src/system/kernel/device_manager/BaseDevice.h haiku/trunk/src/system/kernel/device_manager/devfs.cpp haiku/trunk/src/system/kernel/device_manager/device_manager.cpp haiku/trunk/src/system/kernel/device_manager/legacy_drivers.cpp Log: * Instead of deleting the device directly, we now only remove it from its parent. * Additionally, when a vnode is deleted, the new BaseDevice::Removed() method is called that will remove the device from its parent if needed, and delete it then. * This should fix #3856. Modified: haiku/trunk/src/system/kernel/device_manager/BaseDevice.cpp =================================================================== --- haiku/trunk/src/system/kernel/device_manager/BaseDevice.cpp 2009-05-12 20:01:38 UTC (rev 30725) +++ haiku/trunk/src/system/kernel/device_manager/BaseDevice.cpp 2009-05-12 20:03:58 UTC (rev 30726) @@ -1,5 +1,5 @@ /* - * Copyright 2008, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Copyright 2008-2009, Axel D?rfler, axeld at pinc-software.de. * Distributed under the terms of the MIT License. */ @@ -33,3 +33,9 @@ BaseDevice::UninitDevice() { } + + +void +BaseDevice::Removed() +{ +} Modified: haiku/trunk/src/system/kernel/device_manager/BaseDevice.h =================================================================== --- haiku/trunk/src/system/kernel/device_manager/BaseDevice.h 2009-05-12 20:01:38 UTC (rev 30725) +++ haiku/trunk/src/system/kernel/device_manager/BaseDevice.h 2009-05-12 20:03:58 UTC (rev 30726) @@ -1,5 +1,5 @@ /* - * Copyright 2008, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Copyright 2008-2009, Axel D?rfler, axeld at pinc-software.de. * Distributed under the terms of the MIT License. */ #ifndef BASE_DEVICE_H @@ -22,6 +22,8 @@ virtual status_t InitDevice(); virtual void UninitDevice(); + virtual void Removed(); + device_module_info* Module() const { return fDeviceModule; } void* Data() const { return fDeviceData; } Modified: haiku/trunk/src/system/kernel/device_manager/devfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/device_manager/devfs.cpp 2009-05-12 20:01:38 UTC (rev 30725) +++ haiku/trunk/src/system/kernel/device_manager/devfs.cpp 2009-05-12 20:03:58 UTC (rev 30726) @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Copyright 2002-2009, Axel D?rfler, axeld at pinc-software.de. * Distributed under the terms of the MIT License. * * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. @@ -252,6 +252,9 @@ hash_remove(fs->vnode_hash, vnode); if (S_ISCHR(vnode->stream.type)) { + // pass the call through to the underlying device + vnode->stream.u.dev.device->Removed(); + // for partitions, we have to release the raw device but must // not free the device info as it was inherited from the raw // device and is still in use there Modified: haiku/trunk/src/system/kernel/device_manager/device_manager.cpp =================================================================== --- haiku/trunk/src/system/kernel/device_manager/device_manager.cpp 2009-05-12 20:01:38 UTC (rev 30725) +++ haiku/trunk/src/system/kernel/device_manager/device_manager.cpp 2009-05-12 20:03:58 UTC (rev 30726) @@ -1,5 +1,5 @@ /* - * Copyright 2008, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Copyright 2008-2009, Axel D?rfler, axeld at pinc-software.de. * Distributed under the terms of the MIT License. */ @@ -84,8 +84,14 @@ virtual status_t InitDevice(); virtual void UninitDevice(); + virtual void Removed(); + + void SetRemovedFromParent(bool removed) + { fRemovedFromParent = removed; } + private: const char* fModuleName; + bool fRemovedFromParent; }; typedef DoublyLinkedList DeviceList; @@ -1057,6 +1063,8 @@ Device::Device(device_node* node, const char* moduleName) + : + fRemovedFromParent(false) { fNode = node; fModuleName = strdup(moduleName); @@ -1144,6 +1152,18 @@ } +void +Device::Removed() +{ + RecursiveLocker _(sLock); + + if (!fRemovedFromParent) + fNode->RemoveDevice(this); + + delete this; +} + + // #pragma mark - device_node @@ -1201,8 +1221,8 @@ // Delete devices while (Device* device = fDevices.RemoveHead()) { + device->SetRemovedFromParent(true); devfs_unpublish_device(device, true); - delete device; } // Delete attributes Modified: haiku/trunk/src/system/kernel/device_manager/legacy_drivers.cpp =================================================================== --- haiku/trunk/src/system/kernel/device_manager/legacy_drivers.cpp 2009-05-12 20:01:38 UTC (rev 30725) +++ haiku/trunk/src/system/kernel/device_manager/legacy_drivers.cpp 2009-05-12 20:03:58 UTC (rev 30726) @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Copyright 2002-2009, Axel D?rfler, axeld at pinc-software.de. * Distributed under the terms of the MIT License. */ @@ -54,6 +54,8 @@ virtual status_t InitDevice(); virtual void UninitDevice(); + virtual void Removed(); + void SetHooks(device_hooks* hooks); legacy_driver* Driver() const { return fDriver; } @@ -67,11 +69,16 @@ bool Republished() const { return fRepublished; } void SetRepublished(bool republished) { fRepublished = republished; } + + void SetRemovedFromParent(bool removed) + { fRemovedFromParent = removed; } + private: legacy_driver* fDriver; const char* fPath; device_hooks* fHooks; bool fRepublished; + bool fRemovedFromParent; }; typedef DoublyLinkedList DeviceList; @@ -284,9 +291,9 @@ TRACE(("devfs: unpublishing no more present \"%s\"\n", device->Path())); iterator.Remove(); + device->SetRemovedFromParent(true); devfs_unpublish_device(device, true); - delete device; } if (exported == 0) { @@ -430,8 +437,8 @@ unpublish_driver(legacy_driver *driver) { while (LegacyDevice* device = driver->devices.RemoveHead()) { - if (devfs_unpublish_device(device, true) == B_OK) - delete device; + device->SetRemovedFromParent(true); + devfs_unpublish_device(device, true); } } @@ -1109,7 +1116,8 @@ device_hooks* hooks) : fDriver(driver), - fRepublished(true) + fRepublished(true), + fRemovedFromParent(false) { fDeviceModule = (device_module_info*)malloc(sizeof(device_module_info)); if (fDeviceModule != NULL) @@ -1172,6 +1180,18 @@ void +LegacyDevice::Removed() +{ + RecursiveLocker _(sLock); + + if (!fRemovedFromParent) + fDriver->devices.Remove(this); + + delete this; +} + + +void LegacyDevice::SetHooks(device_hooks* hooks) { // TODO: setup compatibility layer! From axeld at pinc-software.de Tue May 12 22:10:31 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Tue, 12 May 2009 22:10:31 +0200 CEST Subject: [Haiku-commits] r30699 - haiku/trunk/src/preferences/keymap In-Reply-To: <20090512215138.2576.8@bepc.1242114422.fake> Message-ID: <48248931405-BeMail@zon> Oliver Tappe wrote: > > > Ok, I will have a look at that today. > Wrong day, but anyway: I have "fixed" this by simply removing the > "Use" > button from the preflet and switching it to auto-use any changes. We > will see > what problems this causes (if at all). I guess I didn't find the time to look into this, but it obviously turned out for the better :-) > But BTextView and/or the input method stuff exhibit bugs when > handling dead > keys that lead to strange characters being inserted - looking into > that now. Great, I've seen this already some time ago, but then pretty much forgot about it. Bye, Axel. From zooey at hirschkaefer.de Tue May 12 22:31:36 2009 From: zooey at hirschkaefer.de (Oliver Tappe) Date: Tue, 12 May 2009 22:31:36 +0200 Subject: [Haiku-commits] r30723 - haiku/trunk/src/preferences/keymap In-Reply-To: <47170469127-BeMail@zon> References: <47170469127-BeMail@zon> Message-ID: <20090512223136.2688.9@bepc.1242114422.fake> On 2009-05-12 at 22:02:04 [+0200], Axel D?rfler wrote: > zooey at BerliOS wrote: > > Log: > > * Removed the 'Use' button from the keymap preflet, since several > > people have > > mentioned that they tend to forget pressing it (including me, of > > course), in > > effect losing all changes. > > The way the code currently works, having it didn't really make > > sense IMO, > > as any change will only ever be applied to the "current" keymap. If > > you want > > to keep your keymap more persistently, you need to save it into a > > named file, > > anyway. > > Please give it a try and shout if this is unacceptable. > > The only problem I see with this is that you can have an unsaved (under > a new name) customized keymap, and overwrite it with this. Hm, I'm not sure, but actually I do not think you can in fact do this: AFAICS, whenever you change something, Keymap always jumps to the "Current" keymap (the file named '/boot/config/settings/Key_map') and stores that. So it will never overwrite any file unless explicitly asked for it. But since that is so, we should remove the 'Save' menu item, too, since now it will never be enabled ;-) cheers, Oliver > Of course, > one could just press "Revert" as long as the application is still open, > so it's not that different from how other preferences apps are working. > > So I guess we're good to go with this solution - I think it's better > than what I would have done (ie. adding a "You have unsaved changes" > kind of dialog). > > This makes the BTextView customization pretty much superfluous, though. Ah, you mean the message filter - didn't even notice that one yet ;-). I will remove it soon. cheers, Oliver From axeld at pinc-software.de Tue May 12 22:45:50 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Tue, 12 May 2009 22:45:50 +0200 CEST Subject: [Haiku-commits] r30723 - haiku/trunk/src/preferences/keymap In-Reply-To: <20090512223136.2688.9@bepc.1242114422.fake> Message-ID: <50367935611-BeMail@zon> Oliver Tappe wrote: > > The only problem I see with this is that you can have an unsaved > > (under > > a new name) customized keymap, and overwrite it with this. > Hm, I'm not sure, but actually I do not think you can in fact do > this: > AFAICS, whenever you change something, Keymap always jumps to the > "Current" > keymap (the file named '/boot/config/settings/Key_map') and stores > that. So > it will never overwrite any file unless explicitly asked for it. What I meant is that you don't have to save the keymap under a name (as it's stored in "Current"), and that one you actually can overwrite. But as I said, that's what others do as well. > But since that is so, we should remove the 'Save' menu item, too, > since now > it will never be enabled ;-) Oh my :-) Bye, Axel. From bonefish at mail.berlios.de Tue May 12 22:55:51 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Tue, 12 May 2009 22:55:51 +0200 Subject: [Haiku-commits] r30727 - haiku/trunk/headers/os Message-ID: <200905122055.n4CKtpdN025579@sheep.berlios.de> Author: bonefish Date: 2009-05-12 22:55:49 +0200 (Tue, 12 May 2009) New Revision: 30727 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30727&view=rev Modified: haiku/trunk/headers/os/BeBuild.h Log: * Removed the non-GCC macro definitions. * Added missing macro B_HAIKU_VERSION. Also added a version macro for alpha 1 -- it doesn't seem unlikely that the API will change between alpha 1 and R1. * Added new macro B_HAIKU_ABI indicating which ABI is used (gcc 2/4). Modified: haiku/trunk/headers/os/BeBuild.h =================================================================== --- haiku/trunk/headers/os/BeBuild.h 2009-05-12 20:03:58 UTC (rev 30726) +++ haiku/trunk/headers/os/BeBuild.h 2009-05-12 20:55:49 UTC (rev 30727) @@ -13,21 +13,30 @@ #define B_BEOS_VERSION B_BEOS_VERSION_5 #define B_BEOS_VERSION_MAUI B_BEOS_VERSION_5 -#define B_HAIKU_VERSION_1 0x0100 +// Haiku (API) version +#define B_HAIKU_VERSION_1_ALPHA_1 0x0010 +#define B_HAIKU_VERSION_1 0x0100 -#if __GNUC__ -# define _UNUSED(argument) argument -# define _PACKED __attribute__((packed)) -# define _PRINTFLIKE(_format_, _args_) \ - __attribute__((format(__printf__, _format_, _args_))) -# define _EXPORT -# define _IMPORT +#define B_HAIKU_VERSION B_HAIKU_VERSION_1_ALPHA_1 + +// Haiku ABI +#define B_HAIKU_ABI_GCC_2 0x01 +#define B_HAIKU_ABI_GCC_4 0x02 + +#if __GNUC__ == 2 +# define B_HAIKU_ABI B_HAIKU_ABI_GCC_2 +#elif __GNUC__ == 4 +# define B_HAIKU_ABI B_HAIKU_ABI_GCC_4 #else -# define _UNUSED(argument) argument -# error Define _PACKED for your compiler -# define _PRINTFLIKE(format, args) -# define _EXPORT -# define _IMPORT +# error Unsupported gcc version! #endif + +#define _UNUSED(argument) argument +#define _PACKED __attribute__((packed)) +#define _PRINTFLIKE(_format_, _args_) \ + __attribute__((format(__printf__, _format_, _args_))) +#define _EXPORT +#define _IMPORT + #endif /* _BE_BUILD_H */ From axeld at pinc-software.de Tue May 12 22:58:10 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Tue, 12 May 2009 22:58:10 +0200 CEST Subject: [Haiku-commits] r30723 - haiku/trunk/src/preferences/keymap In-Reply-To: <50367935611-BeMail@zon> Message-ID: <51107308765-BeMail@zon> "Axel D?rfler" wrote: > Oliver Tappe wrote: > What I meant is that you don't have to save the keymap under a name > (as > it's stored in "Current"), and that one you actually can overwrite. > But > as I said, that's what others do as well. > > But since that is so, we should remove the 'Save' menu item, too, > > since now it will never be enabled ;-) > Oh my :-) While I'm at it, I just looked at the dead key stuff now, and I'm not so fond of the BMenuBar - any reason you don't use a BPopUpMenu that does not take over the label from its selected entry? Also, it does not seem to work correctly with regards to modifiers. How do I select which modifiers I need to have pressed to make the dead key work? For example, in the American keymap, the '`' key is available via the "option" modifier as dead key, but is a standard key when you don't press that modifier. I am not sure if that would be the perfect solution, but we could make the contents of the popup menu depend on the current modifiers, and also disable keys that aren't accessible with the current set of modifiers. Bye, Axel. From bonefish at mail.berlios.de Tue May 12 23:01:29 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Tue, 12 May 2009 23:01:29 +0200 Subject: [Haiku-commits] r30728 - in haiku/trunk: headers/private/system src/system/glue Message-ID: <200905122101.n4CL1THB025991@sheep.berlios.de> Author: bonefish Date: 2009-05-12 23:01:26 +0200 (Tue, 12 May 2009) New Revision: 30728 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30728&view=rev Added: haiku/trunk/headers/private/system/image_defs.h Modified: haiku/trunk/src/system/glue/init_term_dyn.c Log: Added variables to the glue code that identify the Haiku version and ABI. Added: haiku/trunk/headers/private/system/image_defs.h =================================================================== --- haiku/trunk/headers/private/system/image_defs.h 2009-05-12 20:55:49 UTC (rev 30727) +++ haiku/trunk/headers/private/system/image_defs.h 2009-05-12 21:01:26 UTC (rev 30728) @@ -0,0 +1,18 @@ +/* + * Copyright 2009, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ +#ifndef _SYSTEM_IMAGE_DEFS_H +#define _SYSTEM_IMAGE_DEFS_H + +#include + + +#define B_SHARED_OBJECT_HAIKU_VERSION_VARIABLE _gSharedObjectHaikuVersion +#define B_SHARED_OBJECT_HAIKU_VERSION_VARIABLE_NAME "_gSharedObjectHaikuVersion" + +#define B_SHARED_OBJECT_HAIKU_ABI_VARIABLE _gSharedObjectHaikuABI +#define B_SHARED_OBJECT_HAIKU_ABI_VARIABLE_NAME "_gSharedObjectHaikuABI" + + +#endif /* _SYSTEM_IMAGE_DEFS_H */ Modified: haiku/trunk/src/system/glue/init_term_dyn.c =================================================================== --- haiku/trunk/src/system/glue/init_term_dyn.c 2009-05-12 20:55:49 UTC (rev 30727) +++ haiku/trunk/src/system/glue/init_term_dyn.c 2009-05-12 21:01:26 UTC (rev 30728) @@ -3,13 +3,21 @@ * Distributed under the terms of the MIT License. */ - #include #include +#include #include "init_term_dyn.h" +// Haiku API and ABI versions -- we compile those into shared objects so that +// the runtime loader can discriminate the versions and enable compatibility +// work-arounds, if necessary. + +uint32 B_SHARED_OBJECT_HAIKU_VERSION_VARIABLE = B_HAIKU_VERSION; +uint32 B_SHARED_OBJECT_HAIKU_ABI_VARIABLE = B_HAIKU_ABI; + + /** These functions are called from _init()/_fini() (in crti.S, crtn.S) * _init/_term_before() is called before crtbegin/end code is executed, * _init/_term_after() after this. From bonefish at mail.berlios.de Tue May 12 23:09:00 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Tue, 12 May 2009 23:09:00 +0200 Subject: [Haiku-commits] r30729 - in haiku/trunk: headers/os/kernel headers/private/runtime_loader src/system/kernel src/system/runtime_loader Message-ID: <200905122109.n4CL90ev026393@sheep.berlios.de> Author: bonefish Date: 2009-05-12 23:08:56 +0200 (Tue, 12 May 2009) New Revision: 30729 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30729&view=rev Modified: haiku/trunk/headers/os/kernel/image.h haiku/trunk/headers/private/runtime_loader/runtime_loader.h haiku/trunk/src/system/kernel/elf.cpp haiku/trunk/src/system/kernel/image.cpp haiku/trunk/src/system/runtime_loader/elf.cpp Log: Extended image_info by fields for the Haiku version and ABI. The runtime loader and the kernel read those values from the shared object (if available). In the runtime loader this should eventually replace the gcc version guessing method currently used (at least for shared objects built for Haiku). The optional packages need to be rebuilt first, though. Modified: haiku/trunk/headers/os/kernel/image.h =================================================================== --- haiku/trunk/headers/os/kernel/image.h 2009-05-12 21:01:26 UTC (rev 30728) +++ haiku/trunk/headers/os/kernel/image.h 2009-05-12 21:08:56 UTC (rev 30729) @@ -33,6 +33,10 @@ void *data; int32 text_size; int32 data_size; + + // Haiku R1 extensions + int32 api_version; // the Haiku API version used by the image + int32 abi; // the Haiku ABI used by the image } image_info; // flags for clear_caches() Modified: haiku/trunk/headers/private/runtime_loader/runtime_loader.h =================================================================== --- haiku/trunk/headers/private/runtime_loader/runtime_loader.h 2009-05-12 21:01:26 UTC (rev 30728) +++ haiku/trunk/headers/private/runtime_loader/runtime_loader.h 2009-05-12 21:08:56 UTC (rev 30729) @@ -85,6 +85,9 @@ bool haiku; } gcc_version; + uint32 api_version; + uint32 abi; + addr_t entry_point; addr_t init_routine; addr_t term_routine; Modified: haiku/trunk/src/system/kernel/elf.cpp =================================================================== --- haiku/trunk/src/system/kernel/elf.cpp 2009-05-12 21:01:26 UTC (rev 30728) +++ haiku/trunk/src/system/kernel/elf.cpp 2009-05-12 21:08:56 UTC (rev 30729) @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -59,6 +60,10 @@ static bool sInitialized = false; +static struct Elf32_Sym *elf_find_symbol(struct elf_image_info *image, + const char *name); + + /*! Calculates hash for an image using its ID */ static uint32 image_hash(void *_image, const void *_key, uint32 range) @@ -107,6 +112,46 @@ imageInfo.data = (void *)image->data_region.start; imageInfo.data_size = image->data_region.size; + if (image->text_region.id >= 0) { + // evaluate the API/ABI version symbols + + // Haiku API version + imageInfo.api_version = 0; + struct Elf32_Sym* symbol = elf_find_symbol(image, + B_SHARED_OBJECT_HAIKU_VERSION_VARIABLE_NAME); + if (symbol != NULL && symbol->st_shndx != SHN_UNDEF + && symbol->st_value > 0 + && ELF32_ST_TYPE(symbol->st_info) == STT_OBJECT + && symbol->st_size >= sizeof(uint32)) { + addr_t symbolAddress = symbol->st_value + image->text_region.delta; + if (symbolAddress >= image->text_region.start + && symbolAddress - image->text_region.start + sizeof(uint32) + <= image->text_region.size) { + imageInfo.api_version = *(uint32*)symbolAddress; + } + } + + // Haiku ABI + imageInfo.abi = 0; + symbol = elf_find_symbol(image, + B_SHARED_OBJECT_HAIKU_ABI_VARIABLE_NAME); + if (symbol != NULL && symbol->st_shndx != SHN_UNDEF + && symbol->st_value > 0 + && ELF32_ST_TYPE(symbol->st_info) == STT_OBJECT + && symbol->st_size >= sizeof(uint32)) { + addr_t symbolAddress = symbol->st_value + image->text_region.delta; + if (symbolAddress >= image->text_region.start + && symbolAddress - image->text_region.start + sizeof(uint32) + <= image->text_region.size) { + imageInfo.api_version = *(uint32*)symbolAddress; + } + } + } else { + // in-memory image -- use the current values + imageInfo.api_version = B_HAIKU_VERSION; + imageInfo.abi = B_HAIKU_ABI; + } + image->id = register_image(team_get_kernel_team(), &imageInfo, sizeof(image_info)); hash_insert(sImagesHash, image); @@ -1529,6 +1574,12 @@ imageInfo.node = st.st_ino; strlcpy(imageInfo.name, path, sizeof(imageInfo.name)); + imageInfo.api_version = B_HAIKU_VERSION; + imageInfo.abi = B_HAIKU_ABI; + // TODO: Get the actual values for the shared object. Currently only + // the runtime loader is loaded, so this is good enough for the time + // being. + imageInfo.id = register_image(team, &imageInfo, sizeof(image_info)); if (imageInfo.id >= 0 && team_get_current_team_id() == team->id) user_debug_image_created(&imageInfo); Modified: haiku/trunk/src/system/kernel/image.cpp =================================================================== --- haiku/trunk/src/system/kernel/image.cpp 2009-05-12 21:01:26 UTC (rev 30728) +++ haiku/trunk/src/system/kernel/image.cpp 2009-05-12 21:08:56 UTC (rev 30729) @@ -189,6 +189,9 @@ status_t _get_image_info(image_id id, image_info *info, size_t size) { + if (size > sizeof(image_info)) + return B_BAD_VALUE; + status_t status = B_ENTRY_NOT_FOUND; mutex_lock(&sImageMutex); @@ -209,6 +212,9 @@ _get_next_image_info(team_id teamID, int32 *cookie, image_info *info, size_t size) { + if (size > sizeof(image_info)) + return B_BAD_VALUE; + status_t status = B_ENTRY_NOT_FOUND; struct team *team; cpu_status state; @@ -468,13 +474,13 @@ image_info info; status_t status; - if (size != sizeof(image_info)) + if (size > sizeof(image_info)) return B_BAD_VALUE; if (!IS_USER_ADDRESS(userInfo)) return B_BAD_ADDRESS; - status = _get_image_info(id, &info, size); + status = _get_image_info(id, &info, sizeof(image_info)); if (user_memcpy(userInfo, &info, size) < B_OK) return B_BAD_ADDRESS; @@ -484,18 +490,19 @@ status_t -_user_get_next_image_info(team_id team, int32 *_cookie, image_info *userInfo, size_t size) +_user_get_next_image_info(team_id team, int32 *_cookie, image_info *userInfo, + size_t size) { image_info info; status_t status; - if (size != sizeof(image_info)) + if (size > sizeof(image_info)) return B_BAD_VALUE; if (!IS_USER_ADDRESS(userInfo) || !IS_USER_ADDRESS(_cookie)) return B_BAD_ADDRESS; - status = _get_next_image_info(team, _cookie, &info, size); + status = _get_next_image_info(team, _cookie, &info, sizeof(image_info)); if (user_memcpy(userInfo, &info, size) < B_OK) return B_BAD_ADDRESS; Modified: haiku/trunk/src/system/runtime_loader/elf.cpp =================================================================== --- haiku/trunk/src/system/runtime_loader/elf.cpp 2009-05-12 21:01:26 UTC (rev 30728) +++ haiku/trunk/src/system/runtime_loader/elf.cpp 2009-05-12 21:08:56 UTC (rev 30729) @@ -1,5 +1,5 @@ /* - * Copyright 2008, Ingo Weinhold, ingo_weinhold at gmx.de. + * Copyright 2008-2009, Ingo Weinhold, ingo_weinhold at gmx.de. * Copyright 2003-2008, Axel D?rfler, axeld at pinc-software.de. * Distributed under the terms of the MIT License. * @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -144,6 +145,10 @@ extern runtime_loader_add_on_export gRuntimeLoaderAddOnExport; +static struct Elf32_Sym* find_symbol(image_t* image, const char* name, + int32 type); + + void dprintf(const char *format, ...) { @@ -694,6 +699,34 @@ } +static void +analyze_image_haiku_version_and_abi(image_t* image) +{ + // Haiku API version + struct Elf32_Sym* symbol = find_symbol(image, + B_SHARED_OBJECT_HAIKU_VERSION_VARIABLE_NAME, B_SYMBOL_TYPE_DATA); + if (symbol != NULL && symbol->st_shndx != SHN_UNDEF + && symbol->st_value > 0 + && ELF32_ST_TYPE(symbol->st_info) == STT_OBJECT + && symbol->st_size >= sizeof(uint32)) { + image->api_version + = *(uint32*)(symbol->st_value + image->regions[0].delta); + } else + image->api_version = 0; + + // Haiku ABI + symbol = find_symbol(image, B_SHARED_OBJECT_HAIKU_ABI_VARIABLE_NAME, + B_SYMBOL_TYPE_DATA); + if (symbol != NULL && symbol->st_shndx != SHN_UNDEF + && symbol->st_value > 0 + && ELF32_ST_TYPE(symbol->st_info) == STT_OBJECT + && symbol->st_size >= sizeof(uint32)) { + image->abi = *(uint32*)(symbol->st_value + image->regions[0].delta); + } else + image->abi = 0; +} + + static bool analyze_object_gcc_version(int fd, image_t* image, Elf32_Ehdr& eheader, int32 sheaderSize, char* buffer, size_t bufferSize) @@ -831,9 +864,9 @@ // well as cases where e.g. in a gcc 2 program a single C file has // been compiled with gcc 4. if (gccMajor == 0 || gccMajor > version[0] - || gccMajor == version[0] + || (gccMajor == version[0] && (gccMiddle < version[1] - || gccMiddle == version[1] && gccMinor < version[2])) { + || (gccMiddle == version[1] && gccMinor < version[2])))) { gccMajor = version[0]; gccMiddle = version[1]; gccMinor = version[2]; @@ -1311,9 +1344,9 @@ image_t* otherImage = sLoadedImages.head; while (otherImage != NULL) { if (otherImage == rootImage - || otherImage->type != B_ADD_ON_IMAGE + || (otherImage->type != B_ADD_ON_IMAGE && (otherImage->flags - & (RTLD_GLOBAL | RFLAG_USE_FOR_RESOLVING)) != 0) { + & (RTLD_GLOBAL | RFLAG_USE_FOR_RESOLVING)) != 0)) { struct Elf32_Sym *symbol = find_symbol(otherImage, name, B_SYMBOL_TYPE_ANY); if (symbol) { @@ -1542,6 +1575,8 @@ info.text_size = image->regions[0].vmsize; info.data = (void *)image->regions[1].vmstart; info.data_size = image->regions[1].vmsize; + info.api_version = image->api_version; + info.abi = image->abi; image->id = _kern_register_image(&info, sizeof(image_info)); } @@ -1687,6 +1722,24 @@ goto err2; } + status = map_image(fd, path, image, type == B_APP_IMAGE); + if (status < B_OK) { + FATAL("Could not map image: %s\n", strerror(status)); + status = B_ERROR; + goto err2; + } + + if (!parse_dynamic_segment(image)) { + FATAL("Troubles handling dynamic section\n"); + status = B_BAD_DATA; + goto err3; + } + + if (eheader.e_entry != 0) + image->entry_point = eheader.e_entry + image->regions[0].delta; + + analyze_image_haiku_version_and_abi(image); + if (analyze_object_gcc_version(fd, image, eheader, sheaderSize, ph_buff, sizeof(ph_buff))) { // If this is the executable image, we init the search path @@ -1709,26 +1762,10 @@ // symbol resolution strategy (fallback is R5-style, if version is // unavailable) if (image->gcc_version.major == 0 - || image->gcc_version.major == 2 && image->gcc_version.middle < 95) { + || (image->gcc_version.major == 2 && image->gcc_version.middle < 95)) { image->find_undefined_symbol = find_undefined_symbol_beos; } - status = map_image(fd, path, image, type == B_APP_IMAGE); - if (status < B_OK) { - FATAL("Could not map image: %s\n", strerror(status)); - status = B_ERROR; - goto err2; - } - - if (!parse_dynamic_segment(image)) { - FATAL("Troubles handling dynamic section\n"); - status = B_BAD_DATA; - goto err3; - } - - if (eheader.e_entry != 0) - image->entry_point = eheader.e_entry + image->regions[0].delta; - image->type = type; register_image(image, fd, path); image_event(image, IMAGE_EVENT_LOADED); From bga at bug-br.org.br Tue May 12 18:10:28 2009 From: bga at bug-br.org.br (Bruno Albuquerque) Date: Tue, 12 May 2009 18:10:28 Subject: [Haiku-commits] r30718 - haiku/trunk/src/preferences/keymap In-Reply-To: <200905121831.n4CIVIcs007751@sheep.berlios.de> Message-ID: <391947123-BeMail@Gaspode> On Tue, 12 May 2009 20:31:18 +0200, zooey at BerliOS said: > * Added support for selecting the dead key trigger characters from a > menubar, > offering two choices for acute and diaeresis as well as allowing to > switch > off each dead key completely. > * moved the textview on a line of its own such that the dead key menu > and > the modifier-switching button live together on one line > * added enum dead_key_index and used it at a couple of places instead > of > having to use the magic numbers 1-5 > * refactored the actual updating of the fChars buffer from SetKey() > into > _SetChars(), which is now being invoked by SetDeadKeyTrigger(), too Works like a charm. Thanks! From axeld at mail.berlios.de Tue May 12 23:17:25 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 12 May 2009 23:17:25 +0200 Subject: [Haiku-commits] r30730 - haiku/trunk/src/servers/registrar Message-ID: <200905122117.n4CLHPsm027106@sheep.berlios.de> Author: axeld Date: 2009-05-12 23:17:25 +0200 (Tue, 12 May 2009) New Revision: 30730 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30730&view=rev Modified: haiku/trunk/src/servers/registrar/ShutdownProcess.cpp Log: * Added the option to the shutdown confirmation dialog to perform the "other" shutdown, ie. either reboot or shutdown. Modified: haiku/trunk/src/servers/registrar/ShutdownProcess.cpp =================================================================== --- haiku/trunk/src/servers/registrar/ShutdownProcess.cpp 2009-05-12 21:08:56 UTC (rev 30729) +++ haiku/trunk/src/servers/registrar/ShutdownProcess.cpp 2009-05-12 21:17:25 UTC (rev 30730) @@ -1255,19 +1255,23 @@ // ask the user to confirm the shutdown, if desired bool askUser; if (fHasGUI && fRequest->FindBool("confirm", &askUser) == B_OK && askUser) { - const char *title = (fReboot ? "Restart?" : "Shut Down?"); - const char *text = (fReboot + const char* title = fReboot ? "Restart?" : "Shut Down?"; + const char* text = fReboot ? "Do you really want to restart the system?" - : "Do you really want to shut down the system?"); - const char *buttonText = (fReboot ? "Restart" : "Shut Down"); - BAlert *alert = new BAlert(title, text, "Cancel", buttonText, NULL, + : "Do you really want to shut down the system?"; + const char* defaultText = fReboot ? "Restart" : "Shut Down"; + const char* otherText = fReboot ? "Shut Down" : "Restart"; + BAlert* alert = new BAlert(title, text, "Cancel", otherText, defaultText, B_WIDTH_AS_USUAL, B_WARNING_ALERT); alert->SetShortcut(0, B_ESCAPE); alert->SetFeel(B_NORMAL_WINDOW_FEEL); alert->SetWorkspaces(B_ALL_WORKSPACES); int32 result = alert->Go(); - if (result != 1) + if (result == 1) { + // Toggle shutdown method + fReboot = !fReboot; + } else if (result < 1) throw_error(B_SHUTDOWN_CANCELLED); } From axeld at mail.berlios.de Tue May 12 23:19:02 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 12 May 2009 23:19:02 +0200 Subject: [Haiku-commits] r30731 - haiku/trunk/src/apps/deskbar Message-ID: <200905122119.n4CLJ2He027177@sheep.berlios.de> Author: axeld Date: 2009-05-12 23:19:02 +0200 (Tue, 12 May 2009) New Revision: 30731 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30731&view=rev Modified: haiku/trunk/src/apps/deskbar/BarApp.cpp haiku/trunk/src/apps/deskbar/BeMenu.cpp Log: * When activating the "Shutdown" menu (instead of one of its items), we now get the old shutdown dialog back, but with the additional option to reboot instead. Modified: haiku/trunk/src/apps/deskbar/BarApp.cpp =================================================================== --- haiku/trunk/src/apps/deskbar/BarApp.cpp 2009-05-12 21:17:25 UTC (rev 30730) +++ haiku/trunk/src/apps/deskbar/BarApp.cpp 2009-05-12 21:19:02 UTC (rev 30731) @@ -164,11 +164,11 @@ bool TBarApp::QuitRequested() { - if (CurrentMessage() && CurrentMessage()->FindBool("shortcut")) + if (CurrentMessage() && CurrentMessage()->FindBool("shortcut")) // don't allow user quitting return false; - // system quitting, call inherited to notify all loopers + // system quitting, call inherited to notify all loopers fBarWindow->SaveSettings(); BApplication::QuitRequested(); return true; @@ -268,7 +268,7 @@ fSettingsFile->Read(&settings.recentDocsCount, sizeof(int32)); } if (size >= kValidSettingsSize4) { - fSettingsFile->Read(&settings.timeShowSeconds, sizeof(bool)); + fSettingsFile->Read(&settings.timeShowSeconds, sizeof(bool)); fSettingsFile->Read(&settings.timeShowMil, sizeof(bool)); } if (size >= kValidSettingsSize5) @@ -344,13 +344,13 @@ break; case kConfigClose: - if (message->FindInt32("applications", &count) == B_OK) + if (message->FindInt32("applications", &count) == B_OK) fSettings.recentAppsCount = count; - if (message->FindInt32("folders", &count) == B_OK) + if (message->FindInt32("folders", &count) == B_OK) fSettings.recentFoldersCount = count; - if (message->FindInt32("documents", &count) == B_OK) + if (message->FindInt32("documents", &count) == B_OK) fSettings.recentDocsCount = count; - + fConfigWindow = NULL; break; @@ -364,7 +364,7 @@ const char *sig = NULL; message->FindString("be:signature", &sig); - + entry_ref ref; message->FindRef("be:ref", &ref); @@ -373,7 +373,7 @@ } case B_SOME_APP_QUIT: - { + { team_id team = -1; message->FindInt32("be:team", &team); RemoveTeam(team); @@ -389,7 +389,7 @@ case msg_Be: __set_window_decor(0); break; - + case msg_Win95: __set_window_decor(2); break; @@ -408,11 +408,11 @@ else BDragger::ShowAllDraggers(); break; - + case msg_AlwaysTop: fSettings.alwaysOnTop = !fSettings.alwaysOnTop; - fBarWindow->SetFeel(fSettings.alwaysOnTop ? + fBarWindow->SetFeel(fSettings.alwaysOnTop ? B_FLOATING_ALL_WINDOW_FEEL : B_NORMAL_WINDOW_FEEL); break; @@ -456,7 +456,7 @@ Unsubscribe(messenger); break; } - + case msg_superExpando: { fSettings.superExpando = !fSettings.superExpando; @@ -467,7 +467,7 @@ fBarWindow->Unlock(); break; } - + case msg_expandNewTeams: { fSettings.expandNewTeams = !fSettings.expandNewTeams; @@ -479,7 +479,7 @@ break; } - case 'TASK': + case 'TASK': fSwitcherMessenger.SendMessage(message); break; @@ -488,11 +488,15 @@ break; case CMD_REBOOT_SYSTEM: - case CMD_SHUTDOWN_SYSTEM: { + case CMD_SHUTDOWN_SYSTEM: + { bool reboot = (message->what == CMD_REBOOT_SYSTEM); + bool confirm; + message->FindBool("confirm", &confirm); + BRoster roster; BRoster::Private rosterPrivate(roster); - status_t error = rosterPrivate.ShutDown(reboot, false, false); + status_t error = rosterPrivate.ShutDown(reboot, confirm, false); if (error != B_OK) fprintf(stderr, "Shutdown failed: %s\n", strerror(error)); @@ -509,7 +513,7 @@ break; default: - BApplication::MessageReceived(message); + BApplication::MessageReceived(message); break; } } @@ -590,7 +594,7 @@ if (!autolock.IsLocked()) return; - // have we already seen this team, is this another instance of + // have we already seen this team, is this another instance of // a known app? BarTeamInfo *multiLaunchTeam = NULL; int32 teamCount = sBarTeamInfoList.CountItems(); @@ -612,7 +616,7 @@ message.AddString("sig", multiLaunchTeam->sig); for (int32 i = 0; i < subsCount; i++) - ((BMessenger *)sSubscribers.ItemAt(i))->SendMessage(&message); + ((BMessenger *)sSubscribers.ItemAt(i))->SendMessage(&message); } return; } @@ -620,7 +624,7 @@ BFile file(ref, B_READ_ONLY); BAppFileInfo appMime(&file); - BarTeamInfo *barInfo = new BarTeamInfo(new BList(), flags, strdup(sig), + BarTeamInfo *barInfo = new BarTeamInfo(new BList(), flags, strdup(sig), new BBitmap(kIconSize, kIconFormat), strdup(ref->name)); barInfo->teams->AddItem((void *)team); @@ -682,7 +686,7 @@ return; } } - } + } } @@ -697,8 +701,8 @@ BPath path; find_directory (B_USER_DESKBAR_DIRECTORY, &path); entry_ref startref; - get_ref_for_path(path.Path(), &startref); - + get_ref_for_path(path.Path(), &startref); + fConfigWindow = new TFavoritesConfigWindow(BRect(0, 0, 320, 240), #ifdef __HAIKU__ "Configure Leaf Menu", false, B_ANY_NODE, Modified: haiku/trunk/src/apps/deskbar/BeMenu.cpp =================================================================== --- haiku/trunk/src/apps/deskbar/BeMenu.cpp 2009-05-12 21:17:25 UTC (rev 30730) +++ haiku/trunk/src/apps/deskbar/BeMenu.cpp 2009-05-12 21:19:02 UTC (rev 30731) @@ -124,7 +124,7 @@ } -bool +bool TBeMenu::StartBuildingItemList() { RemoveItems(0, CountItems(), true); @@ -145,9 +145,9 @@ } -bool +bool TBeMenu::AddNextItem() -{ +{ if (fAddState == kStart) return AddStandardBeMenuItems(); @@ -167,7 +167,7 @@ if (count > 0) { AddSeparatorItem(); - for (int i = 0;i < recentTypes;i++) { + for (int i = 0;i < recentTypes;i++) { if (!recentItem[i]) continue; @@ -290,7 +290,7 @@ subMenu->AddItem(item); subMenu->AddSeparatorItem(); - + TReplicantTray *replicantTray = ((TBarApp *)be_app)->BarView()->fReplicantTray; item = new BMenuItem("24 Hour Clock", new BMessage(kMsgMilTime)); @@ -386,10 +386,13 @@ #ifdef __HAIKU__ shutdownMenu->SetTargetForItems(be_app); + BMessage* message = new BMessage(CMD_SHUTDOWN_SYSTEM); + message->AddBool("confirm", true); + AddItem(new BMenuItem(shutdownMenu, message)); #else shutdownMenu->SetTargetForItems(BMessenger(ROSTER_SIG)); + AddItem(shutdownMenu); #endif - AddItem(shutdownMenu); fAddState = kAddingRecents; @@ -397,7 +400,7 @@ } -void +void TBeMenu::ClearMenuBuildingState() { fAddState = kDone; @@ -556,12 +559,12 @@ { // // BNavMenu::DetachedFromWindow sets the TypesList to NULL - // + // BMenu::DetachedFromWindow(); } -bool +bool TRecentsMenu::StartBuildingItemList() { RemoveItems(0, CountItems(), true); @@ -576,7 +579,7 @@ } -bool +bool TRecentsMenu::AddNextItem() { if (fRecentsCount > 0 && AddRecents(fRecentsCount)) @@ -681,7 +684,7 @@ } -void +void TRecentsMenu::DoneBuildingItemList() { // !! note: don't call inherited here @@ -694,7 +697,7 @@ } -void +void TRecentsMenu::ClearMenuBuildingState() { fMenuBuilt = false; @@ -705,7 +708,7 @@ void TRecentsMenu::ResetTargets() { - BNavMenu::ResetTargets(); + BNavMenu::ResetTargets(); // if we are dragging, set the target to whatever was set // else set it to the default (Tracker) From zooey at hirschkaefer.de Tue May 12 23:26:01 2009 From: zooey at hirschkaefer.de (Oliver Tappe) Date: Tue, 12 May 2009 23:26:01 +0200 Subject: [Haiku-commits] r30723 - haiku/trunk/src/preferences/keymap In-Reply-To: <51107308765-BeMail@zon> References: <51107308765-BeMail@zon> Message-ID: <20090512232601.2830.10@bepc.1242114422.fake> On 2009-05-12 at 23:02:04 [+0200], Axel D?rfler wrote: > "Axel D?rfler" wrote: > > Oliver Tappe wrote: > > What I meant is that you don't have to save the keymap under a name > > (as > > it's stored in "Current"), and that one you actually can overwrite. > > But > > as I said, that's what others do as well. > > > But since that is so, we should remove the 'Save' menu item, too, > > > since now it will never be enabled ;-) > > Oh my :-) > > While I'm at it, I just looked at the dead key stuff now, and I'm not > so fond of the BMenuBar - any reason you don't use a BPopUpMenu that > does not take over the label from its selected entry? Nope, but will do! > Also, it does not seem to work correctly with regards to modifiers. How > do I select which modifiers I need to have pressed to make the dead key > work? For example, in the American keymap, the '`' key is available via > the "option" modifier as dead key, but is a standard key when you don't > press that modifier. Yes, currently these two things are separated: the menu only defines which characters work as dead key triggers. You can enable/disable the dead key / modifier combination by clicking on the respective key with the middle mouse button once you have pressed the required modifiers. So the menu sets up dead_key[1] and the middle clicks add/remove modifiers from the dead_key_table field. But maybe that feature is too complicated/hidden? > I am not sure if that would be the perfect solution, but we could make > the contents of the popup menu depend on the current modifiers, and > also disable keys that aren't accessible with the current set of > modifiers. Right, we could do that, too. This would probably be more obvious than having to use the middle mouse button. cheers, Oliver From ingo_weinhold at gmx.de Tue May 12 23:29:59 2009 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Tue, 12 May 2009 23:29:59 +0200 Subject: [Haiku-commits] r30730 - haiku/trunk/src/servers/registrar In-Reply-To: <200905122117.n4CLHPsm027106@sheep.berlios.de> References: <200905122117.n4CLHPsm027106@sheep.berlios.de> Message-ID: <20090512232959.350.1@knochen-vm.localdomain> On 2009-05-12 at 23:17:25 [+0200], axeld at BerliOS wrote: > Author: axeld > Date: 2009-05-12 23:17:25 +0200 (Tue, 12 May 2009) > New Revision: 30730 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30730&view=rev > > Modified: > haiku/trunk/src/servers/registrar/ShutdownProcess.cpp > Log: > * Added the option to the shutdown confirmation dialog to perform the > "other" > shutdown, ie. either reboot or shutdown. Besides that I don't like this change -- almost identical alerts with the buttons swapped -- in which situation besides "shutdown -a" is the alert still shown? CU, Ingo From mattmadia at gmail.com Wed May 13 00:35:18 2009 From: mattmadia at gmail.com (Matt Madia) Date: Tue, 12 May 2009 22:35:18 +0000 Subject: [Haiku-commits] r30729 - in haiku/trunk: headers/os/kernel headers/private/runtime_loader src/system/kernel src/system/runtime_loader In-Reply-To: <200905122109.n4CL90ev026393@sheep.berlios.de> References: <200905122109.n4CL90ev026393@sheep.berlios.de> Message-ID: <1e42d8c50905121535j39d5e54jf5468ae7bb499c1e@mail.gmail.com> On Tue, May 12, 2009 at 9:09 PM, wrote: > Log: > Extended image_info by fields for the Haiku version and ABI. The runtime loader > and the kernel read those values from the shared object (if available). In the > runtime loader this should eventually replace the gcc version guessing method > currently used (at least for shared objects built for Haiku). The optional > packages need to be rebuilt first, though. Should the OptionalPackages be rebuilt now or are there more related commits to follow? --mmadia From bga at mail.berlios.de Wed May 13 00:47:53 2009 From: bga at mail.berlios.de (bga at BerliOS) Date: Wed, 13 May 2009 00:47:53 +0200 Subject: [Haiku-commits] r30732 - haiku/trunk/src/add-ons/kernel/file_systems/cdda Message-ID: <200905122247.n4CMlrgT018122@sheep.berlios.de> Author: bga Date: 2009-05-13 00:47:22 +0200 (Wed, 13 May 2009) New Revision: 30732 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30732&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp Log: - If the name of a CD was changed, return this name instead of the generic "Audio CD" or CD Text obtained one. Modified: haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp 2009-05-12 21:19:02 UTC (rev 30731) +++ haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp 2009-05-12 22:47:22 UTC (rev 30732) @@ -102,7 +102,8 @@ size_t BufferSize() const { return 32 * kFrameSize; } // TODO: for now - static void DetermineName(cdtext& text, char* name, size_t length); + static void DetermineName(uint32 cddbId, int DeviceFD, char* name, + size_t length); private: Inode* _CreateNode(Inode* parent, const char* name, @@ -437,6 +438,58 @@ } +static int +open_attributes(uint32 cddbId, int deviceFD, int mode, + enum attr_mode attrMode) +{ + char* path = (char*)malloc(B_PATH_NAME_LENGTH); + if (path == NULL) + return -1; + + bool create = (mode & O_WRONLY) != 0; + + if (find_directory(B_USER_SETTINGS_DIRECTORY, -1, create, path, + B_PATH_NAME_LENGTH) != B_OK) { + free(path); + return -1; + } + + strlcat(path, "/cdda", B_PATH_NAME_LENGTH); + if (create) + mkdir(path, 0755); + + if (attrMode == kDiscIDAttributes) { + char id[64]; + snprintf(id, sizeof(id), "/%08lx", cddbId); + strlcat(path, id, B_PATH_NAME_LENGTH); + } else if (attrMode == kDeviceAttributes) { + uint32 length = strlen(path); + char* device = path + length; + if (ioctl(deviceFD, B_GET_PATH_FOR_DEVICE, device, + B_PATH_NAME_LENGTH - length) < B_OK) { + free(path); + return B_ERROR; + } + + device++; + + // replace slashes in the device path + while (device[0]) { + if (device[0] == '/') + device[0] = '_'; + + device++; + } + } else + strlcat(path, "/shared", B_PATH_NAME_LENGTH); + + int fd = open(path, mode | (create ? O_CREAT | O_TRUNC : 0), 0644); + + free(path); + return fd; +} + + static void fill_stat_buffer(Volume* volume, Inode* inode, Attribute* attribute, struct stat& stat) @@ -545,15 +598,33 @@ /*static*/ void -Volume::DetermineName(cdtext& text, char* name, size_t length) +Volume::DetermineName(uint32 cddbId, int deviceFD, char* name, size_t length) { - if (text.artist != NULL && text.album != NULL) - snprintf(name, length, "%s - %s", text.artist, text.album); - else if (text.artist != NULL || text.album != NULL) { - snprintf(name, length, "%s", text.artist != NULL - ? text.artist : text.album); - } else - strlcpy(name, "Audio CD", length); + int attrFD = open_attributes(cddbId, deviceFD, O_RDONLY, + kDiscIDAttributes); + if (attrFD < 0) { + // We do not have attributes set. Read CD text. + cdtext text; + read_cdtext(deviceFD, text); + if (text.artist != NULL && text.album != NULL) + snprintf(name, length, "%s - %s", text.artist, text.album); + else if (text.artist != NULL || text.album != NULL) { + snprintf(name, length, "%s", text.artist != NULL + ? text.artist : text.album); + } else + strlcpy(name, "Audio CD", length); + } else { + // We have an attribute file. Read name from it. + char line[B_FILE_NAME_LENGTH]; + if (!read_line(attrFD, line, B_FILE_NAME_LENGTH)) { + // Could not get name from attribute file. use default name. + strlcpy(name, "Audio CD", length); + } else { + // We got a name. Use it. + strlcpy(name, line, length); + } + close(attrFD); + } } @@ -685,7 +756,7 @@ free(toc); // determine volume title - DetermineName(text, title, sizeof(title)); + DetermineName(fDiscID, fDevice, title, sizeof(title)); fName = strdup(title); if (fName == NULL) @@ -787,51 +858,7 @@ int Volume::_OpenAttributes(int mode, enum attr_mode attrMode) { - char* path = (char*)malloc(B_PATH_NAME_LENGTH); - if (path == NULL) - return -1; - - bool create = (mode & O_WRONLY) != 0; - - if (find_directory(B_USER_SETTINGS_DIRECTORY, -1, create, path, - B_PATH_NAME_LENGTH) != B_OK) { - free(path); - return -1; - } - - strlcat(path, "/cdda", B_PATH_NAME_LENGTH); - if (create) - mkdir(path, 0755); - - if (attrMode == kDiscIDAttributes) { - char id[64]; - snprintf(id, sizeof(id), "/%08lx", fDiscID); - strlcat(path, id, B_PATH_NAME_LENGTH); - } else if (attrMode == kDeviceAttributes) { - uint32 length = strlen(path); - char* device = path + length; - if (ioctl(fDevice, B_GET_PATH_FOR_DEVICE, device, - B_PATH_NAME_LENGTH - length) < B_OK) { - free(path); - return B_ERROR; - } - - device++; - - // replace slashes in the device path - while (device[0]) { - if (device[0] == '/') - device[0] = '_'; - - device++; - } - } else - strlcat(path, "/shared", B_PATH_NAME_LENGTH); - - int fd = open(path, mode | (create ? O_CREAT | O_TRUNC : 0), 0644); - - free(path); - return fd; + return open_attributes(fDiscID, fDevice, mode, attrMode); } @@ -1357,11 +1384,9 @@ // determine volume title - cdtext text; - read_cdtext(fd, text); - + uint32 cddbId = compute_cddb_disc_id(*toc); char name[256]; - Volume::DetermineName(text, name, sizeof(name)); + Volume::DetermineName(cddbId, fd, name, sizeof(name)); partition->content_name = strdup(name); if (partition->content_name == NULL) return B_NO_MEMORY; From dlmcpaul at mail.berlios.de Wed May 13 00:51:22 2009 From: dlmcpaul at mail.berlios.de (dlmcpaul at BerliOS) Date: Wed, 13 May 2009 00:51:22 +0200 Subject: [Haiku-commits] r30733 - haiku/trunk/src/kits/media Message-ID: <200905122251.n4CMpMVx021452@sheep.berlios.de> Author: dlmcpaul Date: 2009-05-13 00:51:15 +0200 (Wed, 13 May 2009) New Revision: 30733 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30733&view=rev Modified: haiku/trunk/src/kits/media/MediaRoster.cpp Log: sigh Modified: haiku/trunk/src/kits/media/MediaRoster.cpp =================================================================== --- haiku/trunk/src/kits/media/MediaRoster.cpp 2009-05-12 22:47:22 UTC (rev 30732) +++ haiku/trunk/src/kits/media/MediaRoster.cpp 2009-05-12 22:51:15 UTC (rev 30733) @@ -2864,12 +2864,12 @@ media_node node; // Get all dormant nodes using GetDormantNodes - if (B_OK == GetDormantNodes(nodes, &count, NULL, NULL, NULL, requireNodeKinds | B_FILE_INTERFACE, 0)) { + if (GetDormantNodes(nodes, &count, NULL, NULL, NULL, requireNodeKinds | B_FILE_INTERFACE, 0) == B_OK) { // Call SniffRefFor on each node that matches requireNodeKinds for (int32 i=0;i Author: zooey Date: 2009-05-13 00:58:09 +0200 (Wed, 13 May 2009) New Revision: 30734 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30734&view=rev Removed: haiku/trunk/src/preferences/keymap/KeymapMessageFilter.cpp haiku/trunk/src/preferences/keymap/KeymapMessageFilter.h Modified: haiku/trunk/src/preferences/keymap/Jamfile haiku/trunk/src/preferences/keymap/Keymap.cpp haiku/trunk/src/preferences/keymap/Keymap.h haiku/trunk/src/preferences/keymap/KeymapWindow.cpp haiku/trunk/src/preferences/keymap/KeymapWindow.h Log: * removed KeymapMessageFilter, as it is no longer needed * fixed a couple of issues with respect to internal/external naming of keymaps and the respective files, hopefully such that there's always one keymap active in the view: either one that has been selected or (Current) if any changes have been applied * replaced the dead-key-menubar with a menufield (thanks Axel, looking much better) cleanup: * removed remnants of Use-button (message constant and switch-case) * dropped 'Save' menu item, as it wasn't implemented anyway and would now never be enabled * removed fFirstTime, as it caused problems, but did not serve any purpose anymore Modified: haiku/trunk/src/preferences/keymap/Jamfile =================================================================== --- haiku/trunk/src/preferences/keymap/Jamfile 2009-05-12 22:51:15 UTC (rev 30733) +++ haiku/trunk/src/preferences/keymap/Jamfile 2009-05-12 22:58:09 UTC (rev 30734) @@ -10,7 +10,6 @@ Keymap.cpp KeymapApplication.cpp KeymapListItem.cpp - KeymapMessageFilter.cpp KeymapWindow.cpp : be tracker $(TARGET_LIBSTDC++) Modified: haiku/trunk/src/preferences/keymap/Keymap.cpp =================================================================== --- haiku/trunk/src/preferences/keymap/Keymap.cpp 2009-05-12 22:51:15 UTC (rev 30733) +++ haiku/trunk/src/preferences/keymap/Keymap.cpp 2009-05-12 22:58:09 UTC (rev 30734) @@ -85,6 +85,13 @@ void +Keymap::SetName(const char* name) +{ + strlcpy(fName, name, sizeof(fName)); +} + + +void Keymap::DumpKeymap() { // Print a chart of the normal, shift, option, and option+shift @@ -151,7 +158,14 @@ if (err < B_OK) { fprintf(stderr, "error reading keymap chars: %s\n", strerror(err)); } - strlcpy(fName, ref.name, sizeof(fName)); + + // fetch name from attribute and fall back to filename + ssize_t bytesRead + = file.ReadAttr("keymap:name", B_STRING_TYPE, 0, fName, sizeof(fName)); + if (bytesRead > 0) + fName[bytesRead] = '\0'; + else + strlcpy(fName, ref.name, sizeof(fName)); return err; } Modified: haiku/trunk/src/preferences/keymap/Keymap.h =================================================================== --- haiku/trunk/src/preferences/keymap/Keymap.h 2009-05-12 22:51:15 UTC (rev 30733) +++ haiku/trunk/src/preferences/keymap/Keymap.h 2009-05-12 22:58:09 UTC (rev 30734) @@ -64,6 +64,8 @@ int8 deadKey, const char* bytes, int32 numBytes = -1); + void SetName(const char* name); + const key_map& Map() const { return fKeys; } key_map& Map() { return fKeys; } Deleted: haiku/trunk/src/preferences/keymap/KeymapMessageFilter.cpp Deleted: haiku/trunk/src/preferences/keymap/KeymapMessageFilter.h Modified: haiku/trunk/src/preferences/keymap/KeymapWindow.cpp =================================================================== --- haiku/trunk/src/preferences/keymap/KeymapWindow.cpp 2009-05-12 22:51:15 UTC (rev 30733) +++ haiku/trunk/src/preferences/keymap/KeymapWindow.cpp 2009-05-12 22:58:09 UTC (rev 30734) @@ -21,8 +21,10 @@ #include #include #include +#include #include #include +#include #include #include #include @@ -31,11 +33,9 @@ #include "KeyboardLayoutView.h" #include "KeymapApplication.h" #include "KeymapListItem.h" -#include "KeymapMessageFilter.h" static const uint32 kMsgMenuFileOpen = 'mMFO'; -static const uint32 kMsgMenuFileSave = 'mMFS'; static const uint32 kMsgMenuFileSaveAs = 'mMFA'; static const uint32 kChangeKeyboardLayout = 'cKyL'; @@ -47,7 +47,6 @@ static const uint32 kMsgSystemMapSelected = 'SmST'; static const uint32 kMsgUserMapSelected = 'UmST'; -static const uint32 kMsgUseKeymap = 'UkyM'; static const uint32 kMsgRevertKeymap = 'Rvrt'; static const uint32 kMsgKeymapUpdated = 'upkM'; @@ -59,11 +58,12 @@ static const char* kDeadKeyTriggerNone = ""; +static const char* kCurrentKeymapName = "(Current)"; + KeymapWindow::KeymapWindow() : BWindow(BRect(80, 50, 880, 380), "Keymap", B_TITLED_WINDOW, - B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS), - fFirstTime(true) + B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS) { SetLayout(new BGroupLayout(B_VERTICAL)); @@ -87,7 +87,7 @@ .Add(fKeyboardLayoutView) //.Add(new BStringView("text label", "Sample and Clipboard:")) .Add(BGroupLayoutBuilder(B_HORIZONTAL, 10) - .Add(_CreateDeadKeyMenu(), 0.0) + .Add(_CreateDeadKeyMenuField(), 0.0) .AddGlue() .Add(fSwitchShortcutsButton)) .Add(fTextControl) @@ -99,8 +99,6 @@ fKeyboardLayoutView->SetTarget(fTextControl->TextView()); fTextControl->MakeFocus(); - fTextControl->TextView()->AddFilter(new KeymapMessageFilter( - B_PROGRAMMED_DELIVERY, B_ANY_SOURCE, &fCurrentMap)); _UpdateButtons(); @@ -194,6 +192,7 @@ int32 i = 0; while (message->FindRef("refs", i++, &ref) == B_OK) { fCurrentMap.Load(ref); + fAppliedMap = fCurrentMap; } fKeyboardLayoutView->SetKeymap(&fCurrentMap); fSystemListView->DeselectAll(); @@ -210,9 +209,12 @@ BDirectory directory(&ref); BEntry entry(&directory, name); entry.GetRef(&ref); + fCurrentMap.SetName(name); fCurrentMap.Save(ref); - + fAppliedMap = fCurrentMap; _FillUserMaps(); + fCurrentMapName = name; + _SelectCurrentMap(); } break; } @@ -220,8 +222,6 @@ case kMsgMenuFileOpen: fOpenPanel->Show(); break; - case kMsgMenuFileSave: - break; case kMsgMenuFileSaveAs: fSavePanel->Show(); break; @@ -267,7 +267,6 @@ BListView* otherListView; if (message->what == kMsgSystemMapSelected) { - fUserListView->DeselectAll(); listView = fSystemListView; otherListView = fUserListView; } else { @@ -290,21 +289,15 @@ KeymapListItem* item = static_cast(listView->ItemAt(index)); if (item != NULL) { - if (!fFirstTime) - fCurrentMap.Load(item->EntryRef()); - else - fFirstTime = false; - + fCurrentMap.Load(item->EntryRef()); + fAppliedMap = fCurrentMap; fKeyboardLayoutView->SetKeymap(&fCurrentMap); + _UseKeymap(); _UpdateButtons(); } break; } - case kMsgUseKeymap: - _UseKeymap(); - _UpdateButtons(); - break; case kMsgRevertKeymap: _RevertKeymap(); _UpdateButtons(); @@ -399,9 +392,6 @@ menu->AddItem(new BMenuItem("Open" B_UTF8_ELLIPSIS, new BMessage(kMsgMenuFileOpen), 'O')); menu->AddSeparatorItem(); - item = new BMenuItem("Save", new BMessage(kMsgMenuFileSave), 'S'); - item->SetEnabled(false); - menu->AddItem(item); menu->AddItem(new BMenuItem("Save As" B_UTF8_ELLIPSIS, new BMessage(kMsgMenuFileSaveAs))); menu->AddSeparatorItem(); @@ -446,12 +436,10 @@ } -BMenuBar* -KeymapWindow::_CreateDeadKeyMenu() +BMenuField* +KeymapWindow::_CreateDeadKeyMenuField() { - BMenuBar* menuBar = new BMenuBar("deadkeymenubar"); - fDeadKeyMenu = new BMenu("Select Dead Keys"); - menuBar->AddItem(fDeadKeyMenu); + BPopUpMenu* deadKeyMenu = new BPopUpMenu("Select Dead Keys", false, false); fAcuteMenu = new BMenu("Acute Trigger"); fAcuteMenu->SetRadioMode(true); @@ -461,7 +449,7 @@ new BMessage(kMsgDeadKeyAcuteChanged))); fAcuteMenu->AddItem(new BMenuItem(kDeadKeyTriggerNone, new BMessage(kMsgDeadKeyAcuteChanged))); - fDeadKeyMenu->AddItem(fAcuteMenu); + deadKeyMenu->AddItem(fAcuteMenu); fCircumflexMenu = new BMenu("Circumflex Trigger"); fCircumflexMenu->SetRadioMode(true); @@ -469,7 +457,7 @@ new BMessage(kMsgDeadKeyCircumflexChanged))); fCircumflexMenu->AddItem(new BMenuItem(kDeadKeyTriggerNone, new BMessage(kMsgDeadKeyCircumflexChanged))); - fDeadKeyMenu->AddItem(fCircumflexMenu); + deadKeyMenu->AddItem(fCircumflexMenu); fDiaeresisMenu = new BMenu("Diaeresis Trigger"); fDiaeresisMenu->SetRadioMode(true); @@ -479,7 +467,7 @@ new BMessage(kMsgDeadKeyDiaeresisChanged))); fDiaeresisMenu->AddItem(new BMenuItem(kDeadKeyTriggerNone, new BMessage(kMsgDeadKeyDiaeresisChanged))); - fDeadKeyMenu->AddItem(fDiaeresisMenu); + deadKeyMenu->AddItem(fDiaeresisMenu); fGraveMenu = new BMenu("Grave Trigger"); fGraveMenu->SetRadioMode(true); @@ -487,7 +475,7 @@ new BMessage(kMsgDeadKeyGraveChanged))); fGraveMenu->AddItem(new BMenuItem(kDeadKeyTriggerNone, new BMessage(kMsgDeadKeyGraveChanged))); - fDeadKeyMenu->AddItem(fGraveMenu); + deadKeyMenu->AddItem(fGraveMenu); fTildeMenu = new BMenu("Tilde Trigger"); fTildeMenu->SetRadioMode(true); @@ -495,9 +483,9 @@ new BMessage(kMsgDeadKeyTildeChanged))); fTildeMenu->AddItem(new BMenuItem(kDeadKeyTriggerNone, new BMessage(kMsgDeadKeyTildeChanged))); - fDeadKeyMenu->AddItem(fTildeMenu); + deadKeyMenu->AddItem(fTildeMenu); - return menuBar; + return new BMenuField(NULL, deadKeyMenu); } @@ -633,8 +621,10 @@ void KeymapWindow::_UpdateButtons() { - if (!fCurrentMap.Equals(fAppliedMap)) + if (!fCurrentMap.Equals(fAppliedMap)) { + fCurrentMap.SetName(kCurrentKeymapName); _UseKeymap(); + } fRevertButton->SetEnabled(!fCurrentMap.Equals(fPreviousMap)); @@ -688,6 +678,7 @@ } +//! Saves current map to the "Key_map" file. void KeymapWindow::_UseKeymap() { @@ -704,6 +695,7 @@ fAppliedMap.Load(ref); fCurrentMapName = _GetActiveKeymapName(); + _SelectCurrentMap(); } @@ -792,7 +784,7 @@ BString KeymapWindow::_GetActiveKeymapName() { - BString mapName = "(Current)"; // safe default + BString mapName = kCurrentKeymapName; // safe default entry_ref ref; _GetCurrentKeymap(ref); @@ -832,6 +824,5 @@ && !_SelectCurrentMap(fUserListView)) { // Select the "(Current)" entry if no name matches fUserListView->Select(0L); - fFirstTime = false; } } Modified: haiku/trunk/src/preferences/keymap/KeymapWindow.h =================================================================== --- haiku/trunk/src/preferences/keymap/KeymapWindow.h 2009-05-12 22:51:15 UTC (rev 30733) +++ haiku/trunk/src/preferences/keymap/KeymapWindow.h 2009-05-12 22:58:09 UTC (rev 30734) @@ -21,6 +21,7 @@ class BMenu; class BMenuBar; +class BMenuField; class BTextControl; class KeyboardLayoutView; class KeymapListItem; @@ -46,7 +47,7 @@ void _UseKeymap(); void _RevertKeymap(); - BMenuBar* _CreateDeadKeyMenu(); + BMenuField* _CreateDeadKeyMenuField(); void _UpdateDeadKeyMenu(); void _FillSystemMaps(); @@ -66,7 +67,6 @@ KeyboardLayoutView* fKeyboardLayoutView; BTextControl* fTextControl; BButton* fSwitchShortcutsButton; - BMenu* fDeadKeyMenu; BMenu* fAcuteMenu; BMenu* fCircumflexMenu; BMenu* fDiaeresisMenu; @@ -76,7 +76,6 @@ Keymap fCurrentMap; Keymap fPreviousMap; Keymap fAppliedMap; - bool fFirstTime; BString fCurrentMapName; BFilePanel* fOpenPanel; From kirilla at mail.berlios.de Wed May 13 01:33:25 2009 From: kirilla at mail.berlios.de (kirilla at BerliOS) Date: Wed, 13 May 2009 01:33:25 +0200 Subject: [Haiku-commits] r30735 - haiku/trunk/src/data/beos_mime/application Message-ID: <200905122333.n4CNXPSY000996@sheep.berlios.de> Author: kirilla Date: 2009-05-13 01:33:17 +0200 (Wed, 13 May 2009) New Revision: 30735 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30735&view=rev Modified: haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.beshare haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.file haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.finger haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.ftp haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.http haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.https haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.mailto haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.mms haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.news haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.query haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.rsync haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.rtp haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.rtsp haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.sftp haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.ssh haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.telnet Log: Setting default preferred applications: bezilla for http(s), Mail for mailto: and urlwrapper for the others. Modified: haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.beshare =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.beshare 2009-05-12 22:58:09 UTC (rev 30734) +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.beshare 2009-05-12 23:33:17 UTC (rev 30735) @@ -5,3 +5,5 @@ resource(2, "META:S:DESC") #'MSDC' "BeShare URL"; +resource(3, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-urlwrapper"; + Modified: haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.file =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.file 2009-05-12 22:58:09 UTC (rev 30734) +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.file 2009-05-12 23:33:17 UTC (rev 30735) @@ -7,3 +7,5 @@ resource(3, "META:L:DESC") #'MLDC' "Local filesystem URL"; +resource(4, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-urlwrapper"; + Modified: haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.finger =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.finger 2009-05-12 22:58:09 UTC (rev 30734) +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.finger 2009-05-12 23:33:17 UTC (rev 30735) @@ -4,3 +4,6 @@ resource(1, "META:TYPE") "application/x-vnd.Be.URL.finger"; resource(2, "META:S:DESC") #'MSDC' "Finger URL"; + +resource(3, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-urlwrapper"; + Modified: haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.ftp =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.ftp 2009-05-12 22:58:09 UTC (rev 30734) +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.ftp 2009-05-12 23:33:17 UTC (rev 30735) @@ -7,3 +7,5 @@ resource(3, "META:L:DESC") #'MLDC' "File Transfer Protocol URL"; +resource(4, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-urlwrapper"; + Modified: haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.http =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.http 2009-05-12 22:58:09 UTC (rev 30734) +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.http 2009-05-12 23:33:17 UTC (rev 30735) @@ -7,3 +7,5 @@ resource(3, "META:L:DESC") #'MLDC' "Hypertext Transfer Protocol URL"; +resource(4, "META:PREF_APP") #'MSIG' "application/x-vnd.Mozilla-Firefox"; + Modified: haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.https =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.https 2009-05-12 22:58:09 UTC (rev 30734) +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.https 2009-05-12 23:33:17 UTC (rev 30735) @@ -7,3 +7,5 @@ resource(3, "META:L:DESC") #'MLDC' "Secure HyperText Transfer Protocol URL"; +resource(4, "META:PREF_APP") #'MSIG' "application/x-vnd.Mozilla-Firefox"; + Modified: haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.mailto =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.mailto 2009-05-12 22:58:09 UTC (rev 30734) +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.mailto 2009-05-12 23:33:17 UTC (rev 30735) @@ -7,3 +7,5 @@ resource(3, "META:L:DESC") #'MLDC' "Email Recipient URL"; +resource(4, "META:PREF_APP") #'MSIG' "application/x-vnd.Be-MAIL"; + Modified: haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.mms =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.mms 2009-05-12 22:58:09 UTC (rev 30734) +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.mms 2009-05-12 23:33:17 UTC (rev 30735) @@ -7,3 +7,5 @@ resource(3, "META:L:DESC") #'MLDC' "Microsoft Media Server URL"; +resource(4, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-urlwrapper"; + Modified: haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.news =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.news 2009-05-12 22:58:09 UTC (rev 30734) +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.news 2009-05-12 23:33:17 UTC (rev 30735) @@ -7,3 +7,5 @@ resource(3, "META:L:DESC") #'MLDC' "Usenet Newsgroup URL"; +resource(4, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-urlwrapper"; + Modified: haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.query =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.query 2009-05-12 22:58:09 UTC (rev 30734) +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.query 2009-05-12 23:33:17 UTC (rev 30735) @@ -7,3 +7,5 @@ resource(3, "META:L:DESC") #'MLDC' "Haiku Query URL"; +resource(4, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-urlwrapper"; + Modified: haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.rsync =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.rsync 2009-05-12 22:58:09 UTC (rev 30734) +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.rsync 2009-05-12 23:33:17 UTC (rev 30735) @@ -5,3 +5,5 @@ resource(2, "META:S:DESC") #'MSDC' "rsync URL"; +resource(3, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-urlwrapper"; + Modified: haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.rtp =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.rtp 2009-05-12 22:58:09 UTC (rev 30734) +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.rtp 2009-05-12 23:33:17 UTC (rev 30735) @@ -7,3 +7,5 @@ resource(3, "META:L:DESC") #'MLDC' "Real-time Transport Protocol URL"; +resource(4, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-urlwrapper"; + Modified: haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.rtsp =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.rtsp 2009-05-12 22:58:09 UTC (rev 30734) +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.rtsp 2009-05-12 23:33:17 UTC (rev 30735) @@ -7,3 +7,5 @@ resource(3, "META:L:DESC") #'MLDC' "Real Time Streaming Protocol URL"; +resource(4, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-urlwrapper"; + Modified: haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.sftp =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.sftp 2009-05-12 22:58:09 UTC (rev 30734) +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.sftp 2009-05-12 23:33:17 UTC (rev 30735) @@ -7,3 +7,5 @@ resource(3, "META:L:DESC") #'MLDC' "SSH File Transfer Protocol URL"; +resource(4, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-urlwrapper"; + Modified: haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.ssh =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.ssh 2009-05-12 22:58:09 UTC (rev 30734) +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.ssh 2009-05-12 23:33:17 UTC (rev 30735) @@ -7,3 +7,5 @@ resource(3, "META:L:DESC") #'MLDC' "Secure Shell URL"; +resource(4, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-urlwrapper"; + Modified: haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.telnet =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.telnet 2009-05-12 22:58:09 UTC (rev 30734) +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.telnet 2009-05-12 23:33:17 UTC (rev 30735) @@ -7,3 +7,5 @@ resource(3, "META:L:DESC") #'MLDC' "Telnet URL"; +resource(4, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-urlwrapper"; + From jonas at kirilla.com Wed May 13 01:48:26 2009 From: jonas at kirilla.com (Jonas =?iso-8859-1?q?Sundstr=F6m?=) Date: Wed, 13 May 2009 01:48:26 +0200 CEST Subject: [Haiku-commits] r30709 - haiku/trunk/src/apps/stylededit In-Reply-To: <7635773795-BeMail@zon> Message-ID: <5618027851-BeMail@kirilla> "Axel D?rfler" wrote: > kirilla at BerliOS wrote: ... > > + // StyledEdit has the "single launch" flag set ... > I am a friend of short comments, though - the essence > of this should not need more than a few lines, I would > assume :-) Yeah, I got into Haiku Book mode. Thinking of new developers unfamiliar with the API. 6 lines now. Tolerable, I hope. :-) ... > I like this version a lot better than the previous one! Thanks! /Jonas. From bga at mail.berlios.de Wed May 13 02:05:54 2009 From: bga at mail.berlios.de (bga at BerliOS) Date: Wed, 13 May 2009 02:05:54 +0200 Subject: [Haiku-commits] r30736 - in haiku/trunk: build/jam src/servers/cddb_daemon Message-ID: <200905130005.n4D05sq7020598@sheep.berlios.de> Author: bga Date: 2009-05-13 02:05:53 +0200 (Wed, 13 May 2009) New Revision: 30736 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30736&view=rev Added: haiku/trunk/src/servers/cddb_daemon/cddb_daemon.rdef Modified: haiku/trunk/build/jam/HaikuImage haiku/trunk/src/servers/cddb_daemon/Jamfile haiku/trunk/src/servers/cddb_daemon/cddb_daemon.cpp Log: - Finished up cddb_daemon. Still some cleanup needed here and there but it works. - Added it to the image. - Anyone wants to come up with an icon for it? :) Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2009-05-12 23:33:17 UTC (rev 30735) +++ haiku/trunk/build/jam/HaikuImage 2009-05-13 00:05:53 UTC (rev 30736) @@ -86,7 +86,7 @@ ; SYSTEM_SERVERS = registrar debug_server syslog_daemon media_server net_server media_addon_server input_server app_server fake_app_server - midi_server print_server mail_daemon + midi_server print_server mail_daemon cddb_daemon ; SYSTEM_NETWORK_DEVICES = ethernet loopback ; Modified: haiku/trunk/src/servers/cddb_daemon/Jamfile =================================================================== --- haiku/trunk/src/servers/cddb_daemon/Jamfile 2009-05-12 23:33:17 UTC (rev 30735) +++ haiku/trunk/src/servers/cddb_daemon/Jamfile 2009-05-13 00:05:53 UTC (rev 30736) @@ -2,6 +2,8 @@ UsePrivateHeaders drivers ; +AddResources cddb_daemon : cddb_daemon.rdef ; + Server cddb_daemon : cddb_daemon.cpp cddb_server.cpp Modified: haiku/trunk/src/servers/cddb_daemon/cddb_daemon.cpp =================================================================== --- haiku/trunk/src/servers/cddb_daemon/cddb_daemon.cpp 2009-05-12 23:33:17 UTC (rev 30735) +++ haiku/trunk/src/servers/cddb_daemon/cddb_daemon.cpp 2009-05-13 00:05:53 UTC (rev 30736) @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -193,12 +194,54 @@ BVolume volume(device); status_t result; - if ((result = volume.SetName((diskData->title).String())) != B_OK) { + BString name = diskData->artist << " - " << diskData->title; + if ((result = volume.SetName(name.String())) != B_OK) { printf("Can't set volume name.\n"); return result; } - return B_ERROR; + // Rename tracks and add relevant Audio attributes. + BDirectory cddaRoot; + volume.GetRootDirectory(&cddaRoot); + + BEntry entry; + int cnt = 0; + while (cddaRoot.GetNextEntry(&entry) == B_OK) { + TrackData* data = (TrackData*)((readResponse->tracks).ItemAt(cnt)); + + // Update name. + if ((result = entry.Rename((data->title).String())) != B_OK) { + // Failed renaming one entry. Abort processing. + printf("Failed renaming entry at index %d. Aborting.\n", cnt); + return result; + } + + // Add relevant attributes. We consider an error here as non-fatal. + BNode node(&entry); + node.WriteAttr("Audio:Title", B_STRING_TYPE, 0, (data->title).String(), + (data->title).Length()); + node.WriteAttr("Audio:Album", B_STRING_TYPE, 0, + (readResponse->title).String(), + (readResponse->title).Length()); + node.WriteAttr("Audio:Genre", B_STRING_TYPE, 0, + (readResponse->genre).String(), + (readResponse->genre).Length()); + node.WriteAttr("Audio:Year", B_INT32_TYPE, 0, &(readResponse->year), + sizeof(int32)); + + if (data->artist == "") { + node.WriteAttr("Audio:Artist", B_STRING_TYPE, 0, + (readResponse->artist).String(), + (readResponse->artist).Length()); + } else { + node.WriteAttr("Audio:Artist", B_STRING_TYPE, 0, + (data->artist).String(), (data->artist).Length()); + } + + cnt++; + } + + return B_OK; } Added: haiku/trunk/src/servers/cddb_daemon/cddb_daemon.rdef =================================================================== --- haiku/trunk/src/servers/cddb_daemon/cddb_daemon.rdef 2009-05-12 23:33:17 UTC (rev 30735) +++ haiku/trunk/src/servers/cddb_daemon/cddb_daemon.rdef 2009-05-13 00:05:53 UTC (rev 30736) @@ -0,0 +1,15 @@ +resource app_signature "application/x-vnd.Haiku-cddb_daemon"; + +resource app_flags B_BACKGROUND_APP; + +resource app_version { + major = 1, + middle = 0, + minor = 0, + + variety = B_APPV_FINAL, + internal = 3, + + short_info = "Haiku CDDB Daemon", + long_info = "Haiku CDDB Daemon ?2009 Haiku" +}; From bga at mail.berlios.de Wed May 13 02:08:58 2009 From: bga at mail.berlios.de (bga at BerliOS) Date: Wed, 13 May 2009 02:08:58 +0200 Subject: [Haiku-commits] r30737 - haiku/trunk/src/add-ons/kernel/file_systems/cdda Message-ID: <200905130008.n4D08wTK020773@sheep.berlios.de> Author: bga Date: 2009-05-13 02:08:57 +0200 (Wed, 13 May 2009) New Revision: 30737 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30737&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp Log: - Added bitrate attribute to audio files. Modified: haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp 2009-05-13 00:05:53 UTC (rev 30736) +++ haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp 2009-05-13 00:08:57 UTC (rev 30737) @@ -730,6 +730,7 @@ inode->AddAttribute("Audio:Title", B_STRING_TYPE, text.titles[i]); inode->AddAttribute("Audio:Genre", B_STRING_TYPE, text.genre); inode->AddAttribute("Audio:Track", B_INT32_TYPE, track); + inode->AddAttribute("Audio:Bitrate", B_STRIG_TYPE, "128 kbps"); snprintf(title, sizeof(title), "%02lu:%02lu", uint32(inode->FrameCount() / kFramesPerMinute), From bga at mail.berlios.de Wed May 13 02:10:07 2009 From: bga at mail.berlios.de (bga at BerliOS) Date: Wed, 13 May 2009 02:10:07 +0200 Subject: [Haiku-commits] r30738 - haiku/trunk/src/add-ons/kernel/file_systems/cdda Message-ID: <200905130010.n4D0A7Wg020886@sheep.berlios.de> Author: bga Date: 2009-05-13 02:10:06 +0200 (Wed, 13 May 2009) New Revision: 30738 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30738&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp Log: - Ops... Fix compilation. Modified: haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp 2009-05-13 00:08:57 UTC (rev 30737) +++ haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp 2009-05-13 00:10:06 UTC (rev 30738) @@ -730,7 +730,7 @@ inode->AddAttribute("Audio:Title", B_STRING_TYPE, text.titles[i]); inode->AddAttribute("Audio:Genre", B_STRING_TYPE, text.genre); inode->AddAttribute("Audio:Track", B_INT32_TYPE, track); - inode->AddAttribute("Audio:Bitrate", B_STRIG_TYPE, "128 kbps"); + inode->AddAttribute("Audio:Bitrate", B_STRING_TYPE, "128 kbps"); snprintf(title, sizeof(title), "%02lu:%02lu", uint32(inode->FrameCount() / kFramesPerMinute), From jonas at kirilla.com Wed May 13 02:15:13 2009 From: jonas at kirilla.com (Jonas =?iso-8859-1?q?Sundstr=F6m?=) Date: Wed, 13 May 2009 02:15:13 +0200 CEST Subject: [Haiku-commits] r30702 - in haiku/trunk: headers/private headers/private/support src/bin src/kits/support In-Reply-To: <7816890469-BeMail@zon> Message-ID: <7224152705-BeMail@kirilla> "Axel D?rfler" wrote: > "Jonas Sundstr?m" wrote: > > And yes, my keys '<|>' are in order now. ;) > > Wohoo! :-) Heh > BTW I didn't mean to be disrespectful when I > claimed you shouldn't change code you do not > fully understand; we just have to be very > careful not to introduce new regressions in > new changes. I did feel a little bad, especially since you were right. But I forgive you! ;) I totally agree with keeping a high quality on commits and I hope to soon get the hang of it. It's easy to be a little sensitive in one's solitude at the screen, but please don't be afraid to comment when you see areas where I can improve! /Jonas. From kirilla at mail.berlios.de Wed May 13 03:05:46 2009 From: kirilla at mail.berlios.de (kirilla at BerliOS) Date: Wed, 13 May 2009 03:05:46 +0200 Subject: [Haiku-commits] r30739 - in haiku/trunk: headers/private/support src/bin src/kits/support Message-ID: <200905130105.n4D15krn027843@sheep.berlios.de> Author: kirilla Date: 2009-05-13 03:05:42 +0200 (Wed, 13 May 2009) New Revision: 30739 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30739&view=rev Modified: haiku/trunk/headers/private/support/Url.h haiku/trunk/src/bin/urlwrapper.cpp haiku/trunk/src/bin/urlwrapper.h haiku/trunk/src/kits/support/Url.cpp Log: Hopefully fixed indentation in BUrl header. Made data members in BUrl private. Added some class methods. Adapted urlwrapper to use the BUrl class. Removed a few obvious comments and some code that was defined away. Turned off debugging. Stripped App suffix from class name. No intentional changes to the core functionality of urlwrapper. Modified: haiku/trunk/headers/private/support/Url.h =================================================================== --- haiku/trunk/headers/private/support/Url.h 2009-05-13 00:10:06 UTC (rev 30738) +++ haiku/trunk/headers/private/support/Url.h 2009-05-13 01:05:42 UTC (rev 30739) @@ -12,34 +12,43 @@ class BUrl : public BString { public: - BUrl(const char *url); - ~BUrl(); + BUrl(const char *url); + ~BUrl(); - status_t ParseAndSplit(); - status_t InitCheck() const; + status_t InitCheck() const; - bool HasHost() const; - bool HasPort() const; - bool HasUser() const; - bool HasPass() const; - bool HasPath() const; + bool HasPreferredApplication() const; + BString PreferredApplication() const; + status_t OpenWithPreferredApplication(bool onProblemAskUser = true) const; - BString Proto() const; - BString Full() const; - BString Host() const; - BString Port() const; - BString User() const; - BString Pass() const; + bool HasHost() const; + bool HasPort() const; + bool HasUser() const; + bool HasPass() const; + bool HasPath() const; - BString proto; - BString full; - BString host; - BString port; - BString user; - BString pass; - BString path; + BString Proto() const; + BString Full() const; + BString Host() const; + BString Port() const; + BString User() const; + BString Pass() const; + BString Path() const; + + status_t UnurlString(BString &string); + private: - status_t fStatus; + status_t _ParseAndSplit(); + BString _UrlMimeType() const; + + BString proto; + BString full; + BString host; + BString port; + BString user; + BString pass; + BString path; + status_t fStatus; }; }; // namespace Support Modified: haiku/trunk/src/bin/urlwrapper.cpp =================================================================== --- haiku/trunk/src/bin/urlwrapper.cpp 2009-05-13 00:10:06 UTC (rev 30738) +++ haiku/trunk/src/bin/urlwrapper.cpp 2009-05-13 01:05:42 UTC (rev 30739) @@ -4,30 +4,23 @@ * * Authors: * Fran?ois Revol, revol at free.fr + * Jonas Sundstr?m, jonas at kirilla.com */ /* * urlwrapper: wraps URL mime types around command line apps * or other apps that don't handle them directly. */ -#define DEBUG 1 +#define DEBUG 0 #include #include -#include #include -#include -#include -#include +#include #include #include #include -#include -#include -#include - -/* compile-time configuration */ #include "urlwrapper.h" const char *kAppSig = APP_SIGNATURE; @@ -52,82 +45,33 @@ #endif -class UrlWrapperApp : public BApplication +class UrlWrapper : public BApplication { public: - UrlWrapperApp(); - ~UrlWrapperApp(); -status_t SplitUrl(const char *url, BString &host, BString &port, BString &user, BString &pass, BString &path); -status_t UnurlString(BString &s); -status_t Warn(const char *url); -virtual void RefsReceived(BMessage *msg); -virtual void ArgvReceived(int32 argc, char **argv); -virtual void ReadyToRun(void); -private: + UrlWrapper(); + ~UrlWrapper(); + virtual void RefsReceived(BMessage *msg); + virtual void ArgvReceived(int32 argc, char **argv); + virtual void ReadyToRun(void); + +private: + status_t _Warn(const char *url); }; -status_t UrlWrapperApp::SplitUrl(const char *url, BString &host, BString &port, BString &user, BString &pass, BString &path) +UrlWrapper::UrlWrapper() : BApplication(kAppSig) { - BPrivate::Support::BUrl u(url); - if (u.InitCheck() < 0) - return u.InitCheck(); - host = u.host; - port = u.port; - user = u.user; - pass = u.pass; - path = u.path; - return 0; } -UrlWrapperApp::UrlWrapperApp() : BApplication(kAppSig) -{ -#if 0 - BMimeType mt(B_URL_TELNET); - if (mt.InitCheck()) - return; - if (!mt.IsInstalled()) { - mt.Install(); - } -#endif -#if 0 - BAppFileInfo afi; - if (!afi.Supports(&mt)) { - //printf("adding support for telnet url\n"); - BMessage typemsg; - typemsg.AddString("types", url_mime); - afi.SetSupportedTypes(&typemsg, true); - } -#endif -} -UrlWrapperApp::~UrlWrapperApp() +UrlWrapper::~UrlWrapper() { } - -status_t UrlWrapperApp::UnurlString(BString &s) +status_t UrlWrapper::_Warn(const char *url) { - // TODO: check for %00 and bail out! - int32 length = s.Length(); - int i; - for (i = 0; s[i] && i < length - 2; i++) { - if (s[i] == '%' && isxdigit(s[i+1]) && isxdigit(s[i+2])) { - int c; - sscanf(s.String() + i + 1, "%02x", &c); - s.Remove(i, 3); - s.Insert((char)c, 1, i); - length -= 2; - } - } - - return B_OK; -} - -status_t UrlWrapperApp::Warn(const char *url) -{ BString message("An application has requested the system to open the following url: \n"); message << "\n" << url << "\n\n"; message << "This type of urls has a potential security risk.\n"; @@ -140,7 +84,8 @@ return B_ERROR; } -void UrlWrapperApp::RefsReceived(BMessage *msg) + +void UrlWrapper::RefsReceived(BMessage *msg) { char buff[B_PATH_NAME_LENGTH]; int32 index = 0; @@ -206,13 +151,9 @@ } } -void UrlWrapperApp::ArgvReceived(int32 argc, char **argv) + +void UrlWrapper::ArgvReceived(int32 argc, char **argv) { -#if 0 - for (int i = 1; i < argc; i++) { - //printf("argv[%d]=%s\n", i, argv[i]); - } -#endif if (argc <= 1) return; @@ -220,28 +161,36 @@ const char *pausec = " ; read -p 'Press any key'"; char *args[] = { "/bin/sh", "-c", NULL, NULL}; - BPrivate::Support::BUrl u(argv[1]); - BString url = u.Full(); - if (u.InitCheck() < 0) { - fprintf(stderr, "malformed url: '%s'\n", u.String()); + BPrivate::Support::BUrl url(argv[1]); + + BString full = url.Full(); + BString proto = url.Proto(); + BString host = url.Host(); + BString port = url.Port(); + BString user = url.User(); + BString pass = url.Pass(); + BString path = url.Path(); + + if (url.InitCheck() < 0) { + fprintf(stderr, "malformed url: '%s'\n", url.String()); return; } // XXX: debug - PRINT(("PROTO='%s'\n", u.proto.String())); - PRINT(("HOST='%s'\n", u.host.String())); - PRINT(("PORT='%s'\n", u.port.String())); - PRINT(("USER='%s'\n", u.user.String())); - PRINT(("PASS='%s'\n", u.pass.String())); - PRINT(("PATH='%s'\n", u.path.String())); - - if (u.proto == "telnet") { + PRINT(("PROTO='%s'\n", proto.String())); + PRINT(("HOST='%s'\n", host.String())); + PRINT(("PORT='%s'\n", port.String())); + PRINT(("USER='%s'\n", user.String())); + PRINT(("PASS='%s'\n", pass.String())); + PRINT(("PATH='%s'\n", path.String())); + + if (proto == "telnet") { BString cmd("telnet "); - if (u.HasUser()) - cmd << "-l " << u.user << " "; - cmd << u.host; - if (u.HasPort()) - cmd << " " << u.port; + if (url.HasUser()) + cmd << "-l " << user << " "; + cmd << host; + if (url.HasPort()) + cmd << " " << port; PRINT(("CMD='%s'\n", cmd.String())); cmd << failc; args[2] = (char *)cmd.String(); @@ -250,14 +199,14 @@ } // see draft: http://tools.ietf.org/wg/secsh/draft-ietf-secsh-scp-sftp-ssh-uri/ - if (u.proto == "ssh") { + if (proto == "ssh") { BString cmd("ssh "); - if (u.HasUser()) - cmd << "-l " << u.user << " "; - if (u.HasPort()) - cmd << "-oPort=" << u.port << " "; - cmd << u.host; + if (url.HasUser()) + cmd << "-l " << user << " "; + if (url.HasPort()) + cmd << "-oPort=" << port << " "; + cmd << host; PRINT(("CMD='%s'\n", cmd.String())); cmd << failc; args[2] = (char *)cmd.String(); @@ -266,7 +215,7 @@ return; } - if (u.proto == "ftp") { + if (proto == "ftp") { BString cmd("ftp "); /* @@ -274,7 +223,7 @@ cmd << "-l " << user << " "; cmd << host; */ - cmd << u.full; + cmd << full; PRINT(("CMD='%s'\n", cmd.String())); cmd << failc; args[2] = (char *)cmd.String(); @@ -283,17 +232,17 @@ return; } - if (u.proto == "sftp") { + if (proto == "sftp") { BString cmd("sftp "); //cmd << url; - if (u.HasPort()) - cmd << "-oPort=" << u.port << " "; - if (u.HasUser()) - cmd << u.user << "@"; - cmd << u.host; - if (u.HasPath()) - cmd << ":" << u.path; + if (url.HasPort()) + cmd << "-oPort=" << port << " "; + if (url.HasUser()) + cmd << user << "@"; + cmd << host; + if (url.HasPath()) + cmd << ":" << path; PRINT(("CMD='%s'\n", cmd.String())); cmd << failc; args[2] = (char *)cmd.String(); @@ -302,14 +251,14 @@ return; } - if (u.proto == "finger") { + if (proto == "finger") { BString cmd("/bin/finger "); - if (u.HasUser()) - cmd << u.user; - if (u.HasHost() == 0) - u.host = "127.0.0.1"; - cmd << "@" << u.host; + if (url.HasUser()) + cmd << user; + if (url.HasHost() == 0) + host = "127.0.0.1"; + cmd << "@" << host; PRINT(("CMD='%s'\n", cmd.String())); cmd << pausec; args[2] = (char *)cmd.String(); @@ -319,13 +268,13 @@ } #ifdef HANDLE_HTTP_WGET - if (u.proto == "http") { + if (proto == "http") { BString cmd("/bin/wget "); //cmd << url; - if (u.HasUser()) - cmd << u.user << "@"; - cmd << u.full; + if (url.HasUser()) + cmd << user << "@"; + cmd << full; PRINT(("CMD='%s'\n", cmd.String())); cmd << pausec; args[2] = (char *)cmd.String(); @@ -336,11 +285,11 @@ #endif #ifdef HANDLE_FILE - if (u.proto == "file") { + if (proto == "file") { BMessage m(B_REFS_RECEIVED); entry_ref ref; - UnurlString(u.path); - if (get_ref_for_path(u.path.String(), &ref) < B_OK) + url.UnurlString(path); + if (get_ref_for_path(path.String(), &ref) < B_OK) return; m.AddRef("refs", &ref); be_roster->Launch(kTrackerSig, &m); @@ -350,7 +299,7 @@ #ifdef HANDLE_QUERY // XXX:TODO: split options - if (u.proto == "query") { + if (proto == "query") { // mktemp ? BString qname("/tmp/query-url-temp-"); qname << getpid() << "-" << system_time(); @@ -360,14 +309,14 @@ BString s; int32 v; - UnurlString(u.full); + url.UnurlString(full); // TODO: handle options (list of attrs in the column, ...) v = 'qybF'; // QuerY By Formula XXX: any #define for that ? query.WriteAttr("_trk/qryinitmode", B_INT32_TYPE, 0LL, &v, sizeof(v)); s = "TextControl"; query.WriteAttr("_trk/focusedView", B_STRING_TYPE, 0LL, s.String(), s.Length()+1); - s = u.full; + s = full; PRINT(("QUERY='%s'\n", s.String())); query.WriteAttr("_trk/qryinitstr", B_STRING_TYPE, 0LL, s.String(), s.Length()+1); query.WriteAttr("_trk/qrystr", B_STRING_TYPE, 0LL, s.String(), s.Length()+1); @@ -384,9 +333,9 @@ #endif #ifdef HANDLE_SH - if (u.proto == "sh") { - BString cmd(u.Full()); - if (Warn(u.String()) != B_OK) + if (proto == "sh") { + BString cmd(full); + if (_Warn(url.String()) != B_OK) return; PRINT(("CMD='%s'\n", cmd.String())); cmd << pausec; @@ -398,23 +347,23 @@ #endif #ifdef HANDLE_BESHARE - if (u.proto == "beshare") { + if (proto == "beshare") { team_id team; BMessenger msgr(kBeShareSig); // if no instance is running, or we want a specific server, start it. - if (!msgr.IsValid() || u.HasHost()) { + if (!msgr.IsValid() || url.HasHost()) { be_roster->Launch(kBeShareSig, (BMessage *)NULL, &team); msgr = BMessenger(NULL, team); } - if (u.HasHost()) { + if (url.HasHost()) { BMessage mserver('serv'); - mserver.AddString("server", u.host); + mserver.AddString("server", host); msgr.SendMessage(&mserver); } - if (u.HasPath()) { + if (url.HasPath()) { BMessage mquery('quer'); - mquery.AddString("query", u.path); + mquery.AddString("query", path); msgr.SendMessage(&mquery); } // TODO: handle errors @@ -423,14 +372,14 @@ #endif #ifdef HANDLE_IM - if (u.proto == "icq" || u.proto == "msn") { + if (proto == "icq" || proto == "msn") { // TODO team_id team; be_roster->Launch(kIMSig, (BMessage *)NULL, &team); BMessenger msgr(NULL, team); - if (u.HasHost()) { + if (url.HasHost()) { BMessage mserver(B_REFS_RECEIVED); - mserver.AddString("server", u.host); + mserver.AddString("server", host); msgr.SendMessage(&httpmserver); } @@ -440,8 +389,8 @@ #endif #ifdef HANDLE_VLC - if (u.proto == "mms" || u.proto == "rtp" || u.proto == "rtsp") { - args[0] = (char *)u.String(); + if (proto == "mms" || proto == "rtp" || proto == "rtsp") { + args[0] = (char *)url.String(); be_roster->Launch(kVLCSig, 1, args); return; } @@ -468,14 +417,16 @@ } -void UrlWrapperApp::ReadyToRun(void) + +void UrlWrapper::ReadyToRun(void) { Quit(); } + int main(int argc, char **argv) { - UrlWrapperApp app; + UrlWrapper app; if (be_app) app.Run(); return 0; Modified: haiku/trunk/src/bin/urlwrapper.h =================================================================== --- haiku/trunk/src/bin/urlwrapper.h 2009-05-13 00:10:06 UTC (rev 30738) +++ haiku/trunk/src/bin/urlwrapper.h 2009-05-13 01:05:42 UTC (rev 30739) @@ -6,19 +6,11 @@ * Fran?ois Revol, revol at free.fr */ -/* - * urlwrapper: compile-time configuration of supported protocols. - */ - #define APP_SIGNATURE "application/x-vnd.Haiku-urlwrapper" -/* - * comment out to disable handling a specific protocol - */ - - /* NetPositive Bookmark file type */ #define HANDLE_BOOKMARK_FILES + /* M$IE .url files */ #define HANDLE_URL_FILES @@ -52,3 +44,4 @@ /* audio: redirects SoundPlay-urls for shoutcast streams */ /* UNIMPLEMENTED */ //#define HANDLE_AUDIO + Modified: haiku/trunk/src/kits/support/Url.cpp =================================================================== --- haiku/trunk/src/kits/support/Url.cpp 2009-05-13 00:10:06 UTC (rev 30738) +++ haiku/trunk/src/kits/support/Url.cpp 2009-05-13 01:05:42 UTC (rev 30739) @@ -9,16 +9,26 @@ /*! Url class for parsing an URL and opening it with its preferred handler. */ +#define DEBUG 0 -#include "Url.h" +#include +#include +#include +#include +#include +#include +#include + +#include + namespace BPrivate { namespace Support { BUrl::BUrl(const char *url) : BString(url) { - fStatus = ParseAndSplit(); + fStatus = _ParseAndSplit(); } @@ -34,9 +44,72 @@ } +bool +BUrl::HasPreferredApplication() const +{ + BString appSignature = PreferredApplication(); + BMimeType mime(appSignature.String()); + + if (appSignature.IFindFirst("application/") == 0 + && mime.IsValid()) + return true; + + return false; +} + + +BString +BUrl::PreferredApplication() const +{ + BString appSignature; + BMimeType mime(_UrlMimeType().String()); + mime.GetPreferredApp(appSignature.LockBuffer(B_MIME_TYPE_LENGTH)); + appSignature.UnlockBuffer(); + + return BString(appSignature); +} + + status_t -BUrl::ParseAndSplit() +BUrl::OpenWithPreferredApplication(bool onProblemAskUser) const { + status_t status = InitCheck(); + if (status != B_OK) + return status; + + if (Length() > B_PATH_NAME_LENGTH) { + // TODO: BAlert + // if (onProblemAskUser) + // Balert ... Too long URL! + fprintf(stderr, "URL too long"); + return B_NAME_TOO_LONG; + } + + char *argv[] = { + const_cast("BUrlInvokedApplication"), + const_cast(String()), + NULL + }; + +#if DEBUG + if (HasPreferredApplication()) + printf("HasPreferredApplication() == true\n"); + else + printf("HasPreferredApplication() == false\n"); +#endif + + status = be_roster->Launch(_UrlMimeType().String(), 1, argv+1); + if (status != B_OK) { + fprintf(stderr, "Opening URL failed: %s\n", strerror(status)); + } + + return status; +} + + +status_t +BUrl::_ParseAndSplit() +{ // proto:[//]user:pass at host:port/path int32 v; @@ -107,6 +180,16 @@ } +BString +BUrl::_UrlMimeType() const +{ + BString mime; + mime << "application/x-vnd.Be.URL." << proto; + + return BString(mime); +} + + bool BUrl::HasHost() const { @@ -184,6 +267,33 @@ return BString(pass); } + +BString +BUrl::Path() const +{ + return BString(path); +} + + +status_t +BUrl::UnurlString(BString &string) +{ + // TODO: check for %00 and bail out! + int32 length = string.Length(); + int i; + for (i = 0; string[i] && i < length - 2; i++) { + if (string[i] == '%' && isxdigit(string[i+1]) && isxdigit(string[i+2])) { + int c; + sscanf(string.String() + i + 1, "%02x", &c); + string.Remove(i, 3); + string.Insert((char)c, 1, i); + length -= 2; + } + } + + return B_OK; +} + }; // namespace Support }; // namespace BPrivate From fekdahl at gmail.com Wed May 13 07:59:23 2009 From: fekdahl at gmail.com (Fredrik Ekdahl) Date: Wed, 13 May 2009 07:59:23 +0200 Subject: [Haiku-commits] r30737 - haiku/trunk/src/add-ons/kernel/file_systems/cdda In-Reply-To: <200905130008.n4D08wTK020773@sheep.berlios.de> References: <200905130008.n4D08wTK020773@sheep.berlios.de> Message-ID: 2009/5/13 bga at BerliOS : > Author: bga > Date: 2009-05-13 02:08:57 +0200 (Wed, 13 May 2009) > New Revision: 30737 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30737&view=rev > > Modified: > ? haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp > Log: > - Added bitrate attribute to audio files. > > Modified: haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp > =================================================================== > --- haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp ? ? ? 2009-05-13 00:05:53 UTC (rev 30736) > +++ haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp ? ? ? 2009-05-13 00:08:57 UTC (rev 30737) > @@ -730,6 +730,7 @@ > ? ? ? ? ? ? ? ?inode->AddAttribute("Audio:Title", B_STRING_TYPE, text.titles[i]); > ? ? ? ? ? ? ? ?inode->AddAttribute("Audio:Genre", B_STRING_TYPE, text.genre); > ? ? ? ? ? ? ? ?inode->AddAttribute("Audio:Track", B_INT32_TYPE, track); > + ? ? ? ? ? ? ? inode->AddAttribute("Audio:Bitrate", B_STRIG_TYPE, "128 kbps"); There's a typo there (STRIG). That doesn't look correct. Are you suggesting that the bit rate of an audio CD is 128 kbps? Anyway, is the bit rate of a CD really interesting? I'm quoting wikipedia: The bit rate is 720 kbit/s[4] (103)Often referred to 1411kb/s when not viewed as FFT 2n 900000B: 2 channels x 22,050 final samples per second per channel (44.1kHz combined) ? 16 bits per sample = 720,000 bit/s[5] Which may be otherwise referred to as 44.1kHz per channel dependent unless viewed as Fast Fourier Transform view method, 2n storage 900000B. -- /Fredrik Ekdahl From superstippi at gmx.de Wed May 13 09:04:22 2009 From: superstippi at gmx.de (Stephan Assmus) Date: Wed, 13 May 2009 09:04:22 +0200 Subject: [Haiku-commits] r30731 - haiku/trunk/src/apps/deskbar In-Reply-To: <200905122119.n4CLJ2He027177@sheep.berlios.de> References: <200905122119.n4CLJ2He027177@sheep.berlios.de> Message-ID: <20090513090422.462.1@bepc.1242196279.fake> On 2009-05-12 at 22:19:02 [+0200], axeld at BerliOS wrote: > Author: axeld > Date: 2009-05-12 23:19:02 +0200 (Tue, 12 May 2009) New Revision: 30731 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30731&view=rev > > Modified: > haiku/trunk/src/apps/deskbar/BarApp.cpp > haiku/trunk/src/apps/deskbar/BeMenu.cpp > Log: > * When activating the "Shutdown" menu (instead of one of its items), we > now > get the old shutdown dialog back, but with the additional option to > reboot instead. Ah! Perfect! Best regards, -Stephan From axeld at pinc-software.de Wed May 13 09:06:54 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Wed, 13 May 2009 09:06:54 +0200 CEST Subject: [Haiku-commits] =?utf-8?q?r30737_-_haiku/trunk/src/add-ons/kernel?= =?utf-8?q?/file=5Fsystems/cdda?= In-Reply-To: Message-ID: <483380172-BeMail@zon> Fredrik Ekdahl wrote: > That doesn't look correct. Are you suggesting that the bit rate of an > audio CD is 128 kbps? > Anyway, is the bit rate of a CD really interesting? Indeed, IMO this should be reverted. Bye, Axel. From axeld at pinc-software.de Wed May 13 09:10:40 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Wed, 13 May 2009 09:10:40 +0200 CEST Subject: [Haiku-commits] r30734 - haiku/trunk/src/preferences/keymap In-Reply-To: <200905122258.n4CMwBAl028620@sheep.berlios.de> Message-ID: <709577523-BeMail@zon> zooey at BerliOS wrote: > * dropped 'Save' menu item, as it wasn't implemented anyway and would > now > never be enabled That reminds me: I guess one always needs to "Save As" even when the keymap in question was a user keymap? Maybe "Save" could be reintroduced for this very case? Bye, Axel. From axeld at pinc-software.de Wed May 13 09:16:41 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Wed, 13 May 2009 09:16:41 +0200 CEST Subject: [Haiku-commits] =?utf-8?q?r30739_-_in_haiku/trunk=3A_headers/priv?= =?utf-8?q?ate/support_src/bin_src/kits/support?= In-Reply-To: <200905130105.n4D15krn027843@sheep.berlios.de> Message-ID: <1070668334-BeMail@zon> kirilla at BerliOS wrote: > class BUrl : public BString { Remaining style issues: > + status_t OpenWithPreferredApplication(bool > onProblemAskUser = true) const; This line is longer than 80 characters. > + BString Proto() const; Instead of duplicating the string always, why not returning a "const BString&" instead? > + status_t UnurlString(BString &string); What's this one? Please find a better name. In any case, that would probably UnUrlString()? > + BString proto; Member variables have an 'f' prefix. > + status_t fStatus; Like this one... > }; // namespace Support The closing parenthesis of a namespace is not followed by a semicolon. Bye, Axel. From axeld at pinc-software.de Wed May 13 09:26:56 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Wed, 13 May 2009 09:26:56 +0200 CEST Subject: [Haiku-commits] r30730 - haiku/trunk/src/servers/registrar In-Reply-To: <20090512232959.350.1@knochen-vm.localdomain> Message-ID: <1685335327-BeMail@zon> Ingo Weinhold wrote: > On 2009-05-12 at 23:17:25 [+0200], axeld at BerliOS < > axeld at mail.berlios.de> > wrote: > > Log: > > * Added the option to the shutdown confirmation dialog to perform > > the > > "other" shutdown, ie. either reboot or shutdown. > Besides that I don't like this change -- almost identical alerts with > the > buttons swapped -- in which situation besides "shutdown -a" is the > alert > still shown? See r30731. BAlerts always have the right-most button the default button; there's little choice. Bye, Axel. From axeld at pinc-software.de Wed May 13 09:30:17 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Wed, 13 May 2009 09:30:17 +0200 CEST Subject: [Haiku-commits] =?utf-8?q?r30729_-_in_haiku/trunk=3A_headers/os/k?= =?utf-8?q?ernel_headers/private/runtime=5Floader_src/system/kernel_src/sy?= =?utf-8?q?stem/runtime=5Floader?= In-Reply-To: <1e42d8c50905121535j39d5e54jf5468ae7bb499c1e@mail.gmail.com> Message-ID: <1886654499-BeMail@zon> Matt Madia wrote: > On Tue, May 12, 2009 at 9:09 PM, wrote: > > Log: > > Extended image_info by fields for the Haiku version and ABI. The > > runtime loader > > and the kernel read those values from the shared object (if > > available). In the > > runtime loader this should eventually replace the gcc version > > guessing method > > currently used (at least for shared objects built for Haiku). The > > optional > > packages need to be rebuilt first, though. > Should the OptionalPackages be rebuilt now or are there more related > commits to follow? Before we do that, we could think about solving #3916 for them, too: http://dev.haiku-os.org/ticket/3916 Bye, Axel. From fredrik at modeen.se Wed May 13 09:37:41 2009 From: fredrik at modeen.se (Fredrik =?utf-8?Q?Mod=C3=A8en?=) Date: Wed, 13 May 2009 09:37:41 +0200 (CEST) Subject: [Haiku-commits] r30739 - in haiku/trunk: headers/private/support src/bin src/kits/support In-Reply-To: <1070668334-BeMail@zon> References: <1070668334-BeMail@zon> Message-ID: >> + status_t OpenWithPreferredApplication(bool >> onProblemAskUser = true) const; > > This line is longer than 80 characters. About this 80 characters limit how hard are this rule? If I have one that are 81 should I make it two rows? Is it also used for comments? I don?t want to start a war here but why 80 and not 70 or 90? With today?s screen resolution perhaps a wider characters limit could be used? Other question, what does the starting f in a member variable stands for? -- MVH Fredrik Mod?en From axeld at mail.berlios.de Wed May 13 09:46:21 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 13 May 2009 09:46:21 +0200 Subject: [Haiku-commits] r30740 - haiku/trunk/headers/private/shared Message-ID: <200905130746.n4D7kL9j009553@sheep.berlios.de> Author: axeld Date: 2009-05-13 09:46:14 +0200 (Wed, 13 May 2009) New Revision: 30740 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30740&view=rev Modified: haiku/trunk/headers/private/shared/AutoLocker.h Log: * Added operator=(). * Style cleanup. Modified: haiku/trunk/headers/private/shared/AutoLocker.h =================================================================== --- haiku/trunk/headers/private/shared/AutoLocker.h 2009-05-13 01:05:42 UTC (rev 30739) +++ haiku/trunk/headers/private/shared/AutoLocker.h 2009-05-13 07:46:14 UTC (rev 30740) @@ -15,12 +15,12 @@ template class AutoLockerStandardLocking { public: - inline bool Lock(Lockable *lockable) + inline bool Lock(Lockable* lockable) { return lockable->Lock(); } - inline void Unlock(Lockable *lockable) + inline void Unlock(Lockable* lockable) { lockable->Unlock(); } @@ -30,12 +30,12 @@ template class AutoLockerReadLocking { public: - inline bool Lock(Lockable *lockable) + inline bool Lock(Lockable* lockable) { return lockable->ReadLock(); } - inline void Unlock(Lockable *lockable) + inline void Unlock(Lockable* lockable) { lockable->ReadUnlock(); } @@ -45,12 +45,12 @@ template class AutoLockerWriteLocking { public: - inline bool Lock(Lockable *lockable) + inline bool Lock(Lockable* lockable) { return lockable->WriteLock(); } - inline void Unlock(Lockable *lockable) + inline void Unlock(Lockable* lockable) { lockable->WriteUnlock(); } @@ -78,7 +78,7 @@ { } - inline AutoLocker(Lockable *lockable, bool alreadyLocked = false, + inline AutoLocker(Lockable* lockable, bool alreadyLocked = false, bool lockIfNotLocked = true) : fLockable(lockable), @@ -88,7 +88,7 @@ Lock(); } - inline AutoLocker(Lockable &lockable, bool alreadyLocked = false, + inline AutoLocker(Lockable& lockable, bool alreadyLocked = false, bool lockIfNotLocked = true) : fLockable(&lockable), @@ -103,7 +103,7 @@ Unlock(); } - inline void SetTo(Lockable *lockable, bool alreadyLocked, + inline void SetTo(Lockable* lockable, bool alreadyLocked, bool lockIfNotLocked = true) { Unlock(); @@ -113,7 +113,7 @@ Lock(); } - inline void SetTo(Lockable &lockable, bool alreadyLocked, + inline void SetTo(Lockable& lockable, bool alreadyLocked, bool lockIfNotLocked = true) { SetTo(&lockable, alreadyLocked, lockIfNotLocked); @@ -146,24 +146,32 @@ fLocked = false; } - inline AutoLocker &operator=(Lockable *lockable) + inline AutoLocker& operator=(Lockable* lockable) { SetTo(lockable); return *this; } - inline AutoLocker &operator=(Lockable &lockable) + inline AutoLocker& operator=(Lockable& lockable) { SetTo(&lockable); return *this; } + inline ThisClass& operator=(ThisClass& otherLocker) + { + fLockable = otherLocker.fLockable; + fLocked = otherLocker.fLocked; + otherLocker.Detach(); + return &this; + } + inline bool IsLocked() const { return fLocked; } inline operator bool() const { return fLocked; } protected: - Lockable *fLockable; + Lockable* fLockable; Locking fLocking; bool fLocked; }; From axeld at mail.berlios.de Wed May 13 09:50:30 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 13 May 2009 09:50:30 +0200 Subject: [Haiku-commits] r30741 - haiku/trunk/src/add-ons/kernel/file_systems/cdda Message-ID: <200905130750.n4D7oUJd012239@sheep.berlios.de> Author: axeld Date: 2009-05-13 09:50:29 +0200 (Wed, 13 May 2009) New Revision: 30741 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30741&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/cdda/cdda.cpp haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp Log: * Fixed some naming inconsistencies/typos. * Some cleanup. Modified: haiku/trunk/src/add-ons/kernel/file_systems/cdda/cdda.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/cdda/cdda.cpp 2009-05-13 07:46:14 UTC (rev 30740) +++ haiku/trunk/src/add-ons/kernel/file_systems/cdda/cdda.cpp 2009-05-13 07:50:29 UTC (rev 30741) @@ -1,5 +1,5 @@ /* - * Copyright 2007-2008, Axel D?rfler, axeld at pinc-software.de. + * Copyright 2007-2009, Axel D?rfler, axeld at pinc-software.de. * Distributed under the terms of the MIT License. */ @@ -509,7 +509,7 @@ read_table_of_contents(fd, 1, SCSI_TOC_FORMAT_CD_TEXT, buffer, kBufferSize); if (read_table_of_contents(fd, 1, SCSI_TOC_FORMAT_CD_TEXT, buffer, - kBufferSize) < B_OK) { + kBufferSize) != B_OK) { free(buffer); return B_ERROR; } Modified: haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp 2009-05-13 07:46:14 UTC (rev 30740) +++ haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp 2009-05-13 07:50:29 UTC (rev 30741) @@ -1,5 +1,5 @@ /* - * Copyright 2007-2008, Axel D?rfler, axeld at pinc-software.de. + * Copyright 2007-2009, Axel D?rfler, axeld at pinc-software.de. * Distributed under the terms of the MIT License. */ @@ -102,8 +102,8 @@ size_t BufferSize() const { return 32 * kFrameSize; } // TODO: for now - static void DetermineName(uint32 cddbId, int DeviceFD, char* name, - size_t length); + static void DetermineName(uint32 cddbId, int device, char* name, + size_t length); private: Inode* _CreateNode(Inode* parent, const char* name, @@ -439,7 +439,7 @@ static int -open_attributes(uint32 cddbId, int deviceFD, int mode, +open_attributes(uint32 cddbID, int deviceFD, int mode, enum attr_mode attrMode) { char* path = (char*)malloc(B_PATH_NAME_LENGTH); @@ -460,25 +460,25 @@ if (attrMode == kDiscIDAttributes) { char id[64]; - snprintf(id, sizeof(id), "/%08lx", cddbId); + snprintf(id, sizeof(id), "/%08lx", cddbID); strlcat(path, id, B_PATH_NAME_LENGTH); } else if (attrMode == kDeviceAttributes) { uint32 length = strlen(path); - char* device = path + length; - if (ioctl(deviceFD, B_GET_PATH_FOR_DEVICE, device, + char* deviceName = path + length; + if (ioctl(deviceFD, B_GET_PATH_FOR_DEVICE, deviceName, B_PATH_NAME_LENGTH - length) < B_OK) { free(path); return B_ERROR; } - device++; + deviceName++; // replace slashes in the device path - while (device[0]) { - if (device[0] == '/') - device[0] = '_'; + while (deviceName[0]) { + if (deviceName[0] == '/') + deviceName[0] = '_'; - device++; + deviceName++; } } else strlcat(path, "/shared", B_PATH_NAME_LENGTH); @@ -598,33 +598,33 @@ /*static*/ void -Volume::DetermineName(uint32 cddbId, int deviceFD, char* name, size_t length) +Volume::DetermineName(uint32 cddbID, int device, char* name, size_t length) { - int attrFD = open_attributes(cddbId, deviceFD, O_RDONLY, + name[0] = '\0'; + + int attrFD = open_attributes(cddbID, device, O_RDONLY, kDiscIDAttributes); if (attrFD < 0) { // We do not have attributes set. Read CD text. cdtext text; - read_cdtext(deviceFD, text); - if (text.artist != NULL && text.album != NULL) - snprintf(name, length, "%s - %s", text.artist, text.album); - else if (text.artist != NULL || text.album != NULL) { - snprintf(name, length, "%s", text.artist != NULL - ? text.artist : text.album); - } else - strlcpy(name, "Audio CD", length); + if (read_cdtext(device, text) == B_OK) { + if (text.artist != NULL && text.album != NULL) + snprintf(name, length, "%s - %s", text.artist, text.album); + else if (text.artist != NULL || text.album != NULL) { + snprintf(name, length, "%s", text.artist != NULL + ? text.artist : text.album); + } + } } else { // We have an attribute file. Read name from it. - char line[B_FILE_NAME_LENGTH]; - if (!read_line(attrFD, line, B_FILE_NAME_LENGTH)) { - // Could not get name from attribute file. use default name. - strlcpy(name, "Audio CD", length); - } else { - // We got a name. Use it. - strlcpy(name, line, length); - } + if (!read_line(attrFD, name, length)) + name[0] = '\0'; + close(attrFD); } + + if (!name[0]) + strlcpy(name, "Audio CD", length); } @@ -644,7 +644,7 @@ if (status == B_OK && count_audio_tracks(toc) == 0) status = B_BAD_TYPE; - if (status < B_OK) { + if (status != B_OK) { free(toc); return status; } @@ -655,11 +655,11 @@ fRootNode = _CreateNode(NULL, "", 0, 0, S_IFDIR | 0777); if (fRootNode == NULL) status = B_NO_MEMORY; - if (status >= B_OK) { + if (status == B_OK) { status = publish_vnode(FSVolume(), fRootNode->ID(), fRootNode, &gCDDAVnodeOps, fRootNode->Type(), 0); } - if (status < B_OK) { + if (status != B_OK) { free(toc); return status; } @@ -671,7 +671,7 @@ // We do not seem to have an attribute file so this is probably the // first time this CD is inserted. In this case, try to read CD-Text // data. - if (read_cdtext(fDevice, text) < B_OK) + if (read_cdtext(fDevice, text) != B_OK) dprintf("CDDA: no CD-Text found.\n"); else doLookup = false; @@ -1385,9 +1385,9 @@ // determine volume title - uint32 cddbId = compute_cddb_disc_id(*toc); char name[256]; - Volume::DetermineName(cddbId, fd, name, sizeof(name)); + Volume::DetermineName(compute_cddb_disc_id(*toc), fd, name, sizeof(name)); + partition->content_name = strdup(name); if (partition->content_name == NULL) return B_NO_MEMORY; From stefano.ceccherini at gmail.com Wed May 13 09:51:57 2009 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Wed, 13 May 2009 09:51:57 +0200 Subject: [Haiku-commits] r30731 - haiku/trunk/src/apps/deskbar In-Reply-To: <20090513090422.462.1@bepc.1242196279.fake> References: <200905122119.n4CLJ2He027177@sheep.berlios.de> <20090513090422.462.1@bepc.1242196279.fake> Message-ID: <894b9700905130051t597824f7mce1d661874c45985@mail.gmail.com> 2009/5/13 Stephan Assmus : >> Log: >> * When activating the "Shutdown" menu (instead of one of its items), we >> now >> ? get the old shutdown dialog back, but with the additional option to >> ? reboot instead. > > Ah! Perfect! > > Best regards, > -Stephan Indeed! With a touchpad, navigating to the submenu was pretty irritating. From axeld at mail.berlios.de Wed May 13 09:59:01 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 13 May 2009 09:59:01 +0200 Subject: [Haiku-commits] r30742 - haiku/trunk/src/add-ons/kernel/file_systems/cdda Message-ID: <200905130759.n4D7x10g012664@sheep.berlios.de> Author: axeld Date: 2009-05-13 09:59:00 +0200 (Wed, 13 May 2009) New Revision: 30742 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30742&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp Log: * Even more cleanup. Modified: haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp 2009-05-13 07:50:29 UTC (rev 30741) +++ haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp 2009-05-13 07:59:00 UTC (rev 30742) @@ -43,14 +43,14 @@ typedef DoublyLinkedList AttrCookieList; struct riff_header { - uint32 magic; - uint32 length; - uint32 id; + uint32 magic; + uint32 length; + uint32 id; } _PACKED; struct riff_chunk { - uint32 fourcc; - uint32 length; + uint32 fourcc; + uint32 length; } _PACEKD; struct wav_format_chunk : riff_chunk { @@ -75,160 +75,168 @@ }; class Volume { - public: - Volume(fs_volume* fsVolume); - ~Volume(); +public: + Volume(fs_volume* fsVolume); + ~Volume(); - status_t InitCheck(); - fs_volume* FSVolume() const { return fFSVolume; } - uint32 DiscID() const { return fDiscID; } - Inode& RootNode() const { return *fRootNode; } + status_t InitCheck(); + fs_volume* FSVolume() const { return fFSVolume; } + uint32 DiscID() const { return fDiscID; } + Inode& RootNode() const { return *fRootNode; } - status_t Mount(const char* device); - int Device() const { return fDevice; } - ino_t GetNextNodeID() { return fNextID++; } + status_t Mount(const char* device); + int Device() const { return fDevice; } + ino_t GetNextNodeID() { return fNextID++; } - const char* Name() const { return fName; } - status_t SetName(const char* name); + const char* Name() const { return fName; } + status_t SetName(const char* name); - Semaphore& Lock(); + Semaphore& Lock(); - Inode* Find(ino_t id); - Inode* Find(const char* name); + Inode* Find(ino_t id); + Inode* Find(const char* name); - Inode* FirstEntry() const { return fFirstEntry; } + Inode* FirstEntry() const { return fFirstEntry; } - off_t NumBlocks() const { return fNumBlocks; } - size_t BufferSize() const { return 32 * kFrameSize; } - // TODO: for now + off_t NumBlocks() const { return fNumBlocks; } + size_t BufferSize() const { return 32 * kFrameSize; } + // TODO: for now - static void DetermineName(uint32 cddbId, int device, char* name, - size_t length); + static void DetermineName(uint32 cddbId, int device, char* name, + size_t length); - private: - Inode* _CreateNode(Inode* parent, const char* name, - off_t start, off_t frames, int32 type); - int _OpenAttributes(int mode, - enum attr_mode attrMode = kDiscIDAttributes); - void _RestoreAttributes(); - void _RestoreAttributes(int fd); - void _StoreAttributes(); - void _RestoreSharedAttributes(); - void _StoreSharedAttributes(); +private: + Inode* _CreateNode(Inode* parent, const char* name, + off_t start, off_t frames, int32 type); + int _OpenAttributes(int mode, + enum attr_mode attrMode = kDiscIDAttributes); + void _RestoreAttributes(); + void _RestoreAttributes(int fd); + void _StoreAttributes(); + void _RestoreSharedAttributes(); + void _StoreSharedAttributes(); - Semaphore fLock; - fs_volume* fFSVolume; - int fDevice; - dev_t fID; - uint32 fDiscID; - Inode* fRootNode; - ino_t fNextID; - char* fName; - off_t fNumBlocks; + Semaphore fLock; + fs_volume* fFSVolume; + int fDevice; + dev_t fID; + uint32 fDiscID; + Inode* fRootNode; + ino_t fNextID; + char* fName; + off_t fNumBlocks; - // root directory contents - we don't support other directories - Inode* fFirstEntry; + // root directory contents - we don't support other directories + Inode* fFirstEntry; }; class Attribute : public DoublyLinkedListLinkImpl { - public: - Attribute(const char* name, type_code type); - ~Attribute(); +public: + Attribute(const char* name, type_code type); + ~Attribute(); - status_t InitCheck() const { return fName != NULL ? B_OK : B_NO_MEMORY; } - status_t SetTo(const char* name, type_code type); - void SetType(type_code type) { fType = type; } + status_t InitCheck() const + { return fName != NULL ? B_OK : B_NO_MEMORY; } + status_t SetTo(const char* name, type_code type); + void SetType(type_code type) + { fType = type; } - status_t ReadAt(off_t offset, uint8* buffer, size_t* _length); - status_t WriteAt(off_t offset, const uint8* buffer, size_t* _length); - void Truncate(); - status_t SetSize(off_t size); + status_t ReadAt(off_t offset, uint8* buffer, + size_t* _length); + status_t WriteAt(off_t offset, const uint8* buffer, + size_t* _length); + void Truncate(); + status_t SetSize(off_t size); - const char* Name() const { return fName; } - size_t Size() const { return fSize; } - type_code Type() const { return fType; } - uint8* Data() const { return fData; } + const char* Name() const { return fName; } + size_t Size() const { return fSize; } + type_code Type() const { return fType; } + uint8* Data() const { return fData; } - bool IsProtectedNamespace(); - static bool IsProtectedNamespace(const char* name); + bool IsProtectedNamespace(); + static bool IsProtectedNamespace(const char* name); - private: - char* fName; - type_code fType; - uint8* fData; - size_t fSize; +private: + char* fName; + type_code fType; + uint8* fData; + size_t fSize; }; class Inode { - public: - Inode(Volume* volume, Inode* parent, const char* name, off_t start, - off_t frames, int32 type); - ~Inode(); +public: + Inode(Volume* volume, Inode* parent, + const char* name, off_t start, off_t frames, + int32 type); + ~Inode(); - status_t InitCheck(); - ino_t ID() const { return fID; } + status_t InitCheck(); + ino_t ID() const { return fID; } - const char* Name() const { return fName; } - status_t SetName(const char* name); + const char* Name() const { return fName; } + status_t SetName(const char* name); - int32 Type() const - { return fType; } - gid_t GroupID() const - { return fGroupID; } - uid_t UserID() const - { return fUserID; } - time_t CreationTime() const - { return fCreationTime; } - time_t ModificationTime() const - { return fModificationTime; } - off_t StartFrame() const - { return fStartFrame; } - off_t FrameCount() const - { return fFrameCount; } - off_t Size() const - { return fFrameCount * kFrameSize /* + WAV header */; } + int32 Type() const + { return fType; } + gid_t GroupID() const + { return fGroupID; } + uid_t UserID() const + { return fUserID; } + time_t CreationTime() const + { return fCreationTime; } + time_t ModificationTime() const + { return fModificationTime; } + off_t StartFrame() const + { return fStartFrame; } + off_t FrameCount() const + { return fFrameCount; } + off_t Size() const + { return fFrameCount * kFrameSize; } + // does not include the WAV header - Attribute* FindAttribute(const char* name) const; - status_t AddAttribute(Attribute* attribute, bool overwrite); - status_t AddAttribute(const char* name, type_code type, - bool overwrite, const uint8* data, size_t length); - status_t AddAttribute(const char* name, type_code type, - const char* string); - status_t AddAttribute(const char* name, type_code type, - uint32 value); - status_t RemoveAttribute(const char* name, - bool checkNamespace = false); + Attribute* FindAttribute(const char* name) const; + status_t AddAttribute(Attribute* attribute, bool overwrite); + status_t AddAttribute(const char* name, type_code type, + bool overwrite, const uint8* data, + size_t length); + status_t AddAttribute(const char* name, type_code type, + const char* string); + status_t AddAttribute(const char* name, type_code type, + uint32 value); + status_t RemoveAttribute(const char* name, + bool checkNamespace = false); - void AddAttrCookie(attr_cookie* cookie); - void RemoveAttrCookie(attr_cookie* cookie); - void RewindAttrCookie(attr_cookie* cookie); + void AddAttrCookie(attr_cookie* cookie); + void RemoveAttrCookie(attr_cookie* cookie); + void RewindAttrCookie(attr_cookie* cookie); - AttributeList::ConstIterator Attributes() const - { return fAttributes.GetIterator(); } + AttributeList::ConstIterator Attributes() const + { return fAttributes.GetIterator(); } - const wav_header* WAVHeader() const { return &fWAVHeader; } + const wav_header* WAVHeader() const + { return &fWAVHeader; } - Inode* Next() const { return fNext; } - void SetNext(Inode *inode) { fNext = inode; } + Inode* Next() const { return fNext; } + void SetNext(Inode *inode) { fNext = inode; } - private: - Inode* fNext; - ino_t fID; - int32 fType; - char *fName; - gid_t fGroupID; - uid_t fUserID; - time_t fCreationTime; - time_t fModificationTime; - off_t fStartFrame; - off_t fFrameCount; - AttributeList fAttributes; - AttrCookieList fAttrCookies; - wav_header fWAVHeader; +private: + Inode* fNext; + ino_t fID; + int32 fType; + char* fName; + gid_t fGroupID; + uid_t fUserID; + time_t fCreationTime; + time_t fModificationTime; + off_t fStartFrame; + off_t fFrameCount; + AttributeList fAttributes; + AttrCookieList fAttrCookies; + wav_header fWAVHeader; }; struct dir_cookie { - Inode *current; + Inode* current; int state; // iteration state }; @@ -241,13 +249,13 @@ }; struct attr_cookie : DoublyLinkedListLinkImpl { - Attribute *current; + Attribute* current; }; struct file_cookie { int open_mode; off_t buffer_offset; - void *buffer; + void* buffer; }; static const uint32 kMaxAttributeSize = 65536; From zooey at hirschkaefer.de Wed May 13 09:59:50 2009 From: zooey at hirschkaefer.de (Oliver Tappe) Date: Wed, 13 May 2009 09:59:50 +0200 Subject: [Haiku-commits] r30734 - haiku/trunk/src/preferences/keymap In-Reply-To: <709577523-BeMail@zon> References: <709577523-BeMail@zon> Message-ID: <20090513095950.311.1@bepc.1242200319.fake> On 2009-05-13 at 09:38:53 [+0200], Axel D?rfler wrote: > zooey at BerliOS wrote: > > * dropped 'Save' menu item, as it wasn't implemented anyway and would > > now > > never be enabled > > That reminds me: I guess one always needs to "Save As" even when the > keymap in question was a user keymap? Maybe "Save" could be > reintroduced for this very case? I don't really like that, since it would not be clear to the user to which file the keymap would be saved (as upon any changes, the '(Current)' keymap is be selected in the listview). cheers, Oliver From axeld at pinc-software.de Wed May 13 10:02:25 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Wed, 13 May 2009 10:02:25 +0200 CEST Subject: [Haiku-commits] r30709 - haiku/trunk/src/apps/stylededit In-Reply-To: <5618027851-BeMail@kirilla> Message-ID: <3814541314-BeMail@zon> "Jonas Sundstr?m" wrote: > "Axel D?rfler" wrote: > > I am a friend of short comments, though - the essence > > of this should not need more than a few lines, I would > > assume :-) > Yeah, I got into Haiku Book mode. Thinking of > new developers unfamiliar with the API. Well, there would be plenty of opportunity to follow Haiku Book mode ;- ) > 6 lines now. Tolerable, I hope. :-) Yep, perfect. Bye, Axel. From axeld at mail.berlios.de Wed May 13 10:58:32 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 13 May 2009 10:58:32 +0200 Subject: [Haiku-commits] r30743 - haiku/trunk/src/servers/registrar Message-ID: <200905130858.n4D8wWRB016859@sheep.berlios.de> Author: axeld Date: 2009-05-13 10:58:32 +0200 (Wed, 13 May 2009) New Revision: 30743 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30743&view=rev Modified: haiku/trunk/src/servers/registrar/ShutdownProcess.cpp haiku/trunk/src/servers/registrar/ShutdownProcess.h Log: * Style cleanup, added missing copyrights. Modified: haiku/trunk/src/servers/registrar/ShutdownProcess.cpp =================================================================== --- haiku/trunk/src/servers/registrar/ShutdownProcess.cpp 2009-05-13 07:59:00 UTC (rev 30742) +++ haiku/trunk/src/servers/registrar/ShutdownProcess.cpp 2009-05-13 08:58:32 UTC (rev 30743) @@ -1,8 +1,14 @@ /* * Copyright 2005-2008, Ingo Weinhold, bonefish at users.sf.net. + * Copyright 2006-2009, Axel D?rfler, axeld at pinc-software.de. + * Copyright 2006-2008, Stephan A?mus. + * Copyright 2006, Ryan Leavengood. + * * Distributed under the terms of the MIT License. */ +#include "ShutdownProcess.h" + #include #include @@ -28,9 +34,7 @@ #include #include -#ifdef __HAIKU__ #include -#endif #include "AppInfoListMessagingTargetSet.h" #include "Debug.h" @@ -39,7 +43,6 @@ #include "MessageEvent.h" #include "Registrar.h" #include "RosterAppInfo.h" -#include "ShutdownProcess.h" #include "TRoster.h" using std::nothrow; @@ -98,16 +101,14 @@ }; -// inverse_compare_by_registration_time -static -bool -inverse_compare_by_registration_time(const RosterAppInfo *info1, - const RosterAppInfo *info2) +static bool +inverse_compare_by_registration_time(const RosterAppInfo* info1, + const RosterAppInfo* info2) { return (info2->registration_time < info1->registration_time); } -// throw_error + /*! \brief Used to avoid type matching problems when throwing a constant. */ static inline @@ -117,10 +118,10 @@ throw error; } -// TimeoutEvent + class ShutdownProcess::TimeoutEvent : public MessageEvent { public: - TimeoutEvent(BHandler *target) + TimeoutEvent(BHandler* target) : MessageEvent(0, target, MSG_PHASE_TIMED_OUT) { SetAutoDelete(false); @@ -139,7 +140,7 @@ fMessage.ReplaceInt32("team", team); } - static int32 GetMessagePhase(BMessage *message) + static int32 GetMessagePhase(BMessage* message) { int32 phase; if (message->FindInt32("phase", &phase) != B_OK) @@ -148,7 +149,7 @@ return phase; } - static int32 GetMessageTeam(BMessage *message) + static int32 GetMessageTeam(BMessage* message) { team_id team; if (message->FindInt32("team", &team) != B_OK) @@ -159,14 +160,14 @@ }; -// InternalEvent class ShutdownProcess::InternalEvent : public DoublyLinkedListLinkImpl { public: InternalEvent(uint32 type, team_id team, int32 phase) - : fType(type), - fTeam(team), - fPhase(phase) + : + fType(type), + fTeam(team), + fPhase(phase) { } @@ -181,21 +182,19 @@ }; -// InternalEventList struct ShutdownProcess::InternalEventList : DoublyLinkedList { }; -// QuitRequestReplyHandler class ShutdownProcess::QuitRequestReplyHandler : public BHandler { public: - QuitRequestReplyHandler(ShutdownProcess *shutdownProcess) + QuitRequestReplyHandler(ShutdownProcess* shutdownProcess) : BHandler("shutdown quit reply handler"), - fShutdownProcess(shutdownProcess) + fShutdownProcess(shutdownProcess) { } - virtual void MessageReceived(BMessage *message) + virtual void MessageReceived(BMessage* message) { switch (message->what) { case B_REPLY: @@ -222,7 +221,6 @@ }; -// ShutdownWindow class ShutdownProcess::ShutdownWindow : public BWindow { public: ShutdownWindow() @@ -230,14 +228,14 @@ B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, B_ASYNCHRONOUS_CONTROLS | B_NOT_RESIZABLE | B_NOT_MINIMIZABLE | B_NOT_ZOOMABLE | B_NOT_CLOSABLE, B_ALL_WORKSPACES), - fKillAppMessage(NULL), - fCurrentApp(-1) + fKillAppMessage(NULL), + fCurrentApp(-1) { } ~ShutdownWindow() { - for (int32 i = 0; AppInfo *info = (AppInfo*)fAppInfos.ItemAt(i); i++) { + for (int32 i = 0; AppInfo* info = (AppInfo*)fAppInfos.ItemAt(i); i++) { delete info; } } @@ -279,7 +277,7 @@ return B_NO_MEMORY; fRootView->AddChild(fKillAppButton); - BMessage *message = new BMessage(MSG_KILL_APPLICATION); + BMessage* message = new BMessage(MSG_KILL_APPLICATION); if (!message) return B_NO_MEMORY; message->AddInt32("team", -1); @@ -406,9 +404,9 @@ return B_OK; } - status_t AddApp(team_id team, BBitmap *miniIcon, BBitmap *largeIcon) + status_t AddApp(team_id team, BBitmap* miniIcon, BBitmap* largeIcon) { - AppInfo *info = new(nothrow) AppInfo; + AppInfo* info = new(nothrow) AppInfo; if (!info) { delete miniIcon; delete largeIcon; @@ -436,13 +434,13 @@ if (team == fCurrentApp) SetCurrentApp(-1); - AppInfo *info = (AppInfo*)fAppInfos.RemoveItem(index); + AppInfo* info = (AppInfo*)fAppInfos.RemoveItem(index); delete info; } void SetCurrentApp(team_id team) { - AppInfo *info = (team >= 0 ? _AppInfoFor(team) : NULL); + AppInfo* info = (team >= 0 ? _AppInfoFor(team) : NULL); fCurrentApp = team; fRootView->SetAppInfo(info); @@ -450,7 +448,7 @@ fKillAppMessage->ReplaceInt32("team", team); } - void SetText(const char *text) + void SetText(const char* text) { fTextView->SetText(text); } @@ -513,7 +511,7 @@ if (team < 0) return -1; - for (int32 i = 0; AppInfo *info = (AppInfo*)fAppInfos.ItemAt(i); i++) { + for (int32 i = 0; AppInfo* info = (AppInfo*)fAppInfos.ItemAt(i); i++) { if (info->team == team) return i; } @@ -521,7 +519,7 @@ return -1; } - AppInfo *_AppInfoFor(team_id team) + AppInfo* _AppInfoFor(team_id team) { int32 index = _AppInfoIndexOf(team); return (index >= 0 ? (AppInfo*)fAppInfos.ItemAt(index) : NULL); @@ -529,9 +527,10 @@ class TAlertView : public BView { public: - TAlertView(BRect frame, const char *name, uint32 resizeMask, uint32 flags) + TAlertView(BRect frame, const char* name, uint32 resizeMask, + uint32 flags) : BView(frame, name, resizeMask, flags | B_WILL_DRAW), - fAppInfo(NULL) + fAppInfo(NULL) { } @@ -554,7 +553,7 @@ } } - void SetAppInfo(AppInfo *info) + void SetAppInfo(AppInfo* info) { fAppInfo = info; Invalidate(); @@ -566,42 +565,43 @@ private: BList fAppInfos; - TAlertView *fRootView; - BTextView *fTextView; - BButton *fKillAppButton; - BButton *fCancelShutdownButton; - BButton *fRebootSystemButton; - BButton *fAbortedOKButton; - BMessage *fKillAppMessage; + TAlertView* fRootView; + BTextView* fTextView; + BButton* fKillAppButton; + BButton* fCancelShutdownButton; + BButton* fRebootSystemButton; + BButton* fAbortedOKButton; + BMessage* fKillAppMessage; team_id fCurrentApp; }; // #pragma mark - -// constructor -ShutdownProcess::ShutdownProcess(TRoster *roster, EventQueue *eventQueue) - : BLooper("shutdown process"), - EventMaskWatcher(BMessenger(this), B_REQUEST_QUIT), - fWorkerLock("worker lock"), - fRequest(NULL), - fRoster(roster), - fEventQueue(eventQueue), - fTimeoutEvent(NULL), - fInternalEvents(NULL), - fInternalEventSemaphore(-1), - fQuitRequestReplyHandler(NULL), - fWorker(-1), - fCurrentPhase(INVALID_PHASE), - fShutdownError(B_ERROR), - fHasGUI(false), - fReboot(false), - fRequestReplySent(false), - fWindow(NULL) + +ShutdownProcess::ShutdownProcess(TRoster* roster, EventQueue* eventQueue) + : + BLooper("shutdown process"), + EventMaskWatcher(BMessenger(this), B_REQUEST_QUIT), + fWorkerLock("worker lock"), + fRequest(NULL), + fRoster(roster), + fEventQueue(eventQueue), + fTimeoutEvent(NULL), + fInternalEvents(NULL), + fInternalEventSemaphore(-1), + fQuitRequestReplyHandler(NULL), + fWorker(-1), + fCurrentPhase(INVALID_PHASE), + fShutdownError(B_ERROR), + fHasGUI(false), + fReboot(false), + fRequestReplySent(false), + fWindow(NULL) { } -// destructor + ShutdownProcess::~ShutdownProcess() { // terminate the GUI @@ -642,7 +642,7 @@ // delete all internal events and the queue if (fInternalEvents) { - while (InternalEvent *event = fInternalEvents->First()) { + while (InternalEvent* event = fInternalEvents->First()) { fInternalEvents->Remove(event); delete event; } @@ -655,9 +655,9 @@ delete fRequest; } -// Init + status_t -ShutdownProcess::Init(BMessage *request) +ShutdownProcess::Init(BMessage* request) { PRINT(("ShutdownProcess::Init()\n")); @@ -729,9 +729,9 @@ return B_OK; } -// MessageReceived + void -ShutdownProcess::MessageReceived(BMessage *message) +ShutdownProcess::MessageReceived(BMessage* message) { switch (message->what) { case B_SOME_APP_QUIT: @@ -748,7 +748,7 @@ // remove the app info from the respective list int32 phase; - RosterAppInfo *info; + RosterAppInfo* info; { BAutolock _(fWorkerLock); @@ -778,7 +778,7 @@ // get the phase the event is intended for int32 phase = TimeoutEvent::GetMessagePhase(message); team_id team = TimeoutEvent::GetMessageTeam(message);; -PRINT(("MSG_PHASE_TIMED_OUT: phase: %ld, team: %ld\n", phase, team)); + PRINT(("MSG_PHASE_TIMED_OUT: phase: %ld, team: %ld\n", phase, team)); BAutolock _(fWorkerLock); @@ -857,9 +857,9 @@ } } -// SendReply + void -ShutdownProcess::SendReply(BMessage *request, status_t error) +ShutdownProcess::SendReply(BMessage* request, status_t error) { if (error == B_OK) { BMessage reply(B_REG_SUCCESS); @@ -871,7 +871,7 @@ } } -// _SendReply + void ShutdownProcess::_SendReply(status_t error) { @@ -881,7 +881,7 @@ } } -// _SetPhase + void ShutdownProcess::_SetPhase(int32 phase) { @@ -896,7 +896,7 @@ fEventQueue->RemoveEvent(fTimeoutEvent); } -// _ScheduleTimeoutEvent + void ShutdownProcess::_ScheduleTimeoutEvent(bigtime_t timeout, team_id team) { @@ -914,7 +914,7 @@ fEventQueue->AddEvent(fTimeoutEvent); } -// _SetShowShutdownWindow + void ShutdownProcess::_SetShowShutdownWindow(bool show) { @@ -930,7 +930,7 @@ } } -// _InitShutdownWindow + void ShutdownProcess::_InitShutdownWindow() { @@ -959,15 +959,15 @@ } } -// _AddShutdownWindowApps + void -ShutdownProcess::_AddShutdownWindowApps(AppInfoList &infos) +ShutdownProcess::_AddShutdownWindowApps(AppInfoList& infos) { if (!fHasGUI) return; for (AppInfoList::Iterator it = infos.It(); it.IsValid(); ++it) { - RosterAppInfo *info = *it; + RosterAppInfo* info = *it; // init an app file info BFile file; @@ -995,7 +995,7 @@ #endif // mini icon - BBitmap *miniIcon = new(nothrow) BBitmap(BRect(0, 0, 15, 15), format); + BBitmap* miniIcon = new(nothrow) BBitmap(BRect(0, 0, 15, 15), format); if (miniIcon != NULL) { error = miniIcon->InitCheck(); if (error == B_OK) @@ -1007,7 +1007,7 @@ } // mini icon - BBitmap *largeIcon = new(nothrow) BBitmap(BRect(0, 0, 31, 31), format); + BBitmap* largeIcon = new(nothrow) BBitmap(BRect(0, 0, 31, 31), format); if (largeIcon != NULL) { error = largeIcon->InitCheck(); if (error == B_OK) @@ -1027,7 +1027,7 @@ } } -// _RemoveShutdownWindowApp + void ShutdownProcess::_RemoveShutdownWindowApp(team_id team) { @@ -1038,7 +1038,7 @@ } } -// _SetShutdownWindowCurrentApp + void ShutdownProcess::_SetShutdownWindowCurrentApp(team_id team) { @@ -1049,9 +1049,9 @@ } } -// _SetShutdownWindowText + void -ShutdownProcess::_SetShutdownWindowText(const char *text) +ShutdownProcess::_SetShutdownWindowText(const char* text) { if (fHasGUI) { BAutolock _(fWindow); @@ -1060,7 +1060,7 @@ } } -// _SetShutdownWindowCancelButtonEnabled + void ShutdownProcess::_SetShutdownWindowCancelButtonEnabled(bool enabled) { @@ -1071,7 +1071,7 @@ } } -// _SetShutdownWindowKillButtonEnabled + void ShutdownProcess::_SetShutdownWindowKillButtonEnabled(bool enabled) { @@ -1082,7 +1082,7 @@ } } -// _SetShutdownWindowWaitForShutdown + void ShutdownProcess::_SetShutdownWindowWaitForShutdown() { @@ -1093,7 +1093,7 @@ } } -// _SetShutdownWindowWaitForAbortedOK + void ShutdownProcess::_SetShutdownWindowWaitForAbortedOK() { @@ -1104,7 +1104,7 @@ } } -// _NegativeQuitRequestReply + void ShutdownProcess::_NegativeQuitRequestReply(thread_id thread) { @@ -1116,9 +1116,9 @@ _PushEvent(ABORT_EVENT, thread, fCurrentPhase); } -// _PrepareShutdownMessage + void -ShutdownProcess::_PrepareShutdownMessage(BMessage &message) const +ShutdownProcess::_PrepareShutdownMessage(BMessage& message) const { message.what = B_QUIT_REQUESTED; message.AddBool("_shutdown_", true); @@ -1126,26 +1126,19 @@ BMessage::Private(message).SetReply(BMessenger(fQuitRequestReplyHandler)); } -// _ShutDown + status_t ShutdownProcess::_ShutDown() { PRINT(("Invoking _kern_shutdown(%d)\n", fReboot)); - - #ifdef __HAIKU__ - RETURN_ERROR(_kern_shutdown(fReboot)); - #else - // we can't do anything on R5 - return B_ERROR; - #endif + RETURN_ERROR(_kern_shutdown(fReboot)); } -// _PushEvent status_t ShutdownProcess::_PushEvent(uint32 eventType, team_id team, int32 phase) { - InternalEvent *event = new(nothrow) InternalEvent(eventType, team, phase); + InternalEvent* event = new(nothrow) InternalEvent(eventType, team, phase); if (!event) { ERROR(("ShutdownProcess::_PushEvent(): Failed to create event!\n")); @@ -1160,9 +1153,9 @@ return B_OK; } -// _GetNextEvent + status_t -ShutdownProcess::_GetNextEvent(uint32 &eventType, thread_id &team, int32 &phase, +ShutdownProcess::_GetNextEvent(uint32& eventType, thread_id& team, int32& phase, bool block) { while (true) { @@ -1187,7 +1180,7 @@ // get the event BAutolock _(fWorkerLock); - InternalEvent *event = fInternalEvents->Head(); + InternalEvent* event = fInternalEvents->Head(); fInternalEvents->Remove(event); eventType = event->Type(); @@ -1210,14 +1203,14 @@ return B_OK; } -// _WorkerEntry + status_t -ShutdownProcess::_WorkerEntry(void *data) +ShutdownProcess::_WorkerEntry(void* data) { return ((ShutdownProcess*)data)->_Worker(); } -// _Worker + status_t ShutdownProcess::_Worker() { @@ -1239,7 +1232,7 @@ return B_OK; } -// _WorkerDoShutdown + void ShutdownProcess::_WorkerDoShutdown() { @@ -1333,25 +1326,23 @@ break; } while (event != REBOOT_SYSTEM_EVENT); - #ifdef __HAIKU__ _kern_shutdown(true); - #endif } // either there's no GUI or reboot failed: we enter the kernel debugger // instead - #ifdef __HAIKU__ +#ifdef __HAIKU__ // TODO: Introduce the syscall. // while (true) { // _kern_kernel_debugger("The system is shut down. It's now safe to turn " // "off the computer."); // } - #endif +#endif } bool -ShutdownProcess::_WaitForApp(team_id team, AppInfoList *list, bool systemApps) +ShutdownProcess::_WaitForApp(team_id team, AppInfoList* list, bool systemApps) { uint32 event; do { @@ -1393,7 +1384,7 @@ void -ShutdownProcess::_QuitApps(AppInfoList &list, bool systemApps) +ShutdownProcess::_QuitApps(AppInfoList& list, bool systemApps) { PRINT(("ShutdownProcess::_QuitApps(%s)\n", (systemApps ? "system" : "user"))); @@ -1453,7 +1444,7 @@ { BAutolock _(fWorkerLock); if (!list.IsEmpty()) { - RosterAppInfo *info = *list.It(); + RosterAppInfo* info = *list.It(); team = info->team; port = info->port; strcpy(appName, info->ref.name); @@ -1493,7 +1484,7 @@ // This is a system app: remove it from the list BAutolock _(fWorkerLock); - if (RosterAppInfo *info = list.InfoFor(team)) { + if (RosterAppInfo* info = list.InfoFor(team)) { list.RemoveInfo(info); delete info; } @@ -1502,7 +1493,7 @@ } } -// _QuitBackgroundApps + void ShutdownProcess::_QuitBackgroundApps() { @@ -1535,7 +1526,7 @@ PRINT(("ShutdownProcess::_QuitBackgroundApps() done\n")); } -// _WaitForBackgroundApps + void ShutdownProcess::_WaitForBackgroundApps() { @@ -1569,7 +1560,7 @@ PRINT(("ShutdownProcess::_WaitForBackgroundApps() done\n")); } -// _KillBackgroundApps + void ShutdownProcess::_KillBackgroundApps() { @@ -1590,12 +1581,12 @@ // get the first team to kill team_id team = -1; char appName[B_FILE_NAME_LENGTH]; - AppInfoList &list = fBackgroundApps; + AppInfoList& list = fBackgroundApps; { BAutolock _(fWorkerLock); if (!list.IsEmpty()) { - RosterAppInfo *info = *list.It(); + RosterAppInfo* info = *list.It(); team = info->team; strcpy(appName, info->ref.name); } @@ -1613,7 +1604,7 @@ } } -// _QuitNonApps + void ShutdownProcess::_QuitNonApps() { @@ -1661,10 +1652,10 @@ PRINT(("ShutdownProcess::_QuitNonApps() done\n")); } -// _QuitBlockingApp + void -ShutdownProcess::_QuitBlockingApp(AppInfoList &list, team_id team, - const char *appName, bool cancelAllowed) +ShutdownProcess::_QuitBlockingApp(AppInfoList& list, team_id team, + const char* appName, bool cancelAllowed) { bool debugged = false; bool modal = false; @@ -1737,14 +1728,14 @@ { BAutolock _(fWorkerLock); - if (RosterAppInfo *info = list.InfoFor(team)) { + if (RosterAppInfo* info = list.InfoFor(team)) { list.RemoveInfo(info); delete info; } } } -// _DisplayAbortingApp + void ShutdownProcess::_DisplayAbortingApp(team_id team) { @@ -1754,7 +1745,7 @@ { BAutolock _(fWorkerLock); - RosterAppInfo *info = fUserApps.InfoFor(team); + RosterAppInfo* info = fUserApps.InfoFor(team); if (!info) info = fSystemApps.InfoFor(team); if (!info) @@ -1774,8 +1765,8 @@ // compose the text to be displayed char buffer[1024]; - snprintf(buffer, sizeof(buffer), "Application \"%s\" has aborted the shutdown " - "process.", appName); + snprintf(buffer, sizeof(buffer), "Application \"%s\" has aborted the " + "shutdown process.", appName); // set up the window _SetShutdownWindowCurrentApp(team); @@ -1802,14 +1793,6 @@ // stop waiting when the user hit the cancel button if (event == ABORT_EVENT && phase == ABORTED_PHASE && eventTeam < 0) break; - -// This doesn't give us anything; it will just prevent us to see which -// app was responsible after all... -#if 0 - // also stop when the responsible app quit - if ((event == APP_QUIT_EVENT) && eventTeam == team) - break; -#endif } } Modified: haiku/trunk/src/servers/registrar/ShutdownProcess.h =================================================================== --- haiku/trunk/src/servers/registrar/ShutdownProcess.h 2009-05-13 07:59:00 UTC (rev 30742) +++ haiku/trunk/src/servers/registrar/ShutdownProcess.h 2009-05-13 08:58:32 UTC (rev 30743) @@ -9,6 +9,7 @@ #include +#include #include #include "AppInfoList.h" @@ -28,58 +29,64 @@ // EventMaskWatcher fails otherwise. class ShutdownProcess : public BLooper, public EventMaskWatcher { public: - ShutdownProcess(TRoster *roster, EventQueue *eventQueue); - ~ShutdownProcess(); + ShutdownProcess(TRoster* roster, + EventQueue* eventQueue); + virtual ~ShutdownProcess(); - status_t Init(BMessage *request); + status_t Init(BMessage* request); - virtual void MessageReceived(BMessage *message); + virtual void MessageReceived(BMessage* message); - static void SendReply(BMessage *request, status_t error); + static void SendReply(BMessage* request, status_t error); private: - void _SendReply(status_t error); + void _SendReply(status_t error); - void _NegativeQuitRequestReply(thread_id thread); + void _NegativeQuitRequestReply(thread_id thread); - void _PrepareShutdownMessage(BMessage &message) const; - status_t _ShutDown(); + void _PrepareShutdownMessage(BMessage& message) const; + status_t _ShutDown(); - status_t _PushEvent(uint32 eventType, team_id team, int32 phase); - status_t _GetNextEvent(uint32 &eventType, team_id &team, int32 &phase, - bool block); + status_t _PushEvent(uint32 eventType, team_id team, + int32 phase); + status_t _GetNextEvent(uint32& eventType, team_id& team, + int32& phase, bool block); - void _SetPhase(int32 phase); - void _ScheduleTimeoutEvent(bigtime_t timeout, team_id team = -1); + void _SetPhase(int32 phase); + void _ScheduleTimeoutEvent(bigtime_t timeout, + team_id team = -1); - bool _LockAppLists(); - void _UnlockAppLists(); + bool _LockAppLists(); + void _UnlockAppLists(); - void _InitShutdownWindow(); - void _SetShowShutdownWindow(bool show); - void _AddShutdownWindowApps(AppInfoList &infos); - void _RemoveShutdownWindowApp(team_id team); - void _SetShutdownWindowCurrentApp(team_id team); - void _SetShutdownWindowText(const char *text); - void _SetShutdownWindowCancelButtonEnabled(bool enabled); - void _SetShutdownWindowKillButtonEnabled(bool enabled); - void _SetShutdownWindowWaitForShutdown(); - void _SetShutdownWindowWaitForAbortedOK(); + void _InitShutdownWindow(); + void _SetShowShutdownWindow(bool show); + void _AddShutdownWindowApps(AppInfoList& infos); + void _RemoveShutdownWindowApp(team_id team); + void _SetShutdownWindowCurrentApp(team_id team); + void _SetShutdownWindowText(const char* text); + void _SetShutdownWindowCancelButtonEnabled( + bool enabled); + void _SetShutdownWindowKillButtonEnabled( + bool enabled); + void _SetShutdownWindowWaitForShutdown(); + void _SetShutdownWindowWaitForAbortedOK(); - static status_t _WorkerEntry(void *data); - status_t _Worker(); + static status_t _WorkerEntry(void* data); + status_t _Worker(); - void _WorkerDoShutdown(); - bool _WaitForApp(team_id team, AppInfoList *list, bool systemApps); - void _QuitApps(AppInfoList &list, bool systemApps); - void _QuitBackgroundApps(); - void _WaitForBackgroundApps(); - void _KillBackgroundApps(); - void _QuitNonApps(); - void _QuitBlockingApp(AppInfoList &list, team_id team, const char *appName, - bool cancelAllowed); - void _DisplayAbortingApp(team_id team); - void _WaitForDebuggedTeams(); + void _WorkerDoShutdown(); + bool _WaitForApp(team_id team, AppInfoList* list, + bool systemApps); + void _QuitApps(AppInfoList& list, bool systemApps); + void _QuitBackgroundApps(); + void _WaitForBackgroundApps(); + void _KillBackgroundApps(); + void _QuitNonApps(); + void _QuitBlockingApp(AppInfoList& list, team_id team, + const char* appName, bool cancelAllowed); + void _DisplayAbortingApp(team_id team); + void _WaitForDebuggedTeams(); private: class TimeoutEvent; @@ -90,27 +97,28 @@ friend class QuitRequestReplyHandler; - BLocker fWorkerLock; // protects fields shared by looper - // and worker - BMessage *fRequest; - TRoster *fRoster; - EventQueue *fEventQueue; - hash_set fVitalSystemApps; - AppInfoList fSystemApps; - AppInfoList fUserApps; - AppInfoList fBackgroundApps; - hash_set fDebuggedTeams; - TimeoutEvent *fTimeoutEvent; - InternalEventList *fInternalEvents; - sem_id fInternalEventSemaphore; - QuitRequestReplyHandler *fQuitRequestReplyHandler; - thread_id fWorker; - int32 fCurrentPhase; - status_t fShutdownError; - bool fHasGUI; - bool fReboot; - bool fRequestReplySent; - ShutdownWindow *fWindow; + BLocker fWorkerLock; + // protects fields shared by looper + // and worker + BMessage* fRequest; + TRoster* fRoster; + EventQueue* fEventQueue; + hash_set fVitalSystemApps; + AppInfoList fSystemApps; + AppInfoList fUserApps; + AppInfoList fBackgroundApps; + hash_set fDebuggedTeams; + TimeoutEvent* fTimeoutEvent; + InternalEventList* fInternalEvents; + sem_id fInternalEventSemaphore; + QuitRequestReplyHandler* fQuitRequestReplyHandler; + thread_id fWorker; + int32 fCurrentPhase; + status_t fShutdownError; + bool fHasGUI; + bool fReboot; + bool fRequestReplySent; + ShutdownWindow* fWindow; }; #endif // SHUTDOWN_PROCESS_H From axeld at mail.berlios.de Wed May 13 11:13:27 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 13 May 2009 11:13:27 +0200 Subject: [Haiku-commits] r30744 - haiku/trunk/src/servers/registrar Message-ID: <200905130913.n4D9DREe017906@sheep.berlios.de> Author: axeld Date: 2009-05-13 11:13:26 +0200 (Wed, 13 May 2009) New Revision: 30744 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30744&view=rev Modified: haiku/trunk/src/servers/registrar/ShutdownProcess.cpp Log: * Make the shutdown request no longer prevent apps from being launched. Now they only cannot be launched anymore once you acknowledge that request. Modified: haiku/trunk/src/servers/registrar/ShutdownProcess.cpp =================================================================== --- haiku/trunk/src/servers/registrar/ShutdownProcess.cpp 2009-05-13 08:58:32 UTC (rev 30743) +++ haiku/trunk/src/servers/registrar/ShutdownProcess.cpp 2009-05-13 09:13:26 UTC (rev 30744) @@ -683,11 +683,8 @@ RETURN_ERROR(fInternalEventSemaphore); // init the app server connection - fHasGUI = (Registrar::App()->InitGUIContext() == B_OK); + fHasGUI = Registrar::App()->InitGUIContext() == B_OK; - // tell TRoster not to accept new applications anymore - fRoster->SetShuttingDown(true); - // start watching application quits status_t error = fRoster->AddWatcher(this); if (error != B_OK) { @@ -695,18 +692,6 @@ RETURN_ERROR(error); } - // get a list of all applications to shut down and sort them - error = fRoster->GetShutdownApps(fUserApps, fSystemApps, fBackgroundApps, - fVitalSystemApps); - if (error != B_OK) { - fRoster->RemoveWatcher(this); - fRoster->SetShuttingDown(false); - RETURN_ERROR(error); - } - - fUserApps.Sort(&inverse_compare_by_registration_time); - fSystemApps.Sort(&inverse_compare_by_registration_time); - // start the worker thread fWorker = spawn_thread(_WorkerEntry, "shutdown worker", B_NORMAL_PRIORITY, this); @@ -1268,6 +1253,26 @@ throw_error(B_SHUTDOWN_CANCELLED); } + // tell TRoster not to accept new applications anymore + fRoster->SetShuttingDown(true); + + fWorkerLock.Lock(); + + // get a list of all applications to shut down and sort them + status_t status = fRoster->GetShutdownApps(fUserApps, fSystemApps, + fBackgroundApps, fVitalSystemApps); + if (status != B_OK) { + fWorkerLock.Unlock(); + fRoster->RemoveWatcher(this); + fRoster->SetShuttingDown(false); + return; + } + + fUserApps.Sort(&inverse_compare_by_registration_time); + fSystemApps.Sort(&inverse_compare_by_registration_time); + + fWorkerLock.Unlock(); + // make the shutdown window ready and show it _InitShutdownWindow(); _SetShutdownWindowCurrentApp(-1); @@ -1321,8 +1326,8 @@ do { team_id team; int32 phase; - status_t error = _GetNextEvent(event, team, phase, true); - if (error != B_OK) + status = _GetNextEvent(event, team, phase, true); + if (status != B_OK) break; } while (event != REBOOT_SYSTEM_EVENT); From superstippi at gmx.de Wed May 13 11:27:21 2009 From: superstippi at gmx.de (Stephan Assmus) Date: Wed, 13 May 2009 11:27:21 +0200 Subject: [Haiku-commits] r30739 - in haiku/trunk: headers/private/support src/bin src/kits/support In-Reply-To: References: <1070668334-BeMail@zon> Message-ID: <20090513112721.1987.3@bepc.1242196279.fake> On 2009-05-13 at 08:37:41 [+0200], Fredrik Mod?en wrote: > > >> + status_t OpenWithPreferredApplication(bool > >> onProblemAskUser = true) const; > > > > This line is longer than 80 characters. > > About this 80 characters limit how hard are this rule? If I have one that > are 81 should I make it two rows? Is it also used for comments? > > I don?t want to start a war here but why 80 and not 70 or 90? With > today?s screen resolution perhaps a wider characters limit could be used? We have had this discussion a number of times... the argument is basically this: * To have a limit makes sense, * To have a soft limit doesn't make sense, because that's like having no limit, * The 80 char limit is not totally arbitrary. If you look into configurations of various editors (Qt Creator, Geany), you will notice that they will often have an option to display a cut-off line, and they default to 80. I think it's some default Terminal width or something... also very useful for reading diffs in mails. It doesn't really matter what the limit is. What matters is that we have defined the limit and changing it doesn't make sense. If someone wants to work using a single big window on his 24" screen, that's fine he can do that even with an 80 char limit. Other people have other workflows, and in some workflows, it is extremely annoying if some people didn't stick to the 80 char/line limit. Please, just do it. Yes, this means if you're at 81, break up the line. > Other question, what does the starting f in a member variable stands for? I cannot answer that one. Again, the point is to have consistency. Anyways, the frequent reminders about coding style may seem quite annoying. However, what is really annoying is that people who check in new code into the repo often don't stick to the guidelines, especially when they have been reminded already. We do frequently work in other peoples code, like for example if someone disappears or doesn't have time anymore. Haveing consistent guidelines makes this much more pleasant for everyone. Please, everyone, simply stick to the guide lines. Closely. Best regards, -Stephan From axeld at pinc-software.de Wed May 13 11:28:26 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Wed, 13 May 2009 11:28:26 +0200 CEST Subject: [Haiku-commits] =?utf-8?q?r30736_-_in_haiku/trunk=3A_build/jam_sr?= =?utf-8?q?c/servers/cddb=5Fdaemon?= In-Reply-To: <200905130005.n4D05sq7020598@sheep.berlios.de> Message-ID: <8975113721-BeMail@zon> bga at BerliOS wrote: > Log: > - Finished up cddb_daemon. Still some cleanup needed here and there > but it works. Nice! I guess this is working read-only? Ie. it would still be a nice addition to have an application that transmits the changes you make back to the cddb server? Bye, Axel. From axeld at pinc-software.de Wed May 13 11:31:47 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Wed, 13 May 2009 11:31:47 +0200 CEST Subject: [Haiku-commits] r30739 - in haiku/trunk: headers/private/support src/bin src/kits/support In-Reply-To: Message-ID: <9176890507-BeMail@zon> Fredrik Mod?en wrote: > >> + status_t OpenWithPreferredApplication(bool > >> onProblemAskUser = true) const; > > This line is longer than 80 characters. > About this 80 characters limit how hard are this rule? If I have one > that > are 81 should I make it two rows? Is it also used for comments? For everything, and yes, that would be two rows indeed. > I don?t want to start a war here but why 80 and not 70 or 90? With > today?s screen resolution perhaps a wider characters limit could be > used? As long as it's a hard limit, I guess the actual limit would be debatable. Although 80 characters is sort of standard, and allows you to have two full source windows next two each other even with not that large resolutions. > Other question, what does the starting f in a member variable stands > for? I would guess "field". "k" for constant is also not really that obvious :-) It's just a somewhat common standard we're using. Bye, Axel. From axeld at pinc-software.de Wed May 13 11:33:07 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Wed, 13 May 2009 11:33:07 +0200 CEST Subject: [Haiku-commits] r30734 - haiku/trunk/src/preferences/keymap In-Reply-To: <20090513095950.311.1@bepc.1242200319.fake> Message-ID: <9256928283-BeMail@zon> Oliver Tappe wrote: > On 2009-05-13 at 09:38:53 [+0200], Axel D?rfler > > wrote: > > zooey at BerliOS wrote: > > > * dropped 'Save' menu item, as it wasn't implemented anyway and > > > would > > > now never be enabled > > That reminds me: I guess one always needs to "Save As" even when > > the > > keymap in question was a user keymap? Maybe "Save" could be > > reintroduced for this very case? > I don't really like that, since it would not be clear to the user to > which > file the keymap would be saved (as upon any changes, the '(Current)' > keymap > is be selected in the listview). Indeed, that would need to be changed then as well. I think I would like to move this a bit more towards a file/name based handling, but I guess how it's currently done is okay for now. Bye, Axel. From bga at bug-br.org.br Wed May 13 07:46:45 2009 From: bga at bug-br.org.br (Bruno Albuquerque) Date: Wed, 13 May 2009 07:46:45 Subject: [Haiku-commits] =?utf-8?q?r30737_-_haiku/trunk/src/add-ons/kernel?= =?utf-8?q?/file=5Fsystems/cdda?= In-Reply-To: Message-ID: <714350980-BeMail@Gaspode> On Wed, 13 May 2009 07:59:23 +0200, Fredrik Ekdahl said: > There's a typo there (STRIG). That was fixed in a following revision. > That doesn't look correct. Are you suggesting that the bit rate of an > audio CD is 128 kbps? This is what cdda-fs for BeOS used to show, as far as I remember. I am just replicating the behaviour here. > Anyway, is the bit rate of a CD really interesting? It doesn't matter. It is there for completeness so all relevant aydio attributes are present in the audio files. > I'm quoting wikipedia: > > The bit rate is 720 kbit/s[4] (103)Often referred to 1411kb/s when > not > viewed as FFT 2n 900000B: > 2 channels x 22,050 final samples per second per channel (44.1kHz > combined) ? 16 bits per sample = 720,000 bit/s[5] Which may be > otherwise referred to as 44.1kHz per channel dependent unless viewed > as Fast Fourier Transform view method, 2n storage 900000B. I will look into changing this later, I will first confirm the R5 behaviour and then try to understand why it is like that. In any case, I work with Marco Nelissen, original cdda-fs author and media guru and I will also ask him. -Bruno From bga at bug-br.org.br Wed May 13 07:48:57 2009 From: bga at bug-br.org.br (Bruno Albuquerque) Date: Wed, 13 May 2009 07:48:57 Subject: [Haiku-commits] r30737 - haiku/trunk/src/add-ons/kernel/file_systems/cdda In-Reply-To: <483380172-BeMail@zon> Message-ID: <846127232-BeMail@Gaspode> On Wed, 13 May 2009 09:06:54 +0200 CEST, Axel D?rfler said: > > That doesn't look correct. Are you suggesting that the bit rate of > > an > > audio CD is 128 kbps? > > Anyway, is the bit rate of a CD really interesting? > > Indeed, IMO this should be reverted. Again, I am fine with putting the correct bitrate there, but I really do not see any reason for completelly removing it. There is an Audio:Bitrate attribute and as long as the bitrate can be calculated, there is no reason to leave it empty. -Bruno From bga at bug-br.org.br Wed May 13 07:56:10 2009 From: bga at bug-br.org.br (Bruno Albuquerque) Date: Wed, 13 May 2009 07:56:10 Subject: [Haiku-commits] r30736 - in haiku/trunk: build/jam src/servers/cddb_daemon In-Reply-To: <8975113721-BeMail@zon> Message-ID: <1279956105-BeMail@Gaspode> On Wed, 13 May 2009 11:28:26 +0200 CEST, Axel D?rfler said: > bga at BerliOS wrote: > > Log: > > - Finished up cddb_daemon. Still some cleanup needed here and there > > but it works. > > Nice! I guess this is working read-only? Ie. it would still be a nice > addition to have an application that transmits the changes you make > back to the cddb server? Yes, I have the protocol part done for that (not in the submitted code tough). The problem is that it needs some kind of GUI and GUIs are my sore spot. :P I can draw sticky figures, but that do not help here. :) In any case, I will clean-up this part of the protocol and commit it. So the hooks will all be there and someone can come up with an interface. :) -Bruno From axeld at pinc-software.de Wed May 13 13:14:44 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Wed, 13 May 2009 13:14:44 +0200 CEST Subject: [Haiku-commits] r30737 - haiku/trunk/src/add-ons/kernel/file_systems/cdda In-Reply-To: <846127232-BeMail@Gaspode> Message-ID: <15353254736-BeMail@zon> "Bruno Albuquerque" wrote: > On Wed, 13 May 2009 09:06:54 +0200 CEST, Axel D?rfler said: > > > That doesn't look correct. Are you suggesting that the bit rate > > > of > > > an audio CD is 128 kbps? > > > Anyway, is the bit rate of a CD really interesting? > > Indeed, IMO this should be reverted. > Again, I am fine with putting the correct bitrate there, but I really > do not see any reason for completelly removing it. There is an > Audio:Bitrate attribute and as long as the bitrate can be calculated, > there is no reason to leave it empty. True enough, though it doesn't really matter for non-compressed audio files. In any case, having the wrong bitrate there doesn't make any sense. IIRC the original cdda-fs did not include a bitrate, however, I don't really care about that one, as we aren't compatible anyway, and there is little reason to be. Bye, Axel. From fredrik at modeen.se Wed May 13 13:26:18 2009 From: fredrik at modeen.se (Fredrik =?utf-8?Q?Mod=C3=A8en?=) Date: Wed, 13 May 2009 13:26:18 +0200 (CEST) Subject: [Haiku-commits] r30739 - in haiku/trunk: headers/private/support src/bin src/kits/support In-Reply-To: <20090513112721.1987.3@bepc.1242196279.fake> References: <1070668334-BeMail@zon> <20090513112721.1987.3@bepc.1242196279.fake> Message-ID: <97e6bfaf167eb03edb1430d794ce1afc.squirrel@webmail2.webbhotellsgruppen.se> > > On 2009-05-13 at 08:37:41 [+0200], Fredrik Mod?en -------- > > We have had this discussion a number of times... the argument is basically > this: ya I know sorry for that but thanks for the summery :) a short "it is a standard" or something like that would have satisfied me :) ------- >> Other question, what does the starting f in a member variable stands >> for? > > I cannot answer that one. Again, the point is to have consistency. Axel did :) > Anyways, the frequent reminders about coding style may seem quite > annoying. > However, what is really annoying is that people who check in new code into > the repo often don't stick to the guidelines, especially when they have > been reminded already. We do frequently work in other peoples code, like > for example if someone disappears or doesn't have time anymore. Haveing > consistent guidelines makes this much more pleasant for everyone. Please, > everyone, simply stick to the guide lines. Closely. I'm reading every reminder trying to learn our coding style but it's hard to apply the standard if you are not the author :) Last time I did a commit I made a diff and proof read that. Next check in will probably have a lot more errors as it's a lot of code and not produced by me (SpicyKeys). A code style validation tool would be cool to have :) And thanks to everybody for proof reading the commits. > Best regards, > -Stephan > _______________________________________________ > Haiku-commits mailing list > Haiku-commits at lists.berlios.de > https://lists.berlios.de/mailman/listinfo/haiku-commits > -- MVH Fredrik Mod?en From superstippi at gmx.de Wed May 13 13:42:40 2009 From: superstippi at gmx.de (Stephan Assmus) Date: Wed, 13 May 2009 13:42:40 +0200 Subject: [Haiku-commits] r30739 - in haiku/trunk: headers/private/support src/bin src/kits/support In-Reply-To: <97e6bfaf167eb03edb1430d794ce1afc.squirrel@webmail2.webbhotells gruppen.se> References: <1070668334-BeMail@zon> <20090513112721.1987.3@bepc.1242196279.fake> <97e6bfaf167eb03edb1430d794ce1afc.squirrel@webmail2.webbhotellsgruppen.se> Message-ID: <20090513134240.2234.5@bepc.1242196279.fake> Hi, On 2009-05-13 at 12:26:18 [+0200], Fredrik Mod?en wrote: > > On 2009-05-13 at 08:37:41 [+0200], Fredrik Mod?en > > We have had this discussion a number of times... the argument is > > basically this: > ya I know sorry for that but thanks for the summery :) a short "it is a > standard" or something like that would have satisfied me :) Sorry it I came across a little sore... :-) I didn't mean to for the most part. Thought this would end up in another challenge on the coding style guidelines. > I'm reading every reminder trying to learn our coding style but it's hard > to apply the standard if you are not the author :) I feel your pain. For things that are not maintained anywhere else, it is of course preferred to transfer them into our coding style, but I fully realize that that may be a lot of work and costs time which one doesn't have or wants to spend in other ways... > Last time I did a commit I made a diff and proof read that. Next check in > will probably have a lot more errors as it's a lot of code and not > produced by me (SpicyKeys). > > A code style validation tool would be cool to have :) We do have the guidelines written down, though, and they should be pretty much up to date. I have to use another style guide for work too and need to remember to switch between the two. I find it becomes more and more easy to do that quickly over time. :-) Best regards, -Stephan From joe.prostko+haiku at gmail.com Wed May 13 14:14:41 2009 From: joe.prostko+haiku at gmail.com (Joseph Prostko) Date: Wed, 13 May 2009 12:14:41 +0000 Subject: [Haiku-commits] r30739 - in haiku/trunk: headers/private/support src/bin src/kits/support In-Reply-To: <20090513112721.1987.3@bepc.1242196279.fake> References: <1070668334-BeMail@zon> <20090513112721.1987.3@bepc.1242196279.fake> Message-ID: <7e5795b0905130514l1be73178ufd31723db6a7b9b3@mail.gmail.com> On Wed, May 13, 2009 at 9:27 AM, Stephan Assmus wrote: > > On 2009-05-13 at 08:37:41 [+0200], Fredrik Mod?en wrote: >> >> >> + status_t OpenWithPreferredApplication(bool >> >> onProblemAskUser = true) const; >> > >> > This line is longer than 80 characters. >> >> About this 80 characters limit how hard are this rule? If I have one that >> are 81 should I make it two rows? Is it also used for comments? >> >> I don?t want to start a war here but why 80 and not 70 or 90? With >> today?s screen resolution perhaps a wider characters limit could be used? > > We have had this discussion a number of times... the argument is basically > this: > > * To have a limit makes sense, > * To have a soft limit doesn't make sense, because that's like having no > limit, > * The 80 char limit is not totally arbitrary. If you look into > configurations of various editors (Qt Creator, Geany), you will notice that > they will often have an option to display a cut-off line, and they default > to 80. I think it's some default Terminal width or something... also very > useful for reading diffs in mails. It doesn't really matter what the limit > is. What matters is that we have defined the limit and changing it doesn't > make sense. If someone wants to work using a single big window on his 24" > screen, that's fine he can do that even with an 80 char limit. Other people > have other workflows, and in some workflows, it is extremely annoying if > some people didn't stick to the 80 char/line limit. Please, just do it. > > Yes, this means if you're at 81, break up the line. Well, the coding guidelines document on the website (last updated in 2006) should be updated to reflect this fact. It says: "Try to wrap your code to a reasonable width of 80 - 90 columns." See here: http://www.haiku-os.org/documents/dev/haiku_coding_guidelines Perhaps somebody thoroughly versed with the guidelines can give it a look-through and correct/update it? - joe From ingo_weinhold at gmx.de Wed May 13 13:52:43 2009 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Wed, 13 May 2009 13:52:43 +0200 Subject: [Haiku-commits] r30729 - in haiku/trunk: headers/os/kernel headers/private/runtime_loader src/system/kernel src/system/runtime_loader In-Reply-To: <1886654499-BeMail@zon> References: <1886654499-BeMail@zon> Message-ID: <20090513135243.622.2@knochen-vm.localdomain> On 2009-05-13 at 09:30:17 [+0200], Axel D?rfler wrote: > Matt Madia wrote: > > On Tue, May 12, 2009 at 9:09 PM, wrote: > > > Log: > > > Extended image_info by fields for the Haiku version and ABI. The > > > runtime loader > > > and the kernel read those values from the shared object (if > > > available). In the > > > runtime loader this should eventually replace the gcc version > > > guessing method > > > currently used (at least for shared objects built for Haiku). The > > > optional > > > packages need to be rebuilt first, though. > > Should the OptionalPackages be rebuilt now or are there more related > > commits to follow? > > Before we do that, we could think about solving #3916 for them, too: > http://dev.haiku-os.org/ticket/3916 There's also the wchar_t switch we might want to do. And other such changes might present themselves before alpha 1. I figured it would be a good idea to avoid inflationary introduction of Haiku version macros and corresponding compatibility handling in the runtime loader -- i.e. only have those for actual releases -- but it might be a good idea to temporarily introduce versions for inbetween API changes, too. We could consolidate those when feature-freezing for the release, requiring rebuilding of all optional packages at that point. CU, Ingo From superstippi at gmx.de Wed May 13 14:30:45 2009 From: superstippi at gmx.de (=?windows-1252?Q?Stephan_A=DFmus?=) Date: Wed, 13 May 2009 14:30:45 +0200 Subject: [Haiku-commits] r30739 - in haiku/trunk: headers/private/support src/bin src/kits/support In-Reply-To: <7e5795b0905130514l1be73178ufd31723db6a7b9b3@mail.gmail.com> References: <1070668334-BeMail@zon> <20090513112721.1987.3@bepc.1242196279.fake> <7e5795b0905130514l1be73178ufd31723db6a7b9b3@mail.gmail.com> Message-ID: <4A0ABD75.80900@gmx.de> Joseph Prostko schrieb: > On Wed, May 13, 2009 at 9:27 AM, Stephan Assmus wrote: >> On 2009-05-13 at 08:37:41 [+0200], Fredrik Mod?en wrote: >>>>> + status_t OpenWithPreferredApplication(bool >>>>> onProblemAskUser = true) const; >>>> This line is longer than 80 characters. >>> About this 80 characters limit how hard are this rule? If I have one that >>> are 81 should I make it two rows? Is it also used for comments? >>> >>> I don?t want to start a war here but why 80 and not 70 or 90? With >>> today?s screen resolution perhaps a wider characters limit could be used? >> We have had this discussion a number of times... the argument is basically >> this: >> >> * To have a limit makes sense, >> * To have a soft limit doesn't make sense, because that's like having no >> limit, >> * The 80 char limit is not totally arbitrary. If you look into >> configurations of various editors (Qt Creator, Geany), you will notice that >> they will often have an option to display a cut-off line, and they default >> to 80. I think it's some default Terminal width or something... also very >> useful for reading diffs in mails. It doesn't really matter what the limit >> is. What matters is that we have defined the limit and changing it doesn't >> make sense. If someone wants to work using a single big window on his 24" >> screen, that's fine he can do that even with an 80 char limit. Other people >> have other workflows, and in some workflows, it is extremely annoying if >> some people didn't stick to the 80 char/line limit. Please, just do it. >> >> Yes, this means if you're at 81, break up the line. > > Well, the coding guidelines document on the website (last updated in > 2006) should be updated to reflect this fact. > > It says: > > "Try to wrap your code to a reasonable width of 80 - 90 columns." > > See here: > > http://www.haiku-os.org/documents/dev/haiku_coding_guidelines > > Perhaps somebody thoroughly versed with the guidelines can give it a > look-through and correct/update it? Uh, not good. Thanks for pointed that out! Best regards, -Stephan From superstippi at gmx.de Wed May 13 14:50:17 2009 From: superstippi at gmx.de (Stephan Assmus) Date: Wed, 13 May 2009 14:50:17 +0200 Subject: [Haiku-commits] r30740 - haiku/trunk/headers/private/shared In-Reply-To: <200905130746.n4D7kL9j009553@sheep.berlios.de> References: <200905130746.n4D7kL9j009553@sheep.berlios.de> Message-ID: <20090513145017.2453.8@bepc.1242196279.fake> On 2009-05-13 at 08:46:21 [+0200], axeld at BerliOS wrote: > Author: axeld > Date: 2009-05-13 09:46:14 +0200 (Wed, 13 May 2009) New Revision: 30740 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30740&view=rev > > Modified: > haiku/trunk/headers/private/shared/AutoLocker.h > Log: > * Added operator=(). > + inline ThisClass& operator=(ThisClass& otherLocker) > + { > + fLockable = otherLocker.fLockable; > + fLocked = otherLocker.fLocked; > + otherLocker.Detach(); > + return &this; > + } This looks strange. It seems more like an implementation of an "Adopt()" method. From an operator=(), I expect the locker to give up it's current lock, detach from it's current target, then acquire a new lock for the other lockers target. BTW, even in an "Adopt()", one would have to give up it's own lock first. Best regards, -Stephan From zooey at mail.berlios.de Wed May 13 15:49:01 2009 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Wed, 13 May 2009 15:49:01 +0200 Subject: [Haiku-commits] r30745 - haiku/trunk/src/preferences/keymap Message-ID: <200905131349.n4DDn1b1019107@sheep.berlios.de> Author: zooey Date: 2009-05-13 15:49:00 +0200 (Wed, 13 May 2009) New Revision: 30745 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30745&view=rev Modified: haiku/trunk/src/preferences/keymap/KeyboardLayoutView.cpp haiku/trunk/src/preferences/keymap/KeyboardLayoutView.h Log: * avoid key highlighting unless the preflet window is active, at least I've found it pretty silly that the Keymap preflet would document all my keypresses although I'm doing something elsewhere Modified: haiku/trunk/src/preferences/keymap/KeyboardLayoutView.cpp =================================================================== --- haiku/trunk/src/preferences/keymap/KeyboardLayoutView.cpp 2009-05-13 09:13:26 UTC (rev 30744) +++ haiku/trunk/src/preferences/keymap/KeyboardLayoutView.cpp 2009-05-13 13:49:00 UTC (rev 30745) @@ -108,6 +108,13 @@ } +void +KeyboardLayoutView::WindowActivated(bool active) +{ + if (active) + Invalidate(); +} + BSize KeyboardLayoutView::MinSize() { @@ -482,7 +489,8 @@ && fModifiers != newModifiers) { fModifiers = newModifiers; _EvaluateDropTarget(fDropPoint); - Invalidate(); + if (Window()->IsActive()) + Invalidate(); } break; } @@ -947,7 +955,7 @@ uint8 diff = fKeyState[i] ^ state[i]; fKeyState[i] = state[i]; - if (!checkSingle) + if (!checkSingle || !Window()->IsActive()) continue; for (int32 j = 7; diff != 0; j--, diff >>= 1) { Modified: haiku/trunk/src/preferences/keymap/KeyboardLayoutView.h =================================================================== --- haiku/trunk/src/preferences/keymap/KeyboardLayoutView.h 2009-05-13 09:13:26 UTC (rev 30744) +++ haiku/trunk/src/preferences/keymap/KeyboardLayoutView.h 2009-05-13 13:49:00 UTC (rev 30745) @@ -43,7 +43,7 @@ virtual void Draw(BRect updateRect); virtual void MessageReceived(BMessage* message); - + virtual void WindowActivated(bool active); private: enum key_kind { kNormalKey, From axeld at pinc-software.de Wed May 13 16:18:10 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Wed, 13 May 2009 16:18:10 +0200 CEST Subject: [Haiku-commits] r30745 - haiku/trunk/src/preferences/keymap In-Reply-To: <200905131349.n4DDn1b1019107@sheep.berlios.de> Message-ID: <26359558476-BeMail@zon> zooey at BerliOS wrote: > Log: > * avoid key highlighting unless the preflet window is active, at > least > I've found it pretty silly that the Keymap preflet would document > all my > keypresses although I'm doing something elsewhere Maybe that's something that should be settable in the KeyboardLayoutView? I mean why should it use SetEventMask(B_KEYBOARD_EVENTS) in the first place if you don't want them? > +void > +KeyboardLayoutView::WindowActivated(bool active) > +{ > + if (active) > + Invalidate(); > +} > + > BSize Two blank lines between functions. > virtual void Draw(BRect updateRect); > virtual void MessageReceived(BMessage* message); > - > + virtual void WindowActivated(bool active); > private: Missing blank line. Bye, Axel. From bonefish at mail.berlios.de Wed May 13 16:37:42 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Wed, 13 May 2009 16:37:42 +0200 Subject: [Haiku-commits] r30746 - haiku/trunk/headers/os Message-ID: <200905131437.n4DEbgD2023357@sheep.berlios.de> Author: bonefish Date: 2009-05-13 16:37:41 +0200 (Wed, 13 May 2009) New Revision: 30746 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30746&view=rev Modified: haiku/trunk/headers/os/BeBuild.h Log: * Changed the layout of the Haiku version and ABI constants to allow for more inbetween versions. * Added constants for legacy versions. Modified: haiku/trunk/headers/os/BeBuild.h =================================================================== --- haiku/trunk/headers/os/BeBuild.h 2009-05-13 13:49:00 UTC (rev 30745) +++ haiku/trunk/headers/os/BeBuild.h 2009-05-13 14:37:41 UTC (rev 30746) @@ -1,32 +1,41 @@ /* - * Copyright 2007-2008, Haiku, Inc. All Rights Reserved. + * Copyright 2007-2009, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _BE_BUILD_H #define _BE_BUILD_H -#define B_BEOS_VERSION_4 0x0400 -#define B_BEOS_VERSION_4_5 0x0450 -#define B_BEOS_VERSION_5 0x0500 +#define B_BEOS_VERSION_4 0x0400 +#define B_BEOS_VERSION_4_5 0x0450 +#define B_BEOS_VERSION_5 0x0500 -#define B_BEOS_VERSION B_BEOS_VERSION_5 -#define B_BEOS_VERSION_MAUI B_BEOS_VERSION_5 +#define B_BEOS_VERSION B_BEOS_VERSION_5 +#define B_BEOS_VERSION_MAUI B_BEOS_VERSION_5 // Haiku (API) version -#define B_HAIKU_VERSION_1_ALPHA_1 0x0010 -#define B_HAIKU_VERSION_1 0x0100 +#define B_HAIKU_VERSION_BEOS 0x00000001 +#define B_HAIKU_VERSION_BONE 0x00000002 +#define B_HAIKU_VERSION_DANO 0x00000003 +#define B_HAIKU_VERSION_1_PRE_ALPHA_1 0x00000011 +#define B_HAIKU_VERSION_1_ALPHA_1 0x00000100 +#define B_HAIKU_VERSION_1 0x00010000 -#define B_HAIKU_VERSION B_HAIKU_VERSION_1_ALPHA_1 +#define B_HAIKU_VERSION B_HAIKU_VERSION_1_PRE_ALPHA_1 // Haiku ABI -#define B_HAIKU_ABI_GCC_2 0x01 -#define B_HAIKU_ABI_GCC_4 0x02 +#define B_HAIKU_ABI_MAJOR 0xffff0000 +#define B_HAIKU_ABI_GCC_2 0x00020000 +#define B_HAIKU_ABI_GCC_4 0x00040000 +#define B_HAIKU_ABI_GCC_2_ANCIENT 0x00020000 +#define B_HAIKU_ABI_GCC_2_BEOS 0x00020001 +#define B_HAIKU_ABI_GCC_2_HAIKU 0x00020002 + #if __GNUC__ == 2 -# define B_HAIKU_ABI B_HAIKU_ABI_GCC_2 +# define B_HAIKU_ABI B_HAIKU_ABI_GCC_2 #elif __GNUC__ == 4 -# define B_HAIKU_ABI B_HAIKU_ABI_GCC_4 +# define B_HAIKU_ABI B_HAIKU_ABI_GCC_4 #else # error Unsupported gcc version! #endif From bonefish at mail.berlios.de Wed May 13 16:44:19 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Wed, 13 May 2009 16:44:19 +0200 Subject: [Haiku-commits] r30747 - in haiku/trunk: headers/private/runtime_loader src/system/runtime_loader Message-ID: <200905131444.n4DEiJZK024368@sheep.berlios.de> Author: bonefish Date: 2009-05-13 16:44:17 +0200 (Wed, 13 May 2009) New Revision: 30747 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30747&view=rev Modified: haiku/trunk/headers/private/runtime_loader/runtime_loader.h haiku/trunk/src/system/runtime_loader/elf.cpp Log: Removed the gcc_version from the runtime loader's image_t. Instead we always determine (or guess) Haiku version and ABI and use those for compatibility decisions. Modified: haiku/trunk/headers/private/runtime_loader/runtime_loader.h =================================================================== --- haiku/trunk/headers/private/runtime_loader/runtime_loader.h 2009-05-13 14:37:41 UTC (rev 30746) +++ haiku/trunk/headers/private/runtime_loader/runtime_loader.h 2009-05-13 14:44:17 UTC (rev 30747) @@ -78,13 +78,6 @@ int32 ref_count; uint32 flags; - struct { - int major; - int middle; - int minor; - bool haiku; - } gcc_version; - uint32 api_version; uint32 abi; Modified: haiku/trunk/src/system/runtime_loader/elf.cpp =================================================================== --- haiku/trunk/src/system/runtime_loader/elf.cpp 2009-05-13 14:37:41 UTC (rev 30746) +++ haiku/trunk/src/system/runtime_loader/elf.cpp 2009-05-13 14:44:17 UTC (rev 30747) @@ -42,6 +42,9 @@ // TODO: implement better locking strategy // TODO: implement lazy binding +// interim Haiku API versions +#define HAIKU_VERSION_PRE_GLUE_CODE 0x00000010 + #define PAGE_MASK (B_PAGE_SIZE - 1) #define PAGE_OFFSET(x) ((x) & (PAGE_MASK)) @@ -731,10 +734,6 @@ analyze_object_gcc_version(int fd, image_t* image, Elf32_Ehdr& eheader, int32 sheaderSize, char* buffer, size_t bufferSize) { - image->gcc_version.major = 0; - image->gcc_version.middle = 0; - image->gcc_version.minor = 0; - if (sheaderSize > (int)bufferSize) { FATAL("Cannot handle section headers bigger than %lu\n", bufferSize); return false; @@ -872,16 +871,26 @@ gccMinor = version[2]; } - if (gccMajor == 2 && gccPlatform != NULL && strcmp(gccPlatform, "haiku")) + if (gccMajor == 2 && gccPlatform != NULL + && strcmp(gccPlatform, "haiku")) { isHaiku = false; + } } - image->gcc_version.major = gccMajor; - image->gcc_version.middle = gccMiddle; - image->gcc_version.minor = gccMinor; - image->gcc_version.haiku = isHaiku; + if (gccMajor == 0) + return false; - return gccMajor != 0; + if (gccMajor == 2) { + if (gccMiddle < 95) + image->abi = B_HAIKU_ABI_GCC_2_ANCIENT; + else if (isHaiku) + image->abi = B_HAIKU_ABI_GCC_2_HAIKU; + else + image->abi = B_HAIKU_ABI_GCC_2_BEOS; + } else + image->abi = gccMajor << 16; + + return true; } @@ -1421,7 +1430,7 @@ // patch the symbol name symName = SYMNAME(image, sym); - if (!image->gcc_version.haiku) { + if (image->abi < B_HAIKU_ABI_GCC_2_HAIKU) { // The image has been compiled with a BeOS compiler. This means // we'll have to redirect some functions for compatibility. symName = beos_compatibility_map_symbol(symName); @@ -1740,31 +1749,42 @@ analyze_image_haiku_version_and_abi(image); - if (analyze_object_gcc_version(fd, image, eheader, sheaderSize, ph_buff, - sizeof(ph_buff))) { - // If this is the executable image, we init the search path - // subdir, if the compiler version doesn't match ours. - if (type == B_APP_IMAGE) { - #if __GNUC__ == 2 - if (image->gcc_version.major > 2) - sSearchPathSubDir = "gcc4"; - #elif __GNUC__ == 4 - if (image->gcc_version.major == 2) - sSearchPathSubDir = "gcc2"; - #endif + if (image->abi == 0) { + // No ABI version in the shared object, i.e. it has been built before + // that was introduced in Haiku. We have to try and analyze the gcc + // version. + if (!analyze_object_gcc_version(fd, image, eheader, sheaderSize, + ph_buff, sizeof(ph_buff))) { + FATAL("Failed to get gcc version for %s\n", path); + // not really fatal, actually + + // assume ancient BeOS + image->abi = B_HAIKU_ABI_GCC_2_ANCIENT; } - } else { - FATAL("Failed to get gcc version for %s\n", path); - // not really fatal, actually } + // guess the API version, if we couldn't figure it out yet + if (image->api_version == 0) { + image->api_version = image->abi > B_HAIKU_ABI_GCC_2_BEOS + ? HAIKU_VERSION_PRE_GLUE_CODE : B_HAIKU_VERSION_BEOS; + } + + // If this is the executable image, we init the search path + // subdir, if the compiler version doesn't match ours. + if (type == B_APP_IMAGE) { + #if __GNUC__ == 2 + if ((image->abi & B_HAIKU_ABI_MAJOR) == B_HAIKU_ABI_GCC_4) + sSearchPathSubDir = "gcc4"; + #elif __GNUC__ == 4 + if ((image->abi & B_HAIKU_ABI_MAJOR) == B_HAIKU_ABI_GCC_2) + sSearchPathSubDir = "gcc2"; + #endif + } + // init gcc version dependent image flags - // symbol resolution strategy (fallback is R5-style, if version is - // unavailable) - if (image->gcc_version.major == 0 - || (image->gcc_version.major == 2 && image->gcc_version.middle < 95)) { + // symbol resolution strategy + if (image->abi == B_HAIKU_ABI_GCC_2_ANCIENT) image->find_undefined_symbol = find_undefined_symbol_beos; - } image->type = type; register_image(image, fd, path); @@ -1777,9 +1797,8 @@ *_image = image; - KTRACE("rld: load_container(\"%s\"): done: id: %ld (gcc: %d.%d.%d)", name, - image->id, image->gcc_version.major, image->gcc_version.middle, - image->gcc_version.minor); + KTRACE("rld: load_container(\"%s\"): done: id: %ld (ABI: %#lx)", name, + image->id, image->abi); return B_OK; From axeld at mail.berlios.de Wed May 13 16:45:53 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 13 May 2009 16:45:53 +0200 Subject: [Haiku-commits] r30748 - haiku/trunk/headers/private/shared Message-ID: <200905131445.n4DEjral024572@sheep.berlios.de> Author: axeld Date: 2009-05-13 16:45:53 +0200 (Wed, 13 May 2009) New Revision: 30748 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30748&view=rev Modified: haiku/trunk/headers/private/shared/AutoLocker.h Log: * Removed operator=(otherLocker) again. Didn't really make sense this way, as Stippi correctly pointed out. Modified: haiku/trunk/headers/private/shared/AutoLocker.h =================================================================== --- haiku/trunk/headers/private/shared/AutoLocker.h 2009-05-13 14:44:17 UTC (rev 30747) +++ haiku/trunk/headers/private/shared/AutoLocker.h 2009-05-13 14:45:53 UTC (rev 30748) @@ -158,14 +158,6 @@ return *this; } - inline ThisClass& operator=(ThisClass& otherLocker) - { - fLockable = otherLocker.fLockable; - fLocked = otherLocker.fLocked; - otherLocker.Detach(); - return &this; - } - inline bool IsLocked() const { return fLocked; } inline operator bool() const { return fLocked; } From bga at mail.berlios.de Wed May 13 16:54:07 2009 From: bga at mail.berlios.de (bga at BerliOS) Date: Wed, 13 May 2009 16:54:07 +0200 Subject: [Haiku-commits] r30749 - haiku/trunk/src/add-ons/kernel/file_systems/cdda Message-ID: <200905131454.n4DEs7c6025202@sheep.berlios.de> Author: bga Date: 2009-05-13 16:54:06 +0200 (Wed, 13 May 2009) New Revision: 30749 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30749&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp Log: Marco Nelissen: The bitrate of an audio CD is 44100*4*8 (well, the bitrate of the "files" is, the actual bitrate of the CD is higher because of error correction). Modified: haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp 2009-05-13 14:45:53 UTC (rev 30748) +++ haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp 2009-05-13 14:54:06 UTC (rev 30749) @@ -738,7 +738,7 @@ inode->AddAttribute("Audio:Title", B_STRING_TYPE, text.titles[i]); inode->AddAttribute("Audio:Genre", B_STRING_TYPE, text.genre); inode->AddAttribute("Audio:Track", B_INT32_TYPE, track); - inode->AddAttribute("Audio:Bitrate", B_STRING_TYPE, "128 kbps"); + inode->AddAttribute("Audio:Bitrate", B_STRING_TYPE, "1378 kbps"); snprintf(title, sizeof(title), "%02lu:%02lu", uint32(inode->FrameCount() / kFramesPerMinute), From bonefish at mail.berlios.de Wed May 13 17:25:32 2009 From: bonefish at mail.berlios.de (bonefish at mail.berlios.de) Date: Wed, 13 May 2009 17:25:32 +0200 Subject: [Haiku-commits] r30750 - in haiku/trunk: headers/private/kernel headers/private/kernel/arch src/system/kernel src/system/kernel/arch/m68k src/system/kernel/arch/ppc src/system/kernel/arch/x86 Message-ID: <200905131525.n4DFPWYs027926@sheep.berlios.de> Author: bonefish Date: 2009-05-13 17:25:27 +0200 (Wed, 13 May 2009) New Revision: 30750 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30750&view=rev Modified: haiku/trunk/headers/private/kernel/arch/elf.h haiku/trunk/headers/private/kernel/elf_priv.h haiku/trunk/src/system/kernel/arch/m68k/arch_elf.cpp haiku/trunk/src/system/kernel/arch/ppc/arch_elf.cpp haiku/trunk/src/system/kernel/arch/x86/arch_elf.c haiku/trunk/src/system/kernel/elf.cpp Log: Symbol resolution functions in the kernel: Removed the unused parameter allowing optional prepending of a string to the symbol names. Modified: haiku/trunk/headers/private/kernel/arch/elf.h =================================================================== --- haiku/trunk/headers/private/kernel/arch/elf.h 2009-05-13 14:54:06 UTC (rev 30749) +++ haiku/trunk/headers/private/kernel/arch/elf.h 2009-05-13 15:25:27 UTC (rev 30750) @@ -13,9 +13,9 @@ extern "C" { #endif -extern int arch_elf_relocate_rel(struct elf_image_info *image, const char *sym_prepend, +extern int arch_elf_relocate_rel(struct elf_image_info *image, struct elf_image_info *resolve_image, struct Elf32_Rel *rel, int rel_len); -extern int arch_elf_relocate_rela(struct elf_image_info *image, const char *sym_prepend, +extern int arch_elf_relocate_rela(struct elf_image_info *image, struct elf_image_info *resolve_image, struct Elf32_Rela *rel, int rel_len); #ifdef __cplusplus Modified: haiku/trunk/headers/private/kernel/elf_priv.h =================================================================== --- haiku/trunk/headers/private/kernel/elf_priv.h 2009-05-13 14:54:06 UTC (rev 30749) +++ haiku/trunk/headers/private/kernel/elf_priv.h 2009-05-13 15:25:27 UTC (rev 30750) @@ -64,6 +64,6 @@ "C" #endif status_t elf_resolve_symbol(struct elf_image_info *image, struct Elf32_Sym *sym, - struct elf_image_info *shared_image, const char *sym_prepend, addr_t *sym_addr); + struct elf_image_info *shared_image, addr_t *sym_addr); #endif /* _KERNEL_ELF_PRIV_H */ Modified: haiku/trunk/src/system/kernel/arch/m68k/arch_elf.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/m68k/arch_elf.cpp 2009-05-13 14:54:06 UTC (rev 30749) +++ haiku/trunk/src/system/kernel/arch/m68k/arch_elf.cpp 2009-05-13 15:25:27 UTC (rev 30750) @@ -56,8 +56,8 @@ "R_68K_JMP_SLOT", /* Create PLT entry */ "R_68K_RELATIVE", /* Adjust by program base */ /* These are GNU extensions to enable C++ vtable garbage collection. */ - "R_68K_GNU_VTINHERIT", - "R_68K_GNU_VTENTRY", + "R_68K_GNU_VTINHERIT", + "R_68K_GNU_VTENTRY", #if 0 "R_386_NONE", "R_386_32", /* add symbol value */ @@ -79,8 +79,8 @@ boot_arch_elf_relocate_rel(struct preloaded_image *image, struct Elf32_Rel *rel, int rel_len) #else -int -arch_elf_relocate_rel(struct elf_image_info *image, const char *sym_prepend, +int +arch_elf_relocate_rel(struct elf_image_info *image, struct elf_image_info *resolve_image, struct Elf32_Rel *rel, int rel_len) #endif { @@ -140,8 +140,8 @@ boot_arch_elf_relocate_rela(struct preloaded_image *image, struct Elf32_Rela *rel, int rel_len) #else -int -arch_elf_relocate_rela(struct elf_image_info *image, const char *sym_prepend, +int +arch_elf_relocate_rela(struct elf_image_info *image, struct elf_image_info *resolve_image, struct Elf32_Rela *rel, int rel_len) #endif { @@ -191,8 +191,7 @@ #ifdef _BOOT_MODE vlErr = boot_elf_resolve_symbol(image, sym, &S); #else - vlErr = elf_resolve_symbol(image, sym, resolve_image, - sym_prepend, &S); + vlErr = elf_resolve_symbol(image, sym, resolve_image, &S); #endif if (vlErr < 0) { dprintf("%s(): Failed to relocate " Modified: haiku/trunk/src/system/kernel/arch/ppc/arch_elf.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/ppc/arch_elf.cpp 2009-05-13 14:54:06 UTC (rev 30749) +++ haiku/trunk/src/system/kernel/arch/ppc/arch_elf.cpp 2009-05-13 15:25:27 UTC (rev 30750) @@ -24,8 +24,8 @@ boot_arch_elf_relocate_rel(struct preloaded_image *image, struct Elf32_Rel *rel, int rel_len) #else -int -arch_elf_relocate_rel(struct elf_image_info *image, const char *sym_prepend, +int +arch_elf_relocate_rel(struct elf_image_info *image, struct elf_image_info *resolve_image, struct Elf32_Rel *rel, int rel_len) #endif { @@ -118,8 +118,8 @@ boot_arch_elf_relocate_rela(struct preloaded_image *image, struct Elf32_Rela *rel, int rel_len) #else -int -arch_elf_relocate_rela(struct elf_image_info *image, const char *sym_prepend, +int +arch_elf_relocate_rela(struct elf_image_info *image, struct elf_image_info *resolve_image, struct Elf32_Rela *rel, int rel_len) #endif { @@ -142,7 +142,7 @@ dprintf("arch_elf_relocate_rela(): Failed to get GOT address!\n"); \ return B_ERROR; \ } - + // TODO: Get the PLT address! #define REQUIRE_PLT \ if (L == 0) { \ @@ -189,8 +189,7 @@ #ifdef _BOOT_MODE vlErr = boot_elf_resolve_symbol(image, sym, &S); #else - vlErr = elf_resolve_symbol(image, sym, resolve_image, - sym_prepend, &S); + vlErr = elf_resolve_symbol(image, sym, resolve_image, &S); #endif if (vlErr < 0) { dprintf("%s(): Failed to relocate " Modified: haiku/trunk/src/system/kernel/arch/x86/arch_elf.c =================================================================== --- haiku/trunk/src/system/kernel/arch/x86/arch_elf.c 2009-05-13 14:54:06 UTC (rev 30749) +++ haiku/trunk/src/system/kernel/arch/x86/arch_elf.c 2009-05-13 15:25:27 UTC (rev 30750) @@ -60,7 +60,7 @@ struct Elf32_Rel *rel, int relLength) #else int -arch_elf_relocate_rel(struct elf_image_info *image, const char *prepend, +arch_elf_relocate_rel(struct elf_image_info *image, struct elf_image_info *resolveImage, struct Elf32_Rel *rel, int relLength) #endif { @@ -93,8 +93,7 @@ #ifdef _BOOT_MODE status = boot_elf_resolve_symbol(image, symbol, &S); #else - status = elf_resolve_symbol(image, symbol, resolveImage, - prepend, &S); + status = elf_resolve_symbol(image, symbol, resolveImage, &S); #endif if (status < B_OK) return status; @@ -172,7 +171,7 @@ struct Elf32_Rela *rel, int relLength) #else int -arch_elf_relocate_rela(struct elf_image_info *image, const char *prepend, +arch_elf_relocate_rela(struct elf_image_info *image, struct elf_image_info *resolveImage, struct Elf32_Rela *rel, int relLength) #endif { Modified: haiku/trunk/src/system/kernel/elf.cpp =================================================================== --- haiku/trunk/src/system/kernel/elf.cpp 2009-05-13 14:54:06 UTC (rev 30749) +++ haiku/trunk/src/system/kernel/elf.cpp 2009-05-13 15:25:27 UTC (rev 30750) @@ -660,33 +660,22 @@ /*! Resolves the \a symbol by linking against \a sharedImage if necessary. Returns the resolved symbol's address in \a _symbolAddress. - TODO: eventually get rid of "symbolPrepend" */ status_t elf_resolve_symbol(struct elf_image_info *image, struct Elf32_Sym *symbol, - struct elf_image_info *sharedImage, const char *symbolPrepend, - addr_t *_symbolAddress) + struct elf_image_info *sharedImage, addr_t *_symbolAddress) { switch (symbol->st_shndx) { case SHN_UNDEF: { struct Elf32_Sym *newSymbol; - char newNameBuffer[368]; - char *newName; + const char *symbolName = SYMNAME(image, symbol); - // patch the symbol name - if (symbolPrepend) { - newName = newNameBuffer; - strlcpy(newName, symbolPrepend, sizeof(newName)); - strlcat(newName, SYMNAME(image, symbol), sizeof(newName)); - } else - newName = SYMNAME(image, symbol); - // it's undefined, must be outside this image, try the other image - newSymbol = elf_find_symbol(sharedImage, newName); + newSymbol = elf_find_symbol(sharedImage, symbolName); if (newSymbol == NULL) { dprintf("\"%s\": could not resolve symbol '%s'\n", - image->name, newName); + image->name, symbolName); return B_MISSING_SYMBOL; } @@ -694,14 +683,14 @@ if (ELF32_ST_TYPE(symbol->st_info) != ELF32_ST_TYPE(newSymbol->st_info)) { dprintf("elf_resolve_symbol: found symbol '%s' in shared image " - "but wrong type\n", newName); + "but wrong type\n", symbolName); return B_MISSING_SYMBOL; } if (ELF32_ST_BIND(newSymbol->st_info) != STB_GLOBAL && ELF32_ST_BIND(newSymbol->st_info) != STB_WEAK) { TRACE(("elf_resolve_symbol: found symbol '%s' but not " - "exported\n", newName)); + "exported\n", symbolName)); return B_MISSING_SYMBOL; } @@ -727,7 +716,7 @@ /*! Until we have shared library support, just this links against the kernel */ static int -elf_relocate(struct elf_image_info *image, const char *symbolPrepend) +elf_relocate(struct elf_image_info *image) { int status = B_NO_ERROR; @@ -738,8 +727,8 @@ TRACE(("total %i relocs\n", image->rel_len / (int)sizeof(struct Elf32_Rel))); - status = arch_elf_relocate_rel(image, symbolPrepend, sKernelImage, - image->rel, image->rel_len); + status = arch_elf_relocate_rel(image, sKernelImage, image->rel, + image->rel_len); if (status < B_OK) return status; } @@ -749,10 +738,10 @@ image->pltrel_len / (int)sizeof(struct Elf32_Rel))); if (image->pltrel_type == DT_REL) { - status = arch_elf_relocate_rel(image, symbolPrepend, sKernelImage, - image->pltrel, image->pltrel_len); + status = arch_elf_relocate_rel(image, sKernelImage, image->pltrel, + image->pltrel_len); } else { - status = arch_elf_relocate_rela(image, symbolPrepend, sKernelImage, + status = arch_elf_relocate_rela(image, sKernelImage, (struct Elf32_Rela *)image->pltrel, image->pltrel_len); } if (status < B_OK) @@ -760,8 +749,8 @@ } if (image->rela) { - status = arch_elf_relocate_rela(image, symbolPrepend, sKernelImage, - image->rela, image->rela_len); + status = arch_elf_relocate_rela(image, sKernelImage, image->rela, + image->rela_len); if (status < B_OK) return status; } @@ -943,7 +932,7 @@ goto error1; if (!kernel) { - status = elf_relocate(image, NULL); + status = elf_relocate(image); if (status < B_OK) goto error1; } else @@ -1823,7 +1812,7 @@ if (status < B_OK) goto error5; - status = elf_relocate(image, NULL); + status = elf_relocate(image); if (status < B_OK) goto error5; From fekdahl at gmail.com Wed May 13 17:27:33 2009 From: fekdahl at gmail.com (Fredrik Ekdahl) Date: Wed, 13 May 2009 17:27:33 +0200 Subject: [Haiku-commits] r30749 - haiku/trunk/src/add-ons/kernel/file_systems/cdda In-Reply-To: <200905131454.n4DEs7c6025202@sheep.berlios.de> References: <200905131454.n4DEs7c6025202@sheep.berlios.de> Message-ID: <4A0AE6E5.5090803@gmail.com> bga at BerliOS skrev: > Author: bga > Date: 2009-05-13 16:54:06 +0200 (Wed, 13 May 2009) > New Revision: 30749 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30749&view=rev > > Modified: > haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp > Log: > Marco Nelissen: The bitrate of an audio CD is 44100*4*8 (well, the bitrate of > the "files" is, the actual bitrate of the CD is higher because of error > correction). > > > > Modified: haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp > =================================================================== > --- haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp 2009-05-13 14:45:53 UTC (rev 30748) > +++ haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp 2009-05-13 14:54:06 UTC (rev 30749) > @@ -738,7 +738,7 @@ > inode->AddAttribute("Audio:Title", B_STRING_TYPE, text.titles[i]); > inode->AddAttribute("Audio:Genre", B_STRING_TYPE, text.genre); > inode->AddAttribute("Audio:Track", B_INT32_TYPE, track); > - inode->AddAttribute("Audio:Bitrate", B_STRING_TYPE, "128 kbps"); > + inode->AddAttribute("Audio:Bitrate", B_STRING_TYPE, "1378 kbps") I guess it would be ~1411 kbps then, since k = 1000 (and not 1024) when speaking audio/video bit rates. -- /Fredrik Ekdahl From zooey at mail.berlios.de Wed May 13 17:56:39 2009 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Wed, 13 May 2009 17:56:39 +0200 Subject: [Haiku-commits] r30751 - haiku/trunk/src/preferences/keymap Message-ID: <200905131556.n4DFudp4031513@sheep.berlios.de> Author: zooey Date: 2009-05-13 17:56:38 +0200 (Wed, 13 May 2009) New Revision: 30751 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30751&view=rev Modified: haiku/trunk/src/preferences/keymap/KeyboardLayoutView.cpp haiku/trunk/src/preferences/keymap/KeyboardLayoutView.h Log: * fixed coding style issues Modified: haiku/trunk/src/preferences/keymap/KeyboardLayoutView.cpp =================================================================== --- haiku/trunk/src/preferences/keymap/KeyboardLayoutView.cpp 2009-05-13 15:25:27 UTC (rev 30750) +++ haiku/trunk/src/preferences/keymap/KeyboardLayoutView.cpp 2009-05-13 15:56:38 UTC (rev 30751) @@ -115,6 +115,7 @@ Invalidate(); } + BSize KeyboardLayoutView::MinSize() { Modified: haiku/trunk/src/preferences/keymap/KeyboardLayoutView.h =================================================================== --- haiku/trunk/src/preferences/keymap/KeyboardLayoutView.h 2009-05-13 15:25:27 UTC (rev 30750) +++ haiku/trunk/src/preferences/keymap/KeyboardLayoutView.h 2009-05-13 15:56:38 UTC (rev 30751) @@ -30,20 +30,21 @@ void SetEditable(bool editable); protected: - virtual void AttachedToWindow(); + virtual void AttachedToWindow(); virtual void FrameResized(float width, float height); - virtual BSize MinSize(); + virtual BSize MinSize(); - virtual void KeyDown(const char* bytes, int32 numBytes); - virtual void KeyUp(const char* bytes, int32 numBytes); - virtual void MouseDown(BPoint point); - virtual void MouseUp(BPoint point); - virtual void MouseMoved(BPoint point, uint32 transit, + virtual void KeyDown(const char* bytes, int32 numBytes); + virtual void KeyUp(const char* bytes, int32 numBytes); + virtual void MouseDown(BPoint point); + virtual void MouseUp(BPoint point); + virtual void MouseMoved(BPoint point, uint32 transit, const BMessage* dragMessage); - virtual void Draw(BRect updateRect); - virtual void MessageReceived(BMessage* message); + virtual void Draw(BRect updateRect); + virtual void MessageReceived(BMessage* message); virtual void WindowActivated(bool active); + private: enum key_kind { kNormalKey, From zooey at hirschkaefer.de Wed May 13 18:01:07 2009 From: zooey at hirschkaefer.de (Oliver Tappe) Date: Wed, 13 May 2009 18:01:07 +0200 Subject: [Haiku-commits] r30745 - haiku/trunk/src/preferences/keymap In-Reply-To: <26359558476-BeMail@zon> References: <26359558476-BeMail@zon> Message-ID: <20090513180107.6324.1@bepc.1242226406.fake> On 2009-05-13 at 16:23:35 [+0200], Axel D?rfler wrote: > zooey at BerliOS wrote: > > Log: > > * avoid key highlighting unless the preflet window is active, at > > least > > I've found it pretty silly that the Keymap preflet would document > > all my > > keypresses although I'm doing something elsewhere > > Maybe that's something that should be settable in the > KeyboardLayoutView? > I mean why should it use SetEventMask(B_KEYBOARD_EVENTS) in the first > place if you don't want them? Simply because it wants to track the keys all the time, but highlights the corresponding keys only when the preflet is active. Otherwise it could get confused about the current state of keys (esp. shift-lock and the like). The coding style issues you pointed out are fixed now, additionally all occurrences of "virtualvoid" have been replaced with "virtual void". cheers, Oliver From axeld at pinc-software.de Wed May 13 18:24:23 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Wed, 13 May 2009 18:24:23 +0200 CEST Subject: [Haiku-commits] r30751 - haiku/trunk/src/preferences/keymap In-Reply-To: <200905131556.n4DFudp4031513@sheep.berlios.de> Message-ID: <33932196092-BeMail@zon> zooey at BerliOS wrote: > - virtual BSize MinSize(); > + virtual BSize MinSize(); Did you remove those tabs manually, or what happened here? While it doesn't make any difference at this particular place, the tab would be at least more correct (in any case, no need to change that back). Bye, Axel. From axeld at pinc-software.de Wed May 13 18:26:32 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Wed, 13 May 2009 18:26:32 +0200 CEST Subject: [Haiku-commits] r30745 - haiku/trunk/src/preferences/keymap In-Reply-To: <20090513180107.6324.1@bepc.1242226406.fake> Message-ID: <34061647767-BeMail@zon> Oliver Tappe wrote: > > Maybe that's something that should be settable in the > > KeyboardLayoutView? > > I mean why should it use SetEventMask(B_KEYBOARD_EVENTS) in the > > first > > place if you don't want them? > Simply because it wants to track the keys all the time, but > highlights the > corresponding keys only when the preflet is active. Otherwise it > could get > confused about the current state of keys (esp. shift-lock and the > like). > The coding style issues you pointed out are fixed now, additionally > all > occurrences of "virtualvoid" have been replaced with "virtual > void". Oh, so that was intentionally after all. The reason there was a tab is that the first "column" is reserved for keywords like virtual and static. The second "column" would then be the type - and the columns are actually separated by tab, not space, ie. it's also "staticvoid". Bye, Axel. From axeld at pinc-software.de Wed May 13 18:28:34 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Wed, 13 May 2009 18:28:34 +0200 CEST Subject: [Haiku-commits] r30745 - haiku/trunk/src/preferences/keymap In-Reply-To: <20090513180107.6324.1@bepc.1242226406.fake> Message-ID: <34183711623-BeMail@zon> Oliver Tappe wrote: > > Maybe that's something that should be settable in the > > KeyboardLayoutView? > > I mean why should it use SetEventMask(B_KEYBOARD_EVENTS) in the > > first > > place if you don't want them? > Simply because it wants to track the keys all the time, but > highlights the > corresponding keys only when the preflet is active. Otherwise it > could get > confused about the current state of keys (esp. shift-lock and the > like). Forgot to write this in the last reply: Then one could update the key state in WindowActivated() instead, but I guess it's okay like this. If the KeyboardLayoutView is used in another app one day, one can still refactor this, if needed. Bye, Axel. From clemens.zeidler at rwth-aachen.de Wed May 13 18:40:26 2009 From: clemens.zeidler at rwth-aachen.de (Clemens zeidler) Date: Wed, 13 May 2009 18:40:26 +0200 Subject: [Haiku-commits] r30739 - in haiku/trunk: headers/private/support src/bin src/kits/support In-Reply-To: <1070668334-BeMail@zon> References: <1070668334-BeMail@zon> Message-ID: On Wed, 13 May 2009 09:16:41 +0200, Axel D?rfler wrote: >> + BString Proto() const; > Instead of duplicating the string always, why not returning a "const > BString&" instead? Is there no use of copy on write in the BString? thanks Clemens From superstippi at gmx.de Wed May 13 18:56:39 2009 From: superstippi at gmx.de (=?UTF-8?B?U3RlcGhhbiBBw59tdXM=?=) Date: Wed, 13 May 2009 18:56:39 +0200 Subject: [Haiku-commits] r30739 - in haiku/trunk: headers/private/support src/bin src/kits/support In-Reply-To: References: <1070668334-BeMail@zon> Message-ID: <4A0AFBC7.6060900@gmx.de> Clemens zeidler schrieb: > On Wed, 13 May 2009 09:16:41 +0200, Axel D?rfler > wrote: > >>> + BString Proto() const; >> Instead of duplicating the string always, why not returning a "const >> BString&" instead? > > Is there no use of copy on write in the BString? Actually yes, but that still invokes more code for no reason. IMHO, it's cleaner to return a const BString& from a const getter like this. Best regards, -Stephan From zooey at hirschkaefer.de Wed May 13 19:02:19 2009 From: zooey at hirschkaefer.de (zooey at hirschkaefer.de) Date: Wed, 13 May 2009 19:02:19 +0200 Subject: [Haiku-commits] r30745 - haiku/trunk/src/preferences/keymap In-Reply-To: <34061647767-BeMail@zon> References: <34061647767-BeMail@zon> Message-ID: <20090513190219.7708.1@bepc.1242233376.fake> On 2009-05-13 at 18:26:32 [+0200], Axel D?rfler wrote: > Oliver Tappe wrote: > > > Maybe that's something that should be settable in the > > > KeyboardLayoutView? > > > I mean why should it use SetEventMask(B_KEYBOARD_EVENTS) in the > > > first > > > place if you don't want them? > > Simply because it wants to track the keys all the time, but > > highlights the > > corresponding keys only when the preflet is active. Otherwise it > > could get > > confused about the current state of keys (esp. shift-lock and the > > like). > > > > The coding style issues you pointed out are fixed now, additionally > > all > > occurrences of "virtualvoid" have been replaced with "virtual > > void". > > Oh, so that was intentionally after all. > The reason there was a tab is that the first "column" is reserved for > keywords like virtual and static. The second "column" would then be the > type - and the columns are actually separated by tab, not space, ie. > it's also "staticvoid". Alright, I get it now - although one has to look *very* closely at the coding styleguide in the browser in order to detect that there's tabs, not spaces between those "columns" ;-) I had just noticed that the two were mixed and went for spaces, as I personally cringe whenever I see a tab in the "middle" of a line. Anyway - will just have to get used to that, I suppose. cheers, Oliver From humdingerb at mail.berlios.de Wed May 13 20:14:45 2009 From: humdingerb at mail.berlios.de (humdingerb at mail.berlios.de) Date: Wed, 13 May 2009 20:14:45 +0200 Subject: [Haiku-commits] r30752 - haiku/trunk/docs/userguide/en Message-ID: <200905131814.n4DIEjAr021047@sheep.berlios.de> Author: humdingerb Date: 2009-05-13 20:14:44 +0200 (Wed, 13 May 2009) New Revision: 30752 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30752&view=rev Removed: haiku/trunk/docs/userguide/en/installing.html Log: Once more removed installation.html just to re-add it afterwards... Deleted: haiku/trunk/docs/userguide/en/installing.html From humdingerb at mail.berlios.de Wed May 13 20:15:31 2009 From: humdingerb at mail.berlios.de (humdingerb at mail.berlios.de) Date: Wed, 13 May 2009 20:15:31 +0200 Subject: [Haiku-commits] r30753 - haiku/trunk/docs/userguide/en Message-ID: <200905131815.n4DIFV0E021183@sheep.berlios.de> Author: humdingerb Date: 2009-05-13 20:15:30 +0200 (Wed, 13 May 2009) New Revision: 30753 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30753&view=rev Added: haiku/trunk/docs/userguide/en/installation.html Log: Added installation.html once more. Sorry for all the mess... Added: haiku/trunk/docs/userguide/en/installation.html =================================================================== --- haiku/trunk/docs/userguide/en/installation.html 2009-05-13 18:14:44 UTC (rev 30752) +++ haiku/trunk/docs/userguide/en/installation.html 2009-05-13 18:15:30 UTC (rev 30753) @@ -0,0 +1,85 @@ + + + + + + + + + Installing Haiku + + + + + +
        +

        + Contents +     + Next: Boot Loader +

        +
        + +
        + +

        Installation of Haiku during (pre-) alpha releases can be somewhat tricky, considering it's current development state. With this installation guide, you will learn many of the most common methods to get Haiku installed, whether it be on a USB stick, a partition or running it in a virtual machine. More advanced topics like building Haiku from source will also be explained in detail, so also beginners are be able to follow.
        +All these somewhat complicated installation methods won't be necessary once Haiku R1 is released. Probably even before that when Haiku enters the beta phase.

        + +

        The basic boot process

        +

        Before explaining the many ways of getting Haiku installed, a little introduction to booting methods could be helpful. This information isn't Haiku specific, it describes the general booting process found in many OSes.
        +It's not essential to know these details, so feel free to skip this part if you're not interested in the technical background.

        +

        The basic boot process

        + +

        Haiku in a virtual machine

        +

        You can try out Haiku without having to make room for it for a separate partition. A virtual machine simulates a specific hardware configuration within your familiar operating system and allows you to run Haiku in a window without having to reboot. It's also a good way to deal with incompatible hardware until Haiku gains the needed driver support.

        +

        Running Haiku in a virtual machine

        + +

        Installing from a downloaded RAW image

        +

        text text text text text text

        +

        Installing from a downloaded RAW image

        + +

        Compiling/Installing from source code

        +

        text text text text text text

        +

        Compiling/Installing on BeOS
        +

        Compiling/Installing on Linux
        +

        Compiling/Installing on Mac OS X
        + + + +

        + +
        +

        + Contents +     + Next: Boot Loader +

        +
        + + + From rudolfc at mail.berlios.de Wed May 13 21:01:42 2009 From: rudolfc at mail.berlios.de (rudolfc at mail.berlios.de) Date: Wed, 13 May 2009 21:01:42 +0200 Subject: [Haiku-commits] r30754 - haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia Message-ID: <200905131901.n4DJ1gQZ027605@sheep.berlios.de> Author: rudolfc Date: 2009-05-13 21:01:08 +0200 (Wed, 13 May 2009) New Revision: 30754 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30754&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/driver.c Log: re-enabled ID 0x0141, Geforce FX 6600, since the card is confirmed working OK by me. If someone encounters trouble, contact me. Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/driver.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/driver.c 2009-05-13 18:15:30 UTC (rev 30753) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/driver.c 2009-05-13 19:01:08 UTC (rev 30754) @@ -155,11 +155,7 @@ 0x0112, /* Nvidia GeForce2 Go */ 0x0113, /* Nvidia Quadro2 MXR/EX/Go */ 0x0140, /* Nvidia GeForce FX 6600 GT */ -#if 0 - // TODO: investigate! Other cards might be affected, see tickets #1530 - // and #1712. 0x0141, /* Nvidia GeForce FX 6600 */ -#endif 0x0142, /* Nvidia GeForce FX 6600LE */ 0x0143, /* Nvidia GeForce 6600 VE */ 0x0144, /* Nvidia GeForce FX 6600 Go */ From host.haiku at gmx.de Wed May 13 21:25:51 2009 From: host.haiku at gmx.de (Karsten Heimrich) Date: Wed, 13 May 2009 21:25:51 +0200 Subject: [Haiku-commits] r30739 - in haiku/trunk: headers/private/support src/bin src/kits/support In-Reply-To: <4A0AFBC7.6060900@gmx.de> References: <1070668334-BeMail@zon> <4A0AFBC7.6060900@gmx.de> Message-ID: <4A0B1EBF.9040600@gmx.de> Hi, Stephan A?mus schrieb: > Clemens zeidler schrieb: >> On Wed, 13 May 2009 09:16:41 +0200, Axel D?rfler >> wrote: >> >>>> + BString Proto() const; >>> Instead of duplicating the string always, why not returning a "const >>> BString&" instead? >> Is there no use of copy on write in the BString? > > Actually yes, but that still invokes more code for no reason. IMHO, it's > cleaner to return a const BString& from a const getter like this. I see no real benefit in changing this to return a const reference, since most devs (even long time developers) would tend to write it like this: BString blub = url.Proto(); and the only thing that happens with the current prototype is a call to the copy constructor and an atomic increment, which will also happens with above mentioned sample. I'm rather convinced that if the url object is used in a different thread and it changes, one would not even notice and the const BString &blub would change happily too. Am i wrong here? Regards, Karsten From axeld at pinc-software.de Wed May 13 21:39:00 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Wed, 13 May 2009 21:39:00 +0200 CEST Subject: [Haiku-commits] r30745 - haiku/trunk/src/preferences/keymap In-Reply-To: <20090513190219.7708.1@bepc.1242233376.fake> Message-ID: <45609440752-BeMail@zon> zooey at hirschkaefer.de wrote: > > Oh, so that was intentionally after all. > > The reason there was a tab is that the first "column" is reserved > > for > > keywords like virtual and static. The second "column" would then be > > the > > type - and the columns are actually separated by tab, not space, > > ie. > > it's also "staticvoid". > Alright, I get it now - although one has to look *very* closely at > the coding > styleguide in the browser in order to detect that there's tabs, not > spaces > between those "columns" ;-) > I had just noticed that the two were mixed and went for spaces, as I > personally cringe whenever I see a tab in the "middle" of a line. > Anyway - > will just have to get used to that, I suppose. Yep, you can thank Stephan, and Michael, and their persistence for this that caused this compromise :-) But one gets used to it. Bye, Axel. From axeld at pinc-software.de Wed May 13 21:41:21 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Wed, 13 May 2009 21:41:21 +0200 CEST Subject: [Haiku-commits] r30739 - in haiku/trunk: headers/private/support src/bin src/kits/support In-Reply-To: <4A0B1EBF.9040600@gmx.de> Message-ID: <45750937682-BeMail@zon> Karsten Heimrich wrote: > I'm rather convinced that if the url object is used in a different > thread and it changes, one would not even notice and the const > BString > &blub would change happily too. Am i wrong here? Of course it would change, but that's hardly an argument for this change; if you share objects between different threads it's usually your responsibility to lock their data properly -- copying the object itself is open for race conditions as well. Bye, Axel. From axeld at pinc-software.de Wed May 13 21:43:12 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Wed, 13 May 2009 21:43:12 +0200 CEST Subject: [Haiku-commits] r30739 - in haiku/trunk: headers/private/support src/bin src/kits/support In-Reply-To: <4A0AFBC7.6060900@gmx.de> Message-ID: <45861075069-BeMail@zon> Stephan A?mus wrote: > Clemens zeidler schrieb: > > On Wed, 13 May 2009 09:16:41 +0200, Axel D?rfler > > > > > > wrote: > >>> + BString Proto() const; > >> Instead of duplicating the string always, why not returning a > > > "const > >> BString&" instead? > > Is there no use of copy on write in the BString? > Actually yes, but that still invokes more code for no reason. IMHO, > it's > cleaner to return a const BString& from a const getter like this. Definitely. It's not just like in the example pointed out by Karsten (which would be the developers fault, anyway), but also in things like "if (url.Proto() == "http")" -- btw, why Proto() not Protocol()? Bye, Axel. From kirilla at mail.berlios.de Wed May 13 21:58:06 2009 From: kirilla at mail.berlios.de (kirilla at BerliOS) Date: Wed, 13 May 2009 21:58:06 +0200 Subject: [Haiku-commits] r30755 - haiku/trunk/src/data/beos_mime/text Message-ID: <200905131958.n4DJw6SM003481@sheep.berlios.de> Author: kirilla Date: 2009-05-13 21:58:05 +0200 (Wed, 13 May 2009) New Revision: 30755 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30755&view=rev Added: haiku/trunk/src/data/beos_mime/text/x-url Log: Adding mime for Internet Explorer shortcuts Added: haiku/trunk/src/data/beos_mime/text/x-url =================================================================== --- haiku/trunk/src/data/beos_mime/text/x-url 2009-05-13 19:01:08 UTC (rev 30754) +++ haiku/trunk/src/data/beos_mime/text/x-url 2009-05-13 19:58:05 UTC (rev 30755) @@ -0,0 +1,18 @@ + +resource(0, "BEOS:TYPE") #'MIMS' "application/x-vnd.Be-meta-mime"; + +resource(1, "META:TYPE") "text/x-url"; + +resource(2, "META:SNIFF_RULE") "0.80 (\"[InternetShortcut]\")"; + +resource(3, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-urlwrapper"; + +resource(4, "META:S:DESC") #'MSDC' "Internet Shortcut"; + +resource(5, "META:L:DESC") #'MLDC' "Microsoft Internet Explorer Shortcut"; + +resource(6, "META:EXTENS") message(234) { + "extensions" = "url", + "type" = "text/x-url" +}; + From host.haiku at gmx.de Wed May 13 22:30:32 2009 From: host.haiku at gmx.de (Karsten Heimrich) Date: Wed, 13 May 2009 22:30:32 +0200 Subject: [Haiku-commits] r30739 - in haiku/trunk: headers/private/support src/bin src/kits/support In-Reply-To: <45861075069-BeMail@zon> References: <45861075069-BeMail@zon> Message-ID: <4A0B2DE8.5090105@gmx.de> Hi, Axel D?rfler schrieb: > Stephan A?mus wrote: >> Clemens zeidler schrieb: >>> On Wed, 13 May 2009 09:16:41 +0200, Axel D?rfler >>>>> >>> wrote: >>>>> + BString Proto() const; >>>> Instead of duplicating the string always, why not returning a >>>> "const >>>> BString&" instead? >>> Is there no use of copy on write in the BString? >> Actually yes, but that still invokes more code for no reason. IMHO, >> it's >> cleaner to return a const BString& from a const getter like this. > > Definitely. It's not just like in the example pointed out by Karsten > (which would be the developers fault, anyway), but also in things like > "if (url.Proto() == "http")" -- btw, why Proto() not Protocol()? While looking at the code I found it rather funny that we nitpick on the getter prototype, since every getter implementation would call the copy constructor anyway. :) This should be changed then too. And for a really generic implementation shouldn't it have setter functions? Regards, Karsten From axeld at pinc-software.de Wed May 13 23:29:38 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Wed, 13 May 2009 23:29:38 +0200 CEST Subject: [Haiku-commits] =?utf-8?q?r30739_-_in_haiku/trunk=3A_headers/priv?= =?utf-8?q?ate/support_src/bin_src/kits/support?= In-Reply-To: <7e5795b0905130514l1be73178ufd31723db6a7b9b3@mail.gmail.com> Message-ID: <52247901066-BeMail@zon> Joseph Prostko wrote: > Well, the coding guidelines document on the website (last updated in > 2006) should be updated to reflect this fact. Indeed, that part was outdated (we took over our guidelines from OpenTracker, but made it more detailed, and several changes over the years). I've fixed that now. Bye, Axel. From axeld at pinc-software.de Wed May 13 23:35:01 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Wed, 13 May 2009 23:35:01 +0200 CEST Subject: [Haiku-commits] r30739 - in haiku/trunk: headers/private/support src/bin src/kits/support In-Reply-To: <4A0B2DE8.5090105@gmx.de> Message-ID: <52570594053-BeMail@zon> Karsten Heimrich wrote: > > Definitely. It's not just like in the example pointed out by > > Karsten > > (which would be the developers fault, anyway), but also in things > > like > > "if (url.Proto() == "http")" -- btw, why Proto() not Protocol()? > While looking at the code I found it rather funny that we nitpick on > the getter prototype, since every getter implementation would call > the > copy constructor anyway. :) This should be changed then too. And for > a really generic implementation shouldn't it have setter functions? Yup :-) I guess it was a bit premature to make this class shared as is. Bye, Axel. From zooey at mail.berlios.de Thu May 14 00:09:17 2009 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Thu, 14 May 2009 00:09:17 +0200 Subject: [Haiku-commits] r30756 - in haiku/trunk: headers/os/interface src/kits/interface Message-ID: <200905132209.n4DM9H5p017161@sheep.berlios.de> Author: zooey Date: 2009-05-14 00:09:15 +0200 (Thu, 14 May 2009) New Revision: 30756 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30756&view=rev Modified: haiku/trunk/headers/os/interface/TextView.h haiku/trunk/src/kits/interface/TextView.cpp Log: fixed behaviour of non-editable textviews: * non-editable textviews no longer draw the caret * the cursor keys scroll immediately, not only when the (invisible) caret reaches the views bounds * HOME/END work more reliably * any selection stays active throughout keyboard navigation Tested with AboutSystem, Mail, StyledEdit and Beam - seems to work ok Modified: haiku/trunk/headers/os/interface/TextView.h =================================================================== --- haiku/trunk/headers/os/interface/TextView.h 2009-05-13 19:58:05 UTC (rev 30755) +++ haiku/trunk/headers/os/interface/TextView.h 2009-05-13 22:09:15 UTC (rev 30756) @@ -394,6 +394,10 @@ float _NullStyleHeight() const; + void _ScrollBy(float horizontalStep, + float verticalStep); + void _ScrollTo(float x, float y); + BPrivate::TextGapBuffer* fText; LineBuffer* fLines; StyleBuffer* fStyles; Modified: haiku/trunk/src/kits/interface/TextView.cpp =================================================================== --- haiku/trunk/src/kits/interface/TextView.cpp 2009-05-13 19:58:05 UTC (rev 30755) +++ haiku/trunk/src/kits/interface/TextView.cpp 2009-05-13 22:09:15 UTC (rev 30756) @@ -157,11 +157,14 @@ }; -const static rgb_color kBlackColor = { 0, 0, 0, 255 }; -const static rgb_color kBlueInputColor = { 152, 203, 255, 255 }; -const static rgb_color kRedInputColor = { 255, 152, 152, 255 }; +static const rgb_color kBlackColor = { 0, 0, 0, 255 }; +static const rgb_color kBlueInputColor = { 152, 203, 255, 255 }; +static const rgb_color kRedInputColor = { 255, 152, 152, 255 }; +static const float kHorizontalScrollBarStep = 10.0; +static const float kVerticalScrollBarStep = 12.0; + static property_info sPropertyList[] = { { "selection", @@ -3243,7 +3246,9 @@ int32 lastClickOffset = fClickOffset; switch (inArrowKey) { case B_LEFT_ARROW: - if (fSelStart != fSelEnd && !shiftDown) + if (!fEditable) + _ScrollBy(-1 * kHorizontalScrollBarStep, 0); + else if (fSelStart != fSelEnd && !shiftDown) fClickOffset = fSelStart; else { fClickOffset @@ -3267,7 +3272,9 @@ break; case B_RIGHT_ARROW: - if (fSelStart != fSelEnd && !shiftDown) + if (!fEditable) + _ScrollBy(kHorizontalScrollBarStep, 0); + else if (fSelStart != fSelEnd && !shiftDown) fClickOffset = fSelEnd; else { fClickOffset @@ -3292,7 +3299,9 @@ case B_UP_ARROW: { - if (fSelStart != fSelEnd && !shiftDown) + if (!fEditable) + _ScrollBy(0, -1 * kVerticalScrollBarStep); + else if (fSelStart != fSelEnd && !shiftDown) fClickOffset = fSelStart; else { float height; @@ -3318,7 +3327,9 @@ case B_DOWN_ARROW: { - if (fSelStart != fSelEnd && !shiftDown) + if (!fEditable) + _ScrollBy(0, kVerticalScrollBarStep); + else if (fSelStart != fSelEnd && !shiftDown) fClickOffset = fSelEnd; else { float height; @@ -3346,13 +3357,15 @@ // invalidate the null style fStyles->InvalidateNullStyle(); - if (shiftDown) - Select(selStart, selEnd); - else - Select(fClickOffset, fClickOffset); + if (fEditable) { + if (shiftDown) + Select(selStart, selEnd); + else + Select(fClickOffset, fClickOffset); - // scroll if needed - ScrollToOffset(fClickOffset); + // scroll if needed + ScrollToOffset(fClickOffset); + } } @@ -3406,9 +3419,15 @@ int32 lastClickOffset = fClickOffset; switch (inPageKey) { case B_HOME: - if (ctrlDown) + if (!fEditable) { + _ScrollTo(0, 0); + break; + } + + if (ctrlDown) { + _ScrollTo(0, 0); fClickOffset = 0; - else { + } else { // get the start of the last line if caret is on it line = (*fLines)[_LineAt(lastClickOffset)]; fClickOffset = line->offset; @@ -3433,7 +3452,13 @@ break; case B_END: + if (!fEditable) { + _ScrollTo(0, fTextRect.bottom + fLayoutData->bottomInset); + break; + } + if (ctrlDown) { + _ScrollTo(0, fTextRect.bottom + fLayoutData->bottomInset); fClickOffset = fText->Length(); } else { // If we are on the last line, just go to the last @@ -3479,8 +3504,11 @@ currentPos.y -= Bounds().Height(); fClickOffset = OffsetAt(LineAt(currentPos)); - ScrollBy(0, -1 * Bounds().Height()); + _ScrollBy(0, -1 * Bounds().Height()); + if (!fEditable) + break; + if (!shiftDown) selStart = selEnd = fClickOffset; else if (fClickOffset != lastClickOffset) { @@ -3506,8 +3534,11 @@ currentPos.y += Bounds().Height(); fClickOffset = OffsetAt(LineAt(currentPos)); - ScrollBy(0, Bounds().Height()); + _ScrollBy(0, Bounds().Height()); + if (!fEditable) + break; + if (!shiftDown) selStart = selEnd = fClickOffset; else if (fClickOffset != lastClickOffset) { @@ -3528,12 +3559,14 @@ } } - if (shiftDown) - Select(selStart, selEnd); - else - Select(fClickOffset, fClickOffset); + if (fEditable) { + if (shiftDown) + Select(selStart, selEnd); + else + Select(fClickOffset, fClickOffset); - ScrollToOffset(fClickOffset); + ScrollToOffset(fClickOffset); + } } @@ -3580,7 +3613,8 @@ fClickOffset = fSelEnd; - ScrollToOffset(fClickOffset); + if (fEditable) + ScrollToOffset(fClickOffset); } @@ -4368,7 +4402,7 @@ inline void BTextView::_ShowCaret() { - if (!fCaretVisible) + if (!fCaretVisible && fEditable) _InvertCaret(); } @@ -4719,8 +4753,8 @@ BTextView::_UpdateScrollbars() { BRect bounds(Bounds()); - BScrollBar *horizontalScrollBar = ScrollBar(B_HORIZONTAL); - BScrollBar *verticalScrollBar = ScrollBar(B_VERTICAL); + BScrollBar* horizontalScrollBar = ScrollBar(B_HORIZONTAL); + BScrollBar* verticalScrollBar = ScrollBar(B_VERTICAL); // do we have a horizontal scroll bar? if (horizontalScrollBar != NULL) { @@ -4733,7 +4767,7 @@ horizontalScrollBar->SetRange(0, (float)maxRange); horizontalScrollBar->SetProportion((float)viewWidth / (float)dataWidth); - horizontalScrollBar->SetSteps(10, dataWidth / 10); + horizontalScrollBar->SetSteps(kHorizontalScrollBarStep, dataWidth / 10); } // how about a vertical scroll bar? @@ -4747,11 +4781,45 @@ verticalScrollBar->SetRange(0, maxRange); verticalScrollBar->SetProportion((float)viewHeight / (float)dataHeight); - verticalScrollBar->SetSteps(12, viewHeight); + verticalScrollBar->SetSteps(kVerticalScrollBarStep, viewHeight); } } +/*! \brief Scrolls by the given offsets +*/ +void +BTextView::_ScrollBy(float horizontal, float vertical) +{ + BRect bounds = Bounds(); + _ScrollTo(bounds.left + horizontal, bounds.top + vertical); +} + + +/*! \brief Scrolls to the given position, making sure not to scroll out of + bounds +*/ +void +BTextView::_ScrollTo(float x, float y) +{ + BRect bounds = Bounds(); + long viewWidth = bounds.IntegerWidth(); + long viewHeight = bounds.IntegerHeight(); + + if (x > fTextRect.right - viewWidth) + x = fTextRect.right - viewWidth; + if (x < 0.0) + x = 0.0; + + if (y > fTextRect.bottom + fLayoutData->bottomInset - viewHeight) + y = fTextRect.bottom + fLayoutData->bottomInset - viewHeight; + if (y < 0.0) + y = 0.0; + + ScrollTo(x, y); +} + + /*! \brief Autoresizes the view to fit the contained text. */ void @@ -5185,6 +5253,7 @@ fInline->SetSelectionOffset(selectionStart); fInline->SetSelectionLength(selectionEnd - selectionStart); +printf("string=%s\n", string); const int32 inlineOffset = fInline->Offset(); InsertText(string, stringLen, fSelStart, NULL); fSelStart += stringLen; From kirilla at mail.berlios.de Thu May 14 00:19:42 2009 From: kirilla at mail.berlios.de (kirilla at BerliOS) Date: Thu, 14 May 2009 00:19:42 +0200 Subject: [Haiku-commits] r30757 - in haiku/trunk: headers/private/support src/bin src/kits/support Message-ID: <200905132219.n4DMJg58018124@sheep.berlios.de> Author: kirilla Date: 2009-05-14 00:19:42 +0200 (Thu, 14 May 2009) New Revision: 30757 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30757&view=rev Modified: haiku/trunk/headers/private/support/Url.h haiku/trunk/src/bin/urlwrapper.cpp haiku/trunk/src/bin/urlwrapper.h haiku/trunk/src/bin/urlwrapper.rdef haiku/trunk/src/kits/support/Url.cpp Log: More style guide fixes. Removed a lot of preprocessing / conditional building, with intent to fix or remove. Moved urlwrapper class declaration to its header file. Renamed things for clarity. Removed 5 extra mimetypes for IE shortcuts. (We have one, with sniffing rule and extension.) Moved the UnurlString() back to urlwrapper.cpp and renamed it _DecodeUrlString(). Tweaked copyright clauses. A lot more needs fixing, esp. in urlwrapper but also in BUrl, and I intend to keep working on this until we're satisfied. Let me know of any remaining/added style violations! Feedback welcome. Modified: haiku/trunk/headers/private/support/Url.h =================================================================== --- haiku/trunk/headers/private/support/Url.h 2009-05-13 22:09:15 UTC (rev 30756) +++ haiku/trunk/headers/private/support/Url.h 2009-05-13 22:19:42 UTC (rev 30757) @@ -1,5 +1,5 @@ /* - * Copyright 2007-2009, Haiku Inc. All Rights Reserved. + * Copyright 2007-2009 Haiku Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _URL_H @@ -7,19 +7,21 @@ #include + namespace BPrivate { namespace Support { class BUrl : public BString { public: - BUrl(const char *url); + BUrl(const char* url); ~BUrl(); status_t InitCheck() const; bool HasPreferredApplication() const; BString PreferredApplication() const; - status_t OpenWithPreferredApplication(bool onProblemAskUser = true) const; + status_t OpenWithPreferredApplication( + bool onProblemAskUser = true) const; bool HasHost() const; bool HasPort() const; @@ -27,32 +29,30 @@ bool HasPass() const; bool HasPath() const; - BString Proto() const; - BString Full() const; - BString Host() const; - BString Port() const; - BString User() const; - BString Pass() const; - BString Path() const; + const BString& Proto() const; + const BString& Full() const; + const BString& Host() const; + const BString& Port() const; + const BString& User() const; + const BString& Pass() const; + const BString& Path() const; - status_t UnurlString(BString &string); - private: status_t _ParseAndSplit(); BString _UrlMimeType() const; - BString proto; - BString full; - BString host; - BString port; - BString user; - BString pass; - BString path; + BString fProto; + BString fFull; + BString fHost; + BString fPort; + BString fUser; + BString fPass; + BString fPath; status_t fStatus; }; -}; // namespace Support -}; // namespace BPrivate +} // namespace Support +} // namespace BPrivate #endif // _URL_H Modified: haiku/trunk/src/bin/urlwrapper.cpp =================================================================== --- haiku/trunk/src/bin/urlwrapper.cpp 2009-05-13 22:09:15 UTC (rev 30756) +++ haiku/trunk/src/bin/urlwrapper.cpp 2009-05-13 22:19:42 UTC (rev 30757) @@ -1,5 +1,5 @@ /* - * Copyright 2007, Haiku. All rights reserved. + * Copyright 2007-2009 Haiku Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -13,8 +13,11 @@ */ #define DEBUG 0 +#include +#include +#include + #include -#include #include #include #include @@ -23,43 +26,15 @@ #include "urlwrapper.h" -const char *kAppSig = APP_SIGNATURE; -const char *kTrackerSig = "application/x-vnd.Be-TRAK"; -#ifdef __HAIKU__ -const char *kTerminalSig = "application/x-vnd.Haiku-Terminal"; -#else -const char *kTerminalSig = "application/x-vnd.Be-SHEL"; -#endif +const char* kAppSig = "application/x-vnd.Haiku-urlwrapper"; +const char* kTrackerSig = "application/x-vnd.Be-TRAK"; +const char* kTerminalSig = "application/x-vnd.Haiku-Terminal"; +const char* kBeShareSig = "application/x-vnd.Sugoi-BeShare"; +const char* kIMSig = "application/x-vnd.m_eiman.sample_im_client"; +const char* kVLCSig = "application/x-vnd.videolan-vlc"; -#ifdef HANDLE_BESHARE -const char *kBeShareSig = "application/x-vnd.Sugoi-BeShare"; -#endif -#ifdef HANDLE_IM -const char *kIMSig = "application/x-vnd.m_eiman.sample_im_client"; -#endif - -#ifdef HANDLE_VLC -const char *kVLCSig = "application/x-vnd.videolan-vlc"; -#endif - - -class UrlWrapper : public BApplication -{ -public: - UrlWrapper(); - ~UrlWrapper(); - - virtual void RefsReceived(BMessage *msg); - virtual void ArgvReceived(int32 argc, char **argv); - virtual void ReadyToRun(void); - -private: - status_t _Warn(const char *url); -}; - - UrlWrapper::UrlWrapper() : BApplication(kAppSig) { } @@ -70,27 +45,32 @@ } -status_t UrlWrapper::_Warn(const char *url) +status_t +UrlWrapper::_Warn(const char* url) { - BString message("An application has requested the system to open the following url: \n"); + BString message("An application has requested the system to open the " + "following url: \n"); message << "\n" << url << "\n\n"; - message << "This type of urls has a potential security risk.\n"; - message << "Proceed anyway ?"; - BAlert *alert = new BAlert("Warning", message.String(), "Ok", "No", NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); - int32 v; - v = alert->Go(); - if (v == 0) + message << "This type of URL has a potential security risk.\n"; + message << "Proceed anyway?"; + BAlert* alert = new BAlert("Warning", message.String(), "Proceed", "Stop", NULL, + B_WIDTH_AS_USUAL, B_WARNING_ALERT); + int32 button; + button = alert->Go(); + if (button == 0) return B_OK; + return B_ERROR; } -void UrlWrapper::RefsReceived(BMessage *msg) +void +UrlWrapper::RefsReceived(BMessage* msg) { char buff[B_PATH_NAME_LENGTH]; int32 index = 0; entry_ref ref; - char *args[] = { "urlwrapper", buff, NULL }; + char* args[] = { const_cast("urlwrapper"), buff, NULL }; status_t err; while (msg->FindRef("refs", index++, &ref) == B_OK) { @@ -100,14 +80,10 @@ if (f.InitCheck() == B_OK && ni.InitCheck() == B_OK) { ni.GetType(mimetype.LockBuffer(B_MIME_TYPE_LENGTH)); mimetype.UnlockBuffer(); -#ifdef HANDLE_URL_FILES - // http://filext.com/file-extension/URL - if (mimetype == "wwwserver/redirection" - || mimetype == "application/internet-shortcut" - || mimetype == "application/x-url" - || mimetype == "message/external-body" - || mimetype == "text/url" - || mimetype == "text/x-url") { + + // Internet Explorer Shortcut + if (mimetype == "text/x-url") { + // http://filext.com/file-extension/URL // http://www.cyanwerks.com/file-format-url.html off_t size; if (f.GetSize(&size) < B_OK) @@ -132,34 +108,34 @@ } } if (url.Length()) { - args[1] = (char *)url.String(); - //ArgvReceived(2, args); - err = be_roster->Launch("application/x-vnd.Be.URL.http", 1, args+1); + args[1] = (char*)url.String(); + err = be_roster->Launch("application/x-vnd.Be.URL.http", 1, + args+1); continue; } } -#endif - /* eat everything as bookmark files */ -#ifdef HANDLE_BOOKMARK_FILES - if (f.ReadAttr("META:url", B_STRING_TYPE, 0LL, buff, B_PATH_NAME_LENGTH) > 0) { - //ArgvReceived(2, args); - err = be_roster->Launch("application/x-vnd.Be.URL.http", 1, args+1); + + // NetPositive Bookmark or any file with a META:url attribute + if (f.ReadAttr("META:url", B_STRING_TYPE, 0LL, buff, + B_PATH_NAME_LENGTH) > 0) { + err = be_roster->Launch("application/x-vnd.Be.URL.http", 1, + args+1); continue; } -#endif } } } -void UrlWrapper::ArgvReceived(int32 argc, char **argv) +void +UrlWrapper::ArgvReceived(int32 argc, char** argv) { if (argc <= 1) return; - const char *failc = " || read -p 'Press any key'"; - const char *pausec = " ; read -p 'Press any key'"; - char *args[] = { "/bin/sh", "-c", NULL, NULL}; + const char* failc = " || read -p 'Press any key'"; + const char* pausec = " ; read -p 'Press any key'"; + char* args[] = { "/bin/sh", "-c", NULL, NULL}; BPrivate::Support::BUrl url(argv[1]); @@ -193,12 +169,13 @@ cmd << " " << port; PRINT(("CMD='%s'\n", cmd.String())); cmd << failc; - args[2] = (char *)cmd.String(); + args[2] = (char*)cmd.String(); be_roster->Launch(kTerminalSig, 3, args); return; } - // see draft: http://tools.ietf.org/wg/secsh/draft-ietf-secsh-scp-sftp-ssh-uri/ + // see draft: + // http://tools.ietf.org/wg/secsh/draft-ietf-secsh-scp-sftp-ssh-uri/ if (proto == "ssh") { BString cmd("ssh "); @@ -209,7 +186,7 @@ cmd << host; PRINT(("CMD='%s'\n", cmd.String())); cmd << failc; - args[2] = (char *)cmd.String(); + args[2] = (char*)cmd.String(); be_roster->Launch(kTerminalSig, 3, args); // TODO: handle errors return; @@ -226,7 +203,7 @@ cmd << full; PRINT(("CMD='%s'\n", cmd.String())); cmd << failc; - args[2] = (char *)cmd.String(); + args[2] = (char*)cmd.String(); be_roster->Launch(kTerminalSig, 3, args); // TODO: handle errors return; @@ -245,7 +222,7 @@ cmd << ":" << path; PRINT(("CMD='%s'\n", cmd.String())); cmd << failc; - args[2] = (char *)cmd.String(); + args[2] = (char*)cmd.String(); be_roster->Launch(kTerminalSig, 3, args); // TODO: handle errors return; @@ -261,13 +238,12 @@ cmd << "@" << host; PRINT(("CMD='%s'\n", cmd.String())); cmd << pausec; - args[2] = (char *)cmd.String(); + args[2] = (char*)cmd.String(); be_roster->Launch(kTerminalSig, 3, args); // TODO: handle errors return; } -#ifdef HANDLE_HTTP_WGET if (proto == "http") { BString cmd("/bin/wget "); @@ -277,27 +253,23 @@ cmd << full; PRINT(("CMD='%s'\n", cmd.String())); cmd << pausec; - args[2] = (char *)cmd.String(); + args[2] = (char*)cmd.String(); be_roster->Launch(kTerminalSig, 3, args); // TODO: handle errors return; } -#endif -#ifdef HANDLE_FILE if (proto == "file") { BMessage m(B_REFS_RECEIVED); entry_ref ref; - url.UnurlString(path); + _DecodeUrlString(path); if (get_ref_for_path(path.String(), &ref) < B_OK) return; m.AddRef("refs", &ref); be_roster->Launch(kTrackerSig, &m); return; } -#endif -#ifdef HANDLE_QUERY // XXX:TODO: split options if (proto == "query") { // mktemp ? @@ -309,17 +281,20 @@ BString s; int32 v; - url.UnurlString(full); + _DecodeUrlString(full); // TODO: handle options (list of attrs in the column, ...) v = 'qybF'; // QuerY By Formula XXX: any #define for that ? query.WriteAttr("_trk/qryinitmode", B_INT32_TYPE, 0LL, &v, sizeof(v)); s = "TextControl"; - query.WriteAttr("_trk/focusedView", B_STRING_TYPE, 0LL, s.String(), s.Length()+1); + query.WriteAttr("_trk/focusedView", B_STRING_TYPE, 0LL, s.String(), + s.Length()+1); s = full; PRINT(("QUERY='%s'\n", s.String())); - query.WriteAttr("_trk/qryinitstr", B_STRING_TYPE, 0LL, s.String(), s.Length()+1); - query.WriteAttr("_trk/qrystr", B_STRING_TYPE, 0LL, s.String(), s.Length()+1); + query.WriteAttr("_trk/qryinitstr", B_STRING_TYPE, 0LL, s.String(), + s.Length()+1); + query.WriteAttr("_trk/qrystr", B_STRING_TYPE, 0LL, s.String(), + s.Length()+1); s = "application/x-vnd.Be-query"; query.WriteAttr("BEOS:TYPE", 'MIMS', 0LL, s.String(), s.Length()+1); @@ -330,29 +305,25 @@ be_roster->Launch(&er); return; } -#endif -#ifdef HANDLE_SH if (proto == "sh") { BString cmd(full); if (_Warn(url.String()) != B_OK) return; PRINT(("CMD='%s'\n", cmd.String())); cmd << pausec; - args[2] = (char *)cmd.String(); + args[2] = (char*)cmd.String(); be_roster->Launch(kTerminalSig, 3, args); // TODO: handle errors return; } -#endif -#ifdef HANDLE_BESHARE if (proto == "beshare") { team_id team; BMessenger msgr(kBeShareSig); // if no instance is running, or we want a specific server, start it. if (!msgr.IsValid() || url.HasHost()) { - be_roster->Launch(kBeShareSig, (BMessage *)NULL, &team); + be_roster->Launch(kBeShareSig, (BMessage*)NULL, &team); msgr = BMessenger(NULL, team); } if (url.HasHost()) { @@ -369,36 +340,29 @@ // TODO: handle errors return; } -#endif -#ifdef HANDLE_IM if (proto == "icq" || proto == "msn") { // TODO team_id team; - be_roster->Launch(kIMSig, (BMessage *)NULL, &team); + be_roster->Launch(kIMSig, (BMessage*)NULL, &team); BMessenger msgr(NULL, team); if (url.HasHost()) { BMessage mserver(B_REFS_RECEIVED); mserver.AddString("server", host); - msgr.SendMessage(&httpmserver); + msgr.SendMessage(&mserver); } // TODO: handle errors return; } -#endif -#ifdef HANDLE_VLC if (proto == "mms" || proto == "rtp" || proto == "rtsp") { - args[0] = (char *)url.String(); + args[0] = (char*)url.String(); be_roster->Launch(kVLCSig, 1, args); return; } -#endif -#ifdef HANDLE_AUDIO - // TODO -#endif + // Audio: ? // vnc: ? // irc: ? @@ -408,23 +372,52 @@ // smb: cifsmount ? // nfs: mount_nfs ? // - // mailto: ? but BeMail & Beam both handle it already (not fully though). + // mailto: ? Mail & Beam both handle it already (not fully though). // + // mid: cid: as per RFC 2392 + // http://www.rfc-editor.org/rfc/rfc2392.txt query MAIL:cid + // // itps: pcast: podcast: s//http/ + parse xml to get url to mp3 stream... - // audio: s//http:/ + default MediaPlayer -- see http://forums.winamp.com/showthread.php?threadid=233130 + // audio: s//http:/ + default MediaPlayer + // -- see http://forums.winamp.com/showthread.php?threadid=233130 // // gps: ? I should submit an RFC for that one :) } -void UrlWrapper::ReadyToRun(void) +status_t +UrlWrapper::_DecodeUrlString(BString& string) { + // TODO: check for %00 and bail out! + int32 length = string.Length(); + int i; + for (i = 0; string[i] && i < length - 2; i++) { + if (string[i] == '%' && isxdigit(string[i+1]) + && isxdigit(string[i+2])) { + int c; + sscanf(string.String() + i + 1, "%02x", &c); + string.Remove(i, 3); + string.Insert((char)c, 1, i); + length -= 2; + } + } + + return B_OK; +} + + +void +UrlWrapper::ReadyToRun(void) +{ Quit(); } -int main(int argc, char **argv) +// #pragma mark + + +int main(int argc, char** argv) { UrlWrapper app; if (be_app) Modified: haiku/trunk/src/bin/urlwrapper.h =================================================================== --- haiku/trunk/src/bin/urlwrapper.h 2009-05-13 22:09:15 UTC (rev 30756) +++ haiku/trunk/src/bin/urlwrapper.h 2009-05-13 22:19:42 UTC (rev 30757) @@ -1,47 +1,28 @@ /* - * Copyright 2007, Haiku. All rights reserved. + * Copyright 2007-2009 Haiku Inc. All rights reserved. * Distributed under the terms of the MIT License. - * - * Authors: - * Fran?ois Revol, revol at free.fr */ +#ifndef _URL_WRAPPER_H +#define _URL_WRAPPER_H + +#include +#include -#define APP_SIGNATURE "application/x-vnd.Haiku-urlwrapper" -/* NetPositive Bookmark file type */ -#define HANDLE_BOOKMARK_FILES +class UrlWrapper : public BApplication +{ +public: + UrlWrapper(); + ~UrlWrapper(); -/* M$IE .url files */ -#define HANDLE_URL_FILES + virtual void RefsReceived(BMessage* msg); + virtual void ArgvReceived(int32 argc, char** argv); + virtual void ReadyToRun(void); -/* file: redirects to Tracker */ -#define HANDLE_FILE +private: + status_t _Warn(const char* url); + status_t _DecodeUrlString(BString& string); +}; -/* http: downloads with wget in a Terminal */ -#define HANDLE_HTTP_WGET +#endif // _URL_WRAPPER_H -/* query: BeOS/Haiku-specific: this should allow putting queries in web pages :) */ -#define HANDLE_QUERY - -/* mid: cid: as per RFC 2392 */ -/* http://www.rfc-editor.org/rfc/rfc2392.txt query MAIL:cid */ -/* UNIMPLEMENTED */ -//#define HANDLE_MID_CID - -/* sh: executes a shell command (before warning user of danger) */ -#define HANDLE_SH - -/* beshare: optionaly connect to a server and start a query */ -#define HANDLE_BESHARE - -/* icq: msn: ... should open im_client to this user */ -/* UNIMPLEMENTED */ -//#define HANDLE_IM - -/* mms: rtp: rtsp: opens the stream with VLC */ -#define HANDLE_VLC - -/* audio: redirects SoundPlay-urls for shoutcast streams */ -/* UNIMPLEMENTED */ -//#define HANDLE_AUDIO - Modified: haiku/trunk/src/bin/urlwrapper.rdef =================================================================== --- haiku/trunk/src/bin/urlwrapper.rdef 2009-05-13 22:09:15 UTC (rev 30756) +++ haiku/trunk/src/bin/urlwrapper.rdef 2009-05-13 22:19:42 UTC (rev 30757) @@ -1,55 +1,22 @@ -#include "urlwrapper.h" +resource app_signature "application/x-vnd.Haiku-urlwrapper"; -resource app_signature APP_SIGNATURE; -/*resource app_flags B_MULTIPLE_LAUNCH | B_BACKGROUND_APP | B_ARGV_ONLY;*/ resource app_flags B_MULTIPLE_LAUNCH | B_BACKGROUND_APP; resource(1, "BEOS:FILE_TYPES") message { -#ifdef HANDLE_BOOKMARK_FILES "types" = "application/x-vnd.Be-bookmark", -#endif -#ifdef HANDLE_URL_FILES - /* setmime -set text/x-url -short "Internet Shortcut" -long "Internet Shortcut File" -sniffRule '0.80 ("[InternetShortcut]")' */ - "types" = "wwwserver/redirection", - "types" = "application/internet-shortcut", - "types" = "application/x-url", - "types" = "message/external-body", - "types" = "text/url", "types" = "text/x-url", -#endif -#ifdef HANDLE_FILE "types" = "application/x-vnd.Be.URL.file", -#endif -#ifdef HANDLE_HTTP_WGET "types" = "application/x-vnd.Be.URL.http", -#endif -#ifdef HANDLE_QUERY "types" = "application/x-vnd.Be.URL.query", -#endif -#ifdef HANDLE_MID_CID - "types" = "application/x-vnd.Be.URL.mid", - "types" = "application/x-vnd.Be.URL.cid", -#endif -#ifdef HANDLE_SH "types" = "application/x-vnd.Be.URL.sh", -#endif -#ifdef HANDLE_BESHARE "types" = "application/x-vnd.Be.URL.beshare", -#endif -#ifdef HANDLE_IM "types" = "application/x-vnd.Be.URL.icq", "types" = "application/x-vnd.Be.URL.msn", -#endif -#ifdef HANDLE_VLC "types" = "application/x-vnd.Be.URL.mms", "types" = "application/x-vnd.Be.URL.rtp", "types" = "application/x-vnd.Be.URL.rtsp", -#endif -#ifdef HANDLE_AUDIO - "types" = "application/x-vnd.Be.URL.audio", -#endif -/* default urls */ +// "types" = "application/x-vnd.Be.URL.audio", "types" = "application/x-vnd.Be.URL.telnet", "types" = "application/x-vnd.Be.URL.ssh", "types" = "application/x-vnd.Be.URL.ftp", Modified: haiku/trunk/src/kits/support/Url.cpp =================================================================== --- haiku/trunk/src/kits/support/Url.cpp 2009-05-13 22:09:15 UTC (rev 30756) +++ haiku/trunk/src/kits/support/Url.cpp 2009-05-13 22:19:42 UTC (rev 30757) @@ -1,5 +1,5 @@ /* - * Copyright 2007, Haiku. All rights reserved. + * Copyright 2007-2009 Haiku Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -11,10 +11,6 @@ #define DEBUG 0 -#include -#include -#include - #include #include #include @@ -25,7 +21,7 @@ namespace BPrivate { namespace Support { -BUrl::BUrl(const char *url) +BUrl::BUrl(const char* url) : BString(url) { fStatus = _ParseAndSplit(); @@ -80,12 +76,12 @@ if (Length() > B_PATH_NAME_LENGTH) { // TODO: BAlert // if (onProblemAskUser) - // Balert ... Too long URL! + // BAlert ... Too long URL! fprintf(stderr, "URL too long"); return B_NAME_TOO_LONG; } - char *argv[] = { + char* argv[] = { const_cast("BUrlInvokedApplication"), const_cast(String()), NULL @@ -122,61 +118,62 @@ // TODO: proto and host should be lowercased. // see http://en.wikipedia.org/wiki/URL_normalization - CopyInto(proto, 0, v); + CopyInto(fProto, 0, v); CopyInto(left, v + 1, Length() - v); - // TODO: RFC1738 says the // part should indicate the uri follows the u:p at h:p/path convention, so it should be used to check for special cases. + // TODO: RFC1738 says the // part should indicate the uri follows the + // u:p at h:p/path convention, so it should be used to check for special cases. if (left.FindFirst("//") == 0) left.RemoveFirst("//"); - full = left; + fFull = left; // path part // actually some apps handle file://[host]/path // but I have no idea what proto it implies... // or maybe it's just to emphasize on "localhost". v = left.FindFirst("/"); - if (v == 0 || proto == "file") { - path = left; - return 0; + if (v == 0 || fProto == "file") { + fPath = left; + return B_OK; } // some protos actually implies path if it's the only component - if ((v < 0) && (proto == "beshare" || proto == "irc")) { - path = left; - return 0; + if ((v < 0) && (fProto == "beshare" || fProto == "irc")) { + fPath = left; + return B_OK; } if (v > -1) { - left.MoveInto(path, v+1, left.Length()-v); + left.MoveInto(fPath, v+1, left.Length()-v); left.Remove(v, 1); } // user:pass at host v = left.FindFirst("@"); if (v > -1) { - left.MoveInto(user, 0, v); + left.MoveInto(fUser, 0, v); left.Remove(0, 1); - v = user.FindFirst(":"); + v = fUser.FindFirst(":"); if (v > -1) { - user.MoveInto(pass, v, user.Length() - v); - pass.Remove(0, 1); + fUser.MoveInto(fPass, v, fUser.Length() - v); + fPass.Remove(0, 1); } - } else if (proto == "finger") { + } else if (fProto == "finger") { // single component implies user // see also: http://www.subir.com/lynx/lynx_help/lynx_url_support.html - user = left; - return 0; + fUser = left; + return B_OK; } // host:port v = left.FindFirst(":"); if (v > -1) { - left.MoveInto(port, v + 1, left.Length() - v); + left.MoveInto(fPort, v + 1, left.Length() - v); left.Remove(v, 1); } // not much left... - host = left; + fHost = left; - return 0; + return B_OK; } @@ -184,7 +181,7 @@ BUrl::_UrlMimeType() const { BString mime; - mime << "application/x-vnd.Be.URL." << proto; + mime << "application/x-vnd.Be.URL." << fProto; return BString(mime); } @@ -193,107 +190,88 @@ bool BUrl::HasHost() const { - return host.Length(); + return fHost.Length(); } bool BUrl::HasPort() const { - return port.Length(); + return fPort.Length(); } bool BUrl::HasUser() const { - return user.Length(); + return fUser.Length(); } bool BUrl::HasPass() const { - return pass.Length(); + return fPass.Length(); } bool BUrl::HasPath() const { - return path.Length(); + return fPath.Length(); } -BString +const BString& BUrl::Proto() const { - return BString(proto); + return fProto; } -BString +const BString& BUrl::Full() const { // RFC1738's "sheme-part" - return BString(full); + return fFull; } -BString +const BString& BUrl::Host() const { - return BString(host); + return fHost; } -BString +const BString& BUrl::Port() const { - return BString(port); + return fPort; } -BString +const BString& BUrl::User() const { - return BString(user); + return fUser; } -BString +const BString& BUrl::Pass() const { - return BString(pass); + return fPass; } -BString +const BString& BUrl::Path() const { - return BString(path); + return fPath; } -status_t -BUrl::UnurlString(BString &string) -{ - // TODO: check for %00 and bail out! - int32 length = string.Length(); - int i; - for (i = 0; string[i] && i < length - 2; i++) { - if (string[i] == '%' && isxdigit(string[i+1]) && isxdigit(string[i+2])) { - int c; - sscanf(string.String() + i + 1, "%02x", &c); - string.Remove(i, 3); - string.Insert((char)c, 1, i); - length -= 2; - } - } - - return B_OK; -} +} // namespace Support +} // namespace BPrivate -}; // namespace Support -}; // namespace BPrivate - From zooey at mail.berlios.de Thu May 14 00:28:35 2009 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Thu, 14 May 2009 00:28:35 +0200 Subject: [Haiku-commits] r30758 - haiku/trunk/src/kits/interface Message-ID: <200905132228.n4DMSZjF019268@sheep.berlios.de> Author: zooey Date: 2009-05-14 00:28:34 +0200 (Thu, 14 May 2009) New Revision: 30758 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30758&view=rev Modified: haiku/trunk/src/kits/interface/TextView.cpp Log: * removed debug output Modified: haiku/trunk/src/kits/interface/TextView.cpp =================================================================== --- haiku/trunk/src/kits/interface/TextView.cpp 2009-05-13 22:19:42 UTC (rev 30757) +++ haiku/trunk/src/kits/interface/TextView.cpp 2009-05-13 22:28:34 UTC (rev 30758) @@ -5253,7 +5253,6 @@ fInline->SetSelectionOffset(selectionStart); fInline->SetSelectionLength(selectionEnd - selectionStart); -printf("string=%s\n", string); const int32 inlineOffset = fInline->Offset(); InsertText(string, stringLen, fSelStart, NULL); fSelStart += stringLen; From kirilla at mail.berlios.de Thu May 14 00:30:56 2009 From: kirilla at mail.berlios.de (kirilla at BerliOS) Date: Thu, 14 May 2009 00:30:56 +0200 Subject: [Haiku-commits] r30759 - haiku/trunk/src/bin Message-ID: <200905132230.n4DMUupY020971@sheep.berlios.de> Author: kirilla Date: 2009-05-14 00:30:55 +0200 (Thu, 14 May 2009) New Revision: 30759 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30759&view=rev Modified: haiku/trunk/src/bin/open.cpp Log: Launch URLs via BUrl class. Rearranged header files according to guidelines. Modified: haiku/trunk/src/bin/open.cpp =================================================================== --- haiku/trunk/src/bin/open.cpp 2009-05-13 22:28:34 UTC (rev 30758) +++ haiku/trunk/src/bin/open.cpp 2009-05-13 22:30:55 UTC (rev 30759) @@ -1,22 +1,25 @@ /* * Copyright 2003-2007, Axel D?rfler, axeld at pinc-software.de. * Copyright 2005-2007, Fran?ois Revol, revol at free.fr. + * Copyright 2009, Jonas Sundstr?m, jonas at kirilla.com. * All rights reserved. Distributed under the terms of the MIT License. */ /*! Launches an application/document from the shell */ +#include +#include +#include +#include + #include #include #include #include #include -#include -#include -#include -#include +#include const char *kTrackerSignature = "application/x-vnd.Be-TRAK"; @@ -86,25 +89,15 @@ status = B_OK; } else if (strchr(*argv, ':')) { // try to open it as an URI - BString mimeType = "application/x-vnd.Be.URL."; - BString arg(*argv); - mimeType.Append(arg, arg.FindFirst(":")); + BPrivate::Support::BUrl url(*argv); + if (url.OpenWithPreferredApplication() == B_OK) + continue; - // the protocol should be alphanum - // we just check if it's registered - // if not there is likely no supporting app anyway - if (BMimeType::IsValid(mimeType.String())) { - char *args[2] = { *argv, NULL }; - status = be_roster->Launch(openWith ? openWith - : mimeType.String(), 1, args); - if (status == B_OK) - continue; - } - // maybe it's "file:line" or "file:line:col" int line = 0, col = 0, i; status = B_ENTRY_NOT_FOUND; // remove gcc error's last : + BString arg(*argv); if (arg[arg.Length() - 1] == ':') arg.Truncate(arg.Length() - 1); From ingo_weinhold at gmx.de Thu May 14 01:06:58 2009 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Thu, 14 May 2009 01:06:58 +0200 Subject: [Haiku-commits] r30759 - haiku/trunk/src/bin In-Reply-To: <200905132230.n4DMUupY020971@sheep.berlios.de> References: <200905132230.n4DMUupY020971@sheep.berlios.de> Message-ID: <20090514010658.358.1@knochen-vm.localdomain> On 2009-05-14 at 00:30:56 [+0200], kirilla at BerliOS wrote: > Author: kirilla > Date: 2009-05-14 00:30:55 +0200 (Thu, 14 May 2009) > New Revision: 30759 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30759&view=rev > > Modified: > haiku/trunk/src/bin/open.cpp > Log: > Launch URLs via BUrl class. Rearranged header files according to guidelines. > > Modified: haiku/trunk/src/bin/open.cpp > =================================================================== > --- haiku/trunk/src/bin/open.cpp 2009-05-13 22:28:34 UTC (rev 30758) > +++ haiku/trunk/src/bin/open.cpp 2009-05-13 22:30:55 UTC (rev 30759) [...] > @@ -86,25 +89,15 @@ > status = B_OK; > } else if (strchr(*argv, ':')) { > // try to open it as an URI > - BString mimeType = "application/x-vnd.Be.URL."; > - BString arg(*argv); > - mimeType.Append(arg, arg.FindFirst(":")); > + BPrivate::Support::BUrl url(*argv); > + if (url.OpenWithPreferredApplication() == B_OK) > + continue; I haven't looked at the BUrl class yet, but assuming that it just encapsulates a URL, isn't this functionality misplaced and should rather live in BRoster? CU, Ingo From axeld at pinc-software.de Thu May 14 09:33:31 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Thu, 14 May 2009 09:33:31 +0200 CEST Subject: [Haiku-commits] r30759 - haiku/trunk/src/bin In-Reply-To: <20090514010658.358.1@knochen-vm.localdomain> Message-ID: <738190971-BeMail@zon> Ingo Weinhold wrote: > I haven't looked at the BUrl class yet, but assuming that it just > encapsulates a URL, isn't this functionality misplaced and should > rather live > in BRoster? Definitely, the BUrl class as is is hardly a candidate to be made public soon IMO. Bye, Axel. From jonas at kirilla.com Thu May 14 09:54:49 2009 From: jonas at kirilla.com (Jonas =?iso-8859-1?q?Sundstr=F6m?=) Date: Thu, 14 May 2009 09:54:49 +0200 CEST Subject: [Haiku-commits] r30759 - haiku/trunk/src/bin In-Reply-To: <20090514010658.358.1@knochen-vm.localdomain> Message-ID: <1766320673-BeMail@kirilla> Ingo Weinhold wrote: > > On 2009-05-14 at 00:30:56 [+0200], kirilla at BerliOS > wrote: > > Author: kirilla > > Date: 2009-05-14 00:30:55 +0200 (Thu, 14 May 2009) > > New Revision: 30759 > > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30759&view=rev > > > > Modified: > > haiku/trunk/src/bin/open.cpp > > Log: > > Launch URLs via BUrl class. Rearranged header files according to > > guidelines. > > > > Modified: haiku/trunk/src/bin/open.cpp > > =================================================================== > > --- haiku/trunk/src/bin/open.cpp 2009-05-13 22:28:34 UTC (rev > > 30758) > > +++ haiku/trunk/src/bin/open.cpp 2009-05-13 22:30:55 UTC (rev > > 30759) > [...] > > @@ -86,25 +89,15 @@ > > status = B_OK; > > } else if (strchr(*argv, ':')) { > > // try to open it as an URI > > - BString mimeType = "application/x-vnd.Be.URL."; > > - BString arg(*argv); > > - mimeType.Append(arg, arg.FindFirst(":")); > > + BPrivate::Support::BUrl url(*argv); > > + if (url.OpenWithPreferredApplication() == B_OK) > > + continue; > > I haven't looked at the BUrl class yet, but assuming that it just > encapsulates a URL, isn't this functionality misplaced and should > rather live > in BRoster? Apart from /bin/urlwrapper's need to cherry-pick the varius parts of an URL - parsing or having someone parse the URL for it - yes, BUrl is mostly a way to launch an URL. It does however allow finding out some useful things about an URL. Accomodating the needs of /bin/urlwrapper is secondary to my goal of making the method that opens an URL try harder to make sure that the URL actually finds a handler and if it can't do so, provide the user with enough relevant feedback (if the application has not chosen to suppress a graphical user dialog). E.g., if the URL has a protocol for which no application exists, a simple BAlert would be enough, telling the user that URL xxx://yyy is of an unkown type, and that no application to handle it was found. If there is no preferred application set, but one or more exist, show a dialog enumerating these applications, allowing the user to pick one (this once/for always). If such dialog window code can be accomodated in the guts of BRoster (or in Registrar?) just as well, then I don't mind losing BUrl as a separate entity. /Jonas. From axeld at pinc-software.de Thu May 14 09:59:15 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Thu, 14 May 2009 09:59:15 +0200 CEST Subject: [Haiku-commits] r30759 - haiku/trunk/src/bin In-Reply-To: <1766320673-BeMail@kirilla> Message-ID: <2282129403-BeMail@zon> "Jonas Sundstr?m" wrote: [...] > E.g., if the URL has a protocol for which no application > exists, a simple BAlert would be enough, telling the user > that URL xxx://yyy is of an unkown type, and that no > application to handle it was found. > > If there is no preferred application set, but one or > more exist, show a dialog enumerating these applications, > allowing the user to pick one (this once/for always). > > If such dialog window code can be accomodated in the > guts of BRoster (or in Registrar?) just as well, then It does belong into neither class. It's *always* up to the application to show a dialog; you cannot know in what context BUrl is used, and you should not make any assumptions. > I don't mind losing BUrl as a separate entity. A class encapsulating URIs is definitely useful, it's just not cleanly implemented in BUrl. Bye, Axel. From superstippi at gmx.de Thu May 14 17:44:40 2009 From: superstippi at gmx.de (Stephan Assmus) Date: Thu, 14 May 2009 17:44:40 +0200 Subject: [Haiku-commits] r30736 - in haiku/trunk: build/jam src/servers/cddb_daemon In-Reply-To: <1279956105-BeMail@Gaspode> References: <1279956105-BeMail@Gaspode> Message-ID: <20090514174440.551.1@bepc.1242315173.fake> On Bruno Albuquerque wrote: > On Wed, 13 May 2009 11:28:26 +0200 CEST, Axel D?rfler said: > > bga at BerliOS wrote: > > > Log: > > > - Finished up cddb_daemon. Still some cleanup needed here and there > > > but it works. > > > > Nice! I guess this is working read-only? Ie. it would still be a nice > > addition to have an application that transmits the changes you make > > back to the cddb server? > > Yes, I have the protocol part done for that (not in the submitted code > tough). The problem is that it needs some kind of GUI and GUIs are my > sore spot. :P I can draw sticky figures, but that do not help here. :) In > any case, I will clean-up this part of the protocol and commit it. So the > hooks will all be there and someone can come up with an interface. :) If I understand this correctly, the CDDA filesystem must know which CDs have been edited by the user. The CDDB daemon could combine this information with it's own knowledge of what CDs have already been uploaded by the user. So there could be a simple panel with a list view that lists all edited, but not yet uploaded CDs, each with a checkmark, so you can upload the checked ones. I don't know how/where this panel should be invoked and it probably needs some more options, like which server and so on. But if this were the preflet for the CDDB daemon, maybe that's just the place for it, even though the upload functionality is not that fitting in a "preflet". Just a thought. Best regards, -Stephan From bga at bug-br.org.br Thu May 14 17:54:55 2009 From: bga at bug-br.org.br (Bruno Albuquerque) Date: Thu, 14 May 2009 12:54:55 -0300 Subject: [Haiku-commits] r30749 - haiku/trunk/src/add-ons/kernel/file_systems/cdda In-Reply-To: <4A0AE6E5.5090803@gmail.com> References: <200905131454.n4DEs7c6025202@sheep.berlios.de> <4A0AE6E5.5090803@gmail.com> Message-ID: <4A0C3ECF.80605@bug-br.org.br> Fredrik Ekdahl wrote: > I guess it would be ~1411 kbps then, since k = 1000 (and not 1024) when > speaking audio/video bit rates. Are you sure? Because I used a unit converter to convert from bits per second to kilobits per second and this was the result (truncated). I did that exactly because I was not usre if I should use 1024 or 1000. -Bruno From humdingerb at mail.berlios.de Thu May 14 17:58:16 2009 From: humdingerb at mail.berlios.de (humdingerb at mail.berlios.de) Date: Thu, 14 May 2009 17:58:16 +0200 Subject: [Haiku-commits] r30760 - haiku/trunk/docs/userguide/en/installation Message-ID: <200905141558.n4EFwGQP013208@sheep.berlios.de> Author: humdingerb Date: 2009-05-14 17:58:15 +0200 (Thu, 14 May 2009) New Revision: 30760 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30760&view=rev Modified: haiku/trunk/docs/userguide/en/installation/install-source-linux.html Log: Added a line for adding the Development optional package, so the @ disk case wouldn't be empty. Modified: haiku/trunk/docs/userguide/en/installation/install-source-linux.html =================================================================== --- haiku/trunk/docs/userguide/en/installation/install-source-linux.html 2009-05-13 22:30:55 UTC (rev 30759) +++ haiku/trunk/docs/userguide/en/installation/install-source-linux.html 2009-05-14 15:58:15 UTC (rev 30760) @@ -122,13 +122,13 @@

        In the same way, you use CopyDirectoryToHaikuImage and AddFilesToHaikuImage to copy whole directories or single files into the image.

      • The above commands are executed when building any kind of image. "Build Profiles" provide the means to set commands specifically for different configurations.
        -These are two profiles, one for building and installing an image directly onto a partition and the other to generate a VMWare image:

        +These are two profiles, one for building and installing an image directly onto a partition (and in that case add the optional development package) and the other to generate a 900mb VMWare image:

        DefineBuildProfile disk : disk : "/dev/sda7" ;
         DefineBuildProfile vmware : vmware-image ;
         
         switch $(HAIKU_BUILD_PROFILE) {
         	case "disk" : {
        -
        +		AddOptionalHaikuImagePackages Development ;	
         	}
         
         
        @@ -175,7 +175,7 @@
         
         switch $(HAIKU_BUILD_PROFILE) {
         	case "disk" : {
        -
        +		AddOptionalHaikuImagePackages Development ;
         	}
         
         
        
        
        
        From humdingerb at googlemail.com  Thu May 14 18:05:01 2009
        From: humdingerb at googlemail.com (Humdinger)
        Date: Thu, 14 May 2009 18:05:01 +0200
        Subject: [Haiku-commits] r30705
        	-	haiku/trunk/docs/userguide/en/installation
        In-Reply-To: <1e42d8c50905110913s19f548ceg4dff5f9696b9e630@mail.gmail.com>
        References: <200905111536.n4BFafSl014826@sheep.berlios.de>	<1e80d8750905110847u7b820493n15334f89d87495fb@mail.gmail.com>	<4A084C0A.1050809@googlemail.com>
        	<1e42d8c50905110913s19f548ceg4dff5f9696b9e630@mail.gmail.com>
        Message-ID: <4A0C412D.9070201@googlemail.com>
        
        > On Mon, May 11, 2009 at 4:02 PM, Humdinger  wrote:
        >> One thing's now a bit awkward:
        >>
        >>        case "disk" : {
        >>
        >>        }
        >>
        >> The "disk" case is now completely empty. But I don't want to remove it as for this guide
        >> it's useful to show how it works.
        
        Matt Madia suggested:
        > case "disk" : {
        > # When the BuildProfile $(type) = "disk", the following is not necessary.
        > #    HAIKU_DONT_CLEAR_IMAGE = 1 ;
        > # haiku/trunk/build/jam/MiscRules explicitly sets this variable in this case.
        > }
        
        I don't think learning that something is *not* useful is helpful. :)
        
        Stephan said:
        > Yes, some other optional package should suffice. Maybe you can use the 
        > space to show other tricks that have not already been shown, like adding 
        > more targets from the build, or unzipping something located on the host 
        > system onto the image.
        
        Unzipping is already an example in that guide, and I don't know enough about adding targets...
        
        Philippe offered:
        > 	case "disk" : {
        >            HAIKU_IMAGE_LABEL = CustomHaikuBuild ;
        > 	}
        
        That would be a possibility, but I guess having it more obviously stated that these 
        different case statements can be used for including different packages depending on the 
        used build config, I opted for simply including the dev package when building to disk.
        
        Thanks for the input from all of you.
        
        Regards,
        Humdinger
        
        -- 
        --=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-
        Deutsche Haiku News @ http://www.haiku-gazette.de
        
        
        From umccullough at gmail.com  Thu May 14 19:00:36 2009
        From: umccullough at gmail.com (Urias McCullough)
        Date: Thu, 14 May 2009 10:00:36 -0700
        Subject: [Haiku-commits] r30705 -
        	haiku/trunk/docs/userguide/en/installation
        In-Reply-To: <4A0C412D.9070201@googlemail.com>
        References: <200905111536.n4BFafSl014826@sheep.berlios.de>
        	<1e80d8750905110847u7b820493n15334f89d87495fb@mail.gmail.com>
        	<4A084C0A.1050809@googlemail.com>
        	<1e42d8c50905110913s19f548ceg4dff5f9696b9e630@mail.gmail.com>
        	<4A0C412D.9070201@googlemail.com>
        Message-ID: <1e80d8750905141000y6dfa691chccc1f843bc14519d@mail.gmail.com>
        
        On Thu, May 14, 2009 at 9:05 AM, Humdinger  wrote:
        > That would be a possibility, but I guess having it more obviously stated that these
        > different case statements can be used for including different packages depending on the
        > used build config, I opted for simply including the dev package when building to disk.
        
        While on that topic, it seems that the case is using the type, not the name?
        
        On a couple of my machines at home, I would have two disk profiles,
        but with different names (because they point to different partitions),
        so I might have something "devdisk" and "testdisk" as the names. It
        would probably make more sense to use that for the case statement. I
        also usually have one called "usbdisk" which I use to represent the
        path to my USB stick when I have it plugged in (although, the device
        path sometimes changes... which is obnoxious).
        
        Just some ideas :)
        
        - Urias
        
        
        From zooey at mail.berlios.de  Thu May 14 19:39:01 2009
        From: zooey at mail.berlios.de (zooey at BerliOS)
        Date: Thu, 14 May 2009 19:39:01 +0200
        Subject: [Haiku-commits] r30761 - haiku/trunk/src/tests/kits/interface
        Message-ID: <200905141739.n4EHd1aw031283@sheep.berlios.de>
        
        Author: zooey
        Date: 2009-05-14 19:39:00 +0200 (Thu, 14 May 2009)
        New Revision: 30761
        ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30761&view=rev
        
        Modified:
           haiku/trunk/src/tests/kits/interface/TextViewTest.cpp
        Log:
        * adjusted to allow for switching between alignments (and now makes use of
          the layouting engine, too)
        
        Modified: haiku/trunk/src/tests/kits/interface/TextViewTest.cpp
        ===================================================================
        --- haiku/trunk/src/tests/kits/interface/TextViewTest.cpp	2009-05-14 15:58:15 UTC (rev 30760)
        +++ haiku/trunk/src/tests/kits/interface/TextViewTest.cpp	2009-05-14 17:39:00 UTC (rev 30761)
        @@ -5,19 +5,33 @@
         
         
         #include 
        -#include 
        +#include 
        +#include 
        +#include 
         #include 
         #include 
        +#include 
         #include 
        +#include 
         
         #include 
         
         
        +const static uint32 kMsgAlignLeft = 'alle';
        +const static uint32 kMsgAlignCenter = 'alce';
        +const static uint32 kMsgAlignRight = 'alri';
        +
        +
         class Window : public BWindow {
         	public:
         		Window();
         
         		virtual bool QuitRequested();
        +		virtual void MessageReceived(BMessage *message);
        +
        +	private:
        +		BTextControl* fTextControl;
        +		BTextView* fTextView;
         };
         
         
        @@ -28,22 +42,30 @@
         	: BWindow(BRect(100, 100, 800, 500), "TextView-Test",
         			B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS)
         {
        -	BRect rect = Bounds().InsetByCopy(20, 20);
        +	fTextControl = new BTextControl("text-contr-O",
        +		"a single line of text - (c) Conglom-O", NULL);
        +	fTextView = new BTextView("text-O");
        +	BScrollView* scrollView = new BScrollView("scroll-O", fTextView, 0, true,
        +		true, B_FANCY_BORDER);
         
        -	BTextView* textView = new BTextView(rect, "text-o-mo",
        -		rect.OffsetToCopy(0, 0), B_FOLLOW_ALL);
        +	SetLayout(new BGroupLayout(B_HORIZONTAL));
        +	AddChild(BGroupLayoutBuilder(B_VERTICAL, 10)
        +		.Add(fTextControl)
        +		.Add(scrollView)
        +		.Add(BGroupLayoutBuilder(B_HORIZONTAL, 10)
        +			.Add(new BButton("Align Left", new BMessage(kMsgAlignLeft)))
        +			.AddGlue()
        +			.Add(new BButton("Align Center", new BMessage(kMsgAlignCenter)))
        +			.AddGlue()
        +			.Add(new BButton("Align Right", new BMessage(kMsgAlignRight)))
        +		)
        +		.SetInsets(5, 5, 5, 5)
        +	);
         
        -	BScrollView* scrollView = new BScrollView("scroll-o-mo", textView,
        -		B_FOLLOW_ALL_SIDES, 0, true, true);
        -	AddChild(scrollView);
        -
        -	printf("starting to prepare content ... [%Ld]\n", system_time());
        -
        -	// generate a million lines of content
        -	const int32 kLineCount = 1000000;
        +	// generate some lines of content
        +	const int32 kLineCount = 10;
         	const int32 kLineNoSize = 6;
        -	BString line
        -		= ":	you should see a pretty large text in this textview	...\n";
        +	BString line = ": just some text here - nothing special to see\n";
         	BString format = BString("%*d") << line;
         	BString content;
         	int32 lineLength = line.Length() + kLineNoSize;
        @@ -55,9 +77,8 @@
         			sprintf(currLine, format.String(), kLineNoSize, lineNo++);
         		content.UnlockBuffer(contentLength);
         	}
        -	printf("setting content ... [%Ld]\n", system_time());
        -	textView->SetText(content.String());
        -	printf("done. [%Ld]\n", system_time());
        +	fTextView->SetInsets(2,2,2,2);
        +	fTextView->SetText(content.String());
         }
         
         
        @@ -69,6 +90,32 @@
         }
         
         
        +void
        +Window::MessageReceived(BMessage *message)
        +{
        +	switch (message->what) {
        +		case kMsgAlignLeft:
        +			fTextControl->SetAlignment(B_ALIGN_LEFT, B_ALIGN_LEFT);
        +			fTextView->SetAlignment(B_ALIGN_LEFT);
        +			break;
        +
        +		case kMsgAlignCenter:
        +			fTextControl->SetAlignment(B_ALIGN_LEFT, B_ALIGN_CENTER);
        +			fTextView->SetAlignment(B_ALIGN_CENTER);
        +			break;
        +
        +		case kMsgAlignRight:
        +			fTextControl->SetAlignment(B_ALIGN_LEFT, B_ALIGN_RIGHT);
        +			fTextView->SetAlignment(B_ALIGN_RIGHT);
        +			break;
        +
        +		default:
        +			BWindow::MessageReceived(message);
        +			break;
        +	}
        +}
        +
        +
         //	#pragma mark -
         
         
        
        
        
        From zooey at mail.berlios.de  Thu May 14 19:44:50 2009
        From: zooey at mail.berlios.de (zooey at BerliOS)
        Date: Thu, 14 May 2009 19:44:50 +0200
        Subject: [Haiku-commits] r30762 - haiku/trunk/src/kits/interface
        Message-ID: <200905141744.n4EHiofl032003@sheep.berlios.de>
        
        Author: zooey
        Date: 2009-05-14 19:44:49 +0200 (Thu, 14 May 2009)
        New Revision: 30762
        ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30762&view=rev
        
        Modified:
           haiku/trunk/src/kits/interface/TextView.cpp
        Log:
        * corrected the computation of alignment offsets for centered or right-aligned 
          textviews, such that the characters are drawn at their correct positions and 
          there  are no longer any mismatches between caret and character positions
        * fixed too large widths returned by LineWidth() for lines ending with a
          newline: the newline character must not contribute to the width
        This makes the textcontrol in DiskProbe work properly again.
        
        Modified: haiku/trunk/src/kits/interface/TextView.cpp
        ===================================================================
        --- haiku/trunk/src/kits/interface/TextView.cpp	2009-05-14 17:39:00 UTC (rev 30761)
        +++ haiku/trunk/src/kits/interface/TextView.cpp	2009-05-14 17:44:49 UTC (rev 30762)
        @@ -1764,15 +1764,16 @@
         	result.x = 0.0;
         	result.y = line->origin + fTextRect.top;
         
        -	// Handle the case where there is only one line (no text inserted)
        -	// TODO: See if we can do this better
        +	bool onEmptyLastLine = _IsOnEmptyLastLine(inOffset);
        +
         	if (fStyles->NumRuns() == 0) {
        +		// Handle the case where there is only one line (no text inserted)
         		fStyles->SyncNullStyle(0);
         		height = _NullStyleHeight();
         	} else {
         		height = (line + 1)->origin - line->origin;
         
        -		if (_IsOnEmptyLastLine(inOffset)) {
        +		if (onEmptyLastLine) {
         			// special case: go down one line if inOffset is at the newline
         			// at the end of the buffer ...
         			result.y += height;
        @@ -1802,16 +1803,15 @@
         	}
         
         	if (fAlignment != B_ALIGN_LEFT) {
        -		float modifier = fTextRect.right - LineWidth(lineNum);
        +		float lineWidth = onEmptyLastLine ? 0.0 : LineWidth(lineNum);
        +		float alignmentOffset = fTextRect.Width() - lineWidth;
         		if (fAlignment == B_ALIGN_CENTER)
        -			modifier /= 2;
        -		result.x += modifier;
        +			alignmentOffset /= 2;
        +		result.x += alignmentOffset;
         	}
        +
         	// convert from text rect coordinates
        -	// NOTE: I didn't understand why "- 1.0"
        -	// and it works only correct without it on Haiku app_server.
        -	// Feel free to enlighten me though!
        -	result.x += fTextRect.left;// - 1.0;
        +	result.x += fTextRect.left;
         
         	// round up
         	result.x = ceilf(result.x);
        @@ -1856,10 +1856,10 @@
         
         	// convert to text rect coordinates
         	if (fAlignment != B_ALIGN_LEFT) {
        -		float lineWidth = fTextRect.right - LineWidth(lineNum);
        +		float alignmentOffset = fTextRect.Width() - LineWidth(lineNum);
         		if (fAlignment == B_ALIGN_CENTER)
        -			lineWidth /= 2;
        -		point.x -= lineWidth;
        +			alignmentOffset /= 2;
        +		point.x -= alignmentOffset;
         	}
         
         	point.x -= fTextRect.left;
        @@ -1984,7 +1984,14 @@
         		return 0;
         
         	STELine* line = (*fLines)[lineNum];
        -	return _StyledWidth(line->offset, (line + 1)->offset - line->offset);
        +	int32 length = (line + 1)->offset - line->offset;
        +
        +	// skip newline at the end of the line, if any, as it does no contribute
        +	// to the width
        +	if (ByteAt((line + 1)->offset - 1) == B_ENTER)
        +		length--;
        +
        +	return _StyledWidth(line->offset, length);
         }
         
         
        @@ -4149,6 +4156,12 @@
         		} else
         			startLeft = PointAt(startOffset).x;
         	}
        +	else if (fAlignment != B_ALIGN_LEFT) {
        +		float alignmentOffset = fTextRect.Width() - LineWidth(lineNum);
        +		if (fAlignment == B_ALIGN_CENTER)
        +			alignmentOffset /= 2;
        +		startLeft = fTextRect.left + alignmentOffset;
        +	}
         
         	int32 length = (line + 1)->offset;
         	if (startOffset != -1)
        @@ -4159,20 +4172,12 @@
         	// DrawString() chokes if you draw a newline
         	if (ByteAt((line + 1)->offset - 1) == B_ENTER)
         		length--;
        -	if (fAlignment != B_ALIGN_LEFT) {
        -		// B_ALIGN_RIGHT
        -		startLeft = (fTextRect.right - LineWidth(lineNum));
        -		if (fAlignment == B_ALIGN_CENTER)
        -			startLeft /= 2;
        -		startLeft += fTextRect.left;
        -	}
         
         	view->MovePenTo(startLeft, line->origin + line->ascent + fTextRect.top + 1);
         
         	if (erase) {
         		eraseRect.top = line->origin + fTextRect.top;
         		eraseRect.bottom = (line + 1)->origin + fTextRect.top;
        -
         		view->FillRect(eraseRect, B_SOLID_LOW);
         	}
         
        
        
        
        From humdingerb at googlemail.com  Thu May 14 19:53:36 2009
        From: humdingerb at googlemail.com (Humdinger)
        Date: Thu, 14 May 2009 19:53:36 +0200
        Subject: [Haiku-commits] r30705
        	-	haiku/trunk/docs/userguide/en/installation
        In-Reply-To: <1e80d8750905141000y6dfa691chccc1f843bc14519d@mail.gmail.com>
        References: <200905111536.n4BFafSl014826@sheep.berlios.de>	<1e80d8750905110847u7b820493n15334f89d87495fb@mail.gmail.com>	<4A084C0A.1050809@googlemail.com>	<1e42d8c50905110913s19f548ceg4dff5f9696b9e630@mail.gmail.com>	<4A0C412D.9070201@googlemail.com>
        	<1e80d8750905141000y6dfa691chccc1f843bc14519d@mail.gmail.com>
        Message-ID: <4A0C5AA0.1070605@googlemail.com>
        
        Urias McCullough wrote:
        > While on that topic, it seems that the case is using the type, not the name?
        
        Hmm, you mean this would avoid some confusion:
        
        DefineBuildProfile dev-partition : disk : "/dev/sda7" ;
        DefineBuildProfile test-virtual : vmware-image ;
        
        switch $(HAIKU_BUILD_PROFILE) {
        	case "dev-partition" : {
        		AddOptionalHaikuImagePackages Development ;	
        	}
        
        
        	case "test-virtual" : {
        		HAIKU_IMAGE_SIZE = 900 ;
        	}
        
        
        I never really thought about it... So that means, that these profiles inherit the config 
        of "disk" or "vmware-image" and extend those with the options listed under the case statement?
        Where are those "default" build profiles defined?
        
        
        
        Regards,
        Humdinger
        
        -- 
        --=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-
        Deutsche Haiku News @ http://www.haiku-gazette.de
        
        
        From superstippi at gmx.de  Thu May 14 20:06:08 2009
        From: superstippi at gmx.de (=?ISO-8859-1?Q?Stephan_A=DFmus?=)
        Date: Thu, 14 May 2009 20:06:08 +0200
        Subject: [Haiku-commits]
        	r30705	-	haiku/trunk/docs/userguide/en/installation
        In-Reply-To: <4A0C5AA0.1070605@googlemail.com>
        References: <200905111536.n4BFafSl014826@sheep.berlios.de>	<1e80d8750905110847u7b820493n15334f89d87495fb@mail.gmail.com>	<4A084C0A.1050809@googlemail.com>	<1e42d8c50905110913s19f548ceg4dff5f9696b9e630@mail.gmail.com>	<4A0C412D.9070201@googlemail.com>	<1e80d8750905141000y6dfa691chccc1f843bc14519d@mail.gmail.com>
        	<4A0C5AA0.1070605@googlemail.com>
        Message-ID: <4A0C5D90.1090508@gmx.de>
        
        Humdinger schrieb:
        > Urias McCullough wrote:
        >> While on that topic, it seems that the case is using the type, not the name?
        > 
        > Hmm, you mean this would avoid some confusion:
        > 
        > DefineBuildProfile dev-partition : disk : "/dev/sda7" ;
        > DefineBuildProfile test-virtual : vmware-image ;
        > 
        > switch $(HAIKU_BUILD_PROFILE) {
        > 	case "dev-partition" : {
        > 		AddOptionalHaikuImagePackages Development ;	
        > 	}
        > 
        > 
        > 	case "test-virtual" : {
        > 		HAIKU_IMAGE_SIZE = 900 ;
        > 	}
        > 
        > 
        > I never really thought about it... So that means, that these profiles inherit the config 
        > of "disk" or "vmware-image" and extend those with the options listed under the case statement?
        > Where are those "default" build profiles defined?
        
        Not quite, the "disk" and "vmware-image" strings are "keywords", ie they 
        are specific types of profiles known to the build system. See 
        UserBuildConfig.Readme for all known types.
        
        Best regards,
        -Stephan
        
        
        
        From humdingerb at googlemail.com  Thu May 14 20:20:20 2009
        From: humdingerb at googlemail.com (Humdinger)
        Date: Thu, 14 May 2009 20:20:20 +0200
        Subject: [Haiku-commits]
        	r30705	-	haiku/trunk/docs/userguide/en/installation
        In-Reply-To: <4A0C5D90.1090508@gmx.de>
        References: <200905111536.n4BFafSl014826@sheep.berlios.de>	<1e80d8750905110847u7b820493n15334f89d87495fb@mail.gmail.com>	<4A084C0A.1050809@googlemail.com>	<1e42d8c50905110913s19f548ceg4dff5f9696b9e630@mail.gmail.com>	<4A0C412D.9070201@googlemail.com>	<1e80d8750905141000y6dfa691chccc1f843bc14519d@mail.gmail.com>	<4A0C5AA0.1070605@googlemail.com>
        	<4A0C5D90.1090508@gmx.de>
        Message-ID: <4A0C60E4.3010008@googlemail.com>
        
        Stephan A?mus wrote:
        > Not quite, the "disk" and "vmware-image" strings are "keywords", ie they 
        > are specific types of profiles known to the build system. See 
        > UserBuildConfig.Readme for all known types.
        
        OK. I thought "DefineBuildProfile test-virtual : vmware-image ;" means I define a user 
        profile named "test-virtual" which has the stuff defined for the vmware-image profile plus 
        the stuff listed in the case statement.
        
        Maybe best to leave these build system details to someone more knowledgeable in that area. 
        Anyone, feel free to modify stuff.
        
        Regards,
        Humdinger
        
        -- 
        --=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-
        Deutsche Haiku News @ http://www.haiku-gazette.de
        
        
        From ingo_weinhold at gmx.de  Thu May 14 20:12:57 2009
        From: ingo_weinhold at gmx.de (Ingo Weinhold)
        Date: Thu, 14 May 2009 20:12:57 +0200
        Subject: [Haiku-commits] r30705
         -	haiku/trunk/docs/userguide/en/installation
        In-Reply-To: <4A0C5AA0.1070605@googlemail.com>
        References: <200905111536.n4BFafSl014826@sheep.berlios.de>
        	<1e80d8750905110847u7b820493n15334f89d87495fb@mail.gmail.com>
        	<4A084C0A.1050809@googlemail.com>
        	<1e42d8c50905110913s19f548ceg4dff5f9696b9e630@mail.gmail.com>
        	<4A0C412D.9070201@googlemail.com>
        	<1e80d8750905141000y6dfa691chccc1f843bc14519d@mail.gmail.com>
        	<4A0C5AA0.1070605@googlemail.com>
        Message-ID: <20090514201257.368.1@knochen-vm.localdomain>
        
        
        On 2009-05-14 at 19:53:36 [+0200], Humdinger  
        wrote:
        > Urias McCullough wrote:
        > > While on that topic, it seems that the case is using the type, not the 
        > > name?
        > 
        > Hmm, you mean this would avoid some confusion:
        > 
        > DefineBuildProfile dev-partition : disk : "/dev/sda7" ;
        > DefineBuildProfile test-virtual : vmware-image ;
        > 
        > switch $(HAIKU_BUILD_PROFILE) {
        >     case "dev-partition" : {
        >         AddOptionalHaikuImagePackages Development ;    
        >     }
        > 
        > 
        >     case "test-virtual" : {
        >         HAIKU_IMAGE_SIZE = 900 ;
        >     }
        > 
        > 
        > I never really thought about it...
        
        While this makes clearer which is the build profile name and which the type, 
        longer names are obviously less handy to use.
        
        > So that means, that these profiles 
        > inherit the config
        > of "disk" or "vmware-image" and extend those with the options listed under 
        > the case statement?
        
        Close, but not quite. When you define a build profile, you specify its type, 
        which implies a basic config and build actions (e.g. "disk" never zeroes the 
        image, "install" doesn't support the "mount" action). There are three 
        default build profiles named like the types "image", "vmware-image", 
        "install", which are just defined without any further configuration (i.e. 
        the default values are used for image name, dir, size, etc. -- unless the 
        respective variables are globally set).
        
        > Where are those "default" build profiles defined?
        
        The default build profiles are defined at the end of Jamrules. The build 
        profile types are handled in the DefineBuildProfile rule in 
        build/jam/MiscRules.
        
        CU, Ingo
        
        
        From jonas at kirilla.com  Thu May 14 22:57:19 2009
        From: jonas at kirilla.com (Jonas =?iso-8859-1?q?Sundstr=F6m?=)
        Date: Thu, 14 May 2009 22:57:19 +0200 CEST
        Subject: [Haiku-commits] r30759 - haiku/trunk/src/bin
        In-Reply-To: <2282129403-BeMail@zon>
        Message-ID: <5230539062-BeMail@kirilla>
        
        "Axel D?rfler"  wrote:
        > "Jonas Sundstr?m"  wrote:
        > [...]
        > It does belong into neither class. It's *always* 
        > up to the application to show a dialog; you cannot
        > know in what context BUrl is used, and you should
        > not make any assumptions.
        
        That's what the boolean argument to the OpenWith...
        method is for: with or without dialog. If the app
        doesn't want a user dialog it can say so, and just
        check the return value.
        
        It could be made asynchronous optionally, so the
        application thread does not have to wait on the 
        user dialog. Unless it wants to.
        
        Leaving every application to roll their own dialog,
        well.. 
        
        Take AboutSystem. No feedback on a failed URL open.
        (IIRC no mouse-over indication on links. No visual
        click indication.) Not the ideal user experience.
        
        /Jonas.
        
        
        
        From mmu_man at mail.berlios.de  Fri May 15 02:10:33 2009
        From: mmu_man at mail.berlios.de (mmu_man at BerliOS)
        Date: Fri, 15 May 2009 02:10:33 +0200
        Subject: [Haiku-commits] r30763 - haiku/trunk/src/data/beos_mime/application
        Message-ID: <200905150010.n4F0AXtL001064@sheep.berlios.de>
        
        Author: mmu_man
        Date: 2009-05-15 02:10:32 +0200 (Fri, 15 May 2009)
        New Revision: 30763
        ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30763&view=rev
        
        Added:
           haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.gopher
        Log:
        Mozilla handles gopher: urls very well btw :P
        
        
        Added: haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.gopher
        ===================================================================
        --- haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.gopher	2009-05-14 17:44:49 UTC (rev 30762)
        +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.gopher	2009-05-15 00:10:32 UTC (rev 30763)
        @@ -0,0 +1,11 @@
        +
        +resource(0, "BEOS:TYPE") #'MIMS' "application/x-vnd.Be-meta-mime";
        +
        +resource(1, "META:TYPE") "application/x-vnd.Be.URL.gopher";
        +
        +resource(2, "META:S:DESC") #'MSDC' "Gopher URL";
        +
        +resource(3, "META:L:DESC") #'MLDC' "Gopher Protocol URL";
        +
        +resource(4, "META:PREF_APP") #'MSIG' "application/x-vnd.Mozilla-Firefox";
        +
        
        
        
        From zooey at mail.berlios.de  Fri May 15 12:05:06 2009
        From: zooey at mail.berlios.de (zooey at BerliOS)
        Date: Fri, 15 May 2009 12:05:06 +0200
        Subject: [Haiku-commits] r30764 - haiku/trunk/src/kits/interface
        Message-ID: <200905151005.n4FA56Su021000@sheep.berlios.de>
        
        Author: zooey
        Date: 2009-05-15 12:05:05 +0200 (Fri, 15 May 2009)
        New Revision: 30764
        ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30764&view=rev
        
        Modified:
           haiku/trunk/src/kits/interface/TextView.cpp
        Log:
        * adjusted _HandleInputMethodChanged() to not blindly insert the string that
          has been given via the inline input method, but to feed the individual
          UTF8-characters it contains to KeyDown() - this way special keys like
          B_BACKSPACE and cursor keys will be handled correctly instead of producing
          a "unknown char rectangle"
        
        
        Modified: haiku/trunk/src/kits/interface/TextView.cpp
        ===================================================================
        --- haiku/trunk/src/kits/interface/TextView.cpp	2009-05-15 00:10:32 UTC (rev 30763)
        +++ haiku/trunk/src/kits/interface/TextView.cpp	2009-05-15 10:05:05 UTC (rev 30764)
        @@ -5250,22 +5250,52 @@
         		clauseCount++;
         	}
         
        -	int32 selectionStart = 0;
        -	int32 selectionEnd = 0;
        -	message->FindInt32("be:selection", 0, &selectionStart);
        -	message->FindInt32("be:selection", 1, &selectionEnd);
        +	if (confirmed) {
        +		_Refresh(fSelStart, fSelEnd, true, true);
        +		_ShowCaret();
         
        -	fInline->SetSelectionOffset(selectionStart);
        -	fInline->SetSelectionLength(selectionEnd - selectionStart);
        +		// now we need to feed ourselves the individual characters as if the
        +		// user would have pressed them now - this lets KeyDown() pick out all
        +		// the special characters like B_BACKSPACE, cursor keys and the like:
        +		const char* currPos = string;
        +		const char* prevPos = currPos;
        +		while (*currPos != '\0') {
        +			if ((*currPos & 0xC0) == 0xC0) {
        +				// found the start of an UTF-8 char, we collect while it lasts
        +				++currPos;
        +				while ((*currPos & 0xC0) == 0x80)
        +					++currPos;
        +			} else if ((*currPos & 0xC0) == 0x80) {
        +				// illegal: character starts with utf-8 intermediate byte, skip it
        +				prevPos = ++currPos;
        +			} else {
        +				// single byte character/code, just feed that
        +				++currPos;
        +			}
        +			KeyDown(prevPos, currPos - prevPos);
        +			prevPos = currPos;
        +		}
         
        -	const int32 inlineOffset = fInline->Offset();
        -	InsertText(string, stringLen, fSelStart, NULL);
        -	fSelStart += stringLen;
        -	fClickOffset = fSelEnd = fSelStart;
        +		_Refresh(fSelStart, fSelEnd, true, true);
        +	} else {
        +		// temporarily show transient state of inline input
        +		int32 selectionStart = 0;
        +		int32 selectionEnd = 0;
        +		message->FindInt32("be:selection", 0, &selectionStart);
        +		message->FindInt32("be:selection", 1, &selectionEnd);
         
        -	_Refresh(inlineOffset, fSelEnd, true, true);
        +		fInline->SetSelectionOffset(selectionStart);
        +		fInline->SetSelectionLength(selectionEnd - selectionStart);
         
        -	_ShowCaret();
        +		const int32 inlineOffset = fInline->Offset();
        +		InsertText(string, stringLen, fSelStart, NULL);
        +		fSelStart += stringLen;
        +		fClickOffset = fSelEnd = fSelStart;
        +
        +		_Refresh(inlineOffset, fSelEnd, true, true);
        +		_ShowCaret();
        +	}
        +
         }
         
         
        
        
        
        From zooey at mail.berlios.de  Fri May 15 12:10:49 2009
        From: zooey at mail.berlios.de (zooey at BerliOS)
        Date: Fri, 15 May 2009 12:10:49 +0200
        Subject: [Haiku-commits] r30765 -
        	haiku/trunk/src/add-ons/input_server/devices/keyboard
        Message-ID: <200905151010.n4FAAnZm022021@sheep.berlios.de>
        
        Author: zooey
        Date: 2009-05-15 12:10:47 +0200 (Fri, 15 May 2009)
        New Revision: 30765
        ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30765&view=rev
        
        Modified:
           haiku/trunk/src/add-ons/input_server/devices/keyboard/Keymap.cpp
        Log:
        * if a dead key sequence does not produce a special character as defined by
          the dead key character map - both the dead key itself and the following
          character are being sent. 
          R5 seems to do the same, at least the resulting behaviour in the terminal
          is now identical: e.g. if you press ^ once, you see nothing, if you press ^ a
          second time, you see '^^'.
        
        
        Modified: haiku/trunk/src/add-ons/input_server/devices/keyboard/Keymap.cpp
        ===================================================================
        --- haiku/trunk/src/add-ons/input_server/devices/keyboard/Keymap.cpp	2009-05-15 10:05:05 UTC (rev 30764)
        +++ haiku/trunk/src/add-ons/input_server/devices/keyboard/Keymap.cpp	2009-05-15 10:10:47 UTC (rev 30765)
        @@ -21,7 +21,7 @@
         #include 
         
         
        -static void 
        +static void
         print_key(char *chars, int32 offset)
         {
         	int size = chars[offset++];
        @@ -62,9 +62,9 @@
         void
         Keymap::DumpKeymap()
         {
        -	// Print a chart of the normal, shift, option, and option+shift 
        -	// keys. 
        -	printf("Key #\tNormal\tShift\tCaps\tC+S\tOption\tO+S\tO+C\tO+C+S\tControl\n"); 
        +	// Print a chart of the normal, shift, option, and option+shift
        +	// keys.
        +	printf("Key #\tNormal\tShift\tCaps\tC+S\tOption\tO+S\tO+C\tO+C+S\tControl\n");
         
         	for (int i = 0; i < 128; i++) {
         		printf(" 0x%x\t", i);
        @@ -102,10 +102,10 @@
         }
         
         
        -/* we need to know if a key is a modifier key to choose 
        +/* we need to know if a key is a modifier key to choose
         	a valid key when several are pressed together
         */
        -bool 
        +bool
         Keymap::IsModifierKey(uint32 keyCode)
         {
         	return keyCode == fKeys.caps_key
        @@ -124,7 +124,7 @@
         
         
         //! We need to know a modifier for a key
        -uint32 
        +uint32
         Keymap::Modifier(uint32 keyCode)
         {
         	if (keyCode == fKeys.caps_key)
        @@ -197,7 +197,7 @@
         
         	int32 offset;
         	uint32 tableMask = 0;
        -	
        +
         	switch (modifiers & 0xcf) {
         		case B_SHIFT_KEY: offset = fKeys.shift_map[keyCode]; tableMask = B_SHIFT_TABLE; break;
         		case B_CAPS_LOCK: offset = fKeys.caps_map[keyCode]; tableMask = B_CAPS_TABLE; break;
        @@ -217,9 +217,9 @@
         	if (!numBytes)
         		return 0;
         
        -	char chars[4];	
        +	char chars[4];
         	strncpy(chars, &(fChars[offset+1]), numBytes );
        -	chars[numBytes] = 0; 
        +	chars[numBytes] = 0;
         
         	int32 deadOffsets[] = {
         		fKeys.acute_dead_key[1],
        @@ -227,7 +227,7 @@
         		fKeys.circumflex_dead_key[1],
         		fKeys.dieresis_dead_key[1],
         		fKeys.tilde_dead_key[1]
        -	}; 
        +	};
         
         	uint32 deadTables[] = {
         		fKeys.acute_tables,
        @@ -277,7 +277,7 @@
         	}
         
         	if (offset <= 0 || offset > fCharsSize)
        -		return false;	
        +		return false;
         
         	uint32 numBytes = fChars[offset];
         	if (!numBytes)
        @@ -291,7 +291,7 @@
         		fKeys.tilde_dead_key
         	};
         
        -	int32 *deadOffset = deadOffsets[activeDeadKey-1]; 
        +	int32 *deadOffset = deadOffsets[activeDeadKey-1];
         
         	for (int32 i=0; i<32; i++) {
         		if (offset == deadOffset[i])
        @@ -414,19 +414,23 @@
         				}
         			}
         			return;
        -		}		
        +		}
         		i++;
         	}
         
        -	// if not found we return the current char mapped	
        -	*chars = new (std::nothrow) char[*numBytes + 1];
        +	// if not found we return the whole sequence (the dead key itself plus
        +	// the following char)
        +	int32 deadKeyNumBytes = fChars[deadKey[1]];
        +	int32 fullNumBytes = deadKeyNumBytes + *numBytes;
        +	*chars = new (std::nothrow) char[fullNumBytes + 1];
         	if (*chars == NULL) {
         		*numBytes = 0;
         		return;
         	}
        -
        -	strncpy(*chars, &(fChars[offset + 1]), *numBytes );
        -	(*chars)[*numBytes] = 0; 	
        +	strncpy(*chars, &fChars[deadKey[1] + 1], deadKeyNumBytes);
        +	strncpy(*chars + deadKeyNumBytes, &fChars[offset + 1], *numBytes);
        +	*numBytes = fullNumBytes;
        +	(*chars)[fullNumBytes] = 0;
         }
         
         
        
        
        
        From korli at users.berlios.de  Fri May 15 12:36:05 2009
        From: korli at users.berlios.de (=?ISO-8859-1?B?Suly9G1lIER1dmFs?=)
        Date: Fri, 15 May 2009 12:36:05 +0200
        Subject: [Haiku-commits] r30721 - haiku/trunk/src/preferences/keymap
        In-Reply-To: <200905121849.n4CInXd5010680@sheep.berlios.de>
        References: <200905121849.n4CInXd5010680@sheep.berlios.de>
        Message-ID: 
        
        2009/5/12 zooey at BerliOS :
        >
        > ? ? ? ?ssize_t bytesWritten = file.Write(&fKeys, sizeof(fKeys));
        > - ? ? ? if (bytesWritten < (ssize_t)sizeof(fKeys)) {
        > - ? ? ? ? ? ? ? if (bytesWritten < 0)
        > - ? ? ? ? ? ? ? ? ? ? ? return bytesWritten;
        > - ? ? ? ? ? ? ? return B_IO_ERROR;
        > - ? ? ? }
        > + ? ? ? if (bytesWritten < (ssize_t)sizeof(fKeys))
        > + ? ? ? ? ? ? ? status = bytesWritten < 0 ? bytesWritten : B_IO_ERROR;
        >
        
        Isn't this use of tertiary operator forbidden or discouraged in our
        coding guidelines ?
        
        Bye,
        Jerome
        
        
        From ingo_weinhold at gmx.de  Fri May 15 13:28:16 2009
        From: ingo_weinhold at gmx.de (Ingo Weinhold)
        Date: Fri, 15 May 2009 13:28:16 +0200
        Subject: [Haiku-commits] r30721 - haiku/trunk/src/preferences/keymap
        In-Reply-To: 
        References: <200905121849.n4CInXd5010680@sheep.berlios.de>
        	
        Message-ID: <20090515132816.376.1@knochen-vm.localdomain>
        
        
        On 2009-05-15 at 12:36:05 [+0200], J?r?me Duval  
        wrote:
        > 2009/5/12 zooey at BerliOS :
        > >
        > >        ssize_t bytesWritten = file.Write(&fKeys, sizeof(fKeys));
        > > -       if (bytesWritten < (ssize_t)sizeof(fKeys)) {
        > > -               if (bytesWritten < 0)
        > > -                       return bytesWritten;
        > > -               return B_IO_ERROR;
        > > -       }
        > > +       if (bytesWritten < (ssize_t)sizeof(fKeys))
        > > +               status = bytesWritten < 0 ? bytesWritten : B_IO_ERROR;
        > >
        > 
        > Isn't this use of tertiary operator forbidden or discouraged in our
        > coding guidelines ?
        
        Nope.
        
        CU, Ingo
        
        
        From ingo_weinhold at gmx.de  Fri May 15 13:41:37 2009
        From: ingo_weinhold at gmx.de (Ingo Weinhold)
        Date: Fri, 15 May 2009 13:41:37 +0200
        Subject: [Haiku-commits] r30759 - haiku/trunk/src/bin
        In-Reply-To: <5230539062-BeMail@kirilla>
        References: <5230539062-BeMail@kirilla>
        Message-ID: <20090515134137.538.2@knochen-vm.localdomain>
        
        
        On 2009-05-14 at 22:57:19 [+0200], Jonas Sundstr?m  
        wrote:
        > "Axel D?rfler"  wrote:
        > > "Jonas Sundstr?m"  wrote:
        > > [...]
        > > It does belong into neither class. It's *always*
        > > up to the application to show a dialog; you cannot
        > > know in what context BUrl is used, and you should
        > > not make any assumptions.
        > 
        > That's what the boolean argument to the OpenWith...
        > method is for: with or without dialog. If the app
        > doesn't want a user dialog it can say so, and just
        > check the return value.
        > 
        > It could be made asynchronous optionally, so the
        > application thread does not have to wait on the
        > user dialog. Unless it wants to.
        > 
        > Leaving every application to roll their own dialog,
        > well..
        
        No one said that the functionality shouldn't be provided, it's just a 
        question of good design, how that is done. I would image BUrl to be a 
        simple support class that deals with the syntactical aspect of URLs (as 
        known from other frameworks) and provide other features that use URLs 
        elsewhere -- e.g. application launching belongs to BRoster. Regarding the 
        dialog, if it is complex enough, make it a separate class or function.
        
        > Take AboutSystem. No feedback on a failed URL open.
        > (IIRC no mouse-over indication on links. No visual
        > click indication.) Not the ideal user experience.
        
        Great, we have a volunteer! :-)
        
        CU, Ingo
        
        
        From superstippi at gmx.de  Fri May 15 14:02:09 2009
        From: superstippi at gmx.de (=?ISO-8859-1?Q?Stephan_A=DFmus?=)
        Date: Fri, 15 May 2009 14:02:09 +0200
        Subject: [Haiku-commits] r30759 - haiku/trunk/src/bin
        In-Reply-To: <20090515134137.538.2@knochen-vm.localdomain>
        References: <5230539062-BeMail@kirilla>
        	<20090515134137.538.2@knochen-vm.localdomain>
        Message-ID: <4A0D59C1.1010900@gmx.de>
        
        Ingo Weinhold schrieb:
        > On 2009-05-14 at 22:57:19 [+0200], Jonas Sundstr?m  
        > wrote:
        >> "Axel D?rfler"  wrote:
        >>> "Jonas Sundstr?m"  wrote:
        >>> [...]
        >>> It does belong into neither class. It's *always*
        >>> up to the application to show a dialog; you cannot
        >>> know in what context BUrl is used, and you should
        >>> not make any assumptions.
        >> That's what the boolean argument to the OpenWith...
        >> method is for: with or without dialog. If the app
        >> doesn't want a user dialog it can say so, and just
        >> check the return value.
        >>
        >> It could be made asynchronous optionally, so the
        >> application thread does not have to wait on the
        >> user dialog. Unless it wants to.
        >>
        >> Leaving every application to roll their own dialog,
        >> well..
        > 
        > No one said that the functionality shouldn't be provided, it's just a 
        > question of good design, how that is done. I would image BUrl to be a 
        > simple support class that deals with the syntactical aspect of URLs (as 
        > known from other frameworks) and provide other features that use URLs 
        > elsewhere -- e.g. application launching belongs to BRoster. Regarding the 
        > dialog, if it is complex enough, make it a separate class or function.
        > 
        >> Take AboutSystem. No feedback on a failed URL open.
        >> (IIRC no mouse-over indication on links. No visual
        >> click indication.) Not the ideal user experience.
        > 
        > Great, we have a volunteer! :-)
        
        BTW, it does change the mouse cursor on mouse-over-url... I added that 
        some time ago. But it's not clear enough, it should be the same cursor 
        that Firefox uses for link targets to be more clear. We need to define 
        some system cursors... don't we? ;-) Also, it should probably underline 
        the link targets too at the same time (on mouse over, I mean).
        
        Best regards,
        -Stephan
        
        
        
        From stippi at mail.berlios.de  Fri May 15 20:19:11 2009
        From: stippi at mail.berlios.de (stippi at BerliOS)
        Date: Fri, 15 May 2009 20:19:11 +0200
        Subject: [Haiku-commits] r30766 - haiku/trunk/src/apps/drivesetup
        Message-ID: <200905151819.n4FIJBm9011048@sheep.berlios.de>
        
        Author: stippi
        Date: 2009-05-15 20:19:10 +0200 (Fri, 15 May 2009)
        New Revision: 30766
        ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30766&view=rev
        
        Modified:
           haiku/trunk/src/apps/drivesetup/MainWindow.cpp
           haiku/trunk/src/apps/drivesetup/MainWindow.h
        Log:
        * Adopt the Init menu to the currently available
          disk systems. For disk devices, we allow not only
          file systems, but any disk system. This gets us
          "Intel Partition Map" and "Intel Extended Partition".
          I managed to initialize a disk with Intel Partition
          Map this way.
        * I imported a large chunk of currently disabled code
          from Ingo's partitioner command line tool, which can
          eventually be used to create partitions in the empty
          space. I kept the "Create" menu still disabled, but
          the correct content types are actually retrieved already,
          which are "Intel Primary Partition" and "Intel Extended
          Partition".
        
        
        Modified: haiku/trunk/src/apps/drivesetup/MainWindow.cpp
        ===================================================================
        --- haiku/trunk/src/apps/drivesetup/MainWindow.cpp	2009-05-15 10:10:47 UTC (rev 30765)
        +++ haiku/trunk/src/apps/drivesetup/MainWindow.cpp	2009-05-15 18:19:10 UTC (rev 30766)
        @@ -5,6 +5,7 @@
          * Authors:
          *		Erik Jaesler 
          *		Ithamar R. Adema 
        + *		Ingo Weinhold 
          *		Stephan A?mus 
          */
         
        @@ -37,6 +38,32 @@
         #include 
         
         
        +//static void
        +//print_partition_table_header()
        +//{
        +	//printf("   Index     Start      Size                Content Type      "
        +		//"Content Name\n");
        +	//printf("--------------------------------------------------------------"
        +		//"------------\n");
        +//}
        +
        +
        +//static void
        +//print_partition(BPartition* partition, int level, int index)
        +//{
        +	//BString offset, size;
        +	//get_size_string(partition->Offset(), offset);
        +	//get_size_string(partition->Size(), size);
        +
        +	//printf("%*s%02d%*s  %8s  %8s  %26.26s  %16.16s\n", 2 * level, "",
        +		//index,
        +		//2 * max_c(3 - level, 0), "",
        +		//offset.String(), size.String(),
        +		//(partition->ContentType() ? partition->ContentType() : "-"),
        +		//(partition->ContentName() ? partition->ContentName() : ""));
        +//}
        +
        +
         class ListPopulatorVisitor : public BDiskDeviceVisitor {
         public:
         	ListPopulatorVisitor(PartitionListView* list, int32& diskCount,
        @@ -228,9 +255,6 @@
         
         	BDiskDeviceRoster().StartWatching(this);
         
        -	// populate the Initialiaze menu with the available file systems
        -	_ScanFileSystems();
        -
         	// visit all disks in the system and show their contents
         	_ScanDrives();
         
        @@ -270,7 +294,7 @@
         
         		case MSG_INITIALIZE: {
         			BString diskSystemName;
        -			if (message->FindString("format", &diskSystemName) != B_OK)
        +			if (message->FindString("disk system", &diskSystemName) != B_OK)
         				break;
         			_Initialize(fCurrentDisk, fCurrentPartitionID, diskSystemName);
         			break;
        @@ -388,35 +412,15 @@
         		= fListView->FindRow(fCurrentPartitionID);
         	if (previousSelection) {
         		fListView->AddToSelection(previousSelection);
        -		_EnabledDisableMenuItems(fCurrentDisk, fCurrentPartitionID,
        +		_UpdateMenus(fCurrentDisk, fCurrentPartitionID,
         			previousSelection->ParentID());
         		fDiskView->ForceUpdate();
         	} else {
        -		_EnabledDisableMenuItems(NULL, -1, -1);
        +		_UpdateMenus(NULL, -1, -1);
         	}
         }
         
         
        -void
        -MainWindow::_ScanFileSystems()
        -{
        -	while (BMenuItem* item = fInitMenu->RemoveItem(0L))
        -		delete item;
        -
        -	BDiskSystem diskSystem;
        -	fDDRoster.RewindDiskSystems();
        -	while (fDDRoster.GetNextDiskSystem(&diskSystem) == B_OK) {
        -		if (diskSystem.IsFileSystem() && diskSystem.SupportsInitializing()) {
        -			BMessage* message = new BMessage(MSG_INITIALIZE);
        -			message->AddString("format", diskSystem.PrettyName());
        -			BString label = diskSystem.PrettyName();
        -			label << B_UTF8_ELLIPSIS;
        -			fInitMenu->AddItem(new BMenuItem(label.String(), message));
        -		}
        -	}
        -}
        -
        -
         // #pragma mark -
         
         
        @@ -456,6 +460,8 @@
         MainWindow::_SetToDiskAndPartition(partition_id disk, partition_id partition,
         	partition_id parent)
         {
        +printf("MainWindow::_SetToDiskAndPartition(disk: %ld, partition: %ld, "
        +	"parent: %ld)\n", disk, partition, parent);
         	BDiskDevice* oldDisk = NULL;
         	if (!fCurrentDisk || fCurrentDisk->ID() != disk) {
         		oldDisk = fCurrentDisk;
        @@ -474,20 +480,27 @@
         	fCurrentPartitionID = partition;
         
         	fDiskView->SetDisk(fCurrentDisk, fCurrentPartitionID);
        -	_EnabledDisableMenuItems(fCurrentDisk, fCurrentPartitionID, parent);
        +	_UpdateMenus(fCurrentDisk, fCurrentPartitionID, parent);
         
         	delete oldDisk;
         }
         
         
         void
        -MainWindow::_EnabledDisableMenuItems(BDiskDevice* disk,
        +MainWindow::_UpdateMenus(BDiskDevice* disk,
         	partition_id selectedPartition, partition_id parentID)
         {
        -	// clean out Create menu
        +printf("MainWindow::_UpdateMenus(disk: %p, "
        +	"selectedPartition: %ld, parentID: %ld)\n", disk, selectedPartition,
        +	parentID);
        +
        +	// clean out Create and Init menu
         	while (BMenuItem* item = fCreateMenu->RemoveItem(0L))
         		delete item;
         
        +	while (BMenuItem* item = fInitMenu->RemoveItem(0L))
        +		delete item;
        +
         	if (!disk) {
         		fFormatMI->SetEnabled(false);
         		fEjectMI->SetEnabled(false);
        @@ -508,9 +521,45 @@
         		if (selectedPartition <= -2)
         			parentPartition = disk->FindDescendant(parentID);
         
        -		if (parentPartition) {
        -			bool prepared = disk->PrepareModifications() == B_OK;
        -			fCreateMenu->SetEnabled(true);
        +		BPartition* partition = disk->FindDescendant(selectedPartition);
        +		if (partition == NULL)
        +			partition = disk;
        +
        +		bool prepared = disk->PrepareModifications() == B_OK;
        +printf("  prepared: %d\n", prepared);
        +//		fCreateMenu->SetEnabled(prepared);
        +// TODO: Enable once _Create() is implemented...
        +fCreateMenu->SetEnabled(false);
        +		fInitMenu->SetEnabled(prepared);
        +
        +		BDiskSystem diskSystem;
        +		fDDRoster.RewindDiskSystems();
        +		while (fDDRoster.GetNextDiskSystem(&diskSystem) == B_OK) {
        +			if (!diskSystem.SupportsInitializing())
        +				continue;
        +
        +			if (disk->ID() != selectedPartition
        +				&& disk->ContainsPartitioningSystem()
        +				&& !diskSystem.IsFileSystem()) {
        +				// Do not confuse the user with nested partition maps?
        +				continue;
        +			}
        +			BMessage* message = new BMessage(MSG_INITIALIZE);
        +			message->AddInt32("parent id", parentID);
        +			message->AddString("disk system", diskSystem.PrettyName());
        +
        +			BString label = diskSystem.PrettyName();
        +			label << B_UTF8_ELLIPSIS;
        +			BMenuItem* item = new BMenuItem(label.String(), message);
        +
        +// TODO: Very unintuitive that we have to use the pretty name here!
        +//			item->SetEnabled(partition->CanInitialize(diskSystem.Name()));
        +			item->SetEnabled(partition->CanInitialize(diskSystem.PrettyName()));
        +			fInitMenu->AddItem(item);
        +		}
        +
        +		if (parentPartition != NULL) {
        +printf("  parent partition: %p\n", parentPartition);
         			BString supportedChildType;
         			int32 cookie = 0;
         			status_t ret;
        @@ -527,14 +576,15 @@
         			if (fCreateMenu->CountItems() == 0)
         				fprintf(stderr, "Failed to get supported child types: %s\n",
         					strerror(ret));
        -			if (prepared)
        -				disk->CancelModifications();
         		} else {
        +printf("  no parent partition\n");
         			fCreateMenu->SetEnabled(false);
         		}
         
        +		if (prepared)
        +			disk->CancelModifications();
        +
         		// Mount items
        -		BPartition* partition = disk->FindDescendant(selectedPartition);
         		if (partition) {
         			fInitMenu->SetEnabled(!partition->IsMounted());
         //			fDeleteMI->SetEnabled(!partition->IsMounted());
        @@ -744,7 +794,7 @@
         	fDDRoster.RewindDiskSystems();
         	bool found = false;
         	while (fDDRoster.GetNextDiskSystem(&diskSystem) == B_OK) {
        -		if (diskSystem.IsFileSystem() && diskSystem.SupportsInitializing()) {
        +		if (diskSystem.SupportsInitializing()) {
         			if (diskSystemName == diskSystem.PrettyName()) {
         				found = true;
         				break;
        @@ -762,7 +812,9 @@
         
         	// allow BFS only, since our parameter string
         	// construction only handles BFS at the moment
        -	if (diskSystemName != "Be File System") {
        +	if (diskSystemName != "Be File System"
        +		&& diskSystemName != "Intel Partition Map"
        +		&& diskSystemName != "Intel Extended Partition") {
         		_DisplayPartitionError("Don't know how to construct parameters "
         			"for this file system.");
         		return;
        @@ -778,14 +830,19 @@
         
         	// TODO: use partition initialization editor
         	// (partition->GetInitializationParameterEditor())
        -
         	BString name = partition->ContentName();
        -	if (name.Length() == 0)
        -		name = "Haiku";
         	BString parameters;
        -	InitParamsPanel* panel = new InitParamsPanel(this);
        -	if (panel->Go(name, parameters) == GO_CANCELED)
        -		return;
        +	if (diskSystemName == "Be File System") {
        +		if (name.Length() == 0)
        +			name = "Haiku";
        +		InitParamsPanel* panel = new InitParamsPanel(this);
        +		if (panel->Go(name, parameters) == GO_CANCELED)
        +			return;
        +	} else if (diskSystemName == "Intel Partition Map") {
        +		// TODO: parameters?
        +	} else if (diskSystemName == "Intel Extended Partition") {
        +		// TODO: parameters?
        +	}
         
         	bool supportsName = diskSystem.SupportsContentName();
         	BString validatedName(name);
        @@ -810,10 +867,16 @@
         	// everything looks fine, we are ready to actually write the changes
         	// to disk
         
        +	// Warn the user one more time...
         	message = "Are you sure you want to write the changes back to "
         		"disk now?\n\n";
        -	message << "All data on the partition \"" << previousName;
        -	message << "\" will be irrevertably lost if you do so!";
        +	if (partition->IsDevice())
        +		message << "All data on the disk";
        +	else
        +		message << "All data on the partition";
        +	if (previousName.Length() > 0)
        +		message << " \"" << previousName << "\"";
        +	message << " will be irrevertably lost if you do so!";
         	alert = new BAlert("final notice", message.String(),
         		"Write Changes", "Cancel", NULL, B_WIDTH_FROM_WIDEST, B_WARNING_ALERT);
         	choice = alert->Go();
        @@ -839,3 +902,215 @@
         	_ScanDrives();
         }
         
        +
        +void
        +MainWindow::_Create(BDiskDevice* disk, partition_id selectedPartition,
        +	const BString& partitionType)
        +{
        +	printf("_Create(disk: %p, selectedPartition: %ld)\n", disk,
        +		selectedPartition);
        +
        +	if (disk->IsReadOnly()) {
        +		_DisplayPartitionError("The selected disk is read-only.");
        +		return;
        +	}
        +
        +	//BPartition* partition = disk->FindDescendant(selectedPartition);
        +	//if (!partition) {
        +		//_DisplayPartitionError("Unable to find the selected partition by id.");
        +		//return;
        +	//}
        +
        +
        +#if 0
        +	// get the parent partition
        +	BPartition* partition = NULL;
        +	int32 partitionIndex;
        +	if (!_SelectPartition("parent partition index [-1 to abort]: ",
        +			partition, partitionIndex)) {
        +		return;
        +	}
        +
        +	printf("\nselected partition:\n\n");
        +	print_partition_table_header();
        +	print_partition(partition, 0, partitionIndex);
        +
        +	if (!partition->ContainsPartitioningSystem()) {
        +		printf("The selected partition does not contain a partitioning "
        +			"system.\n");
        +		return;
        +	}
        +
        +	// get supported types
        +	BObjectList supportedTypes(20, true);
        +	BString typeBuffer;
        +	int32 cookie = 0;
        +	while (partition->GetNextSupportedChildType(&cookie, &typeBuffer)
        +			== B_OK) {
        +		supportedTypes.AddItem(new BString(typeBuffer));
        +	}
        +
        +	if (supportedTypes.IsEmpty()) {
        +		printf("The partitioning system is not able to create any "
        +			"child partition (no supported types).\n");
        +		return;
        +	}
        +
        +	// get partitioning info
        +	BPartitioningInfo partitioningInfo;
        +	status_t error = partition->GetPartitioningInfo(&partitioningInfo);
        +	if (error != B_OK) {
        +		printf("Failed to get partitioning info for partition: %s\n",
        +			strerror(error));
        +		return;
        +	}
        +
        +	int32 spacesCount = partitioningInfo.CountPartitionableSpaces();
        +	if (spacesCount == 0) {
        +		printf("There's no space on the partition where a child partition "
        +			"could be created\n");
        +		return;
        +	}
        +
        +	// let the user select the partition type, if there's more than one
        +	int64 typeIndex = 0;
        +	int32 supportedTypesCount = supportedTypes.CountItems();
        +	if (supportedTypesCount > 1) {
        +		// list them
        +		printf("Possible partition types:\n");
        +		for (int32 i = 0; i < supportedTypesCount; i++)
        +			printf("%2ld  %s\n", i, supportedTypes.ItemAt(i)->String());
        +
        +		if (!_ReadNumber("supported type index [-1 to abort]: ", 0,
        +				supportedTypesCount - 1, -1, "invalid index", typeIndex)) {
        +			return;
        +		}
        +	}
        +
        +	const char* type = supportedTypes.ItemAt(typeIndex)->String();
        +
        +	// list partitionable spaces
        +	printf("Unused regions where the new partition could be created:\n");
        +	for (int32 i = 0; i < spacesCount; i++) {
        +		off_t _offset;
        +		off_t _size;
        +		partitioningInfo.GetPartitionableSpaceAt(i, &_offset, &_size);
        +		BString offset, size;
        +		get_size_string(_offset, offset);
        +		get_size_string(_size, size);
        +		printf("%2ld  start: %8s,  size:  %8s\n", i, offset.String(),
        +			size.String());
        +	}
        +
        +	// let the user select the partitionable space, if there's more than one
        +	int64 spaceIndex = 0;
        +	if (spacesCount > 1) {
        +		if (!_ReadNumber("unused region index [-1 to abort]: ", 0,
        +				spacesCount - 1, -1, "invalid index", spaceIndex)) {
        +			return;
        +		}
        +	}
        +
        +	off_t spaceOffset;
        +	off_t spaceSize;
        +	partitioningInfo.GetPartitionableSpaceAt(spaceIndex, &spaceOffset,
        +		&spaceSize);
        +
        +	off_t start;
        +	off_t size;
        +	BString parameters;
        +	while (true) {
        +		// let the user enter start, size, and parameters
        +
        +		// start
        +		while (true) {
        +			BString spaceOffsetString;
        +			get_size_string(spaceOffset, spaceOffsetString);
        +			BString prompt("partition start [default: ");
        +			prompt << spaceOffsetString << "]: ";
        +			if (!_ReadSize(prompt.String(), spaceOffset, start))
        +				return;
        +
        +			if (start >= spaceOffset && start <= spaceOffset + spaceSize)
        +				break;
        +
        +			printf("invalid partition start\n");
        +		}
        +
        +		// size
        +		off_t maxSize = spaceOffset + spaceSize - start;
        +		while (true) {
        +			BString maxSizeString;
        +			get_size_string(maxSize, maxSizeString);
        +			BString prompt("partition size [default: ");
        +			prompt << maxSizeString << "]: ";
        +			if (!_ReadSize(prompt.String(), maxSize, size))
        +				return;
        +
        +			if (size >= 0 && start + size <= spaceOffset + spaceSize)
        +				break;
        +
        +			printf("invalid partition size\n");
        +		}
        +
        +		// parameters
        +		if (!_ReadLine("partition parameters: ", parameters))
        +			return;
        +
        +		// validate parameters
        +		off_t validatedStart = start;
        +		off_t validatedSize = size;
        +// TODO: Support the name parameter!
        +		if (partition->ValidateCreateChild(&start, &size, type, NULL,
        +				parameters.String()) != B_OK) {
        +			printf("Validation of the given values failed. Sorry, can't "
        +				"continue.\n");
        +			return;
        +		}
        +
        +		// did the disk system change offset or size?
        +		if (validatedStart == start && validatedSize == size) {
        +			printf("Everything looks dandy.\n");
        +		} else {
        +			BString startString, sizeString;
        +			get_size_string(validatedStart, startString);
        +			get_size_string(validatedSize, sizeString);
        +			printf("The disk system adjusted the partition start and "
        +				"size to %lld (%s) and %lld (%s).\n",
        +				validatedStart, startString.String(), validatedSize,
        +				sizeString.String());
        +			start = validatedStart;
        +			size = validatedSize;
        +		}
        +
        +		// let the user decide whether to continue, change parameters, or
        +		// abort
        +		bool changeParameters = false;
        +		while (true) {
        +			BString line;
        +			_ReadLine("[c]ontinue, change [p]arameters, or [a]bort? ", line);
        +			if (line == "a")
        +				return;
        +			if (line == "p") {
        +				changeParameters = true;
        +				break;
        +			}
        +			if (line == "c")
        +				break;
        +
        +			printf("invalid input\n");
        +		}
        +
        +		if (!changeParameters)
        +			break;
        +	}
        +
        +	// create child
        +	error = partition->CreateChild(start, size, type, NULL,
        +		parameters.String());
        +	if (error != B_OK)
        +		printf("Creating the partition failed: %s\n", strerror(error));
        +#endif // 0
        +
        +	_ScanDrives();
        +}
        
        Modified: haiku/trunk/src/apps/drivesetup/MainWindow.h
        ===================================================================
        --- haiku/trunk/src/apps/drivesetup/MainWindow.h	2009-05-15 10:10:47 UTC (rev 30765)
        +++ haiku/trunk/src/apps/drivesetup/MainWindow.h	2009-05-15 18:19:10 UTC (rev 30766)
        @@ -44,13 +44,12 @@
         
         private:
         			void				_ScanDrives();
        -			void				_ScanFileSystems();
         
         			void				_AdaptToSelectedPartition();
         			void				_SetToDiskAndPartition(partition_id diskID,
         									partition_id partitionID,
         									partition_id parentID);
        -			void				_EnabledDisableMenuItems(BDiskDevice* disk,
        +			void				_UpdateMenus(BDiskDevice* disk,
         									partition_id selectedPartition,
         									partition_id parentID);
         
        @@ -67,6 +66,9 @@
         			void				_Initialize(BDiskDevice* disk,
         									partition_id selectedPartition,
         									const BString& diskSystemName);
        +			void				_Create(BDiskDevice* disk,
        +									partition_id selectedPartition,
        +									const BString& partitionType);
         
         
         			BDiskDeviceRoster	fDDRoster;
        
        
        
        From oruizdorantes at mail.berlios.de  Sat May 16 00:11:20 2009
        From: oruizdorantes at mail.berlios.de (oruizdorantes at BerliOS)
        Date: Sat, 16 May 2009 00:11:20 +0200
        Subject: [Haiku-commits] r30767 -
        	haiku/trunk/src/add-ons/kernel/drivers/bluetooth/h2/h2generic
        Message-ID: <200905152211.n4FMBKNx006184@sheep.berlios.de>
        
        Author: oruizdorantes
        Date: 2009-05-16 00:11:19 +0200 (Sat, 16 May 2009)
        New Revision: 30767
        ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30767&view=rev
        
        Modified:
           haiku/trunk/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2generic.c
           haiku/trunk/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2generic.h
           haiku/trunk/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2transactions.c
           haiku/trunk/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2upper.c
        Log:
        Style cleanup(or not making it worse), fix some statistics(Monni)
        
        Modified: haiku/trunk/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2generic.c
        ===================================================================
        --- haiku/trunk/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2generic.c	2009-05-15 18:19:10 UTC (rev 30766)
        +++ haiku/trunk/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2generic.c	2009-05-15 22:11:19 UTC (rev 30767)
        @@ -1,6 +1,6 @@
         /*
          * Copyright 2007 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
        - *
        + * Copyright 2008 Mika Lindqvist, monni1995_at_gmail.com
          * All rights reserved. Distributed under the terms of the MIT License.
          *
          */
        @@ -12,9 +12,8 @@
         #include 
         #include 
         #include 
        -#include 
        -#include 
         
        +
         #include "snet_buffer.h"
         
         #include 
        @@ -47,41 +46,46 @@
         struct net_buffer_module_info* nb = NULL;
         struct bluetooth_core_data_module_info* btCoreData = NULL;
         
        -/* Driver Global data */
        +// Driver Global data
         static char	 *publish_names[MAX_BT_GENERIC_USB_DEVICES];
         
        -int32 		dev_count = 0;	/* number of connected devices */
        -static bt_usb_dev*	bt_usb_devices[MAX_BT_GENERIC_USB_DEVICES];
        -sem_id 		dev_table_sem = -1; /* sem to synchronize access to device table */
        +int32 dev_count = 0; // number of connected devices
        +static bt_usb_dev* bt_usb_devices[MAX_BT_GENERIC_USB_DEVICES];
        +sem_id dev_table_sem = -1; // sem to synchronize access to device table
         
         status_t submit_nbuffer(hci_id hid, net_buffer* nbuf);
         
         usb_support_descriptor supported_devices[] =
         {
        -    /* Generic Bluetooth USB device */
        -    /* Class, SubClass, and Protocol codes that describe a Bluetooth device */
        +    // Generic Bluetooth USB device
        +    // Class, SubClass, and Protocol codes that describe a Bluetooth device
         	{ UDCLASS_WIRELESS, UDSUBCLASS_RF, UDPROTO_BLUETOOTH , 0 , 0 },
         
        -    /* Generic devices	*/
        -	/* Broadcom BCM2035 */
        +	// Broadcom BCM2035
         	{ 0, 0, 0, 0x0a5c, 0x200a },
         	{ 0, 0, 0, 0x0a5c, 0x2009 },
         
        -	/* Devices taken from the linux Driver */
        -	/* AVM BlueFRITZ! USB v2.0 */
        +	// Devices taken from the linux Driver
        +	// AVM BlueFRITZ! USB v2.0
         	{ 0, 0, 0, 0x057c   , 0x3800 },
        -	/* Bluetooth Ultraport Module from IBM */
        +	// Bluetooth Ultraport Module from IBM
         	{ 0, 0, 0, 0x04bf   , 0x030a },
        -	/* ALPS Modules with non-standard id */
        +	// ALPS Modules with non-standard id
         	{ 0, 0, 0, 0x044e   , 0x3001 },
         	{ 0, 0, 0, 0x044e   , 0x3002 },
        -	/* Ericsson with non-standard id */
        +	// Ericsson with non-standard id
         	{ 0, 0, 0, 0x0bdb   , 0x1002 }
         };
         
         /* add a device to the list of connected devices */
        +#ifdef HAIKU_TARGET_PLATFORM_HAIKU
         static bt_usb_dev*
        -spawn_device(const usb_device* usb_dev)
        +spawn_device(usb_device usb_dev)
        +#else
        +static bt_usb_dev*
        +spawn_device(usb_device* usb_dev)
        +#endif
        +
         {
         	int32 i;
         	status_t err = B_OK;
        @@ -89,7 +93,7 @@
         
         	flowf("add_device()\n");
         
        -	/* 16 usb dongles... u are unsane */
        +	// 16 usb dongles... 
         	if (dev_count >= MAX_BT_GENERIC_USB_DEVICES) {
         		flowf("device table full\n");
         		goto exit;
        @@ -97,11 +101,11 @@
         
         	/* try the allocation */
         	new_bt_dev = (bt_usb_dev*)malloc(sizeof(bt_usb_dev));
        -	if ( new_bt_dev == NULL ) {
        -		flowf("no memory allocating\n");
        +	if (new_bt_dev == NULL) {
        +		flowf("no memory\n");
         		goto exit;
         	}
        -	memset(new_bt_dev, 0, sizeof(bt_usb_dev) );
        +	memset(new_bt_dev, 0, sizeof(bt_usb_dev));
         
         	/* We will need this sem for some flow control */
         	new_bt_dev->cmd_complete = create_sem(1, BLUETOOTH_DEVICE_DEVFS_NAME "cmd_complete");
        @@ -210,8 +214,12 @@
         
         
         /* called by USB Manager when device is added to the USB */
        +#ifdef HAIKU_TARGET_PLATFORM_HAIKU
         static status_t
        -device_added(const usb_device* dev, void** cookie)
        +device_added(usb_device dev, void** cookie)
        +#else
        +device_added(usb_device* dev, void** cookie)
        +#endif
         {
         	const usb_interface_info* 		interface;
         	const usb_device_descriptor* 	desc;
        @@ -223,7 +231,7 @@
         	bt_usb_dev* new_bt_dev = spawn_device(dev);
             int e;
         
        -	debugf("device_added(%p, %p)\n", dev, new_bt_dev);
        +	debugf("device_added(%ld, %p)\n", dev, new_bt_dev);
         
         	if (new_bt_dev == NULL) {
         		flowf("Couldn't allocate device record.\n");
        @@ -358,13 +366,13 @@
                 return B_ERROR;
             }
         
        -	if (!TEST_AND_CLEAR(&bdev->state, RUNNING) ) {
        +	if (!TEST_AND_CLEAR(&bdev->state, RUNNING)) {
         		flowf(" wasnt running??\n");
         	}
         
         
         	flowf("Cancelling queues...\n");
        -	if ( bdev->intr_in_ep != NULL ) {
        +	if (bdev->intr_in_ep != NULL) {
         		usb->cancel_queued_transfers(bdev->intr_in_ep->handle);
         		flowf("Cancelling impossible EVENTS\n");
         	}
        @@ -455,7 +463,7 @@
         	}
         
         	// Set RUNNING
        -	if ( TEST_AND_SET(&bdev->state, ANCILLYANT) ) {
        +	if (TEST_AND_SET(&bdev->state, RUNNING)) {
         	    flowf("dev already running! - reOpened device!\n");
         	    return B_ERROR;
         	}
        @@ -486,7 +494,7 @@
         		//	TODO: Fill the transport descriptor
         	    err = btDevices->init_device(bdev->name, &ndev);
         		
        -    	if ( err == B_OK ) {
        +    	if (err == B_OK) {
             		bdev->hdev = hdev = ndev->index; // get the index
             		bdev->ndev = ndev;  // get the net_device
         
        @@ -645,7 +653,7 @@
         			#if BT_DRIVER_SUPPORTS_ACL // ACL
         			for (i = 0; i < MAX_ACL_IN_WINDOW; i++) {
         				err = submit_rx_acl(bdev);
        -				if (err != B_OK && i == 0 ) {
        +				if (err != B_OK && i == 0) {
         	  			    CLEAR_BIT(bdev->state, ANCILLYANT);	// Set the flaq in the HCI world
         					flowf("Queuing failed device stops running\n");
         					break;
        
        Modified: haiku/trunk/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2generic.h
        ===================================================================
        --- haiku/trunk/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2generic.h	2009-05-15 18:19:10 UTC (rev 30766)
        +++ haiku/trunk/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2generic.h	2009-05-15 22:11:19 UTC (rev 30767)
        @@ -12,7 +12,12 @@
         #include 
         
         #include 
        +#ifdef HAIKU_TARGET_PLATFORM_HAIKU
        +#include 
        +#else
        +#include 
         #include 
        +#endif
         
         #include 
         #include 
        @@ -54,7 +59,11 @@
         typedef struct bt_usb_dev bt_usb_dev;
         
         struct bt_usb_dev {
        -	const usb_device*		dev;          /* opaque handle */
        +#ifdef HAIKU_TARGET_PLATFORM_HAIKU
        +	usb_device		dev;          /* opaque handle */
        +#else
        +	usb_device*		dev;          /* opaque handle */
        +#endif
         	hci_id					hdev;		  /* HCI device id*/	
         	struct net_device*		ndev;
         	
        
        Modified: haiku/trunk/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2transactions.c
        ===================================================================
        --- haiku/trunk/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2transactions.c	2009-05-15 18:19:10 UTC (rev 30766)
        +++ haiku/trunk/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2transactions.c	2009-05-15 22:11:19 UTC (rev 30767)
        @@ -1,8 +1,7 @@
         /*
          * Copyright 2007 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
        - *
        + * Copyright 2008 Mika Lindqvist, monni1995_at_gmail.com
          * All rights reserved. Distributed under the terms of the MIT License.
        - *
          */
         
         #include "h2generic.h"
        @@ -38,13 +37,13 @@
         
         
         static status_t
        -assembly_rx(bt_usb_dev* bdev, bt_packet_t type, void *data, int count)
        +assembly_rx(bt_usb_dev* bdev, bt_packet_t type, void* data, int count)
         {
        -	net_buffer*		nbuf = NULL;
        -	snet_buffer*	snbuf = NULL;
        +	net_buffer* nbuf = NULL;
        +	snet_buffer* snbuf = NULL;
         
        -	size_t      currentPacketLen = 0;
        -	size_t      expectedPacketLen = 0;
        +	size_t currentPacketLen = 0;
        +	size_t expectedPacketLen = 0;
         
         	bdev->stat.bytesRX += count;
         
        @@ -55,43 +54,41 @@
         
         	while (count) {
         
        -		//debugf("count %d nb=%p sb=%p type=%d\n",count, nbuf, snbuf, type);
        +		//debugf("count %d nb=%p sb=%p type=%d\n", count, nbuf, snbuf, type);
         
        -		if ( (type != BT_EVENT && nbuf == NULL) ||
        -			(type == BT_EVENT && (snbuf == NULL || snb_completed(snbuf))) ) {
        +		if ((type != BT_EVENT && nbuf == NULL) 
        +			|| (type == BT_EVENT && (snbuf == NULL || snb_completed(snbuf)))) {
         
         			/* new buffer incoming */
         			switch (type) {
         				case BT_EVENT:
         					if (count >= HCI_EVENT_HDR_SIZE) {
        -
         						struct hci_event_header* headerPkt = data;
         						expectedPacketLen = HCI_EVENT_HDR_SIZE + headerPkt->elen;
        -						snbuf = bdev->eventRx = snb_fetch(&bdev->snetBufferRecycleTrash, expectedPacketLen);
        -
        +						snbuf = bdev->eventRx = snb_fetch(&bdev->snetBufferRecycleTrash, 
        +							expectedPacketLen);
         					} else {
         						flowf("EVENT frame corrupted\n");
         						return EILSEQ;
         					}
        -				break;
        +					break;
         
         				case BT_ACL:
         					if (count >= HCI_ACL_HDR_SIZE) {
         						int16 index;
         						struct hci_acl_header* headerPkt = data;
         
        -						expectedPacketLen = HCI_ACL_HDR_SIZE + B_LENDIAN_TO_HOST_INT16(headerPkt->alen);
        +						expectedPacketLen = HCI_ACL_HDR_SIZE
        +							+ B_LENDIAN_TO_HOST_INT16(headerPkt->alen);
         
        -						/* Create the buffer */
        +						// Create the buffer -> TODO: this allocation can fail
         						bdev->nbufferRx[type] = nbuf = nb->create(expectedPacketLen);
        -						// TODO: this allocation can fail!!
         						nbuf->protocol = type;
        -						debugf("new ACL frame %p\n", nbuf);
        -						debugf("### Incoming ACL: len = %d\n", count);
        -						for (index = 0 ; index < count; index++ ) {
        +
        +						debugf("## Incoming ACL frame %p len = %d ", nbuf, count);
        +						for (index = 0 ; index < count; index++)
         							dprintf("%x:",((uint8*)data)[index]);
        -						}
        -						flowf("### \n");
        +						dprintf(" ## \n");
         
         					} else {
         						flowf("ACL frame corrupted\n");
        @@ -104,14 +101,14 @@
         				break;
         
         				default:
        -					panic("unkown packet type in assembly");
        +					panic("unknown packet type in assembly");
         				break;
         			}
         
         			currentPacketLen = expectedPacketLen;
         
         		} else {
        -			/* Continuation */
        +			// Continuation of a packet
         			if (type != BT_EVENT)
         				currentPacketLen = get_expected_size(nbuf) - nbuf->size;
         			else
        @@ -125,20 +122,22 @@
         		else
         			nb->append(nbuf, data, currentPacketLen);
         
        -		/* Complete frame? */
        +		// Complete frame?
         		if (type == BT_EVENT && snb_completed(snbuf)) {
         			post_packet_up(bdev, type, snbuf);
         			snbuf = bdev->eventRx = NULL;
         		}
         
         		if (type != BT_EVENT && (get_expected_size(nbuf) - nbuf->size) == 0 ) {
        -
         			post_packet_up(bdev, type, nbuf);
         			bdev->nbufferRx[type] = nbuf = NULL;
        -		} /*else {
        +		} else {
        +#if DEBUG_ACL
         			if (type == BT_ACL)
        -				debugf("ACL Packet not filled size=%ld expected=%ld\n", nbuf->size, get_expected_size(nbuf));
        -		}*/
        +				debugf("ACL Packet not filled size=%ld expected=%ld\n",
        +					nbuf->size, get_expected_size(nbuf));
        +#endif					
        +		}
         
         		/* in case in the pipe there is info about the next buffer ... */
         		count -= currentPacketLen;
        @@ -162,16 +161,19 @@
         #endif
         {
         	bt_usb_dev* bdev = cookie;
        -	status_t    err;
        +	//bt_usb_dev* bdev = fetch_device(cookie, 0); -> safer/slower option
        +	status_t    error;
         
        -	/* TODO: or not running anymore */
        -	if (status == B_CANCELED)
        +	if (bdev == NULL)
         		return;
         
        +	if (status == B_CANCELED) // or not running anymore...
        +		return;
        +
         	if (status != B_OK || actual_len == 0)
         		goto resubmit;
         
        -	if ( assembly_rx(cookie, BT_EVENT, data, actual_len) == B_OK ) {
        +	if (assembly_rx(cookie, BT_EVENT, data, actual_len) == B_OK) {
         		bdev->stat.successfulTX++;
         	} else {
         		bdev->stat.errorRX++;
        @@ -179,18 +181,16 @@
         
         resubmit:
         
        -	err = usb->queue_interrupt(bdev->intr_in_ep->handle,
        -							data, bdev->max_packet_size_intr_in ,
        -							event_complete, bdev);
        +	error = usb->queue_interrupt(bdev->intr_in_ep->handle, data, 
        +		bdev->max_packet_size_intr_in, event_complete, bdev);
         
        -	if (err != B_OK)   {
        +	if (error != B_OK) {
         		reuse_room(&bdev->eventRoom, data);
         		bdev->stat.rejectedRX++;
        -		debugf("RX event resubmittion failed %s\n",strerror(err));
        +		debugf("RX event resubmittion failed %s\n", strerror(error));
         	} else {
         		bdev->stat.acceptedRX++;
         	}
        -
         }
         
         
        @@ -202,12 +202,15 @@
         #endif
         {
         	bt_usb_dev* bdev = cookie;
        -	status_t    err;
        +	//bt_usb_dev* bdev = fetch_device(cookie, 0); -> safer/slower option
        +	status_t error;
         
        -	/* TODO: or not running anymore? */
        -	if (status == B_CANCELED)
        +	if (bdev == NULL)
         		return;
         
        +	if (status == B_CANCELED) // or not running anymore...
        +		return;
        +
         	if (status != B_OK || actual_len == 0)
         		goto resubmit;
         
        @@ -219,14 +222,14 @@
         
         resubmit:
         
        -	err = usb->queue_bulk(bdev->bulk_in_ep->handle, data,
        -						max(HCI_MAX_FRAME_SIZE,bdev->max_packet_size_bulk_in),
        -						acl_rx_complete, (void*) bdev);
        +	error = usb->queue_bulk(bdev->bulk_in_ep->handle, data,
        +		max(HCI_MAX_FRAME_SIZE, bdev->max_packet_size_bulk_in),	
        +		acl_rx_complete, (void*) bdev);
         
        -	if (err != B_OK)   {
        +	if (error != B_OK)   {
         		reuse_room(&bdev->aclRoom, data);
         		bdev->stat.rejectedRX++;
        -		debugf("RX acl resubmittion failed %s\n", strerror(err));
        +		debugf("RX acl resubmittion failed %s\n", strerror(error));
         	} else {
         		bdev->stat.acceptedRX++;
         	}
        @@ -239,16 +242,15 @@
         status_t
         submit_rx_event(bt_usb_dev* bdev)
         {
        -	status_t    status;
        -	size_t      size = bdev->max_packet_size_intr_in;
        -	void*       buf = alloc_room(&bdev->eventRoom, size);
        +	size_t size = bdev->max_packet_size_intr_in;
        +	void* buf = alloc_room(&bdev->eventRoom, size);
        +	status_t status;
         
         	if (buf == NULL)
         		return ENOMEM;
         
        -	status = usb->queue_interrupt(bdev->intr_in_ep->handle,
        -								buf, size ,
        -								event_complete, (void*) bdev);
        +	status = usb->queue_interrupt(bdev->intr_in_ep->handle,	buf, size,
        +		event_complete, (void*)bdev);
         
         	if (status != B_OK) {
         		reuse_room(&bdev->eventRoom, buf); // reuse allocated one
        @@ -264,19 +266,18 @@
         
         status_t
         submit_rx_acl(bt_usb_dev* bdev)
        -{
        +{	
        +	size_t size = max(HCI_MAX_FRAME_SIZE, bdev->max_packet_size_bulk_in);
        +	void* buf = alloc_room(&bdev->aclRoom, size);
        +	status_t status;
         
        -	status_t    status;
        -	size_t      size = max(HCI_MAX_FRAME_SIZE,bdev->max_packet_size_bulk_in);
        -	void*       buf = alloc_room(&bdev->aclRoom, size);
        -
         	if (buf == NULL)
         		return ENOMEM;
         
        -	status = usb->queue_bulk(bdev->bulk_in_ep->handle, buf, size ,
        -								acl_rx_complete, bdev);
        +	status = usb->queue_bulk(bdev->bulk_in_ep->handle, buf, size,
        +		acl_rx_complete, bdev);
         
        -	if (status != B_OK)   {
        +	if (status != B_OK) {
         		reuse_room(&bdev->aclRoom, buf); // reuse allocated
         		bdev->stat.rejectedRX++;
         	} else {
        @@ -290,12 +291,11 @@
         status_t
         submit_rx_sco(bt_usb_dev* bdev)
         {
        +
         	/* not yet implemented */
         	return B_ERROR;
         }
         
        -
        -
         #if 0
         #pragma mark --- TX Complete ---
         #endif
        @@ -307,18 +307,17 @@
         command_complete(void* cookie, status_t status, void* data, size_t actual_len)
         #endif
         {
        -	snet_buffer* snbuf = (snet_buffer*) cookie;
        +	snet_buffer* snbuf = (snet_buffer*)cookie;
         	bt_usb_dev* bdev = snb_cookie(snbuf);
         
        -	debugf("%ld @ %p\n", actual_len, data);
        +	debugf("len = %ld @%p\n", actual_len, data);
         
        -	if (status != B_OK) {
        +	if (status == B_OK) {
         		bdev->stat.successfulTX++;
         		bdev->stat.bytesTX += actual_len;
         	} else {
         		bdev->stat.errorTX++;
        -		/* the packet has been lost */
        -		/* too late to requeue it? */
        +		// the packet has been lost,too late to requeue it? 
         	}
         
         	snb_park(&bdev->snetBufferRecycleTrash, snbuf);
        @@ -337,19 +336,17 @@
         acl_tx_complete(void* cookie, status_t status, void* data, size_t actual_len)
         #endif
         {
        -	net_buffer* nbuf = (net_buffer*) cookie;
        +	net_buffer* nbuf = (net_buffer*)cookie;
         	bt_usb_dev* bdev = GET_DEVICE(nbuf);
         
         	debugf("fetched=%p status=%ld nbuftype %lx B%p\n",bdev, status, nbuf->type, data);
         
        -	if (status != B_OK) {
        -
        +	if (status == B_OK) {
         		bdev->stat.successfulTX++;
         		bdev->stat.bytesTX += actual_len;
         	} else {
         		bdev->stat.errorTX++;
        -		/* the packet has been lost */
        -		/* too late to requeue it? */
        +		// the packet has been lost,too late to requeue it?
         	}
         
         	nb_destroy(nbuf);
        @@ -365,14 +362,13 @@
         status_t
         submit_tx_command(bt_usb_dev* bdev, snet_buffer* snbuf)
         {
        -	status_t err;
        +	uint8 bRequestType = bdev->ctrl_req;
        +	uint8 bRequest = 0;
        +	uint16 wIndex = 0;
        +	uint16 value = 0;
        +	uint16 wLength = B_HOST_TO_LENDIAN_INT16(snb_size(snbuf));
        +	status_t error;	
         
        -	uint8   bRequestType = bdev->ctrl_req;
        -	uint8   bRequest = 0;
        -	uint16  wIndex = 0;
        -	uint16  value = 0;
        -	uint16  wLength = B_HOST_TO_LENDIAN_INT16(snb_size(snbuf));
        -
         	if (!GET_BIT(bdev->state, RUNNING)) {
         		return B_DEV_NOT_READY;
         	}
        @@ -382,30 +378,33 @@
         
         	debugf("@%p\n", snb_get(snbuf));
         
        -	err = usb->queue_request(bdev->dev, bRequestType, bRequest,
        -								value, wIndex, wLength,
        -								snb_get(snbuf), wLength //???
        -								,command_complete, (void*) snbuf);
        +	error = usb->queue_request(bdev->dev, bRequestType, bRequest,
        +								value, wIndex, wLength,	snb_get(snbuf),
        +#ifndef HAIKU_TARGET_PLATFORM_HAIKU								
        +								wLength, //???
        +#endif								
        +								command_complete, (void*) snbuf);
         
        -	if (err != B_OK )   {
        +	if (error != B_OK) {
         		bdev->stat.rejectedTX++;
         	} else {
         		bdev->stat.acceptedTX++;
         	}
         
        -	return err;
        +	return error;
         }
         
        +
         status_t
         submit_tx_acl(bt_usb_dev* bdev, net_buffer* nbuf)
         {
        -	status_t err;
         	int32 index;
        +	status_t error;
         
         	/* set cookie */
         	SET_DEVICE(nbuf, bdev->hdev);
         
        -	if (!GET_BIT(bdev->state, RUNNING) ) {
        +	if (!GET_BIT(bdev->state, RUNNING)) {
         		return B_DEV_NOT_READY;
         	}
         
        @@ -415,17 +414,16 @@
         	}
         	flowf("### \n");
         
        -	err = usb->queue_bulk(bdev->bulk_out_ep->handle,
        -						nb_get_whole_buffer(nbuf), nbuf->size,
        -						acl_tx_complete, (void*) nbuf);
        +	error = usb->queue_bulk(bdev->bulk_out_ep->handle, nb_get_whole_buffer(nbuf),
        +						nbuf->size,	acl_tx_complete, (void*)nbuf);
         
        -	if (err != B_OK )   {
        +	if (error != B_OK) {
         		bdev->stat.rejectedTX++;
         	} else {
         		bdev->stat.acceptedTX++;
         	}
         
        -	return err;
        +	return error;
         }
         
         
        
        Modified: haiku/trunk/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2upper.c
        ===================================================================
        --- haiku/trunk/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2upper.c	2009-05-15 18:19:10 UTC (rev 30766)
        +++ haiku/trunk/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2upper.c	2009-05-15 22:11:19 UTC (rev 30767)
        @@ -1,11 +1,9 @@
         /*
          * Copyright 2007 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
        - *
        + * Copyright 2008 Mika Lindqvist, monni1995_at_gmail.com
          * All rights reserved. Distributed under the terms of the MIT License.
        - *
          */
         
        -
         #include 
         
         #include 
        @@ -20,59 +18,61 @@
         #include 
         
         
        -/* TODO: split for commands and comunication(ACL&SCO) */
        +/* TODO: split for commands and comunication (ACL&SCO) */
         void 
         sched_tx_processing(bt_usb_dev* bdev)
        -{
        +{    
        +	net_buffer* nbuf;
        +	snet_buffer* snbuf;
        +	status_t err;
        +	
        +	debugf("(%p)\n", bdev)
             
        -    net_buffer* nbuf;
        -    snet_buffer* snbuf;
        -	status_t 	err;
        -	flowf("sched\n")    
             if (!TEST_AND_SET(&bdev->state, PROCESSING)) {
        -        /* We are not processing in another thread so... START!! */
        +        // We are not processing in another thread so... START!!
                         
                 do {
        -            /* Do while this bit is on... so someone should set it before we stop the iterations*/
        +            /* Do while this bit is on... so someone should set it before we
        +             * stop the iterations
        +             */
                     CLEAR_BIT(bdev->state, SENDING);
        -            /* check Commands*/
        +            // check Commands
             #ifdef EMPTY_COMMAND_QUEUE        
        -            while (!list_is_empty(&bdev->nbuffersTx[BT_COMMAND]) ) {            
        +            while (!list_is_empty(&bdev->nbuffersTx[BT_COMMAND])) {
             #else
        -            if (!list_is_empty(&bdev->nbuffersTx[BT_COMMAND]) ) {
        +            if (!list_is_empty(&bdev->nbuffersTx[BT_COMMAND])) {
             #endif            
                         snbuf = list_remove_head_item(&bdev->nbuffersTx[BT_COMMAND]);       
                         err = submit_tx_command(bdev, snbuf);
                         if (err != B_OK) {
        -                    /* re-head it*/
        +                    // re-head it
                             list_insert_item_before(&bdev->nbuffersTx[BT_COMMAND], 
        -                                            list_get_first_item(&bdev->nbuffersTx[BT_COMMAND]), snbuf);
        -                }                                                
        +							list_get_first_item(&bdev->nbuffersTx[BT_COMMAND]), snbuf);
        +                }
                     }
                     
        -            /* check Acl */
        +            // check ACl
             #define EMPTY_ACL_QUEUE
             #ifdef EMPTY_ACL_QUEUE
        -            while (!list_is_empty(&bdev->nbuffersTx[BT_ACL]) ) {
        +            while (!list_is_empty(&bdev->nbuffersTx[BT_ACL])) {
             #else            
        -            if (!list_is_empty(&bdev->nbuffersTx[BT_ACL]) ) {
        +            if (!list_is_empty(&bdev->nbuffersTx[BT_ACL])) {
             #endif             
                         nbuf = list_remove_head_item(&bdev->nbuffersTx[BT_ACL]);                
                         err = submit_tx_acl(bdev, nbuf);
                         if (err != B_OK) {
                             /* re-head it*/
                             list_insert_item_before(&bdev->nbuffersTx[BT_ACL], 
        -                                            list_get_first_item(&bdev->nbuffersTx[BT_ACL]), nbuf);
        -                }                                                                
        -                
        +							list_get_first_item(&bdev->nbuffersTx[BT_ACL]), nbuf);
        +                }
        +
                     }
        -    
        -            if (!list_is_empty(&bdev->nbuffersTx[BT_SCO]) ) {
        +
        +            if (!list_is_empty(&bdev->nbuffersTx[BT_SCO])) {
                         /* TODO to be implemented */    
        -                
        +
                     }
        -        
        -        
        +
                 } while (GET_BIT(bdev->state, SENDING));
                 
                 CLEAR_BIT(bdev->state, PROCESSING);
        @@ -81,28 +81,26 @@
                 /* We are processing so MARK that we need to still go on with that ... */    
                 SET_BIT(bdev->state, SENDING);
             }
        -
         }
         
        +
         status_t 
         post_packet_up(bt_usb_dev* bdev, bt_packet_t type, void* buf)
         {
        -    
        -    status_t err = B_OK;
        +    status_t err = B_ERROR;
         
         	debugf("Frame up type=%d\n", type);
        -            
        -	err = B_ERROR;
         
             if (type == BT_EVENT) {
        -		snet_buffer* snbuf = (snet_buffer*) buf;
        -		btCoreData->PostEvent(bdev->ndev, snb_get(snbuf), (size_t) snb_size(snbuf));
        +		snet_buffer* snbuf = (snet_buffer*)buf;
        +		flowf("to btDataCore\n");
        +		btCoreData->PostEvent(bdev->ndev, snb_get(snbuf), (size_t)snb_size(snbuf));
         		snb_park(&bdev->snetBufferRecycleTrash, snbuf);
         	} else {
         		net_buffer* nbuf = (net_buffer*) buf;
           		/* No need to free the buffer at allocation is gonna be reused */
        -  		flowf("HCI not present for acl posting to net_device\n");
        -		btDevices->receive_data(bdev->ndev, &nbuf);	
        +  		flowf("to net_device\n");
        +		btDevices->receive_data(bdev->ndev, &nbuf);
             }
         
             return err;
        @@ -133,7 +131,7 @@
                             bdev->nbuffersPendingTx[type]++;
                     break;
                     default:
        -                debugf("Unkown packet type for sending %d\n",type);
        +                debugf("Unknown packet type for sending %d\n",type);
                         // TODO: free the net_buffer -> no, allow upper layer 
                         // handle it with the given error
                         err = B_BAD_VALUE;
        @@ -144,9 +142,11 @@
             }
         
             // TODO: check if device is actually ready for this
        -    // TODO: unLock device
        +    // TODO: unlock device
                 
        -    /* sched in All cases even if nbuf is null (hidden way to provoke re-scheduling)*/
        +    /* sched in All cases even if nbuf is null (hidden way to provoke
        +     * re-scheduling)
        +     */
             sched_tx_processing(bdev);
             
             return err;
        @@ -178,7 +178,9 @@
             // TODO: check if device is actually ready for this
             // TODO: mutex?
                 
        -    /* sched in All cases even if nbuf is null (hidden way to provoke re-scheduling)*/
        +    /* sched in All cases even if nbuf is null (hidden way to provoke
        +     * re-scheduling)
        +     */
             sched_tx_processing(bdev);
             
             return err;
        
        
        
        From leavengood at gmail.com  Sat May 16 07:38:52 2009
        From: leavengood at gmail.com (Ryan Leavengood)
        Date: Sat, 16 May 2009 01:38:52 -0400
        Subject: [Haiku-commits] r30759 - haiku/trunk/src/bin
        In-Reply-To: <4A0D59C1.1010900@gmx.de>
        References: <5230539062-BeMail@kirilla>
        	<20090515134137.538.2@knochen-vm.localdomain>
        	<4A0D59C1.1010900@gmx.de>
        Message-ID: 
        
        On Fri, May 15, 2009 at 8:02 AM, Stephan A?mus  wrote:
        >
        > BTW, it does change the mouse cursor on mouse-over-url... I added that
        > some time ago. But it's not clear enough, it should be the same cursor
        > that Firefox uses for link targets to be more clear. We need to define
        > some system cursors... don't we? ;-)
        
        Yes definitely. There are quite some that would be useful in the
        WebKit port. Maybe whatever the Firefox port uses could be pulled out.
        
        > Also, it should probably underline
        > the link targets too at the same time (on mouse over, I mean).
        
        Maybe in the long term About System could be changed to use a future
        BHTMLView or similar that will hopefully come out of this browser
        project Maxime and I are working on. Otherwise it seems we are
        re-inventing some aspects of it. Not that mouse-over highlighting is
        that complicated, but why reinvent the wheel :)
        
        Also in regards to the idea of a BUrl class, again let's not reinvent
        the wheel but maybe use something from WebKit or Chrome.
        
        Regards,
        Ryan
        
        
        From stippi at mail.berlios.de  Sat May 16 13:29:25 2009
        From: stippi at mail.berlios.de (stippi at mail.berlios.de)
        Date: Sat, 16 May 2009 13:29:25 +0200
        Subject: [Haiku-commits] r30768 - in haiku/trunk/src/apps/mediaplayer: .
        	playlist
        Message-ID: <200905161129.n4GBTPwF004520@sheep.berlios.de>
        
        Author: stippi
        Date: 2009-05-16 13:29:19 +0200 (Sat, 16 May 2009)
        New Revision: 30768
        ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30768&view=rev
        
        Modified:
           haiku/trunk/src/apps/mediaplayer/ControllerView.cpp
           haiku/trunk/src/apps/mediaplayer/ControllerView.h
           haiku/trunk/src/apps/mediaplayer/MainWin.cpp
           haiku/trunk/src/apps/mediaplayer/playlist/ListViews.cpp
           haiku/trunk/src/apps/mediaplayer/playlist/ListViews.h
           haiku/trunk/src/apps/mediaplayer/playlist/Playlist.cpp
           haiku/trunk/src/apps/mediaplayer/playlist/Playlist.h
           haiku/trunk/src/apps/mediaplayer/playlist/PlaylistListView.cpp
           haiku/trunk/src/apps/mediaplayer/playlist/PlaylistListView.h
           haiku/trunk/src/apps/mediaplayer/playlist/PlaylistWindow.cpp
           haiku/trunk/src/apps/mediaplayer/playlist/PlaylistWindow.h
           haiku/trunk/src/apps/mediaplayer/playlist/RemovePLItemsCommand.cpp
           haiku/trunk/src/apps/mediaplayer/playlist/RemovePLItemsCommand.h
        Log:
        * I didn't like so much how the "Remove and Move into Trash" feature was
          implemented. It didn't reuse existing code and didn't integrate well. No
          Undo/Redo except via Tracker, but not in the Playlist... some bugs as well
          (Remove had same shortcut as Randomize, Didn't maintain current playback item
          if last entry was removed)
        * I need to reenable the main window short cut though. This is only temporary.
        
        
        Modified: haiku/trunk/src/apps/mediaplayer/ControllerView.cpp
        ===================================================================
        --- haiku/trunk/src/apps/mediaplayer/ControllerView.cpp	2009-05-15 22:11:19 UTC (rev 30767)
        +++ haiku/trunk/src/apps/mediaplayer/ControllerView.cpp	2009-05-16 11:29:19 UTC (rev 30768)
        @@ -136,16 +136,6 @@
         
         
         void
        -ControllerView::SkipForwardAndDelete()
        -{
        -	BAutolock _(fPlaylist);
        -	int32 index = fPlaylist->CurrentRefIndex();
        -	fPlaylist->SetCurrentRefIndex(index + 1);
        -	fPlaylist->RemoveRefPermanent(index, true);
        -}
        -
        -
        -void
         ControllerView::VolumeChanged(float value)
         {
         	fController->SetVolume(value);
        
        Modified: haiku/trunk/src/apps/mediaplayer/ControllerView.h
        ===================================================================
        --- haiku/trunk/src/apps/mediaplayer/ControllerView.h	2009-05-15 22:11:19 UTC (rev 30767)
        +++ haiku/trunk/src/apps/mediaplayer/ControllerView.h	2009-05-16 11:29:19 UTC (rev 30768)
        @@ -36,7 +36,7 @@
         						ControllerView(BRect frame, Controller* controller,
         							Playlist* playlist);
         						~ControllerView();
        -					
        +
         	// TransportControlGroup interface
         	virtual	uint32		EnabledButtons();
         	virtual	void		TogglePlaying();
        @@ -45,7 +45,6 @@
         	virtual	void		Forward();
         	virtual	void		SkipBackward();
         	virtual	void		SkipForward();
        -	virtual	void		SkipForwardAndDelete();
         	virtual	void		VolumeChanged(float value);
         	virtual	void		ToggleMute();
         	virtual	void		PositionChanged(float value);
        
        Modified: haiku/trunk/src/apps/mediaplayer/MainWin.cpp
        ===================================================================
        --- haiku/trunk/src/apps/mediaplayer/MainWin.cpp	2009-05-15 22:11:19 UTC (rev 30767)
        +++ haiku/trunk/src/apps/mediaplayer/MainWin.cpp	2009-05-16 11:29:19 UTC (rev 30768)
        @@ -63,7 +63,7 @@
         	M_FILE_INFO,
         	M_FILE_PLAYLIST,
         	M_FILE_CLOSE,
        -	M_FILE_QUIT,	
        +	M_FILE_QUIT,
         	M_VIEW_50,
         	M_VIEW_100,
         	M_VIEW_200,
        @@ -93,7 +93,7 @@
         	M_SELECT_VIDEO_TRACK_END	= 0x000fffff,
         
         	M_SET_PLAYLIST_POSITION,
        -	
        +
         	M_FILE_DELETE
         };
         
        @@ -131,7 +131,7 @@
         	static int pos = 0;
         	MoveBy(pos * 25, pos * 25);
         	pos = (pos + 1) % 15;
        -	
        +
         	BRect rect = Bounds();
         
         	// background
        @@ -154,7 +154,7 @@
         		fMenuBarHeight + 10);
         	fVideoView = new VideoView(rect, "video display", B_FOLLOW_NONE);
         	fBackground->AddChild(fVideoView);
        -	
        +
         	// controls
         	rect = BRect(0, fMenuBarHeight + 11, fBackground->Bounds().right,
         		fBackground->Bounds().bottom);
        @@ -165,7 +165,7 @@
         	fControlsWidth = (int)fControls->Frame().Width() + 1;
         	fControls->SetResizingMode(B_FOLLOW_BOTTOM | B_FOLLOW_LEFT_RIGHT);
         //	fControls->MoveTo(0, fBackground->Bounds().bottom - fControlsHeight + 1);
        -	
        +
         //	fVideoView->ResizeTo(fBackground->Bounds().Width(),
         //		fBackground->Bounds().Height() - fMenuBarHeight - fControlsHeight);
         
        @@ -175,14 +175,14 @@
         	PeakView* peakView = fControls->GetPeakView();
         	peakView->SetPeakNotificationWhat(MSG_PEAK_NOTIFICATION);
         	fController->SetPeakListener(peakView);
        -	
        +
         //	printf("fMenuBarHeight %d\n", fMenuBarHeight);
         //	printf("fControlsHeight %d\n", fControlsHeight);
         //	printf("fControlsWidth %d\n", fControlsWidth);
         
         	_SetupWindow();
         
        -	// setup the playlist window now, we need to have it 
        +	// setup the playlist window now, we need to have it
         	// running for the undo/redo playlist editing
         	fPlaylistWindow = new PlaylistWindow(BRect(150, 150, 500, 600), fPlaylist,
         		fController);
        @@ -217,7 +217,7 @@
         
         	if (fPlaylistWindow && fPlaylistWindow->Lock())
         		fPlaylistWindow->Quit();
        -	
        +
         	delete fPlaylist;
         
         	// quit the Controller looper thread
        @@ -275,7 +275,7 @@
         			fVideoView->Show();
         		y += maxVideoHeight;
         	}
        -	
        +
         	if (noControls) {
         		if (!fControls->IsHidden())
         			fControls->Hide();
        @@ -325,14 +325,14 @@
         			fVideoView->OverlayScreenshotCleanup();
         			return;
         		}
        -		
        +
         		// every other key gets dispatched to our _KeyDown first
         		if (_KeyDown(msg) == B_OK) {
         			// it got handled, don't pass it on
         			return;
         		}
         	}
        -	
        +
         	BWindow::DispatchMessage(msg, handler);
         }
         
        @@ -501,7 +501,7 @@
         		case M_FILE_CLOSE:
         			PostMessage(B_QUIT_REQUESTED);
         			break;
        -		case M_FILE_QUIT:	
        +		case M_FILE_QUIT:
         			be_app->PostMessage(B_QUIT_REQUESTED);
         			break;
         
        @@ -512,19 +512,19 @@
         		case M_TOGGLE_NO_MENU:
         			_ToggleNoMenu();
         			break;
        -			
        +
         		case M_TOGGLE_NO_CONTROLS:
         			_ToggleNoControls();
         			break;
        -		
        +
         		case M_TOGGLE_NO_BORDER:
         			_ToggleNoBorder();
         			break;
        -			
        +
         		case M_TOGGLE_ALWAYS_ON_TOP:
         			_ToggleAlwaysOnTop();
         			break;
        -	
        +
         		case M_TOGGLE_KEEP_ASPECT_RATIO:
         			_ToggleKeepAspectRatio();
         			break;
        @@ -540,7 +540,7 @@
         				_ToggleFullscreen();
         			_ResizeWindow(50);
         			break;
        -			
        +
         		case M_VIEW_100:
         			if (!fHasVideo)
         				break;
        @@ -572,17 +572,17 @@
         				_ToggleFullscreen();
         			_ResizeWindow(400);
         			break;
        -/*		
        +/*
         		case B_ACQUIRE_OVERLAY_LOCK:
         			printf("B_ACQUIRE_OVERLAY_LOCK\n");
         			fVideoView->OverlayLockAcquire();
         			break;
        -			
        +
         		case B_RELEASE_OVERLAY_LOCK:
         			printf("B_RELEASE_OVERLAY_LOCK\n");
         			fVideoView->OverlayLockRelease();
         			break;
        -*/	
        +*/
         		case B_MOUSE_WHEEL_CHANGED:
         		{
         			float dx = msg->FindFloat("be:wheel_delta_x");
        @@ -639,7 +639,7 @@
         			VideoFormatChange(544, 576, 1.41176, 1.0);
         			break;
         
        -/*			
        +/*
         		default:
         			if (msg->what >= M_SELECT_CHANNEL
         				&& msg->what <= M_SELECT_CHANNEL_END) {
        @@ -665,9 +665,7 @@
         			// the global settings instance...
         			_AdoptGlobalSettings();
         			break;
        -		case M_FILE_DELETE:
        -			fControls->SkipForwardAndDelete();
        -			break;
        +
         		default:
         			// let BWindow handle the rest
         			BWindow::MessageReceived(msg);
        @@ -689,16 +687,16 @@
         		// we will move it so all the window is on the screen.
         		if (frame.right > screenFrame.right)
         			// Move left
        -			diffX = screenFrame.right - frame.right; 
        +			diffX = screenFrame.right - frame.right;
         		if (frame.bottom > screenFrame.bottom)
         			// Move up
        -			diffY = screenFrame.bottom - frame.bottom; 
        +			diffY = screenFrame.bottom - frame.bottom;
         		if (frame.left < screenFrame.left)
         			// Move right
        -			diffX = screenFrame.left - frame.left; 
        +			diffX = screenFrame.left - frame.left;
         		if (frame.top < screenFrame.top)
         			// Move down
        -			diffY = screenFrame.top - frame.top; 
        +			diffY = screenFrame.top - frame.top;
         
         		MoveBy(diffX, diffY);
         	}
        @@ -731,7 +729,7 @@
         			message << "The file '";
         			message << ref.name;
         			message << "' could not be opened.\n\n";
        -			
        +
         			if (err == B_MEDIA_NO_HANDLER) {
         				// give a more detailed message for the most likely of all
         				// errors
        @@ -794,7 +792,7 @@
         	float height_scale)
         {
         	// called when video format or aspect ratio changes
        -	
        +
         	printf("VideoFormatChange enter: width %d, height %d, width_scale %.6f, "
         		"height_scale %.6f\n", width, height, width_scale, height_scale);
         
        @@ -804,12 +802,12 @@
         		printf("inverting! new values: width_scale %.6f, height_scale %.6f\n",
         			width_scale, height_scale);
         	}
        -	
        +
          	fSourceWidth  = width;
          	fSourceHeight = height;
          	fWidthScale   = width_scale;
          	fHeightScale  = height_scale;
        - 	
        +
          	FrameResized(Bounds().Width(), Bounds().Height());
         
         	printf("VideoFormatChange leave\n");
        @@ -838,7 +836,7 @@
         void
         MainWin::_SetupWindow()
         {
        -//	printf("MainWin::_SetupWindow\n");	
        +//	printf("MainWin::_SetupWindow\n");
         	// Populate the track menus
         	_SetupTrackMenus();
         	// Enable both if a file was loaded
        @@ -900,7 +898,7 @@
         	// Add recent files
         	BRecentFilesList recentFiles(10, false, NULL, kAppSig);
         	BMenuItem *item = new BMenuItem(recentFiles.NewFileListMenu(
        -		"Open File"B_UTF8_ELLIPSIS, new BMessage(B_REFS_RECEIVED), 
        +		"Open File"B_UTF8_ELLIPSIS, new BMessage(B_REFS_RECEIVED),
         		NULL, this, 10, false, NULL, 0, kAppSig), new BMessage(M_FILE_OPEN));
         	item->SetShortcut('O', 0);
         	fFileMenu->AddItem(item);
        @@ -979,9 +977,9 @@
         {
         	fAudioTrackMenu->RemoveItems(0, fAudioTrackMenu->CountItems(), true);
         	fVideoTrackMenu->RemoveItems(0, fVideoTrackMenu->CountItems(), true);
        -	
        +
         	char s[100];
        -	
        +
         	int count = fController->AudioTrackCount();
         	int current = fController->CurrentAudioTrack();
         	for (int i = 0; i < count; i++) {
        @@ -1021,7 +1019,7 @@
         		minWidth = max_c(minWidth, fMenuBarWidth);
         	int minHeight = (fNoMenu ? 0 : fMenuBarHeight)
         		+ (fNoControls ? 0 : fControlsHeight);
        -	
        +
         	SetSizeLimits(minWidth - 1, 32000, minHeight - 1, fHasVideo ?
         		32000 : minHeight - 1);
         }
        @@ -1033,10 +1031,10 @@
         	// Get required window size
         	int videoWidth = lround(fSourceWidth * fWidthScale);
         	int videoHeight = lround(fSourceHeight * fHeightScale);
        -	
        +
         	videoWidth = (videoWidth * percent) / 100;
         	videoHeight = (videoHeight * percent) / 100;
        -	
        +
         	// Calculate and set the initial window size
         	int width = max_c(fControlsWidth, videoWidth);
         	int height = (fNoControls ? 0 : fControlsHeight) + videoHeight;
        @@ -1054,7 +1052,7 @@
         {
         	printf("_ResizeVideoView: %d,%d, width %d, height %d\n", x, y,
         		width, height);
        -	
        +
         	if (fKeepAspectRatio) {
         		// Keep aspect ratio, place video view inside
         		// the background area (may create black bars).
        @@ -1111,7 +1109,7 @@
         			return;
         		}
         	}
        -	
        +
         	if (2 == buttons && msg->FindInt32("clicks") % 2 == 0) {
         		BRect r(screen_where.x - 1, screen_where.y - 1, screen_where.x + 1,
         			screen_where.y + 1);
        @@ -1143,7 +1141,7 @@
         	bigtime_t start = system_time();
         	bigtime_t delay = 200000;
         	BPoint location;
        -	do { 
        +	do {
         		fVideoView->GetMouse(&location, &buttons);
         		if ((buttons & 2) == 0)
         			break;
        @@ -1162,9 +1160,9 @@
         
         	BPoint mousePos;
         	uint32 buttons = msg->FindInt32("buttons");
        -	
        +
         	if (1 == buttons && fMouseDownTracking && !fIsFullscreen) {
        -/*		
        +/*
         		// very broken in Zeta:
         		BPoint mousePos = msg->FindPoint("where");
         		printf("view where: %.0f, %.0f => ", mousePos.x, mousePos.y);
        @@ -1259,14 +1257,14 @@
         MainWin::_KeyDown(BMessage *msg)
         {
         //	msg->PrintToStream();
        -	
        +
         	uint32 key		 = msg->FindInt32("key");
         	uint32 raw_char  = msg->FindInt32("raw_char");
         	uint32 modifier = msg->FindInt32("modifiers");
        -	
        +
         	printf("key 0x%lx, raw_char 0x%lx, modifiers 0x%lx\n", key, raw_char,
         		modifier);
        -	
        +
         	switch (raw_char) {
         		case B_SPACE:
         			fController->TogglePlaying();
        @@ -1285,7 +1283,7 @@
         				return B_OK;
         			} else
         				break;
        -				
        +
         		case B_TAB:
         			if ((modifier & (B_COMMAND_KEY | B_CONTROL_KEY | B_OPTION_KEY
         					| B_MENU_KEY)) == 0) {
        @@ -1293,7 +1291,7 @@
         				return B_OK;
         			} else
         				break;
        -		
        +
         		case B_UP_ARROW:
         			if (modifier & B_COMMAND_KEY) {
         				PostMessage(M_SKIP_NEXT);
        @@ -1309,7 +1307,7 @@
         				PostMessage(M_VOLUME_DOWN);
         			}
         			return B_OK;
        -			
        +
         		case B_RIGHT_ARROW:
         			if (modifier & B_COMMAND_KEY) {
         				PostMessage(M_VOLUME_UP);
        @@ -1329,7 +1327,7 @@
         		case B_PAGE_UP:
         			PostMessage(M_SKIP_NEXT);
         			return B_OK;
        -			
        +
         		case B_PAGE_DOWN:
         			PostMessage(M_SKIP_PREV);
         			return B_OK;
        @@ -1359,26 +1357,27 @@
         		case 0x59:			// numeric keypad down arrow
         			PostMessage(M_VOLUME_DOWN);
         			return B_OK;
        -			
        +
         		case 0x39:			// numeric keypad page up
         		case 0x4a:			// numeric keypad right arrow
         			PostMessage(M_SKIP_NEXT);
         			return B_OK;
        -			
        +
         		case 0x5a:			// numeric keypad page down
         		case 0x48:			// numeric keypad left arrow
         			PostMessage(M_SKIP_PREV);
         			return B_OK;
        -		case 0x34:			//delete button
        -		case 0x3e: 			//d for delete
        -		case 0x2b:			//t for Trash
        -			if (modifiers() & B_COMMAND_KEY) {
        -				PostMessage(M_FILE_DELETE);
        -				return B_OK;
        -			}
        -			break;
        +// TODO: Reenable this and use Undo/Redo stack...
        +//		case 0x34:			//delete button
        +//		case 0x3e: 			//d for delete
        +//		case 0x2b:			//t for Trash
        +//			if (modifiers() & B_COMMAND_KEY) {
        +//				PostMessage(M_FILE_DELETE);
        +//				return B_OK;
        +//			}
        +//			break;
         	}
        -	
        +
         	return B_ERROR;
         }
         
        @@ -1415,10 +1414,10 @@
         	}
         
         	fIsFullscreen = !fIsFullscreen;
        -	
        +
         	if (fIsFullscreen) {
         		// switch to fullscreen
        -		
        +
         		fSavedFrame = Frame();
         		printf("saving current frame: %d %d %d %d\n", int(fSavedFrame.left),
         			int(fSavedFrame.top), int(fSavedFrame.right),
        @@ -1451,7 +1450,7 @@
         	printf("_ToggleNoControls enter\n");
         
         	if (fIsFullscreen) {
        -		// fullscreen is always without menu	
        +		// fullscreen is always without menu
         		printf("_ToggleNoControls leave, doing nothing, we are fullscreen\n");
         		return;
         	}
        @@ -1476,7 +1475,7 @@
         	printf("_ToggleNoMenu enter\n");
         
         	if (fIsFullscreen) {
        -		// fullscreen is always without menu	
        +		// fullscreen is always without menu
         		printf("_ToggleNoMenu leave, doing nothing, we are fullscreen\n");
         		return;
         	}
        
        Modified: haiku/trunk/src/apps/mediaplayer/playlist/ListViews.cpp
        ===================================================================
        --- haiku/trunk/src/apps/mediaplayer/playlist/ListViews.cpp	2009-05-15 22:11:19 UTC (rev 30767)
        +++ haiku/trunk/src/apps/mediaplayer/playlist/ListViews.cpp	2009-05-16 11:29:19 UTC (rev 30768)
        @@ -264,12 +264,12 @@
         				v->SetHighColor( 0, 0, 0, 255 );
         				v->StrokeRect( v->Bounds() );
         				v->Sync();
        -	
        +
         				uint8 *bits = (uint8 *)dragBitmap->Bits();
         				int32 height = (int32)dragBitmap->Bounds().Height() + 1;
         				int32 width = (int32)dragBitmap->Bounds().Width() + 1;
         				int32 bpr = dragBitmap->BytesPerRow();
        -	
        +
         				if (fade) {
         					for ( int32 y = 0; y < height - ALPHA / 2; y++, bits += bpr ) {
         						uint8 *line = bits + 3;
        @@ -395,7 +395,7 @@
         {
         	if ( numBytes < 1 )
         		return;
        -		
        +
         	if ( ( bytes[0] == B_BACKSPACE ) || ( bytes[0] == B_DELETE ) )
         		RemoveSelected();
         
        @@ -569,7 +569,7 @@
         			// offset where by half of item height
         			r = ItemFrame(0);
         			where.y += r.Height() / 2.0;
        -	
        +
         			int32 index = IndexOf(where);
         			if (index < 0)
         				index = CountItems();
        @@ -627,7 +627,7 @@
         
         // MoveItems
         void
        -DragSortableListView::MoveItems(BList& indices, int32 index)
        +DragSortableListView::MoveItems(const BList& indices, int32 index)
         {
         	DeselectAll();
         	// we remove the items while we look at them, the insertion index is decreased
        @@ -659,7 +659,7 @@
         
         // CopyItems
         void
        -DragSortableListView::CopyItems(BList& indices, int32 toIndex)
        +DragSortableListView::CopyItems(const BList& indices, int32 toIndex)
         {
         	DeselectAll();
         	// by inserting the items after we copied all items first, we avoid
        @@ -689,7 +689,7 @@
         
         // RemoveItemList
         void
        -DragSortableListView::RemoveItemList(BList& indices)
        +DragSortableListView::RemoveItemList(const BList& indices)
         {
         	int32 count = indices.CountItems();
         	for (int32 i = 0; i < count; i++) {
        @@ -698,11 +698,10 @@
         	}
         }
         
        -// RemoveSelected
        +// GetSelectedItems
         void
        -DragSortableListView::RemoveSelected()
        +DragSortableListView::GetSelectedItems(BList& indices)
         {
        -	BList indices;
         	for (int32 i = 0; true; i++) {
         		int32 index = CurrentSelection(i);
         		if (index < 0)
        @@ -710,7 +709,15 @@
         		if (!indices.AddItem((void*)index))
         			break;
         	}
        +}
         
        +// RemoveSelected
        +void
        +DragSortableListView::RemoveSelected()
        +{
        +	BList indices;
        +	GetSelectedItems(indices);
        +
         	DeselectAll();
         
         	if (indices.CountItems() > 0)
        
        Modified: haiku/trunk/src/apps/mediaplayer/playlist/ListViews.h
        ===================================================================
        --- haiku/trunk/src/apps/mediaplayer/playlist/ListViews.h	2009-05-15 22:11:19 UTC (rev 30767)
        +++ haiku/trunk/src/apps/mediaplayer/playlist/ListViews.h	2009-05-16 11:29:19 UTC (rev 30768)
        @@ -89,9 +89,11 @@
         
         			bool			MouseWheelChanged(float x, float y);
         
        -	virtual	void			MoveItems(BList& indices, int32 toIndex);
        -	virtual	void			CopyItems(BList& indices, int32 toIndex);
        -	virtual	void			RemoveItemList(BList& indices);
        +	virtual	void			MoveItems(const BList& indices, int32 toIndex);
        +	virtual	void			CopyItems(const BList& indices, int32 toIndex);
        +	virtual	void			RemoveItemList(const BList& indices);
        +
        +			void			GetSelectedItems(BList& indices);
         			void			RemoveSelected(); // uses RemoveItemList()
         			void			RemoveAll(); // uses RemoveItemList()
         			int32			CountSelectedItems() const;
        
        Modified: haiku/trunk/src/apps/mediaplayer/playlist/Playlist.cpp
        ===================================================================
        --- haiku/trunk/src/apps/mediaplayer/playlist/Playlist.cpp	2009-05-15 22:11:19 UTC (rev 30767)
        +++ haiku/trunk/src/apps/mediaplayer/playlist/Playlist.cpp	2009-05-16 11:29:19 UTC (rev 30768)
        @@ -288,18 +288,6 @@
         }
         
         
        -void
        -Playlist::RemoveRefPermanent(int32 index, bool removeToTrash)
        -{
        -	if (index != -1) {
        -		entry_ref song = RemoveRef(index);
        -
        -		if(removeToTrash)
        -			_DeleteEntry(&song);//Remove with tracker
        -	}
        -}
        -
        -
         int32
         Playlist::IndexOf(const entry_ref& _ref) const
         {
        @@ -455,7 +443,7 @@
         	BEntry entry(&ref, true);
         	if (entry.InitCheck() < B_OK || !entry.Exists())
         		return;
        -	
        +
         	if (entry.IsDirectory()) {
         		BDirectory dir(&entry);
         		if (dir.InitCheck() < B_OK)
        @@ -490,8 +478,8 @@
         		FileReadWrite lineReader(&file);
         
         		BString str;
        -		entry_ref refPath; 
        -		status_t err; 
        +		entry_ref refPath;
        +		status_t err;
         		BPath path;
         		while (lineReader.Next(str)) {
         			str = str.RemoveFirst("file://");
        @@ -501,7 +489,7 @@
         			if (path.Path() != NULL) {
         				if ((err = get_ref_for_path(path.Path(), &refPath)) == B_OK) {
         					playlist->AddRef(refPath);
        -				} else			
        +				} else
         					printf("Error - %s: [%lx]\n", strerror(err), (int32) err);
         			} else
         				printf("Error - No File Found in playlist\n");
        @@ -536,7 +524,7 @@
         Playlist::_IsMediaFile(const BString& mimeString)
         {
         	BMimeType superType;
        -	BMimeType fileType(mimeString.String()); 
        +	BMimeType fileType(mimeString.String());
         
         	if (fileType.GetSupertype(&superType) != B_OK)
         		return false;
        @@ -550,21 +538,21 @@
         
         /*static*/ bool
         Playlist::_IsTextPlaylist(const BString& mimeString)
        -{    	
        +{
         	return mimeString.Compare(kTextPlaylistMimeString) == 0;
         }
         
         
         /*static*/ bool
         Playlist::_IsBinaryPlaylist(const BString& mimeString)
        -{    	
        +{
         	return mimeString.Compare(kBinaryPlaylistMimeString) == 0;
         }
         
         
         /*static*/ bool
         Playlist::_IsPlaylist(const BString& mimeString)
        -{    	
        +{
         	return _IsTextPlaylist(mimeString) || _IsBinaryPlaylist(mimeString);
         }
         
        @@ -583,22 +571,11 @@
         		strlcpy(mimeString, type.Type(), B_MIME_TYPE_LENGTH);
         		nodeInfo.SetType(type.Type());
         	}
        -	return BString(mimeString);	
        +	return BString(mimeString);
         }
         
         
         void
        -Playlist::_DeleteEntry(const entry_ref* file)
        -{
        -	// Move entry_ref to Trash
        -	BMessage trash(BPrivate::kMoveToTrash);
        -	trash.AddRef("refs", file);
        -
        -	BMessenger("application/x-vnd.Be-TRAK").SendMessage(&trash);		
        -}
        -
        -
        -void
         Playlist::_NotifyRefAdded(const entry_ref& ref, int32 index) const
         {
         	BList listeners(fListeners);
        
        Modified: haiku/trunk/src/apps/mediaplayer/playlist/Playlist.h
        ===================================================================
        --- haiku/trunk/src/apps/mediaplayer/playlist/Playlist.h	2009-05-15 22:11:19 UTC (rev 30767)
        +++ haiku/trunk/src/apps/mediaplayer/playlist/Playlist.h	2009-05-16 11:29:19 UTC (rev 30768)
        @@ -68,9 +68,6 @@
         			entry_ref			RemoveRef(int32 index,
         									bool careAboutCurrentIndex = true);
         
        -			void				RemoveRefPermanent(int32 index, 
        -									bool removeToTrash);
        -
         			bool				AdoptPlaylist(Playlist& other);
         			bool				AdoptPlaylist(Playlist& other, int32 index);
         
        @@ -81,7 +78,7 @@
         			// navigating current ref
         			bool				SetCurrentRefIndex(int32 index);
         			int32				CurrentRefIndex() const;
        -		
        +
         			void				GetSkipInfo(bool* canSkipPrevious,
         									bool* canSkipNext) const;
         
        @@ -89,7 +86,7 @@
         			bool				AddListener(Listener* listener);
         			void				RemoveListener(Listener* listener);
         
        -			// support functions			
        +			// support functions
         			void				AppendRefs(const BMessage* refsReceivedMessage,
         									int32 appendIndex = -1);
         	static	void				AppendToPlaylistRecursive(const entry_ref& ref,
        @@ -103,8 +100,7 @@
         	static	bool				_IsTextPlaylist(const BString& mimeString);
         	static	bool				_IsBinaryPlaylist(const BString& mimeString);
         	static	bool				_IsPlaylist(const BString& mimeString);
        -	static	BString				_MIMEString(const entry_ref* entry);
        -			void				_DeleteEntry(const entry_ref* file);
        +	static	BString				_MIMEString(const entry_ref* ref);
         			void				_NotifyRefAdded(const entry_ref& ref,
         									int32 index) const;
         			void				_NotifyRefRemoved(int32 index) const;
        
        Modified: haiku/trunk/src/apps/mediaplayer/playlist/PlaylistListView.cpp
        ===================================================================
        --- haiku/trunk/src/apps/mediaplayer/playlist/PlaylistListView.cpp	2009-05-15 22:11:19 UTC (rev 30767)
        +++ haiku/trunk/src/apps/mediaplayer/playlist/PlaylistListView.cpp	2009-05-16 11:29:19 UTC (rev 30768)
        @@ -358,7 +358,7 @@
         {
         	if (numBytes < 1)
         		return;
        -		
        +
         	if ((bytes[0] == B_BACKSPACE) || (bytes[0] == B_DELETE))
         		RemoveSelected();
         
        @@ -367,7 +367,7 @@
         
         
         void
        -PlaylistListView::MoveItems(BList& indices, int32 toIndex)
        +PlaylistListView::MoveItems(const BList& indices, int32 toIndex)
         {
         	fCommandStack->Perform(new (nothrow) MovePLItemsCommand(fPlaylist,
         		(int32*)indices.Items(), indices.CountItems(), toIndex));
        @@ -375,7 +375,7 @@
         
         
         void
        -PlaylistListView::CopyItems(BList& indices, int32 toIndex)
        +PlaylistListView::CopyItems(const BList& indices, int32 toIndex)
         {
         	fCommandStack->Perform(new (nothrow) CopyPLItemsCommand(fPlaylist,
         		(int32*)indices.Items(), indices.CountItems(), toIndex));
        @@ -383,7 +383,7 @@
         
         
         void
        -PlaylistListView::RemoveItemList(BList& indices)
        +PlaylistListView::RemoveItemList(const BList& indices)
         {
         	fCommandStack->Perform(new (nothrow) RemovePLItemsCommand(fPlaylist,
         		(int32*)indices.Items(), indices.CountItems()));
        @@ -444,12 +444,12 @@
         
         
         void
        -PlaylistListView::PermanentRemoveSelectedFile(bool permRemove)
        +PlaylistListView::RemoveSelectionToTrash()
         {
        -	BAutolock _(fPlaylist);
        -	int32 index = fPlaylist->CurrentRefIndex();
        -	fPlaylist->SetCurrentRefIndex(index + 1);
        -	fPlaylist->RemoveRefPermanent(index, permRemove);
        +	BList indices;
        +	GetSelectedItems(indices);
        +	fCommandStack->Perform(new (nothrow) RemovePLItemsCommand(fPlaylist,
        +		(int32*)indices.Items(), indices.CountItems(), true));
         }
         
         
        
        Modified: haiku/trunk/src/apps/mediaplayer/playlist/PlaylistListView.h
        ===================================================================
        --- haiku/trunk/src/apps/mediaplayer/playlist/PlaylistListView.h	2009-05-15 22:11:19 UTC (rev 30767)
        +++ haiku/trunk/src/apps/mediaplayer/playlist/PlaylistListView.h	2009-05-16 11:29:19 UTC (rev 30768)
        @@ -33,9 +33,9 @@
         	virtual	void				KeyDown(const char* bytes, int32 numBytes);
         
         	// SimpleListView interface
        -	virtual	void				MoveItems(BList& indices, int32 toIndex);
        -	virtual	void				CopyItems(BList& indices, int32 toIndex);
        -	virtual	void				RemoveItemList(BList& indices);
        +	virtual	void				MoveItems(const BList& indices, int32 toIndex);
        +	virtual	void				CopyItems(const BList& indices, int32 toIndex);
        +	virtual	void				RemoveItemList(const BList& indices);
         
         	virtual	void				DrawListItem(BView* owner, int32 index,
         									BRect frame) const;
        @@ -45,7 +45,7 @@
         									int32 appendIndex);
         
         			void				Randomize();
        -			void				PermanentRemoveSelectedFile(bool permRemove);
        +			void				RemoveSelectionToTrash();
         
          private:
         			void				_FullSync();
        
        Modified: haiku/trunk/src/apps/mediaplayer/playlist/PlaylistWindow.cpp
        ===================================================================
        --- haiku/trunk/src/apps/mediaplayer/playlist/PlaylistWindow.cpp	2009-05-15 22:11:19 UTC (rev 30767)
        +++ haiku/trunk/src/apps/mediaplayer/playlist/PlaylistWindow.cpp	2009-05-16 11:29:19 UTC (rev 30768)
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2007-2008, Haiku. All rights reserved.
        + * Copyright 2007-2009, Haiku. All rights reserved.
          * Distributed under the terms of the MIT License.
          *
          * Authors:
        @@ -46,18 +46,17 @@
         
         enum {
         	// file
        -	M_PLAYLIST_OPEN			= 'open',
        -	M_PLAYLIST_SAVE			= 'save',
        -	M_PLAYLIST_SAVE_AS		= 'svas',
        -	M_PLAYLIST_SAVE_RESULT	= 'psrs',
        +	M_PLAYLIST_OPEN							= 'open',
        +	M_PLAYLIST_SAVE							= 'save',
        +	M_PLAYLIST_SAVE_AS						= 'svas',
        +	M_PLAYLIST_SAVE_RESULT					= 'psrs',
         
         	// edit
        -	M_PLAYLIST_EMPTY		= 'emty',
        -	M_PLAYLIST_RANDOMIZE	= 'rand',
        -	
        -	// 
        -	M_PLAYLIST_DELETE_FILE	= 'dlfi',
        -	M_PLAYLIST_PER_DEL_FILE	= 'pdfi'
        +	M_PLAYLIST_EMPTY						= 'emty',
        +	M_PLAYLIST_RANDOMIZE					= 'rand',
        +
        +	M_PLAYLIST_REMOVE						= 'rmov',
        +	M_PLAYLIST_REMOVE_AND_PUT_INTO_TRASH	= 'rmtr'
         };
         
         #define SPACE 5
        @@ -195,12 +194,12 @@
         		case M_PLAYLIST_RANDOMIZE:
         			fListView->Randomize();
         			break;
        -		case M_PLAYLIST_DELETE_FILE:
        -			fListView->PermanentRemoveSelectedFile(false);
        -			break;	
        -		case M_PLAYLIST_PER_DEL_FILE:
        -			fListView->PermanentRemoveSelectedFile(true);		
        +		case M_PLAYLIST_REMOVE:
        +			fListView->RemoveSelected();
         			break;
        +		case M_PLAYLIST_REMOVE_AND_PUT_INTO_TRASH:
        +			fListView->RemoveSelectionToTrash();
        +			break;
         		default:
         			BWindow::MessageReceived(message);
         			break;
        @@ -208,35 +207,6 @@
         }
         
         
        -void
        -PlaylistWindow::DispatchMessage(BMessage *message, BHandler *handler)
        -{
        -	if (message->what == B_KEY_DOWN) {
        -
        -		uint32 key = message->FindInt32("key");
        -	
        -		switch (key) {
        -			case 0x34:			//delete button
        -			case 0x3e: 			//d for delete
        -			case 0x2b:			//t for Trash
        -				if (modifiers() & B_COMMAND_KEY) {
        -					fListView->PermanentRemoveSelectedFile(true);
        -					return;
        -				}
        -				break;
        -			case 0x2a:			//r for Remove
        -				if (modifiers() & B_COMMAND_KEY) {
        -					fListView->PermanentRemoveSelectedFile(false);
        -					return;
        -				}
        -				break;
        -		}
        -	}
        -	
        -	BWindow::DispatchMessage(message, handler);
        -}
        -
        -
         // #pragma mark -
         
         
        @@ -268,10 +238,10 @@
         	editMenu->AddItem(new BMenuItem("Randomize",
         		new BMessage(M_PLAYLIST_RANDOMIZE), 'R'));
         	editMenu->AddSeparatorItem();
        -	editMenu->AddItem(new BMenuItem("Remove",
        -		new BMessage(M_PLAYLIST_DELETE_FILE), 'R'));	
        -	editMenu->AddItem(new BMenuItem("Remove Permanent",
        -		new BMessage(M_PLAYLIST_PER_DEL_FILE), 'T', B_COMMAND_KEY));	
        +	editMenu->AddItem(new BMenuItem("Remove (Del)",
        +		new BMessage(M_PLAYLIST_REMOVE)/*, B_DELETE, 0*/));
        +	editMenu->AddItem(new BMenuItem("Remove and Put into Trash",
        +		new BMessage(M_PLAYLIST_REMOVE_AND_PUT_INTO_TRASH), 'T'));
         	editMenu->AddItem(new BMenuItem("Remove All",
         		new BMessage(M_PLAYLIST_EMPTY), 'N'));
         
        
        Modified: haiku/trunk/src/apps/mediaplayer/playlist/PlaylistWindow.h
        ===================================================================
        --- haiku/trunk/src/apps/mediaplayer/playlist/PlaylistWindow.h	2009-05-15 22:11:19 UTC (rev 30767)
        +++ haiku/trunk/src/apps/mediaplayer/playlist/PlaylistWindow.h	2009-05-16 11:29:19 UTC (rev 30768)
        @@ -6,7 +6,7 @@
          *		Stephan A?mus 	
          *		Fredrik Mod?en 	
          */
        - 
        +
         #ifndef PLAYLIST_WINDOW_H
         #define PLAYLIST_WINDOW_H
         
        @@ -36,7 +36,6 @@
         
         	virtual	bool				QuitRequested();
         	virtual	void				MessageReceived(BMessage* message);
        -	virtual	void				DispatchMessage(BMessage *msg, BHandler *handler);
         
         private:
         			void				_CreateMenu(BRect& frame);
        
        Modified: haiku/trunk/src/apps/mediaplayer/playlist/RemovePLItemsCommand.cpp
        ===================================================================
        --- haiku/trunk/src/apps/mediaplayer/playlist/RemovePLItemsCommand.cpp	2009-05-15 22:11:19 UTC (rev 30767)
        +++ haiku/trunk/src/apps/mediaplayer/playlist/RemovePLItemsCommand.cpp	2009-05-16 11:29:19 UTC (rev 30768)
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2007, Haiku. All rights reserved.
        + * Copyright 2007-2009, Haiku. All rights reserved.
          * Distributed under the terms of the MIT License.
          *
          * Authors:
        @@ -11,7 +11,12 @@
         #include 
         #include 
         
        +#include 
        
        [... truncated: 242 lines follow ...]
        
        
        From bga at mail.berlios.de  Sat May 16 18:23:17 2009
        From: bga at mail.berlios.de (bga at BerliOS)
        Date: Sat, 16 May 2009 18:23:17 +0200
        Subject: [Haiku-commits] r30769 -
        	haiku/trunk/src/add-ons/kernel/file_systems/cdda
        Message-ID: <200905161623.n4GGNHSZ023353@sheep.berlios.de>
        
        Author: bga
        Date: 2009-05-16 18:23:16 +0200 (Sat, 16 May 2009)
        New Revision: 30769
        ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30769&view=rev
        
        Modified:
           haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp
        Log:
        - Set the CD:do_lookup attribute correctly.
        
        
        
        Modified: haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp
        ===================================================================
        --- haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp	2009-05-16 11:29:19 UTC (rev 30768)
        +++ haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp	2009-05-16 16:23:16 UTC (rev 30769)
        @@ -683,6 +683,8 @@
         			dprintf("CDDA: no CD-Text found.\n");
         		else
         			doLookup = false;	 
        +	} else {
        +		doLookup = false;
         	}
         		
         	int32 trackCount = toc->last_track + 1 - toc->first_track;
        
        
        
        From axeld at pinc-software.de  Sat May 16 18:26:33 2009
        From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=)
        Date: Sat, 16 May 2009 18:26:33 +0200 CEST
        Subject: [Haiku-commits]
         =?utf-8?q?r30769_-_haiku/trunk/src/add-ons/kernel?=
         =?utf-8?q?/file=5Fsystems/cdda?=
        In-Reply-To: <200905161623.n4GGNHSZ023353@sheep.berlios.de>
        Message-ID: <26274686365-BeMail@zon>
        
        bga at BerliOS  wrote:
        > Log:
        > - Set the CD:do_lookup attribute correctly.
        
        Why would we need that one, anyway? Can't we just look if the CDDA file 
        system already has created a file for the ID of the CD?
        
        Bye,
           Axel.
        
        
        
        From axeld at mail.berlios.de  Sat May 16 22:01:00 2009
        From: axeld at mail.berlios.de (axeld at BerliOS)
        Date: Sat, 16 May 2009 22:01:00 +0200
        Subject: [Haiku-commits] r30770 -
        	haiku/trunk/src/system/kernel/device_manager
        Message-ID: <200905162001.n4GK10Ue017845@sheep.berlios.de>
        
        Author: axeld
        Date: 2009-05-16 22:00:59 +0200 (Sat, 16 May 2009)
        New Revision: 30770
        ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30770&view=rev
        
        Modified:
           haiku/trunk/src/system/kernel/device_manager/legacy_drivers.cpp
        Log:
        * Applied a patch by Rene that fixes bug #3856.
        
        
        Modified: haiku/trunk/src/system/kernel/device_manager/legacy_drivers.cpp
        ===================================================================
        --- haiku/trunk/src/system/kernel/device_manager/legacy_drivers.cpp	2009-05-16 16:23:16 UTC (rev 30769)
        +++ haiku/trunk/src/system/kernel/device_manager/legacy_drivers.cpp	2009-05-16 20:00:59 UTC (rev 30770)
        @@ -1184,7 +1184,7 @@
         {
         	RecursiveLocker _(sLock);
         
        -	if (!fRemovedFromParent)
        +	if (!fRemovedFromParent && fDriver != NULL)
         		fDriver->devices.Remove(this);
         
         	delete this;
        
        
        
        From axeld at mail.berlios.de  Sat May 16 22:10:02 2009
        From: axeld at mail.berlios.de (axeld at BerliOS)
        Date: Sat, 16 May 2009 22:10:02 +0200
        Subject: [Haiku-commits] r30771 - haiku/trunk/data/develop
        Message-ID: <200905162010.n4GKA2XV018389@sheep.berlios.de>
        
        Author: axeld
        Date: 2009-05-16 22:10:01 +0200 (Sat, 16 May 2009)
        New Revision: 30771
        ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30771&view=rev
        
        Modified:
           haiku/trunk/data/develop/makefile
           haiku/trunk/data/develop/makefile-engine
        Log:
        * Applied patch by Siarzhuk Zharski that adds support for .rdef files to the
          makefile-engine. Thanks!
        
        
        Modified: haiku/trunk/data/develop/makefile
        ===================================================================
        --- haiku/trunk/data/develop/makefile	2009-05-16 20:00:59 UTC (rev 30770)
        +++ haiku/trunk/data/develop/makefile	2009-05-16 20:10:01 UTC (rev 30771)
        @@ -32,8 +32,13 @@
         #	in folder names do not work well with this makefile.
         SRCS= 
         
        -#	specify the resource files to use
        +#	specify the resource definition files to use
         #	full path or a relative path to the resource file can be used.
        +RDEFS= 
        +	
        +#	specify the resource files to use. 
        +#	full path or a relative path to the resource file can be used.
        +#	both RDEFS and RSRCS can be defined in the same makefile.
         RSRCS= 
         
         # @<-src@ 
        
        Modified: haiku/trunk/data/develop/makefile-engine
        ===================================================================
        --- haiku/trunk/data/develop/makefile-engine	2009-05-16 20:00:59 UTC (rev 30770)
        +++ haiku/trunk/data/develop/makefile-engine	2009-05-16 20:10:01 UTC (rev 30771)
        @@ -40,6 +40,8 @@
         #	specify the tools for adding and removing resources
         	XRES		= xres
         
        +#	specify the tools for compiling resource definition files
        +	RESCOMP		= rc
         
         # 	platform specific settings
         
        @@ -267,6 +269,23 @@
         	BUILD_LINE = $(LD) -o $@ $(OBJS) $(LDFLAGS)
         endif
         
        +# pseudo-function for converting a list of resource definition files in RDEFS 
        +# variable to a corresponding list of object files in $(OBJ_DIR)/xxx.rsrc
        +# The "function" strips off the rdef file suffix (.rdef) and then strips 
        +# of the directory name, leaving just the root file name.
        +# It then appends the .rsrc suffix and prepends the $(OBJ_DIR)/ path
        +define RDEFS_LIST_TO_RSRCS
        +	$(addprefix $(OBJ_DIR)/, $(addsuffix .rsrc, $(foreach file, $(RDEFS), \
        +	$(basename $(notdir $(file))))))
        +endef
        +
        +#	create the resource definitions instruction in case RDEFS is not empty
        +	ifeq ($(RDEFS), )
        +		RSRCS +=
        +	else
        +		RSRCS += $(RDEFS_LIST_TO_RSRCS)
        +	endif
        +
         #	create the resource instruction
         	ifeq ($(RSRCS), )
         		DO_RSRCS :=
        @@ -329,6 +348,12 @@
         $(OBJ_DIR)/%.o : %.CPP
         	$(CC) -c $< $(INCLUDES) $(CFLAGS) -o $@
         
        +# rules to compile resource definition files
        +$(OBJ_DIR)/%.rsrc : %.rdef
        +	$(RESCOMP) -o $@ $<
        +$(OBJ_DIR)/%.rsrc : %.RDEF
        +	$(RESCOMP) -o $@ $<
        +
         #	rules to handle lex/flex and yacc/bison files
         
         $(OBJ_DIR)/%.o: %.l
        
        
        
        From axeld at mail.berlios.de  Sat May 16 23:09:34 2009
        From: axeld at mail.berlios.de (axeld at BerliOS)
        Date: Sat, 16 May 2009 23:09:34 +0200
        Subject: [Haiku-commits] r30772 - in haiku/trunk/src: bin/desklink
        	kits/interface
        Message-ID: <200905162109.n4GL9Yfi023191@sheep.berlios.de>
        
        Author: axeld
        Date: 2009-05-16 23:09:33 +0200 (Sat, 16 May 2009)
        New Revision: 30772
        ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30772&view=rev
        
        Modified:
           haiku/trunk/src/bin/desklink/VolumeControl.cpp
           haiku/trunk/src/kits/interface/View.cpp
        Log:
        * The Be API requires that options and mask is 0 to remove a mask using
          BView::SetEventMask(). This fixes bug #3928.
        * And while the app_server handled that correctly, BView actually did not, and
          stored the wrong value.
        
        
        Modified: haiku/trunk/src/bin/desklink/VolumeControl.cpp
        ===================================================================
        --- haiku/trunk/src/bin/desklink/VolumeControl.cpp	2009-05-16 20:10:01 UTC (rev 30771)
        +++ haiku/trunk/src/bin/desklink/VolumeControl.cpp	2009-05-16 21:09:33 UTC (rev 30772)
        @@ -104,7 +104,10 @@
         {
         	BSlider::AttachedToWindow();
         
        -	SetEventMask(_IsReplicant() ? 0 : B_POINTER_EVENTS, B_NO_POINTER_HISTORY);
        +	if (_IsReplicant())
        +		SetEventMask(0, 0);
        +	else
        +		SetEventMask(B_POINTER_EVENTS, B_NO_POINTER_HISTORY);
         
         	BMediaRoster* roster = BMediaRoster::CurrentRoster();
         	if (roster != NULL && fMixerControl->GainNode() != media_node::null) {
        
        Modified: haiku/trunk/src/kits/interface/View.cpp
        ===================================================================
        --- haiku/trunk/src/kits/interface/View.cpp	2009-05-16 20:10:01 UTC (rev 30771)
        +++ haiku/trunk/src/kits/interface/View.cpp	2009-05-16 21:09:33 UTC (rev 30772)
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2001-2008, Haiku.
        + * Copyright 2001-2009, Haiku.
          * Distributed under the terms of the MIT License.
          *
          * Authors:
        @@ -1587,7 +1587,9 @@
         	if (fEventMask == mask && fEventOptions == options)
         		return B_OK;
         
        -	fEventMask = mask | (fEventMask & 0xffff0000);
        +	// don't change the mask if it's zero and we've got options
        +	if (mask != 0 || options == 0)
        +		fEventMask = mask | (fEventMask & 0xffff0000);
         	fEventOptions = options;
         
         	fState->archiving_flags |= B_VIEW_EVENT_MASK_BIT;
        
        
        
        From axeld at mail.berlios.de  Sat May 16 23:28:13 2009
        From: axeld at mail.berlios.de (axeld at BerliOS)
        Date: Sat, 16 May 2009 23:28:13 +0200
        Subject: [Haiku-commits] r30773 - haiku/trunk/src/system/kernel/fs
        Message-ID: <200905162128.n4GLSDNq027126@sheep.berlios.de>
        
        Author: axeld
        Date: 2009-05-16 23:28:12 +0200 (Sat, 16 May 2009)
        New Revision: 30773
        ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30773&view=rev
        
        Modified:
           haiku/trunk/src/system/kernel/fs/vfs.cpp
        Log:
        * The covered vnode release was never put when it already was a mount point
          during fs_mount(). This fixes bug #3934.
        
        
        Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp
        ===================================================================
        --- haiku/trunk/src/system/kernel/fs/vfs.cpp	2009-05-16 21:09:33 UTC (rev 30772)
        +++ haiku/trunk/src/system/kernel/fs/vfs.cpp	2009-05-16 21:28:12 UTC (rev 30773)
        @@ -7025,37 +7025,31 @@
         
         		status = mount->volume->file_system->mount(mount->volume, device, flags,
         			args, &rootID);
        -		if (status < 0) {
        -			// ToDo: why should we hide the error code from the file system here?
        -			//status = ERR_VFS_GENERAL;
        +		if (status != 0)
         			goto err2;
        -		}
         	} else {
        -		struct vnode* coveredVnode;
        -		status = path_to_vnode(path, true, &coveredVnode, NULL, kernel);
        -		if (status < B_OK)
        +		status = path_to_vnode(path, true, &mount->covers_vnode, NULL, kernel);
        +		if (status != B_OK)
         			goto err2;
         
         		// make sure covered_vnode is a directory
        -		if (!S_ISDIR(coveredVnode->type)) {
        +		if (!S_ISDIR(mount->covers_vnode->type)) {
         			status = B_NOT_A_DIRECTORY;
        -			goto err2;
        +			goto err3;
         		}
         
        -		if (coveredVnode->mount->root_vnode == coveredVnode) {
        +		if (mount->covers_vnode->mount->root_vnode == mount->covers_vnode) {
         			// this is already a mount point
         			status = B_BUSY;
        -			goto err2;
        +			goto err3;
         		}
         
        -		mount->covers_vnode = coveredVnode;
        -
         		// mount it/them
         		fs_volume* volume = mount->volume;
         		while (volume) {
         			status = volume->file_system->mount(volume, device, flags, args,
         				&rootID);
        -			if (status < B_OK) {
        +			if (status != B_OK) {
         				if (volume->sub_volume)
         					goto err4;
         				goto err3;
        @@ -7116,7 +7110,7 @@
         err4:
         	FS_MOUNT_CALL_NO_PARAMS(mount, unmount);
         err3:
        -	if (mount->covers_vnode)
        +	if (mount->covers_vnode != NULL)
         		put_vnode(mount->covers_vnode);
         err2:
         	mutex_lock(&sMountMutex);
        
        
        
        From bga at mail.berlios.de  Sat May 16 23:41:33 2009
        From: bga at mail.berlios.de (bga at BerliOS)
        Date: Sat, 16 May 2009 23:41:33 +0200
        Subject: [Haiku-commits] r30774 -
        	haiku/trunk/src/system/kernel/disk_device_manager
        Message-ID: <200905162141.n4GLfXSZ028678@sheep.berlios.de>
        
        Author: bga
        Date: 2009-05-16 23:41:33 +0200 (Sat, 16 May 2009)
        New Revision: 30774
        ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30774&view=rev
        
        Modified:
           haiku/trunk/src/system/kernel/disk_device_manager/KDiskDeviceManager.cpp
        Log:
        - Check if we had any changes in status before sending a notification for a new
          inserted media. This fixes ticket #3921.
        
        
        
        Modified: haiku/trunk/src/system/kernel/disk_device_manager/KDiskDeviceManager.cpp
        ===================================================================
        --- haiku/trunk/src/system/kernel/disk_device_manager/KDiskDeviceManager.cpp	2009-05-16 21:28:12 UTC (rev 30773)
        +++ haiku/trunk/src/system/kernel/disk_device_manager/KDiskDeviceManager.cpp	2009-05-16 21:41:33 UTC (rev 30774)
        @@ -1466,9 +1466,15 @@
         				continue;
         
         			bool hadMedia = device->HasMedia();
        +			bool changedMedia = device->MediaChanged();
         			device->UpdateMediaStatusIfNeeded();
         
        -			if (!device->MediaChanged() && (device->HasMedia() || !hadMedia))
        +			// Detect it there was any status change since last check.
        +			bool updated = (hadMedia != device->HasMedia()) ||
        +				(changedMedia != device->MediaChanged());		
        +
        +			if ((!device->MediaChanged() &&
        +				(device->HasMedia() || !hadMedia)) || !updated)
         				continue;
         
         			device->MarkBusy(true);
        
        
        
        From bga at bug-br.org.br  Sat May 16 18:48:34 2009
        From: bga at bug-br.org.br (Bruno Albuquerque)
        Date: Sat, 16 May 2009 18:48:34
        Subject: [Haiku-commits] r30769 -
         haiku/trunk/src/add-ons/kernel/file_systems/cdda
        In-Reply-To: <26274686365-BeMail@zon>
        Message-ID: <684283861-BeMail@Gaspode>
        
        On Sat, 16 May 2009 18:26:33 +0200 CEST, Axel D?rfler said:
        
        > > - Set the CD:do_lookup attribute correctly.
        > 
        > Why would we need that one, anyway? Can't we just look if the CDDA 
        > file 
        > system already has created a file for the ID of the CD?
        
        The file is only created after the disk is unmounted, for one thing (of 
        course this could be changed). But also because it is easier to simply 
        read an attribute. Other than that, it also takes into account the 
        presence of CDText in the CD.
        
        -Bruno
        
        
        
        From axeld at mail.berlios.de  Sun May 17 00:48:46 2009
        From: axeld at mail.berlios.de (axeld at BerliOS)
        Date: Sun, 17 May 2009 00:48:46 +0200
        Subject: [Haiku-commits] r30775 -
        	haiku/trunk/src/system/kernel/disk_device_manager
        Message-ID: <200905162248.n4GMmkFo013981@sheep.berlios.de>
        
        Author: axeld
        Date: 2009-05-17 00:48:45 +0200 (Sun, 17 May 2009)
        New Revision: 30775
        ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30775&view=rev
        
        Modified:
           haiku/trunk/src/system/kernel/disk_device_manager/KDiskDeviceManager.cpp
        Log:
        * So many style violations in so few lines of code...
        
        
        Modified: haiku/trunk/src/system/kernel/disk_device_manager/KDiskDeviceManager.cpp
        ===================================================================
        --- haiku/trunk/src/system/kernel/disk_device_manager/KDiskDeviceManager.cpp	2009-05-16 21:41:33 UTC (rev 30774)
        +++ haiku/trunk/src/system/kernel/disk_device_manager/KDiskDeviceManager.cpp	2009-05-16 22:48:45 UTC (rev 30775)
        @@ -1469,12 +1469,10 @@
         			bool changedMedia = device->MediaChanged();
         			device->UpdateMediaStatusIfNeeded();
         
        -			// Detect it there was any status change since last check.
        -			bool updated = (hadMedia != device->HasMedia()) ||
        -				(changedMedia != device->MediaChanged());		
        -
        -			if ((!device->MediaChanged() &&
        -				(device->HasMedia() || !hadMedia)) || !updated)
        +			// Detect if there was any status change since last check.
        +			if ((!device->MediaChanged() && (device->HasMedia() || !hadMedia))
        +				|| !(hadMedia != device->HasMedia()
        +					|| changedMedia != device->MediaChanged()))
         				continue;
         
         			device->MarkBusy(true);
        
        
        
        From axeld at pinc-software.de  Sun May 17 00:53:52 2009
        From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=)
        Date: Sun, 17 May 2009 00:53:52 +0200 CEST
        Subject: [Haiku-commits]
         =?utf-8?q?r30774_-_haiku/trunk/src/system/kernel/?=
         =?utf-8?q?disk=5Fdevice=5Fmanager?=
        In-Reply-To: <200905162141.n4GLfXSZ028678@sheep.berlios.de>
        Message-ID: <49513853617-BeMail@zon>
        
        bga at BerliOS  wrote:
        ]> Log:
        > - Check if we had any changes in status before sending a notification 
        > for a new
        >   inserted media. This fixes ticket #3921.
        [...]
        >  			bool hadMedia = device->HasMedia();
        > +			bool changedMedia = device->MediaChanged();
        >  			device->UpdateMediaStatusIfNeeded();
        >  
        > -			if (!device->MediaChanged() && (device->HasMedia() || 
        > !hadMedia))
        > +			// Detect it there was any status change since last check.
        > +			bool updated = (hadMedia != device->HasMedia()) ||
        > +				(changedMedia != device->MediaChanged());		
        
        So many style violations...
        
        But anyway, this hides a bug in the disk device itself; according to 
        the BeBook, a driver should only return B_DEV_MEDIA_CHANGED once in 
        case there was a change: "B_DEV_MEDIA_CHANGED. The media changed since 
        the time that the device was opened, or since the time of the last 
        B_GET_MEDIA_STATUS request."
        While it's good defensive style to fix both ends of an error, the disk 
        device driver is still behaving incorrectly, and that should be fixed 
        as well.
        
        Bye,
           Axel.
        
        
        
        From bga at bug-br.org.br  Sat May 16 20:42:25 2009
        From: bga at bug-br.org.br (Bruno Albuquerque)
        Date: Sat, 16 May 2009 20:42:25
        Subject: [Haiku-commits] r30774 -
         haiku/trunk/src/system/kernel/disk_device_manager
        In-Reply-To: <49513853617-BeMail@zon>
        Message-ID: <510044770-BeMail@Gaspode>
        
        On Sun, 17 May 2009 00:53:52 +0200 CEST, Axel D?rfler said:
        
        > So many style violations...
        
        Heh. You know, altough I am all for consistency and all that, I don' t 
        see the point of this comment. you could have pointed out the 
        violations (and I would have fixed them) or you could fix it (as you 
        did), but there is really no need to act like this specially when your 
        fix did not add anything in what concerns readability of the code. I 
        would understand the criticism if the code was unreadable or something. 
        Oh well... 
         
        > But anyway, this hides a bug in the disk device itself; according to 
        > the BeBook, a driver should only return B_DEV_MEDIA_CHANGED once in 
        > case there was a change: "B_DEV_MEDIA_CHANGED. The media changed 
        > since 
        > the time that the device was opened, or since the time of the last 
        > B_GET_MEDIA_STATUS request."
        > While it's good defensive style to fix both ends of an error, the 
        > disk 
        > device driver is still behaving incorrectly, and that should be fixed 
        > as well.
        
        I don't think it is wrong, it is just implemented in a way that works 
        for now in the sense that this should be a notification mechanism and 
        it is actually implemented with polling. There is a TODO in the code 
        mentioning that it should implemented as notifications or something. It 
        was probably just the fastest way to get it working when Ingo did it. 
        Right now 2 consecutive polls results in MediaChanged() being true and 
        this probably happens because the device itself keeps this status for a 
        while (althouhg I didn't go that deep). Whenever notifications are 
        implemented, this will not be a problem I guess as we would get one 
        notification (from the device, I mean. Right now we pool the device) 
        and that would be all.
        
        -Bruno
         
        
        
        From bga at bug-br.org.br  Sat May 16 20:46:08 2009
        From: bga at bug-br.org.br (Bruno Albuquerque)
        Date: Sat, 16 May 2009 20:46:08
        Subject: [Haiku-commits]
         =?utf-8?q?r30775_-_haiku/trunk/src/system/kernel/?=
         =?utf-8?q?disk=5Fdevice=5Fmanager?=
        In-Reply-To: <200905162248.n4GMmkFo013981@sheep.berlios.de>
        Message-ID: <733927683-BeMail@Gaspode>
        
        On Sun, 17 May 2009 00:48:46 +0200, axeld at BerliOS said:
        
        > -			// Detect it there was any status change since last 
        > check.
        > -			bool updated = (hadMedia != device->HasMedia()) ||
        > -				(changedMedia != device->MediaChanged());		
        > -
        > -			if ((!device->MediaChanged() &&
        > -				(device->HasMedia() || !hadMedia)) || !updated)
        > +			// Detect if there was any status change since last 
        > check.
        > +			if ((!device->MediaChanged() && (device->HasMedia() || 
        > !hadMedia))
        > +				|| !(hadMedia != device->HasMedia()
        > +					|| changedMedia != device->MediaChanged()))
        >  				continue;
        
        Style issues apart, I think this makes the code less legible than it 
        was. It is confusing to parse all the logical operations involved.
        
        -Bruno
        
        
        
        From stippi at mail.berlios.de  Sun May 17 02:16:16 2009
        From: stippi at mail.berlios.de (stippi at mail.berlios.de)
        Date: Sun, 17 May 2009 02:16:16 +0200
        Subject: [Haiku-commits] r30776 - in haiku/trunk/src/apps/mediaplayer: .
        	playlist
        Message-ID: <200905170016.n4H0GGWA024556@sheep.berlios.de>
        
        Author: stippi
        Date: 2009-05-17 02:16:08 +0200 (Sun, 17 May 2009)
        New Revision: 30776
        ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30776&view=rev
        
        Added:
           haiku/trunk/src/apps/mediaplayer/playlist/EntryRefPlaylistItem.cpp
           haiku/trunk/src/apps/mediaplayer/playlist/EntryRefPlaylistItem.h
           haiku/trunk/src/apps/mediaplayer/playlist/PlaylistItem.cpp
           haiku/trunk/src/apps/mediaplayer/playlist/PlaylistItem.h
        Modified:
           haiku/trunk/src/apps/mediaplayer/Jamfile
           haiku/trunk/src/apps/mediaplayer/MainWin.cpp
           haiku/trunk/src/apps/mediaplayer/playlist/Playlist.cpp
           haiku/trunk/src/apps/mediaplayer/playlist/PlaylistListView.cpp
           haiku/trunk/src/apps/mediaplayer/playlist/PlaylistListView.h
           haiku/trunk/src/apps/mediaplayer/playlist/PlaylistWindow.cpp
           haiku/trunk/src/apps/mediaplayer/playlist/PlaylistWindow.h
        Log:
        * Refactor the "Remove and Put into Trash" backend a bit to allow giving it an
          index and not work on the current selection only.
        * Reenable the code in MainWin that implements the shortcuts to trigger this
          feature during playback. Now it uses the Undo/Redo stack and profits from
          existing polish.
        * Add missing fPlaylist locking in MainWin at several places. Should not have
          caused any realworld problems, though.
        * Add Undo/Redo shortcuts to MainWin and forward to Playlist window.
        * Make sure the Playlist window opens on the same workspace as the player
          window. This could be seen when launching MediaPlayer on one workspace, later
          moving the window and then opening the Playlist window, it would open on
          the original workspace. The new behavior additionally pulls the playlist
          when it's already open and you invoke the "Playlist" menu item.
        * Added the beginnings of a refactoring to make the Playlist and everything
          else use a PlaylistItem class, instead of entry_refs directly. This stuff is
          not yet used, though, just compiles.
        
        
        Modified: haiku/trunk/src/apps/mediaplayer/Jamfile
        ===================================================================
        --- haiku/trunk/src/apps/mediaplayer/Jamfile	2009-05-16 22:48:45 UTC (rev 30775)
        +++ haiku/trunk/src/apps/mediaplayer/Jamfile	2009-05-17 00:16:08 UTC (rev 30776)
        @@ -55,10 +55,12 @@
         
         	# playlist
         	CopyPLItemsCommand.cpp
        +	EntryRefPlaylistItem.cpp
         	ImportPLItemsCommand.cpp
         	ListViews.cpp
         	MovePLItemsCommand.cpp
         	Playlist.cpp
        +	PlaylistItem.cpp
         	PlaylistListView.cpp
         	PlaylistObserver.cpp
         	PlaylistWindow.cpp
        
        Modified: haiku/trunk/src/apps/mediaplayer/MainWin.cpp
        ===================================================================
        --- haiku/trunk/src/apps/mediaplayer/MainWin.cpp	2009-05-16 22:48:45 UTC (rev 30775)
        +++ haiku/trunk/src/apps/mediaplayer/MainWin.cpp	2009-05-17 00:16:08 UTC (rev 30776)
        @@ -194,6 +194,11 @@
         	Settings::Default()->AddListener(&fGlobalSettingsListener);
         	_AdoptGlobalSettings();
         
        +	AddShortcut('z', B_COMMAND_KEY, new BMessage(B_UNDO));
        +	AddShortcut('y', B_COMMAND_KEY, new BMessage(B_UNDO));
        +	AddShortcut('z', B_COMMAND_KEY | B_SHIFT_KEY, new BMessage(B_REDO));
        +	AddShortcut('y', B_COMMAND_KEY | B_SHIFT_KEY, new BMessage(B_REDO));
        +
         	Show();
         }
         
        @@ -358,6 +363,11 @@
         			}
         			break;
         
        +		case B_UNDO:
        +		case B_REDO:
        +			fPlaylistWindow->PostMessage(msg);
        +			break;
        +
         		case M_MEDIA_SERVER_STARTED:
         			printf("TODO: implement M_MEDIA_SERVER_STARTED\n");
         			// fController->...
        @@ -404,6 +414,8 @@
         		// ControllerObserver messages
         		case MSG_CONTROLLER_FILE_FINISHED:
         		{
        +			BAutolock _(fPlaylist);
        +
         			bool hadNext = fPlaylist->SetCurrentRefIndex(
         				fPlaylist->CurrentRefIndex() + 1);
         			if (!hadNext) {
        @@ -653,6 +665,8 @@
         			}
         */
         		case M_SET_PLAYLIST_POSITION: {
        +			BAutolock _(fPlaylist);
        +
         			int32 index;
         			if (msg->FindInt32("index", &index) == B_OK)
         				fPlaylist->SetCurrentRefIndex(index);
        @@ -723,6 +737,7 @@
         
         	status_t err = fController->SetTo(ref);
         	if (err != B_OK) {
        +		BAutolock _(fPlaylist);
         		if (fPlaylist->CountItems() == 1) {
         			// display error if this is the only file we're supposed to play
         			BString message;
        @@ -778,10 +793,17 @@
         MainWin::ShowPlaylistWindow()
         {
         	if (fPlaylistWindow->Lock()) {
        +		// make sure the window shows on the same workspace as ourself
        +		uint32 workspaces = Workspaces();
        +		if (fPlaylistWindow->Workspaces() != workspaces)
        +			fPlaylistWindow->SetWorkspaces(workspaces);
        +
        +		// show or activate
         		if (fPlaylistWindow->IsHidden())
         			fPlaylistWindow->Show();
         		else
         			fPlaylistWindow->Activate();
        +
         		fPlaylistWindow->Unlock();
         	}
         }
        @@ -823,6 +845,7 @@
         	// the playlist ist replaced by dropped files
         	// or the dropped files are appended to the end
         	// of the existing playlist if  is pressed
        +	BAutolock _(fPlaylist);
         	int32 appendIndex = modifiers() & B_SHIFT_KEY ?
         		fPlaylist->CountItems() : -1;
         	msg->AddInt32("append_index", appendIndex);
        @@ -1367,15 +1390,19 @@
         		case 0x48:			// numeric keypad left arrow
         			PostMessage(M_SKIP_PREV);
         			return B_OK;
        -// TODO: Reenable this and use Undo/Redo stack...
        -//		case 0x34:			//delete button
        -//		case 0x3e: 			//d for delete
        -//		case 0x2b:			//t for Trash
        -//			if (modifiers() & B_COMMAND_KEY) {
        -//				PostMessage(M_FILE_DELETE);
        -//				return B_OK;
        -//			}
        -//			break;
        +
        +		case 0x34:			//delete button
        +		case 0x3e: 			//d for delete
        +		case 0x2b:			//t for Trash
        +			if (modifiers() & B_COMMAND_KEY) {
        +				BAutolock _(fPlaylist);
        +				BMessage removeMessage(M_PLAYLIST_REMOVE_AND_PUT_INTO_TRASH);
        +				removeMessage.AddInt32("playlist index",
        +					fPlaylist->CurrentRefIndex());
        +				fPlaylistWindow->PostMessage(&removeMessage);
        +				return B_OK;
        +			}
        +			break;
         	}
         
         	return B_ERROR;
        @@ -1541,6 +1568,7 @@
         	if (fHasAudio)
         		enabledButtons |= VOLUME_ENABLED;
         
        +	BAutolock _(fPlaylist);
         	bool canSkipPrevious, canSkipNext;
         	fPlaylist->GetSkipInfo(&canSkipPrevious, &canSkipNext);
         	if (canSkipPrevious)
        
        Added: haiku/trunk/src/apps/mediaplayer/playlist/EntryRefPlaylistItem.cpp
        ===================================================================
        --- haiku/trunk/src/apps/mediaplayer/playlist/EntryRefPlaylistItem.cpp	2009-05-16 22:48:45 UTC (rev 30775)
        +++ haiku/trunk/src/apps/mediaplayer/playlist/EntryRefPlaylistItem.cpp	2009-05-17 00:16:08 UTC (rev 30776)
        @@ -0,0 +1,152 @@
        +/*
        + * Copyright 2009 Stephan A?mus 
        + * All rights reserved. Distributed under the terms of the MIT license.
        + */
        +
        +#include "EntryRefPlaylistItem.h"
        +
        +#include 
        +
        +#include 
        +
        +
        +EntryRefPlaylistItem::EntryRefPlaylistItem(const entry_ref& ref)
        +	:
        +	fRef(ref)
        +{
        +}
        +
        +
        +EntryRefPlaylistItem::~EntryRefPlaylistItem()
        +{
        +}
        +
        +
        +status_t
        +EntryRefPlaylistItem::SetName(const BString& name)
        +{
        +	BEntry entry(&fRef);
        +
        +	status_t ret = entry.Rename(name.String(), false);
        +	if (ret != B_OK)
        +		return ret;
        +
        +	entry.GetRef(&fRef);
        +	_NotifyListeners();
        +	return B_OK;
        +}
        +
        +
        +
        +status_t
        +EntryRefPlaylistItem::GetName(BString& name) const
        +{
        +	name = fRef.name;
        +	return B_OK;
        +}
        +
        +
        +status_t
        +EntryRefPlaylistItem::SetTitle(const BString& title)
        +{
        +	return B_NOT_SUPPORTED;
        +}
        +
        +
        +status_t
        +EntryRefPlaylistItem::GetTitle(BString& title) const
        +{
        +	return B_NOT_SUPPORTED;
        +}
        +
        +
        +status_t
        +EntryRefPlaylistItem::SetAuthor(const BString& author)
        +{
        +	return B_NOT_SUPPORTED;
        +}
        +
        +
        +status_t
        +EntryRefPlaylistItem::GetAuthor(BString& author) const
        +{
        +	return B_NOT_SUPPORTED;
        +}
        +
        +
        +status_t
        +EntryRefPlaylistItem::SetAlbum(const BString& album)
        +{
        +	return B_NOT_SUPPORTED;
        +}
        +
        +
        +status_t
        +EntryRefPlaylistItem::GetAlbum(BString& album) const
        +{
        +	return B_NOT_SUPPORTED;
        +}
        +
        +
        +status_t
        +EntryRefPlaylistItem::SetTrackNumber(int32 trackNumber)
        +{
        +	return B_NOT_SUPPORTED;
        +}
        +
        +
        +status_t
        +EntryRefPlaylistItem::GetTrackNumber(int32& trackNumber) const
        +{
        +	return B_NOT_SUPPORTED;
        +}
        +
        +
        +status_t
        +EntryRefPlaylistItem::SetBitRate(int32 bitRate)
        +{
        +	return B_NOT_SUPPORTED;
        +}
        +
        +
        +status_t
        +EntryRefPlaylistItem::GetBitRate(int32& bitRate) const
        +{
        +	return B_NOT_SUPPORTED;
        +}
        +
        +
        +status_t
        +EntryRefPlaylistItem::GetDuration(bigtime_t& duration) const
        +{
        +	return B_NOT_SUPPORTED;
        +}
        +
        +
        +// #pragma mark -
        +
        +
        +status_t
        +EntryRefPlaylistItem::MoveIntoTrash()
        +{
        +	return B_NOT_SUPPORTED;
        +}
        +
        +
        +
        +status_t
        +EntryRefPlaylistItem::RestoreFromTrash()
        +{
        +	return B_NOT_SUPPORTED;
        +}
        +
        +
        +// #pragma mark -
        +
        +
        +BMediaFile*
        +EntryRefPlaylistItem::CreateMediaFile() const
        +{
        +	return new (std::nothrow) BMediaFile(&fRef);
        +}
        +
        
        Added: haiku/trunk/src/apps/mediaplayer/playlist/EntryRefPlaylistItem.h
        ===================================================================
        --- haiku/trunk/src/apps/mediaplayer/playlist/EntryRefPlaylistItem.h	2009-05-16 22:48:45 UTC (rev 30775)
        +++ haiku/trunk/src/apps/mediaplayer/playlist/EntryRefPlaylistItem.h	2009-05-17 00:16:08 UTC (rev 30776)
        @@ -0,0 +1,56 @@
        +/*
        + * Copyright 2009 Stephan A?mus 
        + * All rights reserved. Distributed under the terms of the MIT license.
        + */
        +#ifndef ENTRY_REF_PLAYLIST_ITEM_H
        +#define ENTRY_REF_PLAYLIST_ITEM_H
        +
        +#include "PlaylistItem.h"
        +
        +#include 
        +
        +class EntryRefPlaylistItem : public PlaylistItem {
        +public:
        +								EntryRefPlaylistItem(const entry_ref& ref);
        +	virtual						~EntryRefPlaylistItem();
        +
        +	// archiving
        +//	virtual	status_t			Unarchive(const BMessage* archive);
        +//	virtual	status_t			Archive(BMessage* into) const;
        +//
        +//	virtual	status_t			Unflatten(BDataIO* stream);
        +//	virtual	status_t			Flatten(BDataIO* stream) const;
        +
        +	// properties
        +	virtual	status_t			SetName(const BString& name);
        +	virtual	status_t			GetName(BString& name) const;
        +
        +	virtual	status_t			SetTitle(const BString& title);
        +	virtual	status_t			GetTitle(BString& title) const;
        +
        +	virtual	status_t			SetAuthor(const BString& author);
        +	virtual	status_t			GetAuthor(BString& author) const;
        +
        +	virtual	status_t			SetAlbum(const BString& album);
        +	virtual	status_t			GetAlbum(BString& album) const;
        +
        +	virtual	status_t			SetTrackNumber(int32 trackNumber);
        +	virtual	status_t			GetTrackNumber(int32& trackNumber) const;
        +
        +	virtual	status_t			SetBitRate(int32 bitRate);
        +	virtual	status_t			GetBitRate(int32& bitRate) const;
        +
        +	virtual status_t			GetDuration(bigtime_t& duration) const;
        +
        +	// methods
        +	virtual	status_t			MoveIntoTrash();
        +	virtual	status_t			RestoreFromTrash();
        +
        +	// playback
        +	virtual	BMediaFile*			CreateMediaFile() const;
        +
        +private:
        +			entry_ref			fRef;
        +};
        +
        +#endif // ENTRY_REF_PLAYLIST_ITEM_H
        
        Modified: haiku/trunk/src/apps/mediaplayer/playlist/Playlist.cpp
        ===================================================================
        --- haiku/trunk/src/apps/mediaplayer/playlist/Playlist.cpp	2009-05-16 22:48:45 UTC (rev 30775)
        +++ haiku/trunk/src/apps/mediaplayer/playlist/Playlist.cpp	2009-05-17 00:16:08 UTC (rev 30776)
        @@ -40,11 +40,6 @@
         
         // TODO: using BList for objects is bad, replace it with a template
         
        -// TODO: Remove this and use Tracker's Command.h once it is moved into the private headers
        -namespace BPrivate {
        -	const uint32 kMoveToTrash = 'Ttrs';
        -}
        -
         Playlist::Listener::Listener() {}
         Playlist::Listener::~Listener() {}
         void Playlist::Listener::RefAdded(const entry_ref& ref, int32 index) {}
        
        Added: haiku/trunk/src/apps/mediaplayer/playlist/PlaylistItem.cpp
        ===================================================================
        --- haiku/trunk/src/apps/mediaplayer/playlist/PlaylistItem.cpp	2009-05-16 22:48:45 UTC (rev 30775)
        +++ haiku/trunk/src/apps/mediaplayer/playlist/PlaylistItem.cpp	2009-05-17 00:16:08 UTC (rev 30776)
        @@ -0,0 +1,63 @@
        +/*
        + * Copyright 2009 Stephan A?mus 
        + * All rights reserved. Distributed under the terms of the MIT license.
        + */
        +
        +#include "PlaylistItem.h"
        +
        +
        +PlaylistItem::Listener::Listener()
        +{
        +}
        +
        +PlaylistItem::Listener::~Listener()
        +{
        +}
        +
        +void PlaylistItem::Listener::ItemChanged(const PlaylistItem* item)
        +{
        +}
        +
        +
        +// #pragma mark -
        +
        +
        +PlaylistItem::PlaylistItem()
        +{
        +}
        +
        +
        +PlaylistItem::~PlaylistItem()
        +{
        +}
        +
        +
        +//! You must hold the Playlist lock.
        +bool
        +PlaylistItem::AddListener(Listener* listener)
        +{
        +	if (listener && !fListeners.HasItem(listener))
        +		return fListeners.AddItem(listener);
        +	return false;
        +}
        +
        +
        +//! You must hold the Playlist lock.
        +void
        +PlaylistItem::RemoveListener(Listener* listener)
        +{
        +	fListeners.RemoveItem(listener);
        +}
        +
        +
        +void
        +PlaylistItem::_NotifyListeners() const
        +{
        +	BList listeners(fListeners);
        +	int32 count = listeners.CountItems();
        +	for (int32 i = 0; i < count; i++) {
        +		Listener* listener = (Listener*)listeners.ItemAtFast(i);
        +		listener->ItemChanged(this);
        +	}
        +}
        +
        
        Added: haiku/trunk/src/apps/mediaplayer/playlist/PlaylistItem.h
        ===================================================================
        --- haiku/trunk/src/apps/mediaplayer/playlist/PlaylistItem.h	2009-05-16 22:48:45 UTC (rev 30775)
        +++ haiku/trunk/src/apps/mediaplayer/playlist/PlaylistItem.h	2009-05-17 00:16:08 UTC (rev 30776)
        @@ -0,0 +1,75 @@
        +/*
        + * Copyright 2009 Stephan A?mus 
        + * All rights reserved. Distributed under the terms of the MIT license.
        + */
        +#ifndef PLAYLIST_ITEM_H
        +#define PLAYLIST_ITEM_H
        +
        +#include 
        +#include 
        +
        +class BDataIO;
        +class BMediaFile;
        +class BMessage;
        +
        +class PlaylistItem {
        +public:
        +	class Listener {
        +	public:
        +						Listener();
        +		virtual			~Listener();
        +
        +		virtual	void	ItemChanged(const PlaylistItem* item);
        +	};
        +
        +public:
        +								PlaylistItem();
        +	virtual						~PlaylistItem();
        +
        +	// archiving
        +//	virtual	status_t			Unarchive(const BMessage* archive) = 0;
        +//	virtual	status_t			Archive(BMessage* into) const = 0;
        +//
        +//	virtual	status_t			Unflatten(BDataIO* stream) = 0;
        +//	virtual	status_t			Flatten(BDataIO* stream) const = 0;
        +
        +	// properties
        +	virtual	status_t			SetName(const BString& name) = 0;
        +	virtual	status_t			GetName(BString& name) const = 0;
        +
        +	virtual	status_t			SetTitle(const BString& title) = 0;
        +	virtual	status_t			GetTitle(BString& title) const = 0;
        +
        +	virtual	status_t			SetAuthor(const BString& author) = 0;
        +	virtual	status_t			GetAuthor(BString& author) const = 0;
        +
        +	virtual	status_t			SetAlbum(const BString& album) = 0;
        +	virtual	status_t			GetAlbum(BString& album) const = 0;
        +
        +	virtual	status_t			SetTrackNumber(int32 trackNumber) = 0;
        +	virtual	status_t			GetTrackNumber(int32& trackNumber) const = 0;
        +
        +	virtual	status_t			SetBitRate(int32 bitRate) = 0;
        +	virtual	status_t			GetBitRate(int32& bitRate) const = 0;
        +
        +	virtual status_t			GetDuration(bigtime_t& duration) const = 0;
        +
        +	// methods
        +	virtual	status_t			MoveIntoTrash() = 0;
        +	virtual	status_t			RestoreFromTrash() = 0;
        +
        +	// playback
        +	virtual	BMediaFile*			CreateMediaFile() const = 0;
        +
        +	// listener support
        +			bool				AddListener(Listener* listener);
        +			void				RemoveListener(Listener* listener);
        +
        +protected:
        +			void				_NotifyListeners() const;
        +
        +private:
        +			BList				fListeners;
        +};
        +
        +#endif // PLAYLIST_ITEM_H
        
        Modified: haiku/trunk/src/apps/mediaplayer/playlist/PlaylistListView.cpp
        ===================================================================
        --- haiku/trunk/src/apps/mediaplayer/playlist/PlaylistListView.cpp	2009-05-16 22:48:45 UTC (rev 30775)
        +++ haiku/trunk/src/apps/mediaplayer/playlist/PlaylistListView.cpp	2009-05-17 00:16:08 UTC (rev 30776)
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2007-2008, Haiku. All rights reserved.
        + * Copyright 2007-2009, Haiku. All rights reserved.
          * Distributed under the terms of the MIT License.
          *
          * Authors:
        @@ -56,10 +56,10 @@
         }
         
         
        -class PlaylistItem : public SimpleItem {
        +class PlaylistListView::Item : public SimpleItem {
          public:
        -								PlaylistItem(const entry_ref& ref);
        -		virtual					~PlaylistItem();
        +								Item(const entry_ref& ref);
        +		virtual					~Item();
         
         				void			Draw(BView* owner, BRect frame,
         									const font_height& fh,
        @@ -73,20 +73,20 @@
         };
         
         
        -PlaylistItem::PlaylistItem(const entry_ref& ref)
        +PlaylistListView::Item::Item(const entry_ref& ref)
         	: SimpleItem(ref.name),
         	  fRef(ref)
         {
         }
         
         
        -PlaylistItem::~PlaylistItem()
        +PlaylistListView::Item::~Item()
         {
         }
         
         
         void
        -PlaylistItem::Draw(BView* owner, BRect frame, const font_height& fh,
        +PlaylistListView::Item::Draw(BView* owner, BRect frame, const font_height& fh,
         	bool tintedLine, uint32 mode, bool active, uint32 playbackState)
         {
         	rgb_color color = (rgb_color){ 255, 255, 255, 255 };
        @@ -323,7 +323,7 @@
         	float textOffset = text_offset(fFontHeight);
         
         	for (int32 i = 0;
        -		PlaylistItem* item = dynamic_cast(ItemAt(i)); i++) {
        +		Item* item = dynamic_cast(ItemAt(i)); i++) {
         		BRect r = ItemFrame(i);
         		if (r.Contains(where)) {
         			if (clicks == 2) {
        @@ -385,15 +385,14 @@
         void
         PlaylistListView::RemoveItemList(const BList& indices)
         {
        -	fCommandStack->Perform(new (nothrow) RemovePLItemsCommand(fPlaylist,
        -		(int32*)indices.Items(), indices.CountItems()));
        +	RemoveItemList(indices, false);
         }
         
         
         void
         PlaylistListView::DrawListItem(BView* owner, int32 index, BRect frame) const
         {
        -	if (PlaylistItem* item = dynamic_cast(ItemAt(index))) {
        +	if (Item* item = dynamic_cast(ItemAt(index))) {
         		item->Draw(owner, frame, fFontHeight, index % 2,
         			DISPLAY_NAME, index == fCurrentPlaylistIndex, fPlaybackState);
         	}
        @@ -448,8 +447,24 @@
         {
         	BList indices;
         	GetSelectedItems(indices);
        +	RemoveItemList(indices, true);
        +}
        +
        +
        +void
        +PlaylistListView::RemoveToTrash(int32 index)
        +{
        +	BList indices;
        +	indices.AddItem((void*)index);
        +	RemoveItemList(indices, true);
        +}
        +
        +
        +void
        +PlaylistListView::RemoveItemList(const BList& indices, bool intoTrash)
        +{
         	fCommandStack->Perform(new (nothrow) RemovePLItemsCommand(fPlaylist,
        -		(int32*)indices.Items(), indices.CountItems(), true));
        +		(int32*)indices.Items(), indices.CountItems(), intoTrash));
         }
         
         
        @@ -496,7 +511,7 @@
         void
         PlaylistListView::_AddItem(const entry_ref& ref, int32 index)
         {
        -	PlaylistItem* item = new (nothrow) PlaylistItem(ref);
        +	Item* item = new (nothrow) Item(ref);
         	if (item)
         		AddItem(item, index);
         }
        
        Modified: haiku/trunk/src/apps/mediaplayer/playlist/PlaylistListView.h
        ===================================================================
        --- haiku/trunk/src/apps/mediaplayer/playlist/PlaylistListView.h	2009-05-16 22:48:45 UTC (rev 30775)
        +++ haiku/trunk/src/apps/mediaplayer/playlist/PlaylistListView.h	2009-05-17 00:16:08 UTC (rev 30776)
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2007, Haiku. All rights reserved.
        + * Copyright 2007-2009, Haiku. All rights reserved.
          * Distributed under the terms of the MIT License.
          *
          * Authors:
        @@ -14,11 +14,10 @@
         class Controller;
         class ControllerObserver;
         class Playlist;
        -class PlaylistItem;
         class PlaylistObserver;
         
         class PlaylistListView : public SimpleListView {
        - public:
        +public:
         								PlaylistListView(BRect frame,
         									Playlist* playlist,
         									Controller* controller,
        @@ -46,8 +45,13 @@
         
         			void				Randomize();
         			void				RemoveSelectionToTrash();
        +			void				RemoveToTrash(int32 index);
        +			void				RemoveItemList(const BList& indices,
        +									bool intoTrash);
         
        - private:
        +private:
        +	class Item;
        +
         			void				_FullSync();
         			void				_AddItem(const entry_ref& ref, int32 index);
         			void				_RemoveItem(int32 index);
        @@ -67,7 +71,7 @@
         			uint32				fPlaybackState;
         
         			font_height			fFontHeight;
        -			PlaylistItem*		fLastClickedItem;
        +			Item*				fLastClickedItem;
         };
         
         #endif // PLAYLIST_LIST_VIEW_H
        
        Modified: haiku/trunk/src/apps/mediaplayer/playlist/PlaylistWindow.cpp
        ===================================================================
        --- haiku/trunk/src/apps/mediaplayer/playlist/PlaylistWindow.cpp	2009-05-16 22:48:45 UTC (rev 30775)
        +++ haiku/trunk/src/apps/mediaplayer/playlist/PlaylistWindow.cpp	2009-05-17 00:16:08 UTC (rev 30776)
        @@ -55,8 +55,7 @@
         	M_PLAYLIST_EMPTY						= 'emty',
         	M_PLAYLIST_RANDOMIZE					= 'rand',
         
        -	M_PLAYLIST_REMOVE						= 'rmov',
        -	M_PLAYLIST_REMOVE_AND_PUT_INTO_TRASH	= 'rmtr'
        +	M_PLAYLIST_REMOVE						= 'rmov'
         };
         
         #define SPACE 5
        @@ -198,8 +197,16 @@
         			fListView->RemoveSelected();
         			break;
         		case M_PLAYLIST_REMOVE_AND_PUT_INTO_TRASH:
        -			fListView->RemoveSelectionToTrash();
        +		{
        +printf("M_PLAYLIST_REMOVE_AND_PUT_INTO_TRASH\n");
        +message->PrintToStream();
        +			int32 index;
        +			if (message->FindInt32("playlist index", &index) == B_OK)
        +				fListView->RemoveToTrash(index);
        +			else
        +				fListView->RemoveSelectionToTrash();
         			break;
        +		}
         		default:
         			BWindow::MessageReceived(message);
         			break;
        
        Modified: haiku/trunk/src/apps/mediaplayer/playlist/PlaylistWindow.h
        ===================================================================
        --- haiku/trunk/src/apps/mediaplayer/playlist/PlaylistWindow.h	2009-05-16 22:48:45 UTC (rev 30775)
        +++ haiku/trunk/src/apps/mediaplayer/playlist/PlaylistWindow.h	2009-05-17 00:16:08 UTC (rev 30776)
        @@ -27,6 +27,10 @@
         class BButton;
         class BFilePanel;
         
        +enum {
        +	M_PLAYLIST_REMOVE_AND_PUT_INTO_TRASH	= 'rmtr'
        +};
        +
         class PlaylistWindow : public BWindow {
         public:
         								PlaylistWindow(BRect frame,
        
        
        
        From mmu_man at mail.berlios.de  Sun May 17 02:40:45 2009
        From: mmu_man at mail.berlios.de (mmu_man at BerliOS)
        Date: Sun, 17 May 2009 02:40:45 +0200
        Subject: [Haiku-commits] r30777 - haiku/trunk/docs/userguide/en/installation
        Message-ID: <200905170040.n4H0ejYQ026913@sheep.berlios.de>
        
        Author: mmu_man
        Date: 2009-05-17 02:40:43 +0200 (Sun, 17 May 2009)
        New Revision: 30777
        ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30777&view=rev
        
        Modified:
           haiku/trunk/docs/userguide/en/installation/install-source-linux.html
        Log:
        - add links to apt: url to install packages for Ubuntu,
        - add mention of libc6-dev-i386 which I had to install on a 64bit server,
        - fix a typo.
        
        
        Modified: haiku/trunk/docs/userguide/en/installation/install-source-linux.html
        ===================================================================
        --- haiku/trunk/docs/userguide/en/installation/install-source-linux.html	2009-05-17 00:16:08 UTC (rev 30776)
        +++ haiku/trunk/docs/userguide/en/installation/install-source-linux.html	2009-05-17 00:40:43 UTC (rev 30777)
        @@ -40,9 +40,13 @@
         

        Downloading the tools and the Haiku source

        1. Install all needed packages:

          +

          On Ubuntu you can do so by clicking here, or use the command line:

          sudo apt-get install subversion autoconf automake texinfo flex bison gawk build-essential yasm
        2. -
        3. Create the Haiku development directories and get the Haiku build tools source.:

          +

          On 64-bit systems, you will also need the libc6-dev-i386 package:

          +
          sudo apt-get install libc6-dev-i386
        4. + +
        5. Create the Haiku development directories and get the Haiku build tools source:

          mkdir develop
           cd develop
           mkdir haiku
          
          
          
          From mmu_man at mail.berlios.de  Sun May 17 04:31:26 2009
          From: mmu_man at mail.berlios.de (mmu_man at BerliOS)
          Date: Sun, 17 May 2009 04:31:26 +0200
          Subject: [Haiku-commits] r30778 - haiku/trunk/docs/userguide/en/installation
          Message-ID: <200905170231.n4H2VQrl005655@sheep.berlios.de>
          
          Author: mmu_man
          Date: 2009-05-17 04:31:25 +0200 (Sun, 17 May 2009)
          New Revision: 30778
          ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30778&view=rev
          
          Modified:
             haiku/trunk/docs/userguide/en/installation/install-source-linux.html
          Log:
          You also need gcc-multilib and g++-multilib on 64bit...
          
          
          Modified: haiku/trunk/docs/userguide/en/installation/install-source-linux.html
          ===================================================================
          --- haiku/trunk/docs/userguide/en/installation/install-source-linux.html	2009-05-17 00:40:43 UTC (rev 30777)
          +++ haiku/trunk/docs/userguide/en/installation/install-source-linux.html	2009-05-17 02:31:25 UTC (rev 30778)
          @@ -43,8 +43,8 @@
           

          On Ubuntu you can do so by clicking here, or use the command line:

          sudo apt-get install subversion autoconf automake texinfo flex bison gawk build-essential yasm
        6. -

          On 64-bit systems, you will also need the libc6-dev-i386 package:

          -
          sudo apt-get install libc6-dev-i386
          +

          On 64-bit systems, you will also need the libc6-dev-i386, gcc-multilib, and g++-multilib packages:

          +
          sudo apt-get install libc6-dev-i386 gcc-multilib g++-multilib
        7. Create the Haiku development directories and get the Haiku build tools source:

          mkdir develop
          
          
          
          From mmu_man at mail.berlios.de  Sun May 17 04:44:44 2009
          From: mmu_man at mail.berlios.de (mmu_man at BerliOS)
          Date: Sun, 17 May 2009 04:44:44 +0200
          Subject: [Haiku-commits] r30779 - haiku/trunk
          Message-ID: <200905170244.n4H2ii2V006449@sheep.berlios.de>
          
          Author: mmu_man
          Date: 2009-05-17 04:44:44 +0200 (Sun, 17 May 2009)
          New Revision: 30779
          ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30779&view=rev
          
          Modified:
             haiku/trunk/configure
          Log:
          This check doesn't work when used inside linux32... just remove it. Use linux32 ./configure --use-32bit
          
          
          Modified: haiku/trunk/configure
          ===================================================================
          --- haiku/trunk/configure	2009-05-17 02:31:25 UTC (rev 30778)
          +++ haiku/trunk/configure	2009-05-17 02:44:44 UTC (rev 30779)
          @@ -349,13 +349,6 @@
           	esac
           done
           
          -# check for a 64bit platform
          -case "${platformMachine}" in
          -	x86_64)	use32bit=1 ;;
          -	*)	echo Assuming 32-bit machine: "$platformMachine"
          -		use32bit=0 ;;
          -esac
          -
           # detect the build platform
           case "${platform}" in
           	BeOS)	revision=`uname -r`
          
          
          
          From fekdahl at gmail.com  Sun May 17 10:25:00 2009
          From: fekdahl at gmail.com (Fredrik Ekdahl)
          Date: Sun, 17 May 2009 10:25:00 +0200
          Subject: [Haiku-commits] r30749
          	-	haiku/trunk/src/add-ons/kernel/file_systems/cdda
          In-Reply-To: <4A0C3ECF.80605@bug-br.org.br>
          References: <200905131454.n4DEs7c6025202@sheep.berlios.de>	<4A0AE6E5.5090803@gmail.com>
          	<4A0C3ECF.80605@bug-br.org.br>
          Message-ID: <4A0FC9DC.5010004@gmail.com>
          
          Bruno Albuquerque skrev:
          > Fredrik Ekdahl wrote:
          > 
          >> I guess it would be ~1411 kbps then, since k = 1000 (and not 1024) when 
          >> speaking audio/video bit rates.
          > 
          > Are you sure? Because I used a unit converter to convert from bits per 
          
          Yes, I'll do a wikipedia quote again:
          
          "The bit rate is quantified using the bits per second (bit/s or bps) 
          unit, often in conjunction with an SI prefix such as kilo- (kbit/s or 
          kbps), mega- (Mbit/s or Mbps), giga- (Gbit/s or Gbps) or tera- (Tbit/s 
          or Tbps). 1 kbit/s has almost always meant 1,000 bit/s, not 1,024 bit/s, 
          also before 1999 when SI prefixes were defined for units of information 
          in an IEC standard."
          
          http://en.wikipedia.org/wiki/Bit_rate
          
          -- 
          /Fredrik Ekdahl
          
          
          From axeld at pinc-software.de  Sun May 17 13:27:56 2009
          From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=)
          Date: Sun, 17 May 2009 13:27:56 +0200 CEST
          Subject: [Haiku-commits] r30774 -
           haiku/trunk/src/system/kernel/disk_device_manager
          In-Reply-To: <510044770-BeMail@Gaspode>
          Message-ID: <1111832475-BeMail@zon>
          
          "Bruno Albuquerque"  wrote:
          > On Sun, 17 May 2009 00:53:52 +0200 CEST, Axel D?rfler said:
          > > So many style violations...
          > Heh. You know, altough I am all for consistency and all that, I don' 
          > t 
          > see the point of this comment. you could have pointed out the 
          > violations (and I would have fixed them) or you could fix it (as you 
          > did), but there is really no need to act like this specially when 
          > your 
          > fix did not add anything in what concerns readability of the code. I 
          > would understand the criticism if the code was unreadable or 
          > something. 
          > Oh well... 
          
          The point is, we have a coding style guide, and it's really not that 
          hard to follow. The more often I have to point that out, the more 
          annoyed I get of it, that's just natural.
          
          > > But anyway, this hides a bug in the disk device itself; according 
          > > to 
          > > the BeBook, a driver should only return B_DEV_MEDIA_CHANGED once in 
          > > case there was a change: "B_DEV_MEDIA_CHANGED. The media changed 
          > > since the time that the device was opened, or since the time of the 
          > > last 
          > > B_GET_MEDIA_STATUS request."
          [...]
          > I don't think it is wrong, it is just implemented in a way that works 
          > for now in the sense that this should be a notification mechanism and 
          > it is actually implemented with polling. There is a TODO in the code 
          > mentioning that it should implemented as notifications or something. 
          > It 
          > was probably just the fastest way to get it working when Ingo did it. 
          
          This has nothing to do with what the disk device manager is doing (and 
          actually it was me who implemented that).
          
          > Right now 2 consecutive polls results in MediaChanged() being true 
          > and 
          > this probably happens because the device itself keeps this status for 
          > a 
          > while (althouhg I didn't go that deep). Whenever notifications are 
          > implemented, this will not be a problem I guess as we would get one 
          > notification (from the device, I mean. Right now we pool the device) 
          > and that would be all.
          
          As I pointed out above, that's a bug in the device driver that should 
          be fixed, it's completely independent from any notifications.
          
          Bye,
             Axel.
          
          
          
          From axeld at pinc-software.de  Sun May 17 13:28:52 2009
          From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=)
          Date: Sun, 17 May 2009 13:28:52 +0200 CEST
          Subject: [Haiku-commits] r30775 -
           haiku/trunk/src/system/kernel/disk_device_manager
          In-Reply-To: <733927683-BeMail@Gaspode>
          Message-ID: <1167210820-BeMail@zon>
          
          "Bruno Albuquerque"  wrote:
          > On Sun, 17 May 2009 00:48:46 +0200, axeld at BerliOS said:
          > > -			// Detect it there was any status change since last 
          > > check.
          > > -			bool updated = (hadMedia != device->HasMedia()) ||
          > > -				(changedMedia != device->MediaChanged());		
          > > -
          > > -			if ((!device->MediaChanged() &&
          > > -				(device->HasMedia() || !hadMedia)) || !updated)
          > > +			// Detect if there was any status change since last 
          > > check.
          > > +			if ((!device->MediaChanged() && (device->HasMedia() || 
          > > !hadMedia))
          > > +				|| !(hadMedia != device->HasMedia()
          > > +					|| changedMedia != device->MediaChanged()))
          > >  				continue;
          > Style issues apart, I think this makes the code less legible than it 
          > was. It is confusing to parse all the logical operations involved.
          
          Oh, come on. The previous separation just didn't make much sense - both 
          conditions checked for a change.
          
          Bye,
             Axel.
          
          
          
          From jonas at kirilla.com  Sun May 17 14:30:13 2009
          From: jonas at kirilla.com (Jonas =?iso-8859-1?q?Sundstr=F6m?=)
          Date: Sun, 17 May 2009 14:30:13 +0200 CEST
          Subject: [Haiku-commits] r30774 -
           haiku/trunk/src/system/kernel/disk_device_manager
          In-Reply-To: <1111832475-BeMail@zon>
          Message-ID: <4569998742-BeMail@kirilla>
          
          "Axel D?rfler"  wrote:
           ...
          > we have a coding style guide, and it's really
          > not that hard to follow. The more often I have
          > to point that out, the more annoyed I get of it,
          > that's just natural.
          
          I've been wondering if you guys are under more
          stress lately. I think I've seen a decrease in 
          commits and an increase in highlighting errors.
          (Not just my recent commits. I've had this feeling
          longer than that.) Could be alpha release feature
          freeze / bug fix mode, I suppose.
          
          You are of course right to safeguard your invest-
          ment in Haiku but be aware that there is a limit
          to when quality control hurts enthusiasm and will
          to contribute.
          
          I'm not saying I know where that limit is, and I
          assume it's different for each contributor.
          
          /Jonas.
          
          
          From bga at mail.berlios.de  Sun May 17 14:44:59 2009
          From: bga at mail.berlios.de (bga at BerliOS)
          Date: Sun, 17 May 2009 14:44:59 +0200
          Subject: [Haiku-commits] r30780 -
          	haiku/trunk/src/add-ons/kernel/file_systems/cdda
          Message-ID: <200905171244.n4HCix0l029943@sheep.berlios.de>
          
          Author: bga
          Date: 2009-05-17 14:44:59 +0200 (Sun, 17 May 2009)
          New Revision: 30780
          ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30780&view=rev
          
          Modified:
             haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp
          Log:
          - For audio-related stuff, when going from bits per second to kilobits per
            second we should use 1000 as a factor and not 1024. Thanks Fredrik Ekdahl
            for the heads up.
          
          
          
          Modified: haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp
          ===================================================================
          --- haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp	2009-05-17 02:44:44 UTC (rev 30779)
          +++ haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp	2009-05-17 12:44:59 UTC (rev 30780)
          @@ -740,7 +740,7 @@
           		inode->AddAttribute("Audio:Title", B_STRING_TYPE, text.titles[i]);
           		inode->AddAttribute("Audio:Genre", B_STRING_TYPE, text.genre);
           		inode->AddAttribute("Audio:Track", B_INT32_TYPE, track);
          -		inode->AddAttribute("Audio:Bitrate", B_STRING_TYPE, "1378 kbps");
          +		inode->AddAttribute("Audio:Bitrate", B_STRING_TYPE, "1411 kbps");
           
           		snprintf(title, sizeof(title), "%02lu:%02lu",
           			uint32(inode->FrameCount() / kFramesPerMinute),
          
          
          
          From bga at bug-br.org.br  Sun May 17 09:45:18 2009
          From: bga at bug-br.org.br (Bruno Albuquerque)
          Date: Sun, 17 May 2009 09:45:18
          Subject: [Haiku-commits]
           =?utf-8?q?r30749_-_haiku/trunk/src/add-ons/kernel?=
           =?utf-8?q?/file=5Fsystems/cdda?=
          In-Reply-To: <4A0FC9DC.5010004@gmail.com>
          Message-ID: <1516263387-BeMail@Gaspode>
          
          On Sun, 17 May 2009 10:25:00 +0200, Fredrik Ekdahl said:
          
          > >> I guess it would be ~1411 kbps then, since k = 1000 (and not 1024) 
          > > > when 
          > >> speaking audio/video bit rates.
          > > 
          > > Are you sure? Because I used a unit converter to convert from bits 
          > > per 
          > 
          > Yes, I'll do a wikipedia quote again:
          > 
          > "The bit rate is quantified using the bits per second (bit/s or bps) 
          > unit, often in conjunction with an SI prefix such as kilo- (kbit/s or 
          > kbps), mega- (Mbit/s or Mbps), giga- (Gbit/s or Gbps) or tera- (Tbit/
          > s 
          > or Tbps). 1 kbit/s has almost always meant 1,000 bit/s, not 1,024 bit
          > /s, 
          > also before 1999 when SI prefixes were defined for units of 
          > information 
          > in an IEC standard."
          > 
          > http://en.wikipedia.org/wiki/Bit_rate
          
          Yes, I managed to confirm this independently too. Just forgot to change 
          it.
          
          -Bruno
          
          
          
          From bga at bug-br.org.br  Sun May 17 09:59:06 2009
          From: bga at bug-br.org.br (Bruno Albuquerque)
          Date: Sun, 17 May 2009 09:59:06
          Subject: [Haiku-commits] r30774 -
           haiku/trunk/src/system/kernel/disk_device_manager
          In-Reply-To: <1111832475-BeMail@zon>
          Message-ID: <2344806856-BeMail@Gaspode>
          
          On Sun, 17 May 2009 13:27:56 +0200 CEST, Axel D?rfler said:
          
          > > > But anyway, this hides a bug in the disk device itself; according 
          > > > to 
          > > > the BeBook, a driver should only return B_DEV_MEDIA_CHANGED once 
          > > > in 
          > > > case there was a change: "B_DEV_MEDIA_CHANGED. The media changed 
          > > > since the time that the device was opened, or since the time of 
          > > > the 
          > > > last 
          > > > B_GET_MEDIA_STATUS request."
          > [...]
          > > I don't think it is wrong, it is just implemented in a way that 
          > > works 
          > > for now in the sense that this should be a notification mechanism 
          > > and 
          > > it is actually implemented with polling. There is a TODO in the 
          > > code 
          > > mentioning that it should implemented as notifications or 
          > > something. 
          > > It 
          > > was probably just the fastest way to get it working when Ingo did 
          > > it. 
          > 
          > This has nothing to do with what the disk device manager is doing 
          > (and 
          > actually it was me who implemented that).
          
          I stand corrected. I thought Ingo did the disk device manager stuff.
           
          > > Right now 2 consecutive polls results in MediaChanged() being true 
          > > and 
          > > this probably happens because the device itself keeps this status 
          > > for 
          > > a 
          > > while (althouhg I didn't go that deep). Whenever notifications are 
          > > implemented, this will not be a problem I guess as we would get one 
          > > notification (from the device, I mean. Right now we pool the device) 
          > > and that would be all.
          > 
          > As I pointed out above, that's a bug in the device driver that should 
          > be fixed, it's completely independent from any notifications.
          
          So, if I understand you correctly, MediaChanged() should return true 
          only after one call to UpdateMediaStatusIfNeeded(), right (meaning that 
          a second call should reset it to false even if immediatelly after a 
          disk change is detected)? I will take a look at the relevant ioctl in 
          the atapi code. Interesting enough, both the old and new stack have 
          exactly the same behaviour so maybe this is just a particularity of 
          atapi itself?
          
          -Bruno
          
          
          
          From bga at bug-br.org.br  Sun May 17 10:07:42 2009
          From: bga at bug-br.org.br (Bruno Albuquerque)
          Date: Sun, 17 May 2009 10:07:42
          Subject: [Haiku-commits] r30775 -
           haiku/trunk/src/system/kernel/disk_device_manager
          In-Reply-To: <1167210820-BeMail@zon>
          Message-ID: <2860177408-BeMail@Gaspode>
          
          On Sun, 17 May 2009 13:28:52 +0200 CEST, Axel D?rfler said:
          
          > > > -			// Detect it there was any status change since last 
          > > > check.
          > > > -			bool updated = (hadMedia != device->HasMedia()) ||
          > > > -				(changedMedia != device->MediaChanged());		
          > > > -
          > > > -			if ((!device->MediaChanged() &&
          > > > -				(device->HasMedia() || !hadMedia)) || !updated)
          > > > +			// Detect if there was any status change since last 
          > > > check.
          > > > +			if ((!device->MediaChanged() && (device->HasMedia() 
          > > > || 
          > > > !hadMedia))
          > > > +				|| !(hadMedia != device->HasMedia()
          > > > +					|| changedMedia != device->
          > > > MediaChanged()))
          > > >  				continue;
          > > Style issues apart, I think this makes the code less legible than 
          > > it 
          > > was. It is confusing to parse all the logical operations involved.
          > 
          > Oh, come on. The previous separation just didn't make much sense - 
          > both 
          > conditions checked for a change.
          
          Then the variable name could be changed. But, really, I rest my case.
          
          -Bruno
          
          
          
          From bga at mail.berlios.de  Sun May 17 16:15:01 2009
          From: bga at mail.berlios.de (bga at BerliOS)
          Date: Sun, 17 May 2009 16:15:01 +0200
          Subject: [Haiku-commits] r30781 - in haiku/trunk: data/system/boot
          	src/servers/cddb_daemon
          Message-ID: <200905171415.n4HEF11r009389@sheep.berlios.de>
          
          Author: bga
          Date: 2009-05-17 16:15:00 +0200 (Sun, 17 May 2009)
          New Revision: 30781
          ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30781&view=rev
          
          Modified:
             haiku/trunk/data/system/boot/Bootscript
             haiku/trunk/src/servers/cddb_daemon/cddb_daemon.cpp
             haiku/trunk/src/servers/cddb_daemon/cddb_server.cpp
          Log:
          - Clean up server output. Added more relevant information.
          - Added the server to Bootscript.
          
          This closes ticket #3446.
          
          
          
          Modified: haiku/trunk/data/system/boot/Bootscript
          ===================================================================
          --- haiku/trunk/data/system/boot/Bootscript	2009-05-17 12:44:59 UTC (rev 30780)
          +++ haiku/trunk/data/system/boot/Bootscript	2009-05-17 14:15:00 UTC (rev 30781)
          @@ -147,6 +147,11 @@
           	launch $SERVERS/mail_daemon "" -E
           fi
           
          +# Launch CDDB Daemon
          +if [ "$SAFEMODE" != "yes" ]; then
          +	launch $SERVERS/cddb_daemon ""
          +fi
          +
           # Check for daily saving time
           launch system/bin/dstcheck
           
          
          Modified: haiku/trunk/src/servers/cddb_daemon/cddb_daemon.cpp
          ===================================================================
          --- haiku/trunk/src/servers/cddb_daemon/cddb_daemon.cpp	2009-05-17 12:44:59 UTC (rev 30780)
          +++ haiku/trunk/src/servers/cddb_daemon/cddb_daemon.cpp	2009-05-17 14:15:00 UTC (rev 30781)
          @@ -35,11 +35,13 @@
           	fVolumeRoster->StartWatching();
           	
           	BVolume volume;
          +	printf("Checking currently mounted volumes ...\n");
           	while (fVolumeRoster->GetNextVolume(&volume) == B_OK) {
           		if (_Lookup(volume.Device()) != B_OK) {
           			continue;
           		}
           	}
          +	printf("Checking complete. Listening for device mounts.\n");
           }
           
           
          @@ -82,10 +84,11 @@
           	uint32 cddbId;
           	if (!_CanLookup(device, &cddbId, toc)) {
           		free(toc);
          +		printf("Skipping device with id %d.\n", device);
           		return B_BAD_TYPE;
           	}
           		
          -	printf("CD can be looked up. CDDB id = %08lx.\n", cddbId);
          +	printf("Looking up CD with CDDB Id %08lx.\n", cddbId);
           
           	CDDBServer cddb_server("freedb.freedb.org:80");
           
          @@ -93,6 +96,7 @@
           
           	BList queryResponse;
           	if ((result = cddb_server.Query(cddbId, toc, &queryResponse)) != B_OK) {
          +		printf("Error when querying CD.\n");
           		free(toc);
           		return result;
           	}
          @@ -101,6 +105,7 @@
           
           	QueryResponseData* diskData = _SelectResult(&queryResponse);
           	if (diskData == NULL) {
          +		printf("Could not find any CD entries in query response.\n");
           		return B_BAD_INDEX;
           	}
           
          @@ -112,7 +117,7 @@
           	if (_WriteCDData(device, diskData, &readResponse) == B_OK) {
           		printf("CD data saved.\n");
           	} else {
          -		printf("CD data not saved.\n" );
          +		printf("Error writting CD data.\n" );
           	}
           
           	// Delete itens in the query response BList;
          @@ -179,9 +184,24 @@
           	//
           	// TODO(bga):Right now it just picks the first entry on the list but
           	// someday we may want to let the user choose one.
          -	if (response->CountItems() != 0)
          +	int32 numItems = response->CountItems();
          +	if (numItems > 0) {
          +		if (numItems > 1) {
          +			printf("Multiple matches found :\n");
          +		};
          +		for (int32 i = 0; i < numItems; i++) {
          +			QueryResponseData* data = (QueryResponseData*)response->ItemAt(i);
          +			printf("* %s : %s - %s (%s)\n", (data->cddbId).String(),
          +				(data->artist).String(), (data->title).String(),
          +				(data->category).String());
          +		}
          +		if (numItems > 1) {
          +			printf("Returning first entry.\n");
          +		}
          +		
           		return (QueryResponseData*)response->ItemAt(0L);
          -	
          +	}
          +
           	return NULL;
           }
           
          @@ -246,6 +266,7 @@
           
           
           int main(void) {
          +	printf("CDDB Daemon for Haiku v1.0.0 started.\n");
           	CDDBDaemon* cddbDaemon = new CDDBDaemon();
           	cddbDaemon->Run();
           	delete cddbDaemon; 
          
          Modified: haiku/trunk/src/servers/cddb_daemon/cddb_server.cpp
          ===================================================================
          --- haiku/trunk/src/servers/cddb_daemon/cddb_server.cpp	2009-05-17 12:44:59 UTC (rev 30780)
          +++ haiku/trunk/src/servers/cddb_daemon/cddb_server.cpp	2009-05-17 14:15:00 UTC (rev 30781)
          @@ -252,8 +252,6 @@
           				trackData->title = line;
           					
           				(readResponse->tracks).AddItem(trackData);
          -			} else {
          -				printf("Unhandled or unknown prefix: %s\n", prefix.String());
           			}
           			
           			if (output == "" || output == ".\r\n") {
          
          
          
          From bga at bug-br.org.br  Sun May 17 11:22:27 2009
          From: bga at bug-br.org.br (Bruno Albuquerque)
          Date: Sun, 17 May 2009 11:22:27
          Subject: [Haiku-commits]
           =?utf-8?q?r30781_-_in_haiku/trunk=3A_data/system/?=
           =?utf-8?q?boot_src/servers/cddb=5Fdaemon?=
          In-Reply-To: <200905171415.n4HEF11r009389@sheep.berlios.de>
          Message-ID: <1045725515-BeMail@Gaspode>
          
          On Sun, 17 May 2009 16:15:01 +0200, bga at BerliOS said:
          
          > - Added the server to Bootscript.
          
          Before this results in some kind of holy war, I added the server to 
          Bootscript in response to the enhancement ticket mentioned in the commit 
          message. Considering we do not have an easy way for the user to select 
          things to be auto-started, I thought this was the best approach. If you 
          disagree, please do tell.
          
          -Bruno 
          
          
          From axeld at pinc-software.de  Sun May 17 17:09:22 2009
          From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=)
          Date: Sun, 17 May 2009 17:09:22 +0200 CEST
          Subject: [Haiku-commits] r30781 - in haiku/trunk: data/system/boot
           src/servers/cddb_daemon
          In-Reply-To: <1045725515-BeMail@Gaspode>
          Message-ID: <14397626815-BeMail@zon>
          
          "Bruno Albuquerque"  wrote:
          > On Sun, 17 May 2009 16:15:01 +0200, bga at BerliOS said:
          > > - Added the server to Bootscript.
          > Before this results in some kind of holy war, I added the server to 
          > Bootscript in response to the enhancement ticket mentioned in the 
          > commit 
          > message. Considering we do not have an easy way for the user to 
          > select 
          > things to be auto-started, I thought this was the best approach. If 
          > you 
          > disagree, please do tell.
          
          I wouldn't mind if we could integrate it with a future add-on based 
          Tracker, but as long as that one is vaporware, I think the end-user 
          experience weighs in more than launching another tiny server.
          
          Bye,
             Axel.
          
          
          
          From axeld at pinc-software.de  Sun May 17 17:21:54 2009
          From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=)
          Date: Sun, 17 May 2009 17:21:54 +0200 CEST
          Subject: [Haiku-commits] r30774 -
           haiku/trunk/src/system/kernel/disk_device_manager
          In-Reply-To: <4569998742-BeMail@kirilla>
          Message-ID: <15149159622-BeMail@zon>
          
          "Jonas Sundstr?m"  wrote:
          > "Axel D?rfler"  wrote:
          > > we have a coding style guide, and it's really
          > > not that hard to follow. The more often I have
          > > to point that out, the more annoyed I get of it,
          > > that's just natural.
          > I've been wondering if you guys are under more
          > stress lately. I think I've seen a decrease in 
          > commits and an increase in highlighting errors.
          > (Not just my recent commits. I've had this feeling
          > longer than that.) Could be alpha release feature
          > freeze / bug fix mode, I suppose.
          
          I just have less time for coding. Furthermore, we have gained a lot 
          more new contributors lately, and it's just natural that everyone needs 
          some time to adapt to the specifics of our coding style.
          
          > You are of course right to safeguard your invest-
          > ment in Haiku but be aware that there is a limit
          > to when quality control hurts enthusiasm and will
          > to contribute.
          
          Writing an operating system just needs a very tight ass quality 
          control. That's of course not about the coding style.
          Following the basic rules of the project is just mandatory for every 
          contributor. And really, it's a minor thing to take that into account. 
          Even if someone is not used to them yet, everyone can have a second 
          look over his code to check if the coding style matches. I don't use 
          the Haiku coding style for my personal projects, and I don't use it 
          when working either.
          
          > I'm not saying I know where that limit is, and I
          > assume it's different for each contributor.
          
          It's about the tone, not the thing. And if Bruno took this personally 
          in this case, then that was my fault - but as I said, I can get 
          annoyed, too. I think I usually manage to only be a pain in the ass 
          without being an ass, though :-)
          
          Bye,
             Axel.
          
          
          
          From axeld at pinc-software.de  Sun May 17 17:26:21 2009
          From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=)
          Date: Sun, 17 May 2009 17:26:21 +0200 CEST
          Subject: [Haiku-commits] r30774 -
           haiku/trunk/src/system/kernel/disk_device_manager
          In-Reply-To: <2344806856-BeMail@Gaspode>
          Message-ID: <15416594374-BeMail@zon>
          
          "Bruno Albuquerque"  wrote:
          > On Sun, 17 May 2009 13:27:56 +0200 CEST, Axel D?rfler said:
          > > > It was probably just the fastest way to get it working when Ingo 
          > > > did it. 
          > > This has nothing to do with what the disk device manager is doing 
          > > (and actually it was me who implemented that).
          > I stand corrected. I thought Ingo did the disk device manager stuff.
          
          He did most of it, but it was me that wrote the media change notifier.
          
          > > As I pointed out above, that's a bug in the device driver that 
          > > should 
          > > be fixed, it's completely independent from any notifications.
          > So, if I understand you correctly, MediaChanged() should return true 
          > only after one call to UpdateMediaStatusIfNeeded(), right (meaning 
          > that 
          > a second call should reset it to false even if immediatelly after a 
          > disk change is detected)? I will take a look at the relevant ioctl in 
          > the atapi code. Interesting enough, both the old and new stack have 
          > exactly the same behaviour so maybe this is just a particularity of 
          > atapi itself?
          
          It's a problem of the scsi_cd driver, I would guess - that one is 
          always used, no matter the stack. The point of B_GET_MEDIA_STATUS is 
          that it only returns B_DEV_MEDIA_CHANGED once for every actual media 
          change - not twice if the device was not fast enough to load the CD in 
          between.
          
          Bye,
             Axel.
          
          
          
          From axeld at mail.berlios.de  Sun May 17 18:49:07 2009
          From: axeld at mail.berlios.de (axeld at BerliOS)
          Date: Sun, 17 May 2009 18:49:07 +0200
          Subject: [Haiku-commits] r30782 - in haiku/trunk: headers/os/interface
          	src/kits/interface
          Message-ID: <200905171649.n4HGn7Kk003721@sheep.berlios.de>
          
          Author: axeld
          Date: 2009-05-17 18:49:05 +0200 (Sun, 17 May 2009)
          New Revision: 30782
          ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30782&view=rev
          
          Modified:
             haiku/trunk/headers/os/interface/ListView.h
             haiku/trunk/src/kits/interface/ListView.cpp
          Log:
          * Applied a changed patch by Romain that fixes the non-working double click in
            BListView. This fixes bug #3919. Got rid of the _TryInitiateDrag() method,
            and let MouseMoved() do it all.
          * Style cleanup of the header, automatic whitespace cleanup.
          
          
          Modified: haiku/trunk/headers/os/interface/ListView.h
          ===================================================================
          --- haiku/trunk/headers/os/interface/ListView.h	2009-05-17 14:15:00 UTC (rev 30781)
          +++ haiku/trunk/headers/os/interface/ListView.h	2009-05-17 16:49:05 UTC (rev 30782)
          @@ -1,5 +1,5 @@
           /*
          - * Copyright 2002-2006, Haiku, Inc. All Rights Reserved.
          + * Copyright 2002-2009, Haiku, Inc. All Rights Reserved.
            * Distributed under the terms of the MIT License.
            */
           #ifndef _LIST_VIEW_H
          @@ -7,9 +7,9 @@
           
           
           #include 
          -#include 
           #include 
           #include 
          +#include 
           
           
           struct track_data;
          @@ -21,167 +21,170 @@
           
           
           class BListView : public BView, public BInvoker {
          -	public:
          -		BListView(BRect frame, const char* name,
          -			list_view_type type = B_SINGLE_SELECTION_LIST,
          -			uint32 resizeMask = B_FOLLOW_LEFT | B_FOLLOW_TOP,
          -			uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE);
          -		BListView(const char* name,
          -			list_view_type type = B_SINGLE_SELECTION_LIST,
          -			uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE);
          -		BListView(list_view_type type = B_SINGLE_SELECTION_LIST);
          -		BListView(BMessage* data);
          +public:
          +							BListView(BRect frame, const char* name,
          +								list_view_type type = B_SINGLE_SELECTION_LIST,
          +								uint32 resizeMask = B_FOLLOW_LEFT | B_FOLLOW_TOP,
          +								uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS
          +									| B_NAVIGABLE);
          +							BListView(const char* name,
          +								list_view_type type = B_SINGLE_SELECTION_LIST,
          +								uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS
          +									| B_NAVIGABLE);
          +							BListView(
          +								list_view_type type = B_SINGLE_SELECTION_LIST);
          +							BListView(BMessage* data);
           
          -		virtual ~BListView() ;
          +	virtual					~BListView();
           
          -		static	BArchivable* Instantiate(BMessage* data);
          -		virtual status_t	Archive(BMessage* data, bool deep = true) const;
          -		virtual void		Draw(BRect updateRect);
          -		virtual void		MessageReceived(BMessage* msg);
          -		virtual void		MouseDown(BPoint where);
          -		virtual void		KeyDown(const char* bytes, int32 numBytes);
          -		virtual void		MakeFocus(bool state = true);
          -		virtual void		AttachedToWindow();
          -		virtual void		FrameResized(float newWidth, float newHeight);
          -		virtual void		FrameMoved(BPoint newPosition);
          -		virtual	void		SetFont(const BFont* font,
          -								uint32 mask = B_FONT_ALL);
          -		virtual void		TargetedByScrollView(BScrollView* scroller);
          -		virtual void		ScrollTo(BPoint where);
          -		inline	void		ScrollTo(float x, float y);
          -		virtual bool		AddItem(BListItem* item);
          -		virtual bool		AddItem(BListItem* item, int32 atIndex);
          -		virtual bool		AddList(BList* newItems);
          -		virtual bool		AddList(BList* newItems, int32 atIndex);
          -		virtual bool		RemoveItem(BListItem* item);
          -		virtual BListItem*	RemoveItem(int32 index);
          -		virtual bool		RemoveItems(int32 index, int32 count);
          +	static	BArchivable*	Instantiate(BMessage* data);
          +	virtual status_t		Archive(BMessage* data, bool deep = true) const;
          +	virtual void			Draw(BRect updateRect);
          +	virtual void			MessageReceived(BMessage* message);
          +	virtual void			MouseDown(BPoint where);
          +	virtual void			KeyDown(const char* bytes, int32 numBytes);
          +	virtual void			MakeFocus(bool state = true);
          +	virtual void			AttachedToWindow();
          +	virtual void			FrameResized(float newWidth, float newHeight);
          +	virtual void			FrameMoved(BPoint newPosition);
          +	virtual	void			SetFont(const BFont* font, uint32 mask = B_FONT_ALL);
          +	virtual void			TargetedByScrollView(BScrollView* scroller);
          +	virtual void			ScrollTo(BPoint where);
          +	inline	void			ScrollTo(float x, float y);
          +	virtual bool			AddItem(BListItem* item);
          +	virtual bool			AddItem(BListItem* item, int32 atIndex);
          +	virtual bool			AddList(BList* newItems);
          +	virtual bool			AddList(BList* newItems, int32 atIndex);
          +	virtual bool			RemoveItem(BListItem* item);
          +	virtual BListItem*		RemoveItem(int32 index);
          +	virtual bool			RemoveItems(int32 index, int32 count);
           
          -		virtual void		SetSelectionMessage(BMessage* message);
          -		virtual void		SetInvocationMessage(BMessage* message);
          +	virtual void			SetSelectionMessage(BMessage* message);
          +	virtual void			SetInvocationMessage(BMessage* message);
           
          -				BMessage*	SelectionMessage() const;
          -				uint32		SelectionCommand() const;
          -				BMessage*	InvocationMessage() const;
          -				uint32		InvocationCommand() const;
          +			BMessage*		SelectionMessage() const;
          +			uint32			SelectionCommand() const;
          +			BMessage*		InvocationMessage() const;
          +			uint32			InvocationCommand() const;
           
          -		virtual void		SetListType(list_view_type type);
          -				list_view_type ListType() const;
          +	virtual void			SetListType(list_view_type type);
          +			list_view_type	ListType() const;
           
          -				BListItem*	ItemAt(int32 index) const;
          -				int32		IndexOf(BPoint point) const;
          -				int32		IndexOf(BListItem* item) const;
          -				BListItem*	FirstItem() const;
          -				BListItem*	LastItem() const;
          -				bool		HasItem(BListItem* item) const;
          -				int32		CountItems() const;
          -		virtual void		MakeEmpty();
          -				bool		IsEmpty() const;
          -				void		DoForEach(bool (*func)(BListItem* item));
          -				void		DoForEach(bool (*func)(BListItem* item, void* arg), void* arg);
          -		const	BListItem**	Items() const;
          -				void		InvalidateItem(int32 index);
          -				void		ScrollToSelection();
          +			BListItem*		ItemAt(int32 index) const;
          +			int32			IndexOf(BPoint point) const;
          +			int32			IndexOf(BListItem* item) const;
          +			BListItem*		FirstItem() const;
          +			BListItem*		LastItem() const;
          +			bool			HasItem(BListItem* item) const;
          +			int32			CountItems() const;
          +	virtual void			MakeEmpty();
          +			bool			IsEmpty() const;
          +			void			DoForEach(bool (*func)(BListItem* item));
          +			void			DoForEach(bool (*func)(BListItem* item, void* arg),
          +								void* arg);
          +			const BListItem** Items() const;
          +			void			InvalidateItem(int32 index);
          +			void			ScrollToSelection();
           
          -				void		Select(int32 index, bool extend = false);
          -				void		Select(int32 from, int32 to, bool extend = false);
          -				bool		IsItemSelected(int32 index) const;
          -				int32		CurrentSelection(int32 index = 0) const;
          -		virtual status_t	Invoke(BMessage* message = NULL);
          +			void			Select(int32 index, bool extend = false);
          +			void			Select(int32 from, int32 to, bool extend = false);
          +			bool			IsItemSelected(int32 index) const;
          +			int32			CurrentSelection(int32 index = 0) const;
          +	virtual status_t		Invoke(BMessage* message = NULL);
           
          -				void		DeselectAll();
          -				void		DeselectExcept(int32 exceptFrom, int32 exceptTo);
          -				void		Deselect(int32 index);
          +			void			DeselectAll();
          +			void			DeselectExcept(int32 exceptFrom, int32 exceptTo);
          +			void			Deselect(int32 index);
           
          -		virtual void		SelectionChanged();
          +	virtual void			SelectionChanged();
           
          -				void		SortItems(int (*cmp)(const void*, const void*));
          +			void			SortItems(int (*cmp)(const void*, const void*));
           
          -		/* These functions bottleneck through DoMiscellaneous() */
          -				bool		SwapItems(int32 a, int32 b);
          -				bool		MoveItem(int32 from, int32 to);
          -				bool		ReplaceItem(int32 index, BListItem* item);
          +	/* These functions bottleneck through DoMiscellaneous() */
          +			bool			SwapItems(int32 a, int32 b);
          +			bool			MoveItem(int32 from, int32 to);
          +			bool			ReplaceItem(int32 index, BListItem* item);
           
          -				BRect		ItemFrame(int32 index);
          +			BRect			ItemFrame(int32 index);
           
          -		virtual BHandler*	ResolveSpecifier(BMessage* message, int32 index,
          -								BMessage* specifier, int32 form, const char* property);
          -		virtual status_t	GetSupportedSuites(BMessage* data);
          +	virtual BHandler*		ResolveSpecifier(BMessage* message, int32 index,
          +								BMessage* specifier, int32 form,
          +								const char* property);
          +	virtual status_t		GetSupportedSuites(BMessage* data);
           
          -		virtual status_t	Perform(perform_code code, void* arg);
          +	virtual status_t		Perform(perform_code code, void* arg);
           
          -		virtual void		WindowActivated(bool state);
          -		virtual void		MouseUp(BPoint point);
          -		virtual void		MouseMoved(BPoint point, uint32 code,
          -								const BMessage *dragMessage);
          -		virtual void		DetachedFromWindow();
          -		virtual bool		InitiateDrag(BPoint point, int32 itemIndex,
          +	virtual void			WindowActivated(bool state);
          +	virtual void			MouseUp(BPoint point);
          +	virtual void			MouseMoved(BPoint point, uint32 code,
          +								const BMessage* dragMessage);
          +	virtual void			DetachedFromWindow();
          +	virtual bool			InitiateDrag(BPoint point, int32 itemIndex,
           								bool initialySelected);
           
          -		virtual void		ResizeToPreferred();
          -		virtual void		GetPreferredSize(float* _width, float* _height);
          -		virtual void		AllAttached();
          -		virtual void		AllDetached();
          +	virtual void			ResizeToPreferred();
          +	virtual void			GetPreferredSize(float* _width, float* _height);
          +	virtual void			AllAttached();
          +	virtual void			AllDetached();
           
          -		virtual	BSize		MinSize();
          -		virtual	BSize		MaxSize();
          -		virtual	BSize		PreferredSize();
          +	virtual	BSize			MinSize();
          +	virtual	BSize			MaxSize();
          +	virtual	BSize			PreferredSize();
           
          -	protected:
          -		enum MiscCode { B_NO_OP, B_REPLACE_OP, B_MOVE_OP, B_SWAP_OP };
          -		union MiscData {
          -			struct Spare { int32 data[5]; };
          -			struct Replace { int32 index; BListItem *item; } replace;
          -			struct Move { int32 from; int32 to; } move;
          -			struct Swap { int32 a; int32 b; } swap;
          -		};
          +protected:
          +	enum MiscCode { B_NO_OP, B_REPLACE_OP, B_MOVE_OP, B_SWAP_OP };
          +	union MiscData {
          +		struct Spare { int32 data[5]; };
          +		struct Replace { int32 index; BListItem *item; } replace;
          +		struct Move { int32 from; int32 to; } move;
          +		struct Swap { int32 a; int32 b; } swap;
          +	};
           
          -		virtual bool		DoMiscellaneous(MiscCode code, MiscData *data);
          -	private:
          -		friend class BOutlineListView;
          +	virtual bool			DoMiscellaneous(MiscCode code, MiscData* data);
           
          -		virtual	void		_ReservedListView2();
          -		virtual	void		_ReservedListView3();
          -		virtual	void		_ReservedListView4();
          +private:
          +	friend class BOutlineListView;
           
          -				BListView&	operator=(const BListView&);
          +	virtual	void			_ReservedListView2();
          +	virtual	void			_ReservedListView3();
          +	virtual	void			_ReservedListView4();
           
          -				void		_InitObject(list_view_type type);
          -				void		_FixupScrollBar();
          -				void		_InvalidateFrom(int32 index);
          -				status_t	_PostMessage(BMessage* message);
          -				void		_FontChanged();
          -				int32		_RangeCheck(int32 index);
          -				bool		_Select(int32 index, bool extend);
          -				bool		_Select(int32 from, int32 to, bool extend);
          -				bool		_Deselect(int32 index);
          -//				void		_Deselect(int32 from, int32 to);
          -				bool		_DeselectAll(int32 exceptFrom, int32 exceptTo);
          -//				void		PerformDelayedSelect();
          -				bool		_TryInitiateDrag(BPoint where);
          -				int32		_CalcFirstSelected(int32 after);
          -				int32		_CalcLastSelected(int32 before);
          -				void		_RecalcItemTops(int32 start, int32 end = -1);
          -		virtual void		DrawItem(BListItem* item, BRect itemRect,
          +			BListView&		operator=(const BListView& other);
          +
          +			void			_InitObject(list_view_type type);
          +			void			_FixupScrollBar();
          +			void			_InvalidateFrom(int32 index);
          +			status_t		_PostMessage(BMessage* message);
          +			void			_FontChanged();
          +			int32			_RangeCheck(int32 index);
          +			bool			_Select(int32 index, bool extend);
          +			bool			_Select(int32 from, int32 to, bool extend);
          +			bool			_Deselect(int32 index);
          +			bool			_DeselectAll(int32 exceptFrom, int32 exceptTo);
          +			int32			_CalcFirstSelected(int32 after);
          +			int32			_CalcLastSelected(int32 before);
          +			void			_RecalcItemTops(int32 start, int32 end = -1);
          +	virtual void			DrawItem(BListItem* item, BRect itemRect,
           								bool complete = false);
          -	
          -				bool		_SwapItems(int32 a, int32 b);
          -				bool		_MoveItem(int32 from, int32 to);
          -				bool		_ReplaceItem(int32 index, BListItem* item);
          -				void		_RescanSelection(int32 from, int32 to);
           
          -		BList				fList;
          -		list_view_type		fListType;
          -		int32				fFirstSelected;
          -		int32				fLastSelected;
          -		int32				fAnchorIndex;
          -		BMessage*			fSelectMessage;
          -		BScrollView*		fScrollView;
          -		track_data*			fTrack;
          +			bool			_SwapItems(int32 a, int32 b);
          +			bool			_MoveItem(int32 from, int32 to);
          +			bool			_ReplaceItem(int32 index, BListItem* item);
          +			void			_RescanSelection(int32 from, int32 to);
           
          -		uint32				_reserved[4];
          +			BList			fList;
          +			list_view_type	fListType;
          +			int32			fFirstSelected;
          +			int32			fLastSelected;
          +			int32			fAnchorIndex;
          +			BMessage*		fSelectMessage;
          +			BScrollView*	fScrollView;
          +			track_data*		fTrack;
          +
          +			uint32			_reserved[4];
           };
           
          +
           inline void
           BListView::ScrollTo(float x, float y)
           {
          
          Modified: haiku/trunk/src/kits/interface/ListView.cpp
          ===================================================================
          --- haiku/trunk/src/kits/interface/ListView.cpp	2009-05-17 14:15:00 UTC (rev 30781)
          +++ haiku/trunk/src/kits/interface/ListView.cpp	2009-05-17 16:49:05 UTC (rev 30782)
          @@ -1,5 +1,5 @@
           /*
          - * Copyright (c) 2001-2008, Haiku, Inc.
          + * Copyright (c) 2001-2009, Haiku, Inc.
            * Distributed under the terms of the MIT license.
            *
            * Authors:
          @@ -323,13 +323,13 @@
           	bigtime_t doubleClickSpeed;
           	get_click_speed(&doubleClickSpeed);
           	bool doubleClick = false;
          -	
          +
           	if (timeDelta < doubleClickSpeed
           		&& fabs(delta.x) < kDoubleClickTresh
           		&& fabs(delta.y) < kDoubleClickTresh
           		&& fTrack->item_index == index)
           		doubleClick = true;
          -	
          +
           	if (doubleClick && index >= fFirstSelected && index <= fLastSelected) {
           		fTrack->drag_start.Set(LONG_MAX, LONG_MAX);
           		Invoke();
          @@ -338,7 +338,7 @@
           
           	int32 modifiers;
           	message->FindInt32("modifiers", &modifiers);
          -	
          +
           	if (!doubleClick) {
           		fTrack->drag_start = point;
           		fTrack->last_click_time = system_time();
          @@ -382,22 +382,27 @@
           void
           BListView::MouseUp(BPoint pt)
           {
          -	fTrack->item_index = -1;
           	fTrack->try_drag = false;
           }
           
          -// MouseMoved
          +
           void
          -BListView::MouseMoved(BPoint pt, uint32 code, const BMessage *msg)
          +BListView::MouseMoved(BPoint where, uint32 code, const BMessage* dragMessage)
           {
          -	if (fTrack->item_index == -1) {
          +	if (fTrack->item_index == -1 || !fTrack->try_drag) {
           		// mouse was not clicked above any item
           		// or no mouse button pressed
           		return;
           	}
           
          -	if (_TryInitiateDrag(pt))
          -		return;
          +	// Initiate a drag if the mouse was moved far enough
          +	BPoint offset = where - fTrack->drag_start;
          +	float dragDistance = sqrtf(offset.x * offset.x + offset.y * offset.y);
          +	if (dragDistance >= 5.0f) {
          +		fTrack->try_drag = false;
          +		InitiateDrag(fTrack->drag_start, fTrack->item_index,
          +			fTrack->was_selected);
          +	}
           }
           
           
          @@ -615,7 +620,7 @@
           			ItemAt(i)->SetTop((i > 0) ? ItemAt(i - 1)->Bottom() + 1.0 : 0.0);
           			ItemAt(i)->Update(this, &font);
           		}
          -		
          +
           		_RecalcItemTops(index + list->CountItems() - 1);
           
           		_FixupScrollBar();
          @@ -1553,23 +1558,6 @@
           }
           
           
          -bool
          -BListView::_TryInitiateDrag(BPoint where)
          -{
          -	if (!fTrack->try_drag || fTrack->item_index < 0)
          -		return false;
          -
          -	BPoint offset = where - fTrack->drag_start;
          -	float dragDistance = sqrtf(offset.x * offset.x + offset.y * offset.y);
          -
          -	if (dragDistance > 5.0) {
          -		fTrack->try_drag = false;
          -		return InitiateDrag(fTrack->drag_start, fTrack->item_index, fTrack->was_selected);
          -	}
          -	return false;
          -}
          -
          -
           int32
           BListView::_CalcFirstSelected(int32 after)
           {
          
          
          
          From bga at bug-br.org.br  Sun May 17 14:36:03 2009
          From: bga at bug-br.org.br (Bruno Albuquerque)
          Date: Sun, 17 May 2009 14:36:03
          Subject: [Haiku-commits] r30774 -
           haiku/trunk/src/system/kernel/disk_device_manager
          In-Reply-To: <15416594374-BeMail@zon>
          Message-ID: <1429768921-BeMail@Gaspode>
          
          On Sun, 17 May 2009 17:26:21 +0200 CEST, Axel D?rfler said:
          
          > > So, if I understand you correctly, MediaChanged() should return 
          > > true 
          > > only after one call to UpdateMediaStatusIfNeeded(), right (meaning 
          > > that 
          > > a second call should reset it to false even if immediatelly after a 
          > > disk change is detected)? I will take a look at the relevant ioctl 
          > > in 
          > > the atapi code. Interesting enough, both the old and new stack have 
          > > exactly the same behaviour so maybe this is just a particularity of 
          > > atapi itself?
          > 
          > It's a problem of the scsi_cd driver, I would guess - that one is 
          > always used, no matter the stack. The point of B_GET_MEDIA_STATUS is 
          > that it only returns B_DEV_MEDIA_CHANGED once for every actual media 
          > change - not twice if the device was not fast enough to load the CD 
          > in 
          > between.
          
          periph_get_media_status() in scsi_periph/removable.cpp is what handles 
          the B_GET_MEDIA_STATUS. Not being familiar with the code I can not 
          really pinpoint any problems in it but one thing that I guess may happen 
          is that there is a pending_error in the first read (handle->pending_
          error != B_OK) and it returns this the first time (which is interoreted 
          as a media change). Then the second time there is no pending error and 
          the request is sent to the device itself (scsi ccb request) and it 
          returns media changed again. Does it make sense at all? I guess someone 
          that knows more about this code will have to take a look at it as with 
          what I know I can only guess.
          
          -Bruno
          
          
          
          From rudolfc at mail.berlios.de  Sun May 17 22:37:37 2009
          From: rudolfc at mail.berlios.de (rudolfc at mail.berlios.de)
          Date: Sun, 17 May 2009 22:37:37 +0200
          Subject: [Haiku-commits] r30783 - in haiku/trunk/src/add-ons:
          	accelerants/nvidia/engine kernel/drivers/graphics/nvidia
          Message-ID: <200905172037.n4HKbbTS027014@sheep.berlios.de>
          
          Author: rudolfc
          Date: 2009-05-17 22:37:20 +0200 (Sun, 17 May 2009)
          New Revision: 30783
          ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30783&view=rev
          
          Modified:
             haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_acc.c
             haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_acc_dma.c
             haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c
             haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html
          Log:
          fixed acceleration engine crashes on at least G72 cards by powering up a new part of the engine. This fixes acc on Geforce 7300/7400/7500 cards, and closes tickets #927, #1535 and #3482. In order to test this you need to go back to Haiku R30277 at least since app_server nolonger uses acceleration. Acceleration code was synced to Xfree86 4.8.0. and no chances were found. Bumped version to 0.90, updated docs.
          
          Modified: haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_acc.c
          ===================================================================
          --- haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_acc.c	2009-05-17 16:49:05 UTC (rev 30782)
          +++ haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_acc.c	2009-05-17 20:37:20 UTC (rev 30783)
          @@ -1,6 +1,6 @@
           /* NV Acceleration functions */
           /* Author:
          -   Rudolf Cornelissen 8/2003-5/2005.
          +   Rudolf Cornelissen 8/2003-5/2009.
           
              This code was possible thanks to:
               - the Linux XFree86 NV driver,
          @@ -85,9 +85,9 @@
           	uint16 cnt;
           
           	/* a hanging engine only recovers from a complete power-down/power-up cycle */
          -	NV_REG32(NV32_PWRUPCTRL) = 0x13110011;
          +	NV_REG32(NV32_PWRUPCTRL) = 0xffff00ff;
           	snooze(1000);
          -	NV_REG32(NV32_PWRUPCTRL) = 0x13111111;
          +	NV_REG32(NV32_PWRUPCTRL) = 0xffffffff;
           
           	/* setup PTIMER: */
           	//fixme? how about NV28 setup as just after coldstarting? (see nv_info.c)
          
          Modified: haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_acc_dma.c
          ===================================================================
          --- haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_acc_dma.c	2009-05-17 16:49:05 UTC (rev 30782)
          +++ haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_acc_dma.c	2009-05-17 20:37:20 UTC (rev 30783)
          @@ -1,7 +1,7 @@
           /* NV Acceleration functions */
           
           /* Author:
          -   Rudolf Cornelissen 8/2003-9/2007.
          +   Rudolf Cornelissen 8/2003-5/2009.
           
              This code was possible thanks to:
               - the Linux XFree86 NV driver,
          @@ -80,9 +80,9 @@
           	err = 0;
           
           	/* a hanging engine only recovers from a complete power-down/power-up cycle */
          -	NV_REG32(NV32_PWRUPCTRL) = 0x13110011;
          +	NV_REG32(NV32_PWRUPCTRL) = 0xffff00ff;
           	snooze(1000);
          -	NV_REG32(NV32_PWRUPCTRL) = 0x13111111;
          +	NV_REG32(NV32_PWRUPCTRL) = 0xffffffff;
           
           	/* don't try this on NV20 and later.. */
           	/* note:
          
          Modified: haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c
          ===================================================================
          --- haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c	2009-05-17 16:49:05 UTC (rev 30782)
          +++ haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c	2009-05-17 20:37:20 UTC (rev 30783)
          @@ -1,7 +1,7 @@
           /* Authors:
              Mark Watson 12/1999,
              Apsed,
          -   Rudolf Cornelissen 10/2002-6/2008
          +   Rudolf Cornelissen 10/2002-5/2009
              tst..
           */
           
          @@ -92,7 +92,7 @@
           {
           	status_t status;
           
          -	LOG(1,("POWERUP: Haiku nVidia Accelerant 0.89 running.\n"));
          +	LOG(1,("POWERUP: Haiku nVidia Accelerant 0.90 running.\n"));
           
           	/* log VBLANK INT usability status */
           	if (si->ps.int_assigned)
          @@ -1654,17 +1654,18 @@
           
           static void unlock_card(void)
           {
          -	/* power-up all nvidia hardware function blocks */
          +	/* make sure to power-up all nvidia hardware function blocks */
           	/* bit 28: OVERLAY ENGINE (BES),
           	 * bit 25: CRTC2, (> NV04A)
           	 * bit 24: CRTC1,
           	 * bit 20: framebuffer,
           	 * bit 16: PPMI,
          +	 * bit 13: some part of at least the G72 acceleration engine,
           	 * bit 12: PGRAPH,
           	 * bit  8: PFIFO,
           	 * bit  4: PMEDIA,
           	 * bit  0: TVOUT. (> NV04A) */
          -	NV_REG32(NV32_PWRUPCTRL) = 0x13111111;
          +	NV_REG32(NV32_PWRUPCTRL) = 0xffffffff;
           
           	/* select colormode CRTC registers base adresses */
           	NV_REG8(NV8_MISCW) = 0xcb;
          @@ -1689,9 +1690,9 @@
           static status_t nv_general_bios_to_powergraphics()
           {
           	/* let acc engine make power off/power on cycle to start 'fresh' */
          -	NV_REG32(NV32_PWRUPCTRL) = 0x13110011;
          +	NV_REG32(NV32_PWRUPCTRL) = 0xffff00ff;
           	snooze(1000);
          -	NV_REG32(NV32_PWRUPCTRL) = 0x13111111;
          +	NV_REG32(NV32_PWRUPCTRL) = 0xffffffff;
           
           	unlock_card();
           
          
          Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html
          ===================================================================
          --- haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html	2009-05-17 16:49:05 UTC (rev 30782)
          +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html	2009-05-17 20:37:20 UTC (rev 30783)
          @@ -4,7 +4,7 @@
           
           
           

          Changes done for each driverversion:

          -

          head (SVN 0.89, Rudolf)

          +

          head (SVN 0.90, Rudolf)

          • Fixed driver assuming enabling AGP mode succeeded on some occasions if it did not block it itself. Blocking AGP mode completely via the AGP busmanager (option 'block_agp') resulted in a crashing acceleration engine because it was setup for AGP transfers instead of using PCI transfers. Error was solved with help from user kraton.
          • Fixed shared_info struct problem occuring when 3D 'accelerant' is used (tested Alpha 4.1): the TVencoder type definition list apparantly gets some memory assigned these days when done inside the definition of shared_info. Moved encoder list outside the shared_info definition. @@ -20,6 +20,7 @@
          • HDTV video upto/including 1920x1080p can now be played back using overlay on Geforce cards where overlay is supported. On TNT1/TNT2/TNT2-M64 this can't be done and bitmap output is used.
          • Added partial DDC/EDID support: dumping monitor specs to logfile only for now.
          • Added confirmed support for laptop card with ID 0x01d7: Quadro NVS 110M/GeForce 7300 Go. Also fixed support for laptop card with ID 0x01d8: GeForce 7400 Go: the 'laptop' definition was missing here. +
          • Fixed acceleration engine crashes on at least G72 cards (Geforce 7300/7400/7500) by powering up new part(s) of the acceleration engines too..

          nv_driver 0.80 (Rudolf)

            From stippi at mail.berlios.de Mon May 18 02:20:10 2009 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Mon, 18 May 2009 02:20:10 +0200 Subject: [Haiku-commits] r30784 - haiku/trunk/src/kits/interface Message-ID: <200905180020.n4I0KA9Z023798@sheep.berlios.de> Author: stippi Date: 2009-05-18 02:20:07 +0200 (Mon, 18 May 2009) New Revision: 30784 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30784&view=rev Modified: haiku/trunk/src/kits/interface/ColorControl.cpp Log: * Removed unnecessary code and simplified some places in the drawing code paths. * Calling BTextView::SetText() will invoke Window()->UpdateIfNeeded(), maybe since some recent changes only - we should perhaps look into this... (zooey), but the problem was that we called BControl::SetValueNoUpdate() after that, and thus we were drawing the color mark at the old offset and the invalidation in SetValue() was rendered effectless. Fixes #3719. Modified: haiku/trunk/src/kits/interface/ColorControl.cpp =================================================================== --- haiku/trunk/src/kits/interface/ColorControl.cpp 2009-05-17 20:37:20 UTC (rev 30783) +++ haiku/trunk/src/kits/interface/ColorControl.cpp 2009-05-18 00:20:07 UTC (rev 30784) @@ -246,7 +246,6 @@ c2.green = (value & 0x00FF0000) >> 16; c2.blue = (value & 0x0000FF00) >> 8; c2.alpha = 255; - char string[4]; if (fPaletteMode) { //workaround when two indexes have the same color @@ -264,7 +263,7 @@ fPreviousSelectedPaletteColorIndex = fSelectedPaletteColorIndex; } else { - float invalidateRadius = kSelectorSize/2 + kSelectorPenSize; + float invalidateRadius = kSelectorSize / 2 + kSelectorPenSize; BPoint p; if (c1.red != c2.red) { @@ -295,26 +294,23 @@ p.x + invalidateRadius, p.y + invalidateRadius)); } } - + + // Set the value here, since BTextControl will trigger + // Window()->UpdateIfNeeded() which will cause us to draw the indicators + // at the old offset. + if (Value() != value) + BControl::SetValueNoUpdate(value); + // the textcontrols have to be updated even when the color // hasn't changed since the value is clamped upstream // and the textcontrols would still show the unclamped value + char string[4]; sprintf(string, "%d", c2.red); fRedText->SetText(string); sprintf(string, "%d", c2.green); fGreenText->SetText(string); sprintf(string, "%d", c2.blue); fBlueText->SetText(string); - - if (Value() == value) - return; - - BControl::SetValueNoUpdate(value); - - if (LockLooper()) { - Window()->UpdateIfNeeded(); - UnlockLooper(); - } } @@ -369,6 +365,7 @@ switch (message->what) { case kMsgColorEntered: { +printf("kMsgColorEntered\n"); rgb_color color; color.red = min_c(strtol(fRedText->Text(), NULL, 10), 255); color.green = min_c(strtol(fGreenText->Text(), NULL, 10), 255); @@ -388,29 +385,17 @@ void BColorControl::Draw(BRect updateRect) { - if (fBitmap) { - if (!fBitmap->Lock()) - return; - - if (fOffscreenView->Bounds().Intersects(updateRect)) - DrawBitmap(fBitmap, B_ORIGIN); - - fBitmap->Unlock(); - _DrawSelectors(this); - - } else { + if (fBitmap) + DrawBitmap(fBitmap, B_ORIGIN); + else _DrawColorArea(this, updateRect); - _DrawSelectors(this); - } + _DrawSelectors(this); } void BColorControl::_DrawColorArea(BView* target, BRect update) { - BRegion region(update); - target->ConstrainClippingRegion(®ion); - BRect bevelRect = fPaletteFrame.InsetByCopy(-2.0,-2.0); //bevel bool enabled = IsEnabled(); @@ -509,8 +494,6 @@ _ColorRamp(_RampFrame(2), target, green, compColor, 0, false, update); _ColorRamp(_RampFrame(3), target, blue, compColor, 0, false, update); } - - target->ConstrainClippingRegion(NULL); } @@ -710,6 +693,8 @@ return; if (!fPaletteFrame.Contains(point)) return; + + MakeFocus(); if (fPaletteMode) { int column = (int) ( (point.x - fPaletteFrame.left) / fCellSize ); @@ -723,7 +708,8 @@ rgb_color color = ValueAsColor(); uint8 shade = (unsigned char)max_c(0, - min_c((point.x - _RampFrame(0).left) * 255 / _RampFrame(0).Width(), 255)); + min_c((point.x - _RampFrame(0).left) * 255 / _RampFrame(0).Width(), + 255)); if (_RampFrame(0).Contains(point)) { color.red = color.green = color.blue = shade; @@ -746,7 +732,6 @@ Invoke(); SetTracking(true); - MakeFocus(); SetMouseEventMask(B_POINTER_EVENTS, B_NO_POINTER_HISTORY|B_LOCK_WINDOW_FOCUS); } From stippi at mail.berlios.de Mon May 18 02:24:03 2009 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Mon, 18 May 2009 02:24:03 +0200 Subject: [Haiku-commits] r30785 - haiku/trunk/src/kits/interface Message-ID: <200905180024.n4I0O3r0024041@sheep.berlios.de> Author: stippi Date: 2009-05-18 02:24:01 +0200 (Mon, 18 May 2009) New Revision: 30785 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30785&view=rev Modified: haiku/trunk/src/kits/interface/ColorControl.cpp Log: Removed debugging left-over... sorry. Modified: haiku/trunk/src/kits/interface/ColorControl.cpp =================================================================== --- haiku/trunk/src/kits/interface/ColorControl.cpp 2009-05-18 00:20:07 UTC (rev 30784) +++ haiku/trunk/src/kits/interface/ColorControl.cpp 2009-05-18 00:24:01 UTC (rev 30785) @@ -365,7 +365,6 @@ switch (message->what) { case kMsgColorEntered: { -printf("kMsgColorEntered\n"); rgb_color color; color.red = min_c(strtol(fRedText->Text(), NULL, 10), 255); color.green = min_c(strtol(fGreenText->Text(), NULL, 10), 255); From mmlr at mail.berlios.de Mon May 18 03:13:45 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Mon, 18 May 2009 03:13:45 +0200 Subject: [Haiku-commits] r30786 - haiku/trunk/src/add-ons/kernel/network/stack Message-ID: <200905180113.n4I1Dj3q030750@sheep.berlios.de> Author: mmlr Date: 2009-05-18 03:13:44 +0200 (Mon, 18 May 2009) New Revision: 30786 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30786&view=rev Modified: haiku/trunk/src/add-ons/kernel/network/stack/net_socket.cpp Log: Implement the FIONREAD ioctl for sockets. We already supported it in userland but the kernel part was missing. It is used to query for the buffer size that can be retrieved using recv(). It returns the same value we use for the read select(). Modified: haiku/trunk/src/add-ons/kernel/network/stack/net_socket.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/stack/net_socket.cpp 2009-05-18 00:24:01 UTC (rev 30785) +++ haiku/trunk/src/add-ons/kernel/network/stack/net_socket.cpp 2009-05-18 01:13:44 UTC (rev 30786) @@ -70,8 +70,8 @@ socklen_t addressLength); int socket_setsockopt(net_socket* socket, int level, int option, const void* value, int length); +ssize_t socket_read_avail(net_socket* socket); - static SocketList sSocketList; static mutex sSocketLock; @@ -496,6 +496,23 @@ sizeof(int)); } + case FIONREAD: + { + if (data == NULL) + return B_BAD_VALUE; + + ssize_t available = socket_read_avail(socket); + if (is_syscall()) { + if (!IS_USER_ADDRESS(data) + || user_memcpy(data, &available, sizeof(ssize_t)) != B_OK) { + return B_BAD_ADDRESS; + } + } else + *(ssize_t *)data = available; + + return B_OK; + } + case B_SET_BLOCKING_IO: case B_SET_NONBLOCKING_IO: { From axeld at mail.berlios.de Mon May 18 11:09:24 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Mon, 18 May 2009 11:09:24 +0200 Subject: [Haiku-commits] r30787 - in haiku/trunk: headers/os/storage src/kits/storage Message-ID: <200905180909.n4I99Osd031441@sheep.berlios.de> Author: axeld Date: 2009-05-18 11:09:23 +0200 (Mon, 18 May 2009) New Revision: 30787 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30787&view=rev Modified: haiku/trunk/headers/os/storage/Path.h haiku/trunk/src/kits/storage/Path.cpp Log: * Flatten() would create an invalid entry ref if the path did not exist, or the path was not yet initialized. It will now fail instead. * Got rid of EBadInput - _MustNormalize() can now return an error code instead. * Style cleanup. Modified: haiku/trunk/headers/os/storage/Path.h =================================================================== --- haiku/trunk/headers/os/storage/Path.h 2009-05-18 01:13:44 UTC (rev 30786) +++ haiku/trunk/headers/os/storage/Path.h 2009-05-18 09:09:23 UTC (rev 30787) @@ -1,103 +1,79 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file Path.h - BPath interface declaration. -*/ - +/* + * Copyright 2002-2009, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + */ #ifndef _PATH_H #define _PATH_H + #include +#include #include -#include /* for convenience, as in R5 */ -#ifdef USE_OPENBEOS_NAMESPACE -namespace OpenBeOS { -#endif // Forward declarations class BDirectory; class BEntry; struct entry_ref; -/*! - \class BPath - \brief An absolute pathname wrapper class - - Provides a convenient means of managing pathnames. - \author Ingo Weinhold - \author Tyler Dauwalder - - \version 0.0.0 -*/ class BPath : public BFlattenable { public: + BPath(); + BPath(const BPath& path); + BPath(const entry_ref* ref); + BPath(const BEntry* entry); + BPath(const char* dir, const char* leaf = NULL, + bool normalize = false); + BPath(const BDirectory* dir, const char* leaf, + bool normalize = false); - BPath(); - BPath(const BPath &path); - BPath(const entry_ref *ref); - BPath(const BEntry *entry); - BPath(const char *dir, const char *leaf = NULL, bool normalize = false); - BPath(const BDirectory *dir, const char *leaf, bool normalize = false); - - virtual ~BPath(); + virtual ~BPath(); - status_t InitCheck() const; + status_t InitCheck() const; - status_t SetTo(const entry_ref *ref); - status_t SetTo(const BEntry *entry); - status_t SetTo(const char *path, const char *leaf = NULL, - bool normalize = false); - status_t SetTo(const BDirectory *dir, const char *path, - bool normalize = false); - void Unset(); - - status_t Append(const char *path, bool normalize = false); - - const char *Path() const; - const char *Leaf() const; - status_t GetParent(BPath *path) const; - - bool operator==(const BPath &item) const; - bool operator==(const char *path) const; - bool operator!=(const BPath &item) const; - bool operator!=(const char *path) const; - BPath& operator=(const BPath &item); - BPath& operator=(const char *path); - - // BFlattenable protocol - virtual bool IsFixedSize() const; - virtual type_code TypeCode() const; - virtual ssize_t FlattenedSize() const; - virtual status_t Flatten(void *buffer, ssize_t size) const; - virtual bool AllowsTypeCode(type_code code) const; - virtual status_t Unflatten(type_code c, const void *buf, ssize_t size); + status_t SetTo(const entry_ref* ref); + status_t SetTo(const BEntry* entry); + status_t SetTo(const char* path, const char* leaf = NULL, + bool normalize = false); + status_t SetTo(const BDirectory* dir, const char* path, + bool normalize = false); + void Unset(); -private: - virtual void _WarPath1(); - virtual void _WarPath2(); - virtual void _WarPath3(); + status_t Append(const char* path, bool normalize = false); - uint32 _warData[4]; + const char* Path() const; + const char* Leaf() const; + status_t GetParent(BPath* path) const; - char *fName; - status_t fCStatus; + bool operator==(const BPath& item) const; + bool operator==(const char* path) const; + bool operator!=(const BPath& item) const; + bool operator!=(const char* path) const; + BPath& operator=(const BPath& item); + BPath& operator=(const char* path); - class EBadInput { }; + // BFlattenable protocol + virtual bool IsFixedSize() const; + virtual type_code TypeCode() const; + virtual ssize_t FlattenedSize() const; + virtual status_t Flatten(void* buffer, ssize_t size) const; + virtual bool AllowsTypeCode(type_code code) const; + virtual status_t Unflatten(type_code code, const void* buffer, + ssize_t size); - status_t set_path(const char *path); +private: + virtual void _WarPath1(); + virtual void _WarPath2(); + virtual void _WarPath3(); - static bool MustNormalize(const char *path); -}; + status_t _SetPath(const char* path); + static bool _MustNormalize(const char* path, status_t* _error); -#ifdef USE_OPENBEOS_NAMESPACE -}; // namespace OpenBeOS -#endif + uint32 _reserved[4]; -#endif // _PATH_H + char* fName; + status_t fCStatus; +}; - +#endif // _PATH_H Modified: haiku/trunk/src/kits/storage/Path.cpp =================================================================== --- haiku/trunk/src/kits/storage/Path.cpp 2009-05-18 01:13:44 UTC (rev 30786) +++ haiku/trunk/src/kits/storage/Path.cpp 2009-05-18 09:09:23 UTC (rev 30787) @@ -1,15 +1,21 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- +/* + * Copyright 2002-2009, Haiku Inc. + * Distributed under the terms of the MIT License. + * + * Authors: + * Tyler Dauwalder + * Ingo Weinhold, bonefish at users.sf.net + */ + /*! \file Path.cpp BPath implementation. */ +#include + #include -#include #include #include #include @@ -21,66 +27,74 @@ using namespace std; -#ifdef USE_OPENBEOS_NAMESPACE -using namespace OpenBeOS; -#endif -//! Creates an uninitialized BPath object. +//! Creates an uninitialized BPath object. BPath::BPath() - : fName(NULL), - fCStatus(B_NO_INIT) + : + fName(NULL), + fCStatus(B_NO_INIT) { } - -//! Creates a copy of the given BPath object. -/*! \param path the object to be copied + + +/*! Creates a copy of the given BPath object. + \param path the object to be copied */ -BPath::BPath(const BPath &path) - : fName(NULL), - fCStatus(B_NO_INIT) +BPath::BPath(const BPath& path) + : + fName(NULL), + fCStatus(B_NO_INIT) { *this = path; } + /*! \brief Creates a BPath object and initializes it to the filesystem entry specified by the given entry_ref struct. \param ref the entry_ref */ -BPath::BPath(const entry_ref *ref) - : fName(NULL), - fCStatus(B_NO_INIT) +BPath::BPath(const entry_ref* ref) + : + fName(NULL), + fCStatus(B_NO_INIT) { SetTo(ref); } -/*! Creates a BPath object and initializes it to the filesystem entry + +/*! \brief Creates a BPath object and initializes it to the filesystem entry specified by the given BEntry object. \param entry the BEntry object */ -BPath::BPath(const BEntry *entry) - : fName(NULL), - fCStatus(B_NO_INIT) +BPath::BPath(const BEntry* entry) + : + fName(NULL), + fCStatus(B_NO_INIT) { SetTo(entry); } + /*! \brief Creates a BPath object and initializes it to the specified path or path and filename combination. + \param dir The base component of the pathname. May be absolute or relative. If relative, it is reckoned off the current working directory. \param leaf The (optional) leaf component of the pathname. Must be relative. The value of leaf is concatenated to the end of \a dir (a "/" will be added as a separator, if necessary). \param normalize boolean flag used to force normalization; normalization - may occur even if false (see \ref MustNormalize). + may occur even if false (see \ref _MustNormalize). */ -BPath::BPath(const char *dir, const char *leaf, bool normalize) - : fName(NULL), - fCStatus(B_NO_INIT) +BPath::BPath(const char* dir, const char* leaf, bool normalize) + : + fName(NULL), + fCStatus(B_NO_INIT) { SetTo(dir, leaf, normalize); } - + + /*! \brief Creates a BPath object and initializes it to the specified directory and filename combination. \param dir Refers to the directory that provides the base component of the @@ -89,23 +103,26 @@ relative. The value of leaf is concatenated to the end of \a dir (a "/" will be added as a separator, if necessary). \param normalize boolean flag used to force normalization; normalization - may occur even if false (see \ref MustNormalize). + may occur even if false (see \ref _MustNormalize). */ -BPath::BPath(const BDirectory *dir, const char *leaf, bool normalize) - : fName(NULL), - fCStatus(B_NO_INIT) +BPath::BPath(const BDirectory* dir, const char* leaf, bool normalize) + : + fName(NULL), + fCStatus(B_NO_INIT) { SetTo(dir, leaf, normalize); } + //! Destroys the BPath object and frees any of its associated resources. BPath::~BPath() { Unset(); } -//! Returns the status of the most recent construction or SetTo() call. -/*! \return \c B_OK, if the BPath object is properly initialized, an error + +/*! \brief Returns the status of the most recent construction or SetTo() call. + \return \c B_OK, if the BPath object is properly initialized, an error code otherwise. */ status_t @@ -114,6 +131,7 @@ return fCStatus; } + /*! \brief Reinitializes the object to the filesystem entry specified by the given entry_ref struct. \param ref the entry_ref @@ -124,21 +142,24 @@ - other error codes. */ status_t -BPath::SetTo(const entry_ref *ref) +BPath::SetTo(const entry_ref* ref) { Unset(); if (!ref) - return (fCStatus = B_BAD_VALUE); + return fCStatus = B_BAD_VALUE; char path[B_PATH_NAME_LENGTH]; - status_t error = _kern_entry_ref_to_path(ref->device, ref->directory, + fCStatus = _kern_entry_ref_to_path(ref->device, ref->directory, ref->name, path, sizeof(path)); - if (error != B_OK) - return (fCStatus = error); - fCStatus = set_path(path); // the path is already normalized + if (fCStatus != B_OK) + return fCStatus; + + fCStatus = _SetPath(path); + // the path is already normalized return fCStatus; } + /*! \brief Reinitializes the object to the specified filesystem entry. \param entry the BEntry \return @@ -148,25 +169,27 @@ - other error codes. */ status_t -BPath::SetTo(const BEntry *entry) +BPath::SetTo(const BEntry* entry) { Unset(); - status_t error = (entry ? B_OK : B_BAD_VALUE); + if (entry == NULL) + return B_BAD_VALUE; + entry_ref ref; - if (error == B_OK) - error = entry->GetRef(&ref); - if (error == B_OK) - error = SetTo(&ref); - fCStatus = error; - return error; + fCStatus = entry->GetRef(&ref); + if (fCStatus == B_OK) + fCStatus = SetTo(&ref); + + return fCStatus; } - + + /*! \brief Reinitializes the object to the specified path or path and file name combination. \param path the path name \param leaf the leaf name (may be \c NULL) \param normalize boolean flag used to force normalization; normalization - may occur even if false (see \ref MustNormalize). + may occur even if false (see \ref _MustNormalize). \return - \c B_OK: The initialization was successful. - \c B_BAD_VALUE: \c NULL \a path or absolute \a leaf. @@ -175,7 +198,7 @@ \note \code path.SetTo(path.Path(), "new leaf") \endcode is safe. */ status_t -BPath::SetTo(const char *path, const char *leaf, bool normalize) +BPath::SetTo(const char* path, const char* leaf, bool normalize) { status_t error = (path ? B_OK : B_BAD_VALUE); if (error == B_OK && leaf && BPrivate::Storage::is_absolute_path(leaf)) @@ -207,13 +230,9 @@ } } // check, if necessary to normalize - if (error == B_OK && !normalize) { - try { - normalize = normalize || MustNormalize(newPath); - } catch (BPath::EBadInput) { - error = B_BAD_VALUE; - } - } + if (error == B_OK && !normalize) + normalize = normalize || _MustNormalize(newPath, &error); + // normalize the path, if necessary, otherwise just set it if (error == B_OK) { if (normalize) { @@ -223,7 +242,7 @@ if (error == B_OK) return SetTo(&entry); } else - error = set_path(newPath); + error = _SetPath(newPath); } } // cleanup, if something went wrong @@ -232,14 +251,15 @@ fCStatus = error; return error; } - + + /*! \brief Reinitializes the object to the specified directory and relative path combination. \param dir Refers to the directory that provides the base component of the pathname. \param path the relative path name (may be \c NULL) \param normalize boolean flag used to force normalization; normalization - may occur even if false (see \ref MustNormalize). + may occur even if false (see \ref _MustNormalize). \return - \c B_OK: The initialization was successful. - \c B_BAD_VALUE: \c NULL \a dir or absolute \a path. @@ -247,7 +267,7 @@ - other error codes. */ status_t -BPath::SetTo(const BDirectory *dir, const char *path, bool normalize) +BPath::SetTo(const BDirectory* dir, const char* path, bool normalize) { status_t error = (dir && dir->InitCheck() == B_OK ? B_OK : B_BAD_VALUE); // get the path of the BDirectory @@ -265,23 +285,25 @@ fCStatus = error; return error; } - + + /*! \brief Returns the object to an uninitialized state. The object frees any resources it allocated and marks itself as uninitialized. */ void BPath::Unset() { - set_path(NULL); + _SetPath(NULL); fCStatus = B_NO_INIT; } - + + /*! \brief Appends the given (relative) path to the end of the current path. This call fails if the path is absolute or the object to which you're appending is uninitialized. \param path relative pathname to append to current path (may be \c NULL). \param normalize boolean flag used to force normalization; normalization - may occur even if false (see \ref MustNormalize). + may occur even if false (see \ref _MustNormalize). \return - \c B_OK: The initialization was successful. - \c B_BAD_VALUE: The object is not properly initialized. @@ -289,7 +311,7 @@ - other error codes. */ status_t -BPath::Append(const char *path, bool normalize) +BPath::Append(const char* path, bool normalize) { status_t error = (InitCheck() == B_OK ? B_OK : B_BAD_VALUE); if (error == B_OK) @@ -299,41 +321,45 @@ fCStatus = error; return error; } - -//! Returns the object's complete path name. -/*! \return + + +/*! \brief Returns the object's complete path name. + \return - the object's path name, or - \c NULL, if it is not properly initialized. */ -const char * +const char* BPath::Path() const { return fName; } - -//! Returns the leaf portion of the object's path name. -/*! The leaf portion is defined as the string after the last \c '/'. For + + +/*! \brief Returns the leaf portion of the object's path name. + The leaf portion is defined as the string after the last \c '/'. For the root path (\c "/") it is the empty string (\c ""). \return - the leaf portion of the object's path name, or - \c NULL, if it is not properly initialized. */ -const char * +const char* BPath::Leaf() const { - const char *result = NULL; - if (InitCheck() == B_OK) { - result = fName + strlen(fName); - // There should be no need for the second condition, since we deal - // with absolute paths only and those contain at least one '/'. - // However, it doesn't harm. - while (*result != '/' && result > fName) - result--; - result++; - } + if (InitCheck() != B_OK) + return NULL; + + const char* result = fName + strlen(fName); + // There should be no need for the second condition, since we deal + // with absolute paths only and those contain at least one '/'. + // However, it doesn't harm. + while (*result != '/' && result > fName) + result--; + result++; + return result; } + /*! \brief Calls the argument's SetTo() method with the name of the object's parent directory. No normalization is done. @@ -346,96 +372,107 @@ - other error code returned by SetTo(). */ status_t -BPath::GetParent(BPath *path) const +BPath::GetParent(BPath* path) const { - status_t error = (path ? B_OK : B_BAD_VALUE); - if (error == B_OK) - error = InitCheck(); - if (error == B_OK) { - int32 len = strlen(fName); - if (len == 1) // handle "/" - error = B_ENTRY_NOT_FOUND; - else { - char parentPath[B_PATH_NAME_LENGTH]; - len--; - while (fName[len] != '/' && len > 0) - len--; - if (len == 0) // parent dir is "/" - len++; - memcpy(parentPath, fName, len); - parentPath[len] = 0; - error = path->SetTo(parentPath); - } + if (path == NULL) + return B_BAD_VALUE; + + status_t error = InitCheck(); + if (error != B_OK) + return error; + + int32 length = strlen(fName); + if (length == 1) { + // handle "/" (path is supposed to be absolute) + return B_ENTRY_NOT_FOUND; } - return error; + + char parentPath[B_PATH_NAME_LENGTH]; + length--; + while (fName[length] != '/' && length > 0) + length--; + if (length == 0) { + // parent dir is "/" + length++; + } + memcpy(parentPath, fName, length); + parentPath[length] = '\0'; + + return path->SetTo(parentPath); } - -//! Performs a simple (string-wise) comparison of paths. -/*! No normalization takes place! Uninitialized BPath objects are considered + + +/*! \brief Performs a simple (string-wise) comparison of paths. + No normalization takes place! Uninitialized BPath objects are considered to be equal. \param item the BPath object to be compared with \return \c true, if the path names are equal, \c false otherwise. */ bool -BPath::operator==(const BPath &item) const +BPath::operator==(const BPath& item) const { - return (*this == item.Path()); + return *this == item.Path(); } -//! Performs a simple (string-wise) comparison of paths. -/*! No normalization takes place! + +/*! \brief Performs a simple (string-wise) comparison of paths. + No normalization takes place! \param path the path name to be compared with \return \c true, if the path names are equal, \c false otherwise. */ bool -BPath::operator==(const char *path) const +BPath::operator==(const char* path) const { - return ((InitCheck() != B_OK && path == NULL) - || (fName != NULL && path != NULL && strcmp(fName, path) == 0)); + return (InitCheck() != B_OK && path == NULL) + || (fName != NULL && path != NULL && strcmp(fName, path) == 0); } -//! Performs a simple (string-wise) comparison of paths. -/*! No normalization takes place! Uninitialized BPath objects are considered + +/*! \brief Performs a simple (string-wise) comparison of paths. + No normalization takes place! Uninitialized BPath objects are considered to be equal. \param item the BPath object to be compared with \return \c true, if the path names are not equal, \c false otherwise. */ bool -BPath::operator!=(const BPath &item) const +BPath::operator!=(const BPath& item) const { return !(*this == item); } -//! Performs a simple (string-wise) comparison of paths. -/*! No normalization takes place! + +/*! \brief Performs a simple (string-wise) comparison of paths. + No normalization takes place! \param path the path name to be compared with \return \c true, if the path names are not equal, \c false otherwise. */ bool -BPath::operator!=(const char *path) const +BPath::operator!=(const char* path) const { return !(*this == path); } - -//! Initializes the object to be a copy of the argument. -/*! \param item the BPath object to be copied + + +/*! \brief Initializes the object to be a copy of the argument. + \param item the BPath object to be copied \return \c *this */ BPath& -BPath::operator=(const BPath &item) +BPath::operator=(const BPath& item) { if (this != &item) *this = item.Path(); return *this; } -//! Initializes the object to be a copy of the argument. -/*! Has the same effect as \code SetTo(path) \endcode. + +/*! \brief Initializes the object to be a copy of the argument. + Has the same effect as \code SetTo(path) \endcode. \param path the path name to be assigned to this object \return \c *this */ BPath& -BPath::operator=(const char *path) +BPath::operator=(const char* path) { if (path == NULL) Unset(); @@ -445,8 +482,9 @@ } -// BFlattenable functionality +// #pragma mark - BFlattenable functionality + // that's the layout of a flattened entry_ref struct flattened_entry_ref { dev_t device; @@ -459,8 +497,8 @@ = sizeof(dev_t) + sizeof(ino_t); -//! Returns \c false. -/*! Implements BFlattenable. +/*! \brief Returns \c false. + Implements BFlattenable. \return \c false */ bool @@ -468,9 +506,10 @@ { return false; } - -//! Returns \c B_REF_TYPE. -/*! Implements BFlattenable. + + +/*! \brief Returns \c B_REF_TYPE. + Implements BFlattenable. \return \c B_REF_TYPE */ type_code @@ -478,7 +517,8 @@ { return B_REF_TYPE; } - + + /*! \brief Returns the size of the flattened entry_ref structure that represents the pathname. Implements BFlattenable. @@ -497,7 +537,8 @@ } return size; } - + + /*! \brief Converts the object's pathname to an entry_ref and writes it into buffer. Implements BFlattenable. @@ -510,43 +551,52 @@ \todo Reimplement for performance reasons: Don't call FlattenedSize(). */ status_t -BPath::Flatten(void *buffer, ssize_t size) const +BPath::Flatten(void* buffer, ssize_t size) const { - status_t error = (buffer ? B_OK : B_BAD_VALUE); - if (error == B_OK) { - ssize_t flattenedSize = FlattenedSize(); - if (flattenedSize < 0) - error = flattenedSize; - if (error == B_OK && size < flattenedSize) - error = B_BAD_VALUE; - if (error == B_OK) { - // convert the path to an entry_ref - BEntry entry; - entry_ref ref; - if (InitCheck() == B_OK && entry.SetTo(Path()) == B_OK) - entry.GetRef(&ref); - // store the entry_ref in the buffer - flattened_entry_ref &fref = *(flattened_entry_ref*)buffer; - fref.device = ref.device; - fref.directory = ref.directory; - if (ref.name) - strcpy(fref.name, ref.name); - } - } - return error; + if (buffer == NULL) + return B_BAD_VALUE; + + ssize_t flattenedSize = FlattenedSize(); + if (flattenedSize < 0) + return flattenedSize; + if (size < flattenedSize) + return B_BAD_VALUE; + status_t status = InitCheck(); + if (status != B_OK) + return status; + + // convert the path to an entry_ref + BEntry entry; + entry_ref ref; + status = entry.SetTo(Path()); + if (status == B_OK) + status = entry.GetRef(&ref); + if (status != B_OK) + return status; + + // store the entry_ref in the buffer + flattened_entry_ref& fref = *(flattened_entry_ref*)buffer; + fref.device = ref.device; + fref.directory = ref.directory; + if (ref.name) + strcpy(fref.name, ref.name); + + return B_OK; } - -//! Returns \c true if code is \c B_REF_TYPE, and false otherwise. -/*! Implements BFlattenable. + + +/*! \brief Returns \c true if code is \c B_REF_TYPE, and false otherwise. + Implements BFlattenable. \param code the type code in question \return \c true if code is \c B_REF_TYPE, and false otherwise. */ bool BPath::AllowsTypeCode(type_code code) const { - return (code == B_REF_TYPE); + return code == B_REF_TYPE; } - + + /*! \brief Initializes the BPath with the flattened entry_ref data that's found in the supplied buffer. The type code must be \c B_REF_TYPE. @@ -561,12 +611,12 @@ - other error codes. */ status_t -BPath::Unflatten(type_code code, const void *buf, ssize_t size) +BPath::Unflatten(type_code code, const void* buffer, ssize_t size) { Unset(); status_t error = B_OK; // check params - if (!(code == B_REF_TYPE && buf + if (!(code == B_REF_TYPE && buffer != NULL && size >= (ssize_t)flattened_entry_ref_size)) { error = B_BAD_VALUE; } @@ -575,7 +625,8 @@ // already Unset(); } else { // reconstruct the entry_ref from the buffer - const flattened_entry_ref &fref = *(const flattened_entry_ref*)buf; + const flattened_entry_ref& fref + = *(const flattened_entry_ref*)buffer; BString name(fref.name, size - flattened_entry_ref_size); entry_ref ref(fref.device, fref.directory, name.String()); error = SetTo(&ref); @@ -586,10 +637,12 @@ return error; } + void BPath::_WarPath1() {} void BPath::_WarPath2() {} void BPath::_WarPath3() {} + /*! \brief Sets the supplied path. The path is copied. If \c NULL, the object's path is set to NULL as well. The object's old path is deleted. @@ -599,10 +652,10 @@ - \c B_NO_MEMORY: Insufficient memory. */ status_t -BPath::set_path(const char *path) +BPath::_SetPath(const char* path) { status_t error = B_OK; - const char *oldPath = fName; + const char* oldPath = fName; // set the new path if (path) { fName = new(nothrow) char[strlen(path) + 1]; @@ -612,37 +665,39 @@ error = B_NO_MEMORY; } else fName = NULL; + // delete the old one delete[] oldPath; return error; } - /*! \brief Checks a path to see if normalization is required. The following items require normalization: - - Relative pathnames (after concatenation; e.g. "boot/ltj") + - Relative pathnames (after concatenation; e.g. "boot/ltj") - The presence of "." or ".." ("/boot/ltj/../ltj/./gwar") - Redundant slashes ("/boot//ltj") - A trailing slash ("/boot/ltj/") - + + \param _error A pointer to an error variable that will be set if the input + is not a valid path. \return - \c true: \a path requires normalization - \c false: \a path does not require normalization - - \exception BPath::EBadInput : \a path is \c NULL or an empty string. - - */ +*/ bool -BPath::MustNormalize(const char *path) +BPath::_MustNormalize(const char* path, status_t* _error) { // Check for useless input - if (path == NULL || path[0] == 0) - throw BPath::EBadInput(); - - int len = strlen(path); - + if (path == NULL || path[0] == 0) { + if (_error != NULL) + *_error = B_BAD_VALUE; + return false; + } + + int len = strlen(path); + /* Look for anything in the string that forces us to normalize: + No leading / + any occurence of /./ or /../ or //, or a trailing /. or /.. @@ -661,54 +716,52 @@ OneDot, TwoDots } state = NoMatch; - + for (int i = 0; path[i] != 0; i++) { switch (state) { case NoMatch: if (path[i] == '/') state = InitialSlash; break; - + case InitialSlash: if (path[i] == '/') return true; // "*//*" - else if (path[i] == '.') + + if (path[i] == '.') state = OneDot; else state = NoMatch; break; - + case OneDot: if (path[i] == '/') return true; // "*/./*" - else if (path[i] == '.') + + if (path[i] == '.') state = TwoDots; else state = NoMatch; break; - + case TwoDots: if (path[i] == '/') return true; // "*/../*" - else [... truncated: 35 lines follow ...] From axeld at mail.berlios.de Mon May 18 11:10:58 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Mon, 18 May 2009 11:10:58 +0200 Subject: [Haiku-commits] r30788 - haiku/trunk/src/servers/registrar Message-ID: <200905180910.n4I9Awsf031709@sheep.berlios.de> Author: axeld Date: 2009-05-18 11:10:58 +0200 (Mon, 18 May 2009) New Revision: 30788 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30788&view=rev Modified: haiku/trunk/src/servers/registrar/TRoster.cpp haiku/trunk/src/servers/registrar/TRoster.h Log: * _IsSystemApp() did not work anymore with the new directory hierarchy. It will now check for the complete path instead of just the prefix. This fixes bug #3862. * Made TRoster.h self contained. * Style cleanup. Modified: haiku/trunk/src/servers/registrar/TRoster.cpp =================================================================== --- haiku/trunk/src/servers/registrar/TRoster.cpp 2009-05-18 09:09:23 UTC (rev 30787) +++ haiku/trunk/src/servers/registrar/TRoster.cpp 2009-05-18 09:10:58 UTC (rev 30788) @@ -7,8 +7,14 @@ applications. */ +#include "TRoster.h" + #include +#include +#include +#include + #include #include #include @@ -18,14 +24,9 @@ #include #include #include -#include // for B_BACKGROUND_APP #include #include -#include -#include -#include - #include "AppInfoListMessagingTargetSet.h" #include "Debug.h" #include "EventMaskWatcher.h" @@ -33,17 +34,12 @@ #include "RegistrarDefs.h" #include "RosterAppInfo.h" #include "RosterSettingsCharStream.h" -#include "TRoster.h" using std::nothrow; using namespace BPrivate; -static bool larger_index(const recent_entry *entry1, const recent_entry *entry2); - - -/*! - \class TRoster +/*! \class TRoster \brief Implements the application roster. This class handles the BRoster requests. For each kind a hook method is @@ -70,21 +66,21 @@ //! The maximal period of time an app may be early pre-registered (60 s). const bigtime_t kMaximalEarlyPreRegistrationPeriod = 60000000LL; -//! Applications living in this tree are considered "vital system apps". -static const char *const kVitalSystemAppPathPrefix - = "/boot/system/servers"; +//! Applications living in these directory are considered "system apps". +// TODO: move those into a common shared system header +static const char* const kSystemAppPath = "/boot/system"; +static const char* const kSystemServerPath = "/boot/system/servers"; -//! Applications living in this tree are considered "system apps". -static const char *const kSystemAppPathPrefix = "/boot/system"; -// get_default_roster_settings_file +// #pragma mark - Private local functions + + /*! \brief Returns the path to the default roster settings. \param path BPath to be set to the roster settings path. \return the settings path as C string (\code path.Path() \endcode). */ -static -const char * -get_default_roster_settings_file(BPath &path) +static const char* +get_default_roster_settings_file(BPath& path) { // get the path of the settings dir and append the subpath of our file status_t error = find_directory(B_USER_SETTINGS_DIRECTORY, &path); @@ -99,7 +95,27 @@ return path.Path(); } -// constructor + +/*! \brief Returns true if entry1's index is larger than entry2's index. + + Also returns true if either entry is \c NULL. + + Used for sorting the recent entry lists loaded from disk into the + proper order. +*/ +bool +larger_index(const recent_entry* entry1, const recent_entry* entry2) +{ + if (entry1 && entry2) + return entry1->index > entry2->index; + + return true; +} + + +// #pragma mark - + + /*! \brief Creates a new roster. The object is completely initialized and ready to handle requests. @@ -122,19 +138,19 @@ _LoadRosterSettings(); } -// destructor + /*! \brief Frees all resources associated with this object. */ TRoster::~TRoster() { } -// HandleAddApplication + /*! \brief Handles an AddApplication() request. \param request The request message */ void -TRoster::HandleAddApplication(BMessage *request) +TRoster::HandleAddApplication(BMessage* request) { FUNCTION_START(); @@ -142,7 +158,7 @@ status_t error = B_OK; // get the parameters - const char *signature; + const char* signature; entry_ref ref; uint32 flags; team_id team; @@ -163,9 +179,10 @@ port = -1; if (request->FindBool("full_registration", &fullReg) != B_OK) fullReg = false; -PRINT(("team: %ld, signature: %s\n", team, signature)); -PRINT(("full registration: %d\n", fullReg)); + PRINT(("team: %ld, signature: %s\n", team, signature)); + PRINT(("full registration: %d\n", fullReg)); + if (fShuttingDown) error = B_SHUTTING_DOWN; @@ -183,10 +200,10 @@ // entry_ref if (error == B_OK) { -PRINT(("flags: %lx\n", flags)); -PRINT(("ref: %ld, %lld, %s\n", ref.device, ref.directory, ref.name)); + PRINT(("flags: %lx\n", flags)); + PRINT(("ref: %ld, %lld, %s\n", ref.device, ref.directory, ref.name)); // check single/exclusive launchers - RosterAppInfo *info = NULL; + RosterAppInfo* info = NULL; if ((launchFlags == B_SINGLE_LAUNCH || launchFlags == B_EXCLUSIVE_LAUNCH) && ((info = info = fRegisteredApps.InfoFor(&ref)) != NULL @@ -200,7 +217,7 @@ // signature if (error == B_OK && signature) { // check exclusive launchers - RosterAppInfo *info = NULL; + RosterAppInfo* info = NULL; if (launchFlags == B_EXCLUSIVE_LAUNCH && (((info = fRegisteredApps.InfoFor(signature))) || ((info = fEarlyPreRegisteredApps.InfoFor(signature))))) { @@ -222,7 +239,7 @@ // Add the application info. if (error == B_OK) { // alloc and init the info - RosterAppInfo *info = new(nothrow) RosterAppInfo; + RosterAppInfo* info = new(nothrow) RosterAppInfo; if (info) { info->Init(thread, team, port, flags, &ref, signature); if (fullReg) @@ -233,14 +250,15 @@ // add it to the right list bool addingSuccess = false; if (team >= 0) { -PRINT(("added ref: %ld, %lld, %s\n", info->ref.device, info->ref.directory, info->ref.name)); + PRINT(("added ref: %ld, %lld, %s\n", info->ref.device, + info->ref.directory, info->ref.name)); addingSuccess = (AddApp(info) == B_OK); if (addingSuccess && fullReg) _AppAdded(info); } else { token = info->token = _NextToken(); addingSuccess = fEarlyPreRegisteredApps.AddInfo(info); -PRINT(("added to early pre-regs, token: %lu\n", token)); + PRINT(("added to early pre-regs, token: %lu\n", token)); } if (!addingSuccess) SET_ERROR(error, B_NO_MEMORY); @@ -258,7 +276,6 @@ fRecentApps.Add(signature, flags); else fRecentApps.Add(&ref, flags); -// fRecentApps.Print(); BMessage reply(B_REG_SUCCESS); // The token is valid only when no team ID has been supplied. @@ -278,12 +295,12 @@ FUNCTION_END(); } -// HandleCompleteRegistration + /*! \brief Handles a CompleteRegistration() request. \param request The request message */ void -TRoster::HandleCompleteRegistration(BMessage *request) +TRoster::HandleCompleteRegistration(BMessage* request) { FUNCTION_START(); @@ -317,7 +334,7 @@ if (error == B_OK) { if (team >= 0) { // everything is fine -- set the values - RosterAppInfo *info = fRegisteredApps.InfoFor(team); + RosterAppInfo* info = fRegisteredApps.InfoFor(team); if (info && info->state == APP_STATE_PRE_REGISTERED) { info->thread = thread; info->port = port; @@ -342,12 +359,12 @@ FUNCTION_END(); } -// HandleIsAppRegistered + /*! \brief Handles an IsAppRegistered() request. \param request The request message */ void -TRoster::HandleIsAppRegistered(BMessage *request) +TRoster::HandleIsAppRegistered(BMessage* request) { FUNCTION_START(); @@ -377,7 +394,7 @@ SET_ERROR(error, B_BAD_VALUE); // look up the information - RosterAppInfo *info = NULL; + RosterAppInfo* info = NULL; if (error == B_OK) { if ((info = fRegisteredApps.InfoFor(team)) != NULL) { PRINT(("found team in fRegisteredApps\n")); @@ -411,12 +428,12 @@ FUNCTION_END(); } -// HandleRemovePreRegApp + /*! \brief Handles a RemovePreRegApp() request. \param request The request message */ void -TRoster::HandleRemovePreRegApp(BMessage *request) +TRoster::HandleRemovePreRegApp(BMessage* request) { FUNCTION_START(); @@ -429,7 +446,7 @@ SET_ERROR(error, B_BAD_VALUE); // remove the app if (error == B_OK) { - RosterAppInfo *info = fEarlyPreRegisteredApps.InfoForToken(token); + RosterAppInfo* info = fEarlyPreRegisteredApps.InfoForToken(token); if (info) { fEarlyPreRegisteredApps.RemoveInfo(info); delete info; @@ -449,12 +466,12 @@ FUNCTION_END(); } -// HandleRemoveApp + /*! \brief Handles a RemoveApp() request. \param request The request message */ void -TRoster::HandleRemoveApp(BMessage *request) +TRoster::HandleRemoveApp(BMessage* request) { FUNCTION_START(); @@ -465,10 +482,12 @@ team_id team; if (request->FindInt32("team", &team) != B_OK) team = -1; -PRINT(("team: %ld\n", team)); + + PRINT(("team: %ld\n", team)); + // remove the app if (error == B_OK) { - if (RosterAppInfo *info = fRegisteredApps.InfoFor(team)) { + if (RosterAppInfo* info = fRegisteredApps.InfoFor(team)) { RemoveApp(info); delete info; } else @@ -487,18 +506,19 @@ FUNCTION_END(); } -// HandleSetThreadAndTeam + /*! \brief Handles a SetThreadAndTeam() request. \param request The request message */ void -TRoster::HandleSetThreadAndTeam(BMessage *request) +TRoster::HandleSetThreadAndTeam(BMessage* request) { FUNCTION_START(); BAutolock _(fLock); status_t error = B_OK; + // get the parameters team_id team; thread_id thread; @@ -509,14 +529,17 @@ thread = -1; if (request->FindInt32("token", (int32*)&token) != B_OK) SET_ERROR(error, B_BAD_VALUE); + // check the parameters // team if (error == B_OK && team < 0) SET_ERROR(error, B_BAD_VALUE); -PRINT(("team: %ld, thread: %ld, token: %lu\n", team, thread, token)); + + PRINT(("team: %ld, thread: %ld, token: %lu\n", team, thread, token)); + // update the app_info if (error == B_OK) { - RosterAppInfo *info = fEarlyPreRegisteredApps.InfoForToken(token); + RosterAppInfo* info = fEarlyPreRegisteredApps.InfoForToken(token); if (info) { // Set thread and team, create a port for the application and // move the app_info from the list of the early pre-registered @@ -544,7 +567,7 @@ // handle pending IsAppRegistered() requests IARRequestMap::iterator it = fIARRequestsByID.find(team); if (it != fIARRequestsByID.end()) { - BMessageQueue *requests = it->second; + BMessageQueue* requests = it->second; if (error == B_OK) _ReplyToIARRequests(requests, info); delete requests; @@ -553,7 +576,7 @@ it = fIARRequestsByToken.find((int32)token); if (it != fIARRequestsByToken.end()) { - BMessageQueue *requests = it->second; + BMessageQueue* requests = it->second; if (error == B_OK) _ReplyToIARRequests(requests, info); delete requests; @@ -575,12 +598,12 @@ FUNCTION_END(); } -// HandleSetSignature + /*! \brief Handles a SetSignature() request. \param request The request message */ void -TRoster::HandleSetSignature(BMessage *request) +TRoster::HandleSetSignature(BMessage* request) { FUNCTION_START(); @@ -589,14 +612,14 @@ status_t error = B_OK; // get the parameters team_id team; - const char *signature; + const char* signature; if (request->FindInt32("team", &team) != B_OK) error = B_BAD_VALUE; if (request->FindString("signature", &signature) != B_OK) error = B_BAD_VALUE; // find the app and set the signature if (error == B_OK) { - if (RosterAppInfo *info = fRegisteredApps.InfoFor(team)) + if (RosterAppInfo* info = fRegisteredApps.InfoFor(team)) strcpy(info->signature, signature); else SET_ERROR(error, B_REG_APP_NOT_REGISTERED); @@ -614,12 +637,12 @@ FUNCTION_END(); } -// HandleGetAppInfo + /*! \brief Handles a Get{Running,Active,}AppInfo() request. \param request The request message */ void -TRoster::HandleGetAppInfo(BMessage *request) +TRoster::HandleGetAppInfo(BMessage* request) { FUNCTION_START(); @@ -629,7 +652,7 @@ // get the parameters team_id team; entry_ref ref; - const char *signature; + const char* signature; bool hasTeam = true; bool hasRef = true; bool hasSignature = true; @@ -639,14 +662,16 @@ hasRef = false; if (request->FindString("signature", &signature) != B_OK) hasSignature = false; + if (hasTeam) PRINT(("team: %ld\n", team)); if (hasRef) PRINT(("ref: %ld, %lld, %s\n", ref.device, ref.directory, ref.name)); if (hasSignature) PRINT(("signature: %s\n", signature)); + // get the info - RosterAppInfo *info = NULL; + RosterAppInfo* info = NULL; if (error == B_OK) { if (hasTeam) { info = fRegisteredApps.InfoFor(team); @@ -683,12 +708,12 @@ FUNCTION_END(); } -// HandleGetAppList + /*! \brief Handles a GetAppList() request. \param request The request message */ void -TRoster::HandleGetAppList(BMessage *request) +TRoster::HandleGetAppList(BMessage* request) { FUNCTION_START(); @@ -696,7 +721,7 @@ status_t error = B_OK; // get the parameters - const char *signature; + const char* signature; if (request->FindString("signature", &signature) != B_OK) signature = NULL; // reply to the request @@ -704,7 +729,7 @@ BMessage reply(B_REG_SUCCESS); // get the list for (AppInfoList::Iterator it(fRegisteredApps.It()); - RosterAppInfo *info = *it; + RosterAppInfo* info = *it; ++it) { if (info->state != APP_STATE_REGISTERED) continue; @@ -730,7 +755,7 @@ \param request The request message */ void -TRoster::HandleUpdateActiveApp(BMessage *request) +TRoster::HandleUpdateActiveApp(BMessage* request) { FUNCTION_START(); @@ -744,7 +769,7 @@ // activate the app if (error == B_OK) { - if (RosterAppInfo *info = fRegisteredApps.InfoFor(team)) + if (RosterAppInfo* info = fRegisteredApps.InfoFor(team)) UpdateActiveApp(info); else error = B_BAD_TEAM_ID; @@ -765,12 +790,12 @@ FUNCTION_END(); } -// HandleBroadcast + /*! \brief Handles a Broadcast() request. \param request The request message */ void -TRoster::HandleBroadcast(BMessage *request) +TRoster::HandleBroadcast(BMessage* request) { FUNCTION_START(); @@ -806,13 +831,13 @@ class BroadcastMessagingTargetSet : public AppInfoListMessagingTargetSet { public: - BroadcastMessagingTargetSet(AppInfoList &list, team_id team) + BroadcastMessagingTargetSet(AppInfoList& list, team_id team) : AppInfoListMessagingTargetSet(list, true), fTeam(team) { } - virtual bool Filter(const RosterAppInfo *info) + virtual bool Filter(const RosterAppInfo* info) { return AppInfoListMessagingTargetSet::Filter(info) && (info->team != fTeam); @@ -834,12 +859,12 @@ FUNCTION_END(); } -// HandleStartWatching + /*! \brief Handles a StartWatching() request. \param request The request message */ void -TRoster::HandleStartWatching(BMessage *request) +TRoster::HandleStartWatching(BMessage* request) { FUNCTION_START(); @@ -855,7 +880,7 @@ error = B_BAD_VALUE; // add the new watcher if (error == B_OK) { - Watcher *watcher = new(nothrow) EventMaskWatcher(target, events); + Watcher* watcher = new(nothrow) EventMaskWatcher(target, events); if (watcher) { if (!fWatchingService.AddWatcher(watcher)) { error = B_NO_MEMORY; @@ -877,12 +902,12 @@ FUNCTION_END(); } -// HandleStopWatching + /*! \brief Handles a StopWatching() request. \param request The request message */ void -TRoster::HandleStopWatching(BMessage *request) +TRoster::HandleStopWatching(BMessage* request) { FUNCTION_START(); @@ -911,12 +936,12 @@ FUNCTION_END(); } -// HandleGetRecentDocuments + /*! \brief Handles a GetRecentDocuments() request. \param request The request message */ void -TRoster::HandleGetRecentDocuments(BMessage *request) +TRoster::HandleGetRecentDocuments(BMessage* request) { FUNCTION_START(); @@ -927,12 +952,12 @@ FUNCTION_END(); } -// HandleGetRecentFolders + /*! \brief Handles a GetRecentFolders() request. \param request The request message */ void -TRoster::HandleGetRecentFolders(BMessage *request) +TRoster::HandleGetRecentFolders(BMessage* request) { FUNCTION_START(); @@ -943,12 +968,12 @@ FUNCTION_END(); } -// HandleGetRecentApps + /*! \brief Handles a GetRecentApps() request. \param request The request message */ void -TRoster::HandleGetRecentApps(BMessage *request) +TRoster::HandleGetRecentApps(BMessage* request) { FUNCTION_START(); @@ -971,12 +996,12 @@ FUNCTION_END(); } -// HandleAddToRecentDocuments + /*! \brief Handles an AddToRecentDocuments() request. \param request The request message */ void -TRoster::HandleAddToRecentDocuments(BMessage *request) +TRoster::HandleAddToRecentDocuments(BMessage* request) { FUNCTION_START(); @@ -988,7 +1013,7 @@ } entry_ref ref; - const char *appSig; + const char* appSig; BMessage reply(B_REG_RESULT); status_t error = request->FindRef("ref", &ref); @@ -1002,12 +1027,12 @@ FUNCTION_END(); } -// HandleAddToRecentFolders + /*! \brief Handles an AddToRecentFolders() request. \param request The request message */ void -TRoster::HandleAddToRecentFolders(BMessage *request) +TRoster::HandleAddToRecentFolders(BMessage* request) { FUNCTION_START(); @@ -1019,7 +1044,7 @@ } entry_ref ref; - const char *appSig; + const char* appSig; BMessage reply(B_REG_RESULT); status_t error = request->FindRef("ref", &ref); @@ -1033,12 +1058,12 @@ FUNCTION_END(); } -// HandleAddToRecentApps + /*! \brief Handles an AddToRecentApps() request. \param request The request message */ void -TRoster::HandleAddToRecentApps(BMessage *request) +TRoster::HandleAddToRecentApps(BMessage* request) { FUNCTION_START(); @@ -1049,7 +1074,7 @@ return; } - const char *appSig; + const char* appSig; BMessage reply(B_REG_RESULT); status_t error = request->FindString("app sig", &appSig); @@ -1061,8 +1086,9 @@ FUNCTION_END(); } + void -TRoster::HandleLoadRecentLists(BMessage *request) +TRoster::HandleLoadRecentLists(BMessage* request) { FUNCTION_START(); @@ -1073,7 +1099,7 @@ return; } - const char *filename; + const char* filename; BMessage reply(B_REG_RESULT); status_t error = request->FindString("filename", &filename); @@ -1085,8 +1111,9 @@ FUNCTION_END(); } + void -TRoster::HandleSaveRecentLists(BMessage *request) +TRoster::HandleSaveRecentLists(BMessage* request) { FUNCTION_START(); @@ -1097,7 +1124,7 @@ return; } - const char *filename; + const char* filename; BMessage reply(B_REG_RESULT); status_t error = request->FindString("filename", &filename); @@ -1109,7 +1136,7 @@ FUNCTION_END(); } -// ClearRecentDocuments + /*! \brief Clears the current list of recent documents */ void @@ -1120,7 +1147,7 @@ fRecentDocuments.Clear(); } -// ClearRecentFolders + /*! \brief Clears the current list of recent folders */ void @@ -1131,7 +1158,7 @@ fRecentFolders.Clear(); } -// ClearRecentApps + /*! \brief Clears the current list of recent apps */ void @@ -1142,7 +1169,7 @@ fRecentApps.Clear(); } -// Init + /*! \brief Initializes the roster. Currently only adds the registrar to the roster. @@ -1163,7 +1190,7 @@ return fLock.Sem(); // create the info - RosterAppInfo *info = new(nothrow) RosterAppInfo; + RosterAppInfo* info = new(nothrow) RosterAppInfo; if (!info) error = B_NO_MEMORY; @@ -1175,9 +1202,8 @@ // init and add the info if (error == B_OK) { info->Init(be_app->Thread(), be_app->Team(), - BMessenger::Private(be_app_messenger).Port(), - B_EXCLUSIVE_LAUNCH | B_BACKGROUND_APP, &ref, - kRegistrarSignature); + BMessenger::Private(be_app_messenger).Port(), + B_EXCLUSIVE_LAUNCH | B_BACKGROUND_APP, &ref, kRegistrarSignature); info->state = APP_STATE_REGISTERED; info->registration_time = system_time(); error = AddApp(info); @@ -1190,13 +1216,13 @@ return error; } -// AddApp + /*! \brief Add the supplied app info to the list of (pre-)registered apps. \param info The app info to be added */ status_t -TRoster::AddApp(RosterAppInfo *info) +TRoster::AddApp(RosterAppInfo* info) { BAutolock _(fLock); @@ -1208,14 +1234,14 @@ return error; } -// RemoveApp + /*! \brief Removes the supplied app info from the list of (pre-)registered apps. \param info The app info to be removed */ void -TRoster::RemoveApp(RosterAppInfo *info) +TRoster::RemoveApp(RosterAppInfo* info) { BAutolock _(fLock); @@ -1239,13 +1265,13 @@ \param info The info of the app to be activated */ void -TRoster::UpdateActiveApp(RosterAppInfo *info) +TRoster::UpdateActiveApp(RosterAppInfo* info) { BAutolock _(fLock); if (info != fActiveApp) { // deactivate the currently active app - RosterAppInfo *oldActiveApp = fActiveApp; + RosterAppInfo* oldActiveApp = fActiveApp; fActiveApp = NULL; if (oldActiveApp) _AppDeactivated(oldActiveApp); @@ -1258,7 +1284,7 @@ } } -// CheckSanity + /*! \brief Checks whether the (pre-)registered applications are still running. This is necessary, since killed applications don't unregister properly. @@ -1301,7 +1327,7 @@ // don't delete infos a second time } -// SetShuttingDown + /*! \brief Tells the roster whether a shutdown process is in progess at the moment. @@ -1319,7 +1345,7 @@ fShuttingDown = shuttingDown; } -// GetShutdownApps + /*! \brief Returns lists of applications to be asked to quit on shutdown. \param userApps List of RosterAppInfos identifying the user applications. @@ -1332,8 +1358,8 @@ \return \c B_OK, if everything went fine, another error code otherwise. */ status_t -TRoster::GetShutdownApps(AppInfoList &userApps, AppInfoList &systemApps, - AppInfoList &backgroundApps, hash_set &vitalSystemApps) +TRoster::GetShutdownApps(AppInfoList& userApps, AppInfoList& systemApps, + AppInfoList& backgroundApps, hash_set& vitalSystemApps) { BAutolock _(fLock); @@ -1362,17 +1388,17 @@ } // debug server - RosterAppInfo *info = + RosterAppInfo* info = fRegisteredApps.InfoFor("application/x-vnd.haiku-debug_server"); if (info) vitalSystemApps.insert(info->team); // populate the other groups for (AppInfoList::Iterator it(fRegisteredApps.It()); - RosterAppInfo *info = *it; + RosterAppInfo* info = *it; ++it) { if (vitalSystemApps.find(info->team) == vitalSystemApps.end()) { - RosterAppInfo *clonedInfo = info->Clone(); + RosterAppInfo* clonedInfo = info->Clone(); if (clonedInfo) { if (_IsSystemApp(info)) { if (!systemApps.AddInfo(clonedInfo)) @@ -1410,9 +1436,9 @@ return error; } -// AddWatcher + status_t -TRoster::AddWatcher(Watcher *watcher) +TRoster::AddWatcher(Watcher* watcher) { BAutolock _(fLock); @@ -1426,9 +1452,8 @@ } -// RemoveWatcher void -TRoster::RemoveWatcher(Watcher *watcher) +TRoster::RemoveWatcher(Watcher* watcher) { BAutolock _(fLock); @@ -1437,12 +1462,11 @@ } -// _AppAdded /*! \brief Hook method invoked, when an application has been fully registered. \param info The RosterAppInfo of the added application. */ void -TRoster::_AppAdded(RosterAppInfo *info) +TRoster::_AppAdded(RosterAppInfo* info) { // notify the watchers BMessage message(B_SOME_APP_LAUNCHED); @@ -1451,12 +1475,13 @@ fWatchingService.NotifyWatchers(&message, &filter); } -// _AppRemoved -/*! \brief Hook method invoked, when a fully registered application has been removed. + +/*! \brief Hook method invoked, when a fully registered application has been + removed. \param info The RosterAppInfo of the removed application. */ void -TRoster::_AppRemoved(RosterAppInfo *info) +TRoster::_AppRemoved(RosterAppInfo* info) { if (info) { // deactivate the app, if it was the active one @@ -1471,55 +1496,51 @@ } } -// _AppActivated + /*! \brief Hook method invoked, when an application has been activated. \param info The RosterAppInfo of the activated application. */ void -TRoster::_AppActivated(RosterAppInfo *info) +TRoster::_AppActivated(RosterAppInfo* info) { - if (info) { - if (info->state == APP_STATE_REGISTERED) { - // send B_APP_ACTIVATED to the app - BMessenger messenger; - BMessenger::Private messengerPrivate(messenger); - messengerPrivate.SetTo(info->team, info->port, B_NULL_TOKEN); - BMessage message(B_APP_ACTIVATED); - message.AddBool("active", true); - // not sure, if it makes sense to use the MessageDeliverer here - MessageDeliverer::Default()->DeliverMessage(&message, messenger); + if (info != NULL && info->state == APP_STATE_REGISTERED) { + // send B_APP_ACTIVATED to the app + BMessenger messenger; + BMessenger::Private messengerPrivate(messenger); + messengerPrivate.SetTo(info->team, info->port, B_NULL_TOKEN); + BMessage message(B_APP_ACTIVATED); + message.AddBool("active", true); + // not sure, if it makes sense to use the MessageDeliverer here + MessageDeliverer::Default()->DeliverMessage(&message, messenger); - // notify the watchers - BMessage watcherMessage(B_SOME_APP_ACTIVATED); - _AddMessageWatchingInfo(&watcherMessage, info); - EventMaskWatcherFilter filter(B_REQUEST_ACTIVATED); - fWatchingService.NotifyWatchers(&watcherMessage, &filter); - } + // notify the watchers + BMessage watcherMessage(B_SOME_APP_ACTIVATED); + _AddMessageWatchingInfo(&watcherMessage, info); + EventMaskWatcherFilter filter(B_REQUEST_ACTIVATED); + fWatchingService.NotifyWatchers(&watcherMessage, &filter); } } -// _AppDeactivated + /*! \brief Hook method invoked, when an application has been deactivated. \param info The RosterAppInfo of the deactivated application. [... truncated: 511 lines follow ...] From humdingerb at mail.berlios.de Mon May 18 17:03:51 2009 From: humdingerb at mail.berlios.de (humdingerb at mail.berlios.de) Date: Mon, 18 May 2009 17:03:51 +0200 Subject: [Haiku-commits] r30789 - haiku/trunk/docs/userguide/en/applications Message-ID: <200905181503.n4IF3pSu019556@sheep.berlios.de> Author: humdingerb Date: 2009-05-18 17:03:44 +0200 (Mon, 18 May 2009) New Revision: 30789 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30789&view=rev Modified: haiku/trunk/docs/userguide/en/applications/apps-bepdf.html haiku/trunk/docs/userguide/en/applications/apps-bezillabrowser.html Log: * Included lelldorin's tip on using the html2pdf add-on to overcome BeZilla's aversion to printing. * Fixed typo in apps-bepdf.html. Modified: haiku/trunk/docs/userguide/en/applications/apps-bepdf.html =================================================================== --- haiku/trunk/docs/userguide/en/applications/apps-bepdf.html 2009-05-18 09:10:58 UTC (rev 30788) +++ haiku/trunk/docs/userguide/en/applications/apps-bepdf.html 2009-05-18 15:03:44 UTC (rev 30789) @@ -45,7 +45,7 @@ Settings:/boot/common/settings/BePDF

            BePDF is Haiku's fast launching PDF viewer. Besides viewing, it supports annotating and user-defined bookmarking for unencrypted PDFs. It's fully localized for 20 languages at the moment with additional languages being easily added via text files.

            -

            BePDF comes with its own documentation as HTML or as PDF. The later will also open from the menu Help | Show Help...

            +

            BePDF comes with its own documentation as HTML or as PDF. The latter will also open from the menu Help | Show Help...